#!/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. # # The input file must be generated by the fxt_tool command inputfile=$1 # TODO display help if -h is passed # 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 * $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; EOF cnt=0 for worker in $workers do grep "^$worker" $inputfile > .tmp.$worker starty=$(echo "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