diff options
author | Ahmed S. Darwish <darwish.07@gmail.com> | 2015-09-23 18:33:05 +0200 |
---|---|---|
committer | Tanu Kaskinen <tanuk@iki.fi> | 2015-10-31 15:29:48 +0200 |
commit | 4bda712ee146b1e7f042ac2fedb3699893f36482 (patch) | |
tree | 0d689dd6fed22b5a27eac6f7b0d91d08d304ccd3 | |
parent | c0f2e7d36ade75d86cd3504004e64b555b8a5273 (diff) |
scripts: Plot memory benchmarks using gnuplot
Now that we have memory usage benchmarks collected at our disposal,
introduce a gnuplot script to plot the newest version.
To avoid scaling issues, memory is plotted in a "double y axis" form,
with VM usage on the left, and dirty RSS memory usage on the right.
Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>
-rw-r--r-- | Makefile.am | 1 | ||||
-rwxr-xr-x | scripts/benchmark_memory_usage.sh | 2 | ||||
-rw-r--r-- | scripts/plot_memory_usage.gp | 63 |
3 files changed, 66 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am index db8af10b7..13bc469db 100644 --- a/Makefile.am +++ b/Makefile.am @@ -28,6 +28,7 @@ EXTRA_DIST = \ PROTOCOL \ README \ scripts/benchmark_memory_usage.sh \ + scripts/plot_memory_usage.gp \ scripts/benchmarks/README \ todo \ .gitignore \ diff --git a/scripts/benchmark_memory_usage.sh b/scripts/benchmark_memory_usage.sh index 1b991a871..f053d7e47 100755 --- a/scripts/benchmark_memory_usage.sh +++ b/scripts/benchmark_memory_usage.sh @@ -53,6 +53,7 @@ PA_PLAY_PROCESS_NAME="paplay" SCRIPTS_DIR=${PA_HOME}/scripts BENCHMARKS_DIR=${SCRIPTS_DIR}/benchmarks +GNUPLOT_SCRIPT=${SCRIPTS_DIR}/plot_memory_usage.gp OUTPUT_FILE=${BENCHMARKS_DIR}/memory-usage-`date -Iseconds`.txt SYMLINK_LATEST_OUTPUT_FILE=${BENCHMARKS_DIR}/memory-usage-LATEST.txt @@ -129,3 +130,4 @@ ln -s $OUTPUT_FILE $SYMLINK_LATEST_OUTPUT_FILE msg "Sampling daemon memory usage done!" msg "Check the results at $SYMLINK_LATEST_OUTPUT_FILE" +msg "Plot these results using 'gnuplot $GNUPLOT_SCRIPT'" diff --git a/scripts/plot_memory_usage.gp b/scripts/plot_memory_usage.gp new file mode 100644 index 000000000..33cc4e1d3 --- /dev/null +++ b/scripts/plot_memory_usage.gp @@ -0,0 +1,63 @@ + +# This file is part of PulseAudio. +# +# Copyright 2015 Ahmed S. Darwish <darwish.07@gmail.com> +# +# PulseAudio is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# PulseAudio is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with PulseAudio; if not, see <http://www.gnu.org/licenses/>. + +# +# PulseAudio memory usage plotting script +# +# Before invocation, generate necessary data by running the +# 'benchmark_memory_usage.sh' bash script. Afterwards, you can plot +# such data by running: +# +# gnuplot plot_memory_usage.gp +# +# Note! To avoid scaling issues, memory is plotted in a "double y axis" +# form, with VM usage on the left, and dirty RSS memory usage on the +# right. The scales are different. +# + +# Print our user messages to the stdout +set print "-" + +benchDir = system('dirname ' .ARG0) .'/benchmarks/' +inputFile = benchDir ."memory-usage-LATEST.txt" +outputFile = benchDir ."pulse-memory-usage.png" + +set title "PulseAudio Memory Usage Over Time" +set xlabel "Number of councurrent 'paplay' clients" + +set ylabel "Virtual memory consumption (GiB)" +set y2label "Dirty RSS consumption (MiB)" +set ytics nomirror +set y2tics + +# Finer granulrity for x-axis ticks ... +set xtics 1,1 +set grid + +# Use Cairo's PNG backend. This produce images which are way +# better-rendered than the barebone classical png backend +set terminal pngcairo enhanced size 1000,768 font 'Verdana,10' +set output outputFile + +print "Plotting data from input file: ", inputFile +print "..." + +plot inputFile using 1:($2/1024/1024) title "VmSize" axes x1y1 with linespoints, \ + inputFile using 1:($3/1024) title "Dirty RSS" axes x1y2 with linespoints + +print "Done! Check our performance at: ", outputFile |