starpu_codelet_profile.in 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #!@BASH@
  2. # StarPU --- Runtime system for heterogeneous multicore architectures.
  3. #
  4. # Copyright (C) 2008-2011,2013-2014 Université de Bordeaux
  5. # Copyright (C) 2010,2013,2015 CNRS
  6. #
  7. # StarPU is free software; you can redistribute it and/or modify
  8. # it under the terms of the GNU Lesser General Public License as published by
  9. # the Free Software Foundation; either version 2.1 of the License, or (at
  10. # your option) any later version.
  11. #
  12. # StarPU is distributed in the hope that it will be useful, but
  13. # WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  15. #
  16. # See the GNU Lesser General Public License in COPYING.LGPL for more details.
  17. #
  18. PROGNAME=$0
  19. usage()
  20. {
  21. echo "Offline tool to draw codelet profile over a traced execution"
  22. echo ""
  23. echo "Usage: $PROGNAME distrib.data codelet_name"
  24. echo ""
  25. echo "Options:"
  26. echo " -h, --help display this help and exit"
  27. echo " -v, --version output version information and exit"
  28. echo ""
  29. echo "Report bugs to <@PACKAGE_BUGREPORT@>"
  30. exit 1
  31. }
  32. if [ "$1" = "-v" ] || [ "$1" = "--version" ] ; then
  33. echo "$PROGNAME (@PACKAGE_NAME@) @PACKAGE_VERSION@"
  34. exit 0
  35. fi
  36. if [ "$1" = "-h" ] || [ "$1" = "--help" ] || [ "$2" = "" ] ; then
  37. usage
  38. fi
  39. inputfile=$1
  40. codelet_name=$2
  41. archlist=`< $inputfile grep "^$codelet_name " | cut -f 2 | sort | uniq | xargs`
  42. # extract subfiles from the history file
  43. for arch in $archlist
  44. do
  45. echo "Arch $arch"
  46. grep "^$codelet_name $arch" $inputfile > $inputfile.$arch
  47. done
  48. # create the gnuplot file
  49. gpfile=$inputfile.gp
  50. echo "#!/usr/bin/gnuplot -persist" > $gpfile
  51. echo "set term postscript eps enhanced color" >> $gpfile
  52. echo "set logscale x" >> $gpfile
  53. echo "set logscale y" >> $gpfile
  54. echo "set output \"$inputfile.eps\"" >> $gpfile
  55. echo "set key top left" >> $gpfile
  56. echo "set xlabel \"Total data size\"" >> $gpfile
  57. echo "set ylabel \"Execution time (ms)\"" >> $gpfile
  58. echo -n "plot " >> $gpfile
  59. first=1
  60. for arch in $archlist
  61. do
  62. if [ $first = 0 ]
  63. then
  64. echo -n " , " >> $gpfile
  65. else
  66. first=0
  67. fi
  68. echo -n " \"$inputfile.$arch\" using 3:5 title \"${codelet_name//_/\\\\_} arch $arch\"" >> $gpfile
  69. done