Skip to content

Commit

Permalink
Merge pull request kata-containers#2530 from GabyCT/topic/fixreport
Browse files Browse the repository at this point in the history
metrics: Fix footprint data results
  • Loading branch information
amshinde authored May 21, 2020
2 parents 715f5ef + 8b49db4 commit 9441e91
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions metrics/density/footprint_data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ function grab_vm_uss() {
"qemu": "$qemu",
"virtiofsd": "$virtiofsd",
"total": $total,
"Units": "KB"
"Units": "B"
}
EOF
)"
Expand All @@ -203,7 +203,7 @@ function grab_vm_pss() {
"qemu": "$qemu",
"virtiofsd": "$virtiofsd",
"total": $total,
"Units": "KB"
"Units": "B"
}
EOF
)"
Expand All @@ -220,7 +220,7 @@ function grab_dockerd_pss() {
local json="$(cat << EOF
"dockerd": {
"pss": $item,
"Units": "KB"
"Units": "B"
}
EOF
)"
Expand All @@ -239,7 +239,7 @@ function grab_all_pss() {
local json="$(cat << EOF
"all_pss": {
"pss": $item,
"Units": "KB"
"Units": "B"
}
EOF
)"
Expand All @@ -255,7 +255,7 @@ function grab_user_smem() {
local json="$(cat << EOF
"user_smem": {
"userspace": $item,
"Units": "KB"
"Units": "B"
}
EOF
)"
Expand All @@ -267,12 +267,11 @@ function grab_slab() {
# Grabbing slab total from meminfo is easier than doing the math
# on slabinfo
item=$(fgrep "Slab:" /proc/meminfo | awk '{print $2}')
((item*=1024))

local json="$(cat << EOF
"slab": {
"slab": $item,
"Units": "KB"
"Units": "B"
}
EOF
)"
Expand All @@ -290,26 +289,25 @@ function grab_system() {

# avail memory, from 'free'
local avail=$(free -b | head -2 | tail -1 | awk '{print $7}')
((avail/=1024))
local avail_decr=$((base_mem_avail-avail))

# cached memory, from 'free'
local cached=$(free -b | head -2 | tail -1 | awk '{print $6}')
((cached/=1024))

# free memory from smem
local smem_free=$(get_memfree)
local free_decr=$((base_mem_free-item))

# Anon pages
local anon=$(fgrep "AnonPages:" /proc/meminfo | awk '{print $2}')
((anon*=1024))

# Mapped pages
local mapped=$(egrep "^Mapped:" /proc/meminfo | awk '{print $2}')
((mapped*=1024))

# Cached
local meminfo_cached=$(grep "^Cached:" /proc/meminfo | awk '{print $2}')
((meminfo_cached*=1024))

local json="$(cat << EOF
"system": {
Expand Down

0 comments on commit 9441e91

Please sign in to comment.