activity.sh 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #!/bin/bash
  2. #
  3. # StarPU
  4. # Copyright (C) INRIA 2008-2010 (see AUTHORS file)
  5. #
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU Lesser General Public License as published by
  8. # the Free Software Foundation; either version 2.1 of the License, or (at
  9. # your option) any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful, but
  12. # WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  14. #
  15. # See the GNU Lesser General Public License in COPYING.LGPL for more details.
  16. #
  17. # The input file must be generated by the fxt_tool command
  18. inputfile=$1
  19. # TODO display help if -h is passed
  20. # Count the number of workers in the trace
  21. workers=`cut -f1 $inputfile | sort -n | uniq`
  22. nworkers=`cut -f1 $inputfile | sort -n | uniq|wc -l`
  23. # size of the entire graph
  24. width=2.5
  25. heigth=$(echo "0.5 * $nworkers"|bc -l)
  26. # In case 3 arguments are provided, the 2nd (resp. 3rd) indicates the start
  27. # (resp. the end) of the interval to be displayed.
  28. if [ $# -ge 3 ]; then
  29. starttime=$2
  30. endtime=$3
  31. else
  32. starttime=$(cut -f 2 $inputfile |sort -n|head -1)
  33. endtime=$(cut -f 2 $inputfile |sort -n|tail -1)
  34. fi
  35. # Gnuplot header
  36. cat > gnuplotcmd << EOF
  37. set term postscript eps enhanced color
  38. set output "activity.eps"
  39. set xrange [$starttime:$endtime]
  40. set size $width,$heigth
  41. set multiplot;
  42. EOF
  43. cnt=0
  44. for worker in $workers
  45. do
  46. grep "^$worker" $inputfile > .tmp.$worker
  47. starty=$(echo "0.5 * $cnt"|bc -l)
  48. cat >> gnuplotcmd << EOF
  49. set origin 0.0,$starty;
  50. set size $width,0.5;
  51. set key off
  52. plot ".tmp.$worker" using 2:(100) with filledcurves y1=0.0 lt rgb "#000000" notitle,\
  53. ".tmp.$worker" using 2:((100*(\$4+\$5))/\$3) with filledcurves y1=0.0 lt rgb "#ff0000" notitle,\
  54. ".tmp.$worker" using 2:((100*\$4)/\$3) with filledcurves y1=0.0 lt rgb "#00ff00" notitle
  55. EOF
  56. cnt=$(($cnt+1))
  57. done
  58. cat >> gnuplotcmd << EOF
  59. unset multiplot
  60. EOF
  61. gnuplot < gnuplotcmd