summaryrefslogtreecommitdiffstats
path: root/fbench/util/plot.pl
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@yahoo-inc.com>2016-06-15 23:09:44 +0200
committerJon Bratseth <bratseth@yahoo-inc.com>2016-06-15 23:09:44 +0200
commit72231250ed81e10d66bfe70701e64fa5fe50f712 (patch)
tree2728bba1131a6f6e5bdf95afec7d7ff9358dac50 /fbench/util/plot.pl
Publish
Diffstat (limited to 'fbench/util/plot.pl')
-rwxr-xr-xfbench/util/plot.pl82
1 files changed, 82 insertions, 0 deletions
diff --git a/fbench/util/plot.pl b/fbench/util/plot.pl
new file mode 100755
index 00000000000..78964b170b0
--- /dev/null
+++ b/fbench/util/plot.pl
@@ -0,0 +1,82 @@
+#!/usr/bin/perl -s
+# Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+# TODO
+# - parameter for input and output file name
+# - more graphs
+
+sub usage {
+ die qq{usage: plot.pl [-h] [-x] <plotno> <format>
+Plot the contents of 'result.txt' to 'graph.<format>'.
+ -h This help
+ -x Output to X11 window
+ plotno: 1: Response Time Percentiles by NumCli
+ 2: Rate by NumCli
+ 3: Response Time Percentiles by Rate
+ format: png (default), ps
+};
+}
+
+$plotno = shift || die usage;
+$term = shift || "png";
+
+if ($h) {
+ usage;
+}
+
+# setup the output
+if ($x) {
+ # X11 output
+ open(PLOTSCRIPT, "| gnuplot -persist");
+ print PLOTSCRIPT "set term X11\n";
+
+} else {
+ open(PLOTSCRIPT, "| gnuplot");
+ if ("$term" eq "ps") {
+ print PLOTSCRIPT "set term postscript\n";
+ print PLOTSCRIPT "set output \"graph.ps\"\n";
+ }
+ else {
+ print PLOTSCRIPT "set term png transparent small medium enhanced\n";
+ print PLOTSCRIPT "set output \"graph.png\"\n";
+ }
+}
+select(PLOTSCRIPT);
+
+
+
+# choose the graph
+if ($plotno == 1) {
+ # Cli Percentile
+ print qq{
+set data style lines
+set title "Response Time Percentiles by NumCli"
+set xlabel "Number of clients"
+set ylabel "Response time (msec)"
+set key left top
+plot 'result.txt' using 1:10 title "max", 'result.txt' using 1:17 title "99 %", 'result.txt' using 1:16 title "95 %", 'result.txt' using 1:15 title "90 %", 'result.txt' using 1:14 title "75 %", 'result.txt' using 1:13 title "50 %", 'result.txt' using 1:12 title "25 %", 'result.txt' using 1:9 title "min"
+ };
+
+} elsif ($plotno == 2) {
+ # Cli Rate
+ print qq{
+set data style lines
+set title "Rate by NumCli"
+set xlabel "Number of clients"
+set ylabel "Rate (queries/sec)"
+set nokey
+plot 'result.txt' using 1:18
+ };
+} elsif ($plotno == 3) {
+ # Rate Percentile
+ print qq{
+set data style lines
+set title "Response Time Percentiles by Rate"
+set xlabel "Rate (queries/sec)"
+set ylabel "Response time (msec)"
+set key left top
+plot 'result.txt' using 18:17 title "99 %", 'result.txt' using 18:16 title "95 %", 'result.txt' using 18:15 title "90 %", 'result.txt' using 18:14 title "75 %", 'result.txt' using 18:13 title "50 %", 'result.txt' using 18:12 title "25 %"
+ };
+}
+
+close(PLOTSCRIPT);