| 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 commandinputfile_with_counters=$1# We extract the counters out of the input fileinputfile=.$inputfile_with_counters.activityinputfile_cnt_ready=.$1.cnt_readyinputfile_cnt_submitted=.$1.cnt_submittedgrep -v "^cnt" $inputfile_with_counters > $inputfilegrep "^cnt_ready" $inputfile_with_counters > $inputfile_cnt_readygrep "^cnt_submitted" $inputfile_with_counters > $inputfile_cnt_submittedmax_cnt_submitted=`cut -f2 $inputfile_cnt_submitted |sort -n|tail -1`# Count the number of workers in the traceworkers=`cut -f1 $inputfile | sort -n | uniq`nworkers=`cut -f1 $inputfile | sort -n | uniq|wc -l`# size of the entire graphwidth=2.5heigth=$(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 ]; thenstarttime=$2endtime=$3elsestarttime=$(cut -f 2 $inputfile |sort -n|head -1)endtime=$(cut -f 2 $inputfile |sort -n|tail -1)fi# Gnuplot headercat > gnuplotcmd << EOFset term postscript eps enhanced colorset output "activity.eps"set xrange [$starttime:$endtime]set size $width,$heigthset 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"EOFcnt=0for worker in $workersdo	grep "^$worker" $inputfile > .tmp.$worker	starty=$(echo "0.5 + (0.5 * $cnt)"|bc -l)cat >> gnuplotcmd << EOFset origin 0.0,$starty;set size $width,0.5;set key offplot ".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" notitleEOF	cnt=$(($cnt+1))	donecat >> gnuplotcmd << EOFunset multiplotEOFgnuplot < gnuplotcmdrm gnuplotcmdrm $inputfilerm $inputfile_cnt_readyrm $inputfile_cnt_submittedfor worker in $workersdo	rm .tmp.$workerdone
 |