From 2ebc9c2eeaeb03df85f21f6c593e64d3b8218658 Mon Sep 17 00:00:00 2001 From: "Bjoern B. Brandenburg" Date: Sat, 24 May 2008 22:22:46 -0400 Subject: extracted the plotting tools from csvtools --- csv2graph | 23 +++++++++++++++++++ plot_dist | 30 +++++++++++++++++++++++++ plot_sched | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 129 insertions(+) create mode 100755 csv2graph create mode 100755 plot_dist create mode 100755 plot_sched diff --git a/csv2graph b/csv2graph new file mode 100755 index 0000000..8f7d795 --- /dev/null +++ b/csv2graph @@ -0,0 +1,23 @@ +#!/bin/bash + +FILE=$1 + +shift + +if [ ! -f "$FILE" ] ; then + echo "Usage: csv2graph " +fi + +CUM=`mktemp` +DIST=`mktemp` +OUT=`echo $FILE | sed s/csv/png/` + +analyze -adist -b1000 "$FILE" --csv -n -i $* > $DIST +analyze -adist -c -b1000 "$FILE" --csv -n -i $* > $CUM + +if [ -s $CUM ] && [ -s $DIST ]; then + plot_dist $DIST $CUM $OUT "$FILE: $*" + rm $DIST $CUM +else + echo "$FILE: Empty." +fi diff --git a/plot_dist b/plot_dist new file mode 100755 index 0000000..18cb48c --- /dev/null +++ b/plot_dist @@ -0,0 +1,30 @@ +#!/bin/bash + +CSV1=$1 +CSV2=$2 +OUT=$3 +TITLE=$4 + +if [ ! -f "$CSV1" ] || [ ! -f "$CSV2" ] || + [ "" == "$OUT" ] ; then + echo "Usage: plot_dist " + exit 1 +fi + +gnuplot <<EOM +set terminal png picsize 1024 768 +set out '/dev/null' +plot '$CSV1' title 'distribution' with lines +replot '$CSV2' title 'distribution (cumulative)' axes x1y2 with lines +set ylabel 'probability' +set y2label 'probability (cumulative)' +set xlabel 'overhead (in us)' +set y2tics +set y2range [0.0:1.0] +set title '$TITLE' +set key top left +set out '$OUT' +replot +set out +EOM + diff --git a/plot_sched b/plot_sched new file mode 100755 index 0000000..41ab38b --- /dev/null +++ b/plot_sched @@ -0,0 +1,76 @@ +#!/bin/bash + +NICE="blacktext linewidth 4.0 \"Helvetica\" 16 " + +if [ "$1" == "--eps" ]; then + EXT="eps" + TERMINAL="postscript color eps $NICE" + shift +else + EXT="png" + TERMINAL="png picsize 1024 768" +fi + +CSV1=$1 +TITLE=$2 +OUT=$3 + +if [ ! -f "$CSV1" ]; then + echo "Usage: plot_sched <data.csv> [<title>] [<out.png>]" + exit 1 +fi + +KIND=`basename $CSV1 | sed -e 's/^\([^_]*\).*/\1/'` + +case "$KIND" in + util) + XLABEL="utilization cap" + ;; + freq) + XLABEL="K" + ;; + mcsl) + XLABEL="L (in us)" + ;; + cpus) + XLABEL="processor count" + ;; + *) + XLABEL=""; + ;; +esac + + +BASE=`basename $CSV1 | sed -e s/.csv//g -e s/_[a-z]*=0.123000//g -e 's/\([0-9]*\.[^0]\+\)0*\([_c]\)/\1_\2/g' -e 's/\([0-9]\)\.0*\([_c]\)/\1_\2/g' -e s/_cpus=16//g -e s/_freq=0//g` + +echo $BASE + +if [ "$OUT" == "" ]; then + OUT="${BASE}.${EXT}" +fi + +if [ "$TITLE" == "" ]; then + TITLE=`echo -n $BASE | tr '_' ' ' | sed -e 's/^\(util\|freq\|mcsl\|cpus\) //g' -e s/freq=/K=/g -e s/mcsl=/L=/g ` +fi + +gnuplot <<EOM +set terminal $TERMINAL +set out '/dev/null' +set yrange [-0.1:1.1] +plot '$CSV1' using 1:2 title 'FMLP (short)' with linespoints +replot '$CSV1' using 1:3 title 'FMLP (long)' with linespoints +replot '$CSV1' using 1:4 title 'M-PCP' with linespoints +replot '$CSV1' using 1:5 title 'D-PCP' with linespoints +set ylabel 'schedulability' +set xlabel '$XLABEL' +set title '$TITLE' +set key below +set data style linespoints +set out '$OUT' +replot +set out +EOM + +if [ "$EXT" == "eps" ]; then + ps2pdf -dEPSCrop $OUT +fi \ No newline at end of file -- cgit v1.2.2