~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/power/cpupower/bench/cpufreq-bench_plot.sh

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #!/bin/bash
  2 # SPDX-License-Identifier: GPL-2.0-or-later
  3 
  4 
  5 # Author/Copyright(c): 2009, Thomas Renninger <trenn@suse.de>, Novell Inc.
  6 
  7 # Helper script to easily create nice plots of your cpufreq-bench results
  8 
  9 dir=`mktemp -d`
 10 output_file="cpufreq-bench.png"
 11 global_title="cpufreq-bench plot"
 12 picture_type="jpeg"
 13 file[0]=""
 14 
 15 function usage()
 16 {
 17     echo "cpufreq-bench_plot.sh [OPTIONS] logfile [measure_title] [logfile [measure_title]] ...]"
 18     echo
 19     echo "Options"
 20     echo "   -o output_file"
 21     echo "   -t global_title"
 22     echo "   -p picture_type [jpeg|gif|png|postscript|...]"
 23     exit 1
 24 }
 25 
 26 if [ $# -eq 0 ];then
 27         echo "No benchmark results file provided"
 28         echo
 29         usage
 30 fi
 31 
 32 while getopts o:t:p: name ; do
 33     case $name in
 34         o)
 35             output_file="$OPTARG".$picture_type
 36             ;;
 37         t)
 38             global_title="$OPTARG"
 39             ;;
 40         p)
 41             picture_type="$OPTARG"
 42             ;;
 43         ?)
 44             usage
 45             ;;
 46     esac
 47 done
 48 shift $(($OPTIND -1))
 49 
 50 plots=0
 51 while [ "$1" ];do
 52     if [ ! -f "$1" ];then
 53         echo "File $1 does not exist"
 54         usage
 55     fi
 56     file[$plots]="$1"
 57     title[$plots]="$2"
 58     # echo "File: ${file[$plots]} - ${title[plots]}"
 59     shift;shift
 60     plots=$((plots + 1))
 61 done
 62 
 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
 68 
 69 for((plot=0;plot<$plots;plot++));do
 70 
 71     # Sanity check
 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... #####
 75 
 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
 79 
 80     if [ $plot -eq 0 ];then
 81         echo -n "plot " >> $dir/plot_script.gpl
 82     fi
 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
 86     fi
 87 done
 88 echo >> $dir/plot_script.gpl
 89 
 90 gnuplot $dir/plot_script.gpl
 91 rm -r $dir

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php