| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- #!/bin/bash
- #
- # StarPU
- # Copyright (C) INRIA 2008-2010 (see AUTHORS file)
- #
- # This program is free software; you can redistribute it and/or modify
- # it under the terms of the GNU Lesser General Public License as published by
- # the Free Software Foundation; either version 2.1 of the License, or (at
- # your option) any later version.
- #
- # This program is distributed in the hope that it will be useful, but
- # WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- #
- # See the GNU Lesser General Public License in COPYING.LGPL for more details.
- #
- # TODO display help if -h is passed
- # The input file must be generated by the fxt_tool command
- inputfile_with_counters=$1
- # We extract the counters out of the input file
- inputfile=.$inputfile_with_counters.activity
- inputfile_cnt_ready=.$1.cnt_ready
- inputfile_cnt_submitted=.$1.cnt_submitted
- grep -v "^cnt" $inputfile_with_counters > $inputfile
- grep "^cnt_ready" $inputfile_with_counters > $inputfile_cnt_ready
- grep "^cnt_submitted" $inputfile_with_counters > $inputfile_cnt_submitted
- max_cnt_submitted=`cut -f2 $inputfile_cnt_submitted |sort -n|tail -1`
- # Count the number of workers in the trace
- workers=`cut -f1 $inputfile | sort -n | uniq`
- nworkers=`cut -f1 $inputfile | sort -n | uniq|wc -l`
- # size of the entire graph
- width=2.5
- heigth=$(echo "0.5 + (0.5 * $nworkers)"|bc -l)
- # In case 3 arguments are provided, the 2nd (resp. 3rd) indicates the start
- # (resp. the end) of the interval to be displayed.
- if [ $# -ge 3 ]; then
- starttime=$2
- endtime=$3
- else
- starttime=$(cut -f 2 $inputfile |sort -n|head -1)
- endtime=$(cut -f 2 $inputfile |sort -n|tail -1)
- fi
- # Gnuplot header
- cat > gnuplotcmd << EOF
- set term postscript eps enhanced color
- set output "activity.eps"
- set xrange [$starttime:$endtime]
- set size $width,$heigth
- set multiplot;
- set origin 0.0,0.0;
- set size $width,0.5;
- plot "$inputfile_cnt_submitted" using 2:3 with filledcurves lt rgb "#999999" title "submitted",\
- "$inputfile_cnt_ready" using 2:3 with filledcurves lt rgb "#000000" title "ready"
- EOF
- cnt=0
- for worker in $workers
- do
- grep "^$worker" $inputfile > .tmp.$worker
- starty=$(echo "0.5 + (0.5 * $cnt)"|bc -l)
- cat >> gnuplotcmd << EOF
- set origin 0.0,$starty;
- set size $width,0.5;
- set key off
- plot ".tmp.$worker" using 2:(100) with filledcurves y1=0.0 lt rgb "#000000" notitle,\
- ".tmp.$worker" using 2:((100*(\$4+\$5))/\$3) with filledcurves y1=0.0 lt rgb "#ff0000" notitle,\
- ".tmp.$worker" using 2:((100*\$4)/\$3) with filledcurves y1=0.0 lt rgb "#00ff00" notitle
- EOF
- cnt=$(($cnt+1))
- done
- cat >> gnuplotcmd << EOF
- unset multiplot
- EOF
- gnuplot < gnuplotcmd
- rm gnuplotcmd
- rm $inputfile
- rm $inputfile_cnt_ready
- rm $inputfile_cnt_submitted
- for worker in $workers
- do
- rm .tmp.$worker
- done
|