3 # This program is free software: you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2, or (at your option)
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 # Author/Copyright(c): 2009, Thomas Renninger <trenn@suse.de>, Novell Inc.
20 # Helper script to easily create nice plots of your cpufreq-bench results
23 output_file
="cpufreq-bench.png"
24 global_title
="cpufreq-bench plot"
30 echo "cpufreq-bench_plot.sh [OPTIONS] logfile [measure_title] [logfile [measure_title]] ...]"
33 echo " -o output_file"
34 echo " -t global_title"
35 echo " -p picture_type [jpeg|gif|png|postscript|...]"
40 echo "No benchmark results file provided"
45 while getopts o
:t
:p
: name
; do
48 output_file
="$OPTARG".
$picture_type
51 global_title
="$OPTARG"
54 picture_type
="$OPTARG"
66 echo "File $1 does not exist"
71 # echo "File: ${file[$plots]} - ${title[plots]}"
76 echo "set terminal $picture_type" >> $dir/plot_script.gpl
77 echo "set output \"$output_file\"" >> $dir/plot_script.gpl
78 echo "set title \"$global_title\"" >> $dir/plot_script.gpl
79 echo "set xlabel \"sleep/load time\"" >> $dir/plot_script.gpl
80 echo "set ylabel \"Performance (%)\"" >> $dir/plot_script.gpl
82 for((plot
=0;plot
<$plots;plot
++));do
85 ###### I am to dump to get this redirected to stderr/stdout in one awk call... #####
86 cat ${file[$plot]} |
grep -v "^#" |
awk '{if ($2 != $3) printf("Error in measure %d:Load time %s does not equal sleep time %s, plot will not be correct\n", $1, $2, $3); ERR=1}'
87 ###### I am to dump to get this redirected in one awk call... #####
89 # Parse out load time (which must be equal to sleep time for a plot), divide it by 1000
90 # to get ms and parse out the performance in percentage and write it to a temp file for plotting
91 cat ${file[$plot]} |
grep -v "^#" |
awk '{printf "%lu %.1f\n",$2/1000, $6}' >$dir/data_
$plot
93 if [ $plot -eq 0 ];then
94 echo -n "plot " >> $dir/plot_script.gpl
96 echo -n "\"$dir/data_$plot\" title \"${title[$plot]}\" with lines" >> $dir/plot_script.gpl
97 if [ $
(($plot + 1)) -ne $plots ];then
98 echo -n ", " >> $dir/plot_script.gpl
101 echo >> $dir/plot_script.gpl
103 gnuplot
$dir/plot_script.gpl