Skip to content

Commit

Permalink
misc/gcmem: print used raw mem
Browse files Browse the repository at this point in the history
  • Loading branch information
jxy committed Jun 10, 2020
1 parent bfc756d commit aecf6a4
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions misc/gcmem
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,27 @@
# ./gcmem OUTPUT_FILE
f="$1"
awk '
BEGIN{M=1024**2};
/^# /{s=$2;for(i=3;i<=NF;++i)s=s"_"$i}
/^\[RAW\] used memory/{
if(r==0)
r=$4;
else
else{
r-=$4;
t=$4;
}
}
/^\[GC\] occupied memory/{
if(m==0)
m=$4;
else{
m-=$4;
printf("%-20s %10.3f %10.3f %10.3f\n",
s,r/1024**2,m/1024**2,$4/1024**2);
printf("%-20s %6.0f %6.0f %6.0f %6.0f\n",
s,r/M,m/M,t/M,$4/M);
m=0;
r=0;
}
}
' "$f" \
|sort -s -k 1,1 -k 2,2nr -k 3,3nr -k 4,4nr \
|uniq -c -w 42
|sort -k 1,1 -k 2,2nr -k 3,3nr -k 4,4nr -k 5,5nr \
|uniq -c -w 34

0 comments on commit aecf6a4

Please sign in to comment.