memleak: Record and plot Swap usage.

- Put RSS together with USS and PSS on y1
- Put Swap on y2
This commit is contained in:
tastytea 2021-12-05 13:49:58 +01:00
parent 940a9a126f
commit 2bb8c6e5b6
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
1 changed files with 12 additions and 9 deletions

View File

@ -1,7 +1,7 @@
#!/usr/bin/env -S gnuplot --persist -c
# Gnuplot script for data generated with:
# smem -P '^myprogram' -t | tail -n1 \
# | awk '{print "USS:", $4; print "PSS:",$5; print "RSS:",$6;}' \
# | awk '{print "USS:", $4; print "PSS:",$5; print "RSS:",$6; print "SWP:",$3;}' \
# | sed "s/:/ $(date --iso-8601=minutes)/" >> mem-myprogram.data
# Example usage: ./memory-consumption-over-time.gp myprogram 2021-12-05T08:42
@ -23,8 +23,8 @@ if (ARGC > 1) {
set title sprintf('%s memory consumption over time', myprog)
set key left top
set xlabel 'Time (Hours)'
set ylabel 'MiB (USS, PSS)'
set y2label 'MiB (RSS)' textcolor 'dark-orange'
set ylabel 'MiB (USS, PSS, RSS)'
set y2label 'MiB (Swap)' textcolor 'dark-red'
set xdata time
set timefmt mytimefmt
@ -35,11 +35,11 @@ set xtics 21600 # 1 tic every 6 hours.
set mxtics 6 # 1 mtic every hour.
set ytics 10 nomirror # 1 tic every 10 MiB.
set mytics 2 # 1 mtic every 5 MiB.
set y2tics 10 nomirror textcolor 'dark-orange'
set y2tics 10 nomirror textcolor 'dark-red'
set my2tics 2
set grid xtics ytics mxtics mytics lc "gray50" lw 0.75, lc "gray" lw 0.5
# myfont = "Source Sans Pro,12"
myfont = "Source Sans Pro,12"
# set terminal qt enhanced size 1200,900 font myfont
@ -50,13 +50,16 @@ myfont = "Source Sans Pro,16"
set terminal svg enhanced background rgb 'white' size 1200,900 dynamic font myfont
set output sprintf("%s memory consumption over time.svg", myprog)
plot infile every 3::0 using ((timecolumn(2) - mystarttime)):($3/1024) title 'USS' \
plot infile every 4::0 using ((timecolumn(2) - mystarttime)):($3/1024) title 'USS' \
with linespoints linewidth 2 pointtype 7 pointsize 0.5 linecolor 'dark-violet', \
\
'' every 3::1 using ((timecolumn(2) - mystarttime)):($3/1024) title 'PSS' \
'' every 4::1 using ((timecolumn(2) - mystarttime)):($3/1024) title 'PSS' \
with linespoints linewidth 2 pointtype 7 pointsize 0.5 linecolor 'dark-green', \
\
'' every 3::2 using ((timecolumn(2) - mystarttime)):($3/1024) title 'RSS' \
with linespoints linewidth 2 pointtype 7 pointsize 0.5 linecolor 'dark-orange' axes x1y2
'' every 4::2 using ((timecolumn(2) - mystarttime)):($3/1024) title 'RSS' \
with linespoints linewidth 2 pointtype 7 pointsize 0.5 linecolor 'dark-orange', \
\
'' every 4::3 using ((timecolumn(2) - mystarttime)):($3/1024) title 'Swap' \
with linespoints linewidth 2 pointtype 7 pointsize 0.5 linecolor 'dark-red' axes x1y2
print 'Maximum = ',GPVAL_DATA_Y_MAX