| # Plots CPU and memory usage graphs from vmstat.log. |
| # NOTE: vmstat.log must be in current working dir. |
| # |
| # Run: |
| # gnuplot $JIRI_ROOT/release/go/src/v.io/x/ref/services/syncbase/longevity_tests/plot-vmstat |
| # |
| # Output: |
| # cpu.png # cpu usage |
| # mem.png # memory usage |
| |
| # Set the timeformat used in the vmstat.log. |
| set timefmt "%a %d %b %Y %r %Z, %Z" |
| |
| # X-axis is time. |
| set xdata time |
| |
| # Rotate x-axis labels. |
| set xtics rotate |
| |
| # Output 800x400px png image. |
| set term png size 800, 400 |
| |
| # Put key outside plot. |
| set key outside |
| |
| # NOTE(nlacasse): The plot functions below plot every 60th row. This is |
| # probably fine for the memory graph, but for the CPU graph a rolling average |
| # would be better. |
| # |
| # GNUPlot is stream-based, and doesn't have an easy way to calculate rolling |
| # averages. There is a way to do it [0], but it is very slow, taking many |
| # minutes on my machine. |
| # |
| # We may need to post-process the logs ourselves to calculate the rolling |
| # average before plotting. |
| # |
| # [0]: http://blog.sam.liddicott.com/2013/05/gnuplot-rolling-average.html |
| |
| set output 'mem.png' |
| plot 'vmstat.log' every 60::2 using 0:11 with lines title 'swap', \ |
| 'vmstat.log' every 60::2 using 0:12 with lines title 'free', \ |
| 'vmstat.log' every 60::2 using 0:13 with lines title 'buff', \ |
| 'vmstat.log' every 60::2 using 0:14 with lines title 'cache' |
| |
| set output 'cpu.png' |
| plot 'vmstat.log' every 60::2 using 0:21 with lines title 'user', \ |
| 'vmstat.log' every 60::2 using 0:22 with lines title 'system' |