2 # SPDX-License-Identifier: GPL-2.0-or-later
5 # Author/Copyright(c): 2009, Thomas Renninger <trenn@suse.de>, Novell Inc.
7 # Helper script to easily create nice plots of your cpufreq-bench results
10 output_file
="cpufreq-bench.png"
11 global_title
="cpufreq-bench plot"
17 echo "cpufreq-bench_plot.sh [OPTIONS] logfile [measure_title] [logfile [measure_title]] ...]"
20 echo " -o output_file"
21 echo " -t global_title"
22 echo " -p picture_type [jpeg|gif|png|postscript|...]"
27 echo "No benchmark results file provided"
32 while getopts o
:t
:p
: name
; do
35 output_file
="$OPTARG".
$picture_type
38 global_title
="$OPTARG"
41 picture_type
="$OPTARG"
53 echo "File $1 does not exist"
58 # echo "File: ${file[$plots]} - ${title[plots]}"
63 echo "set terminal $picture_type" >> $dir/plot_script.gpl
64 echo "set output \"$output_file\"" >> $dir/plot_script.gpl
65 echo "set title \"$global_title\"" >> $dir/plot_script.gpl
66 echo "set xlabel \"sleep/load time\"" >> $dir/plot_script.gpl
67 echo "set ylabel \"Performance (%)\"" >> $dir/plot_script.gpl
69 for((plot
=0;plot
<$plots;plot
++));do
72 ###### I am to dump to get this redirected to stderr/stdout in one awk call... #####
73 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}'
74 ###### I am to dump to get this redirected in one awk call... #####
76 # Parse out load time (which must be equal to sleep time for a plot), divide it by 1000
77 # to get ms and parse out the performance in percentage and write it to a temp file for plotting
78 cat ${file[$plot]} |
grep -v "^#" |
awk '{printf "%lu %.1f\n",$2/1000, $6}' >$dir/data_
$plot
80 if [ $plot -eq 0 ];then
81 echo -n "plot " >> $dir/plot_script.gpl
83 echo -n "\"$dir/data_$plot\" title \"${title[$plot]}\" with lines" >> $dir/plot_script.gpl
84 if [ $
(($plot + 1)) -ne $plots ];then
85 echo -n ", " >> $dir/plot_script.gpl
88 echo >> $dir/plot_script.gpl
90 gnuplot
$dir/plot_script.gpl