#! /bin/sh # # (C) 2002-2003 Intel Corporation # Iñaky Pérez-González # # Distributed under the FSF's GNU Public License v2 or later. # # Plot the output of priority inheritance tests. # Modifs by Sebastien Decugis: # -> plots linespoints instead of dots # -> legend is outside the graph. # -> Change axis names and graph title FILE=$1 TMP=$(mktemp -d) function clean_up { rm -rf $TMP } function error { cat 1>&2 clean_up exit 1 } trap clean_up EXIT if ! cols=$(grep "#[ ]*COLUMNS" $FILE) then error < $TMP/gnuplot.script < $TMP/events events=$(cat $TMP/events | wc -l) if [ $events -gt 0 ] then step=$(((100 - $height) / $events)) if [ $step -lt 5 ] then step=5; fi cat $TMP/events | while read event x text do if ! [ $event = "EVENT" ] then cat 1>&2 <> $TMP/gnuplot.script echo "set label \"$text\" at $x, graph 0.$height_text center" >> $TMP/gnuplot.script height=$(($height + $step)) done fi # Plot the data plot_cmd="plot '$FILE' using 1:2 title \"${column[$count]}\" $with" count=3 while [ $count -le $columns ] do plot_cmd=$plot_cmd",'$FILE' using 1:$count title \"${column[$count]}\" $with" count=$(($count + 1)) done echo $plot_cmd >> $TMP/gnuplot.script #cp $TMP/gnuplot.script . ( cat $TMP/gnuplot.script; cat ) | gnuplot rm -rf $TMP