starpu_codelet_profile.in 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #!@BASH@
  2. # StarPU --- Runtime system for heterogeneous multicore architectures.
  3. #
  4. # Copyright (C) 2008, 2009, 2010, 2013 Université de Bordeaux 1
  5. # Copyright (C) 2010, 2013 Centre National de la Recherche Scientifique
  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. PROGNAME=$0
  18. usage()
  19. {
  20. echo "Offline tool to draw codelet profile over a traced execution"
  21. echo ""
  22. echo "Usage: $PROGNAME distrib.data codelet_name"
  23. echo ""
  24. echo "Options:"
  25. echo " -h, --help display this help and exit"
  26. echo " -v, --version output version information and exit"
  27. echo ""
  28. echo "Report bugs to <@PACKAGE_BUGREPORT@>"
  29. exit 1
  30. }
  31. if [ "$1" = "-v" ] || [ "$1" = "--version" ] ; then
  32. echo "$PROGNAME (@PACKAGE_NAME@) @PACKAGE_VERSION@"
  33. exit 0
  34. fi
  35. if [ "$1" = "-h" ] || [ "$1" = "--help" ] || [ "$2" = "" ] ; then
  36. usage
  37. fi
  38. inputfile=$1
  39. codelet_name=$2
  40. archlist=`< $inputfile grep "^$codelet_name " | cut -f 2 | sort | uniq | xargs`
  41. # extract subfiles from the history file
  42. for arch in $archlist
  43. do
  44. echo "Arch $arch"
  45. grep "^$codelet_name $arch" $inputfile > $inputfile.$arch
  46. done
  47. # create the gnuplot file
  48. gpfile=$inputfile.gp
  49. echo "#!/usr/bin/gnuplot -persist" > $gpfile
  50. echo "set term postscript eps enhanced color" >> $gpfile
  51. echo "set logscale x" >> $gpfile
  52. echo "set logscale y" >> $gpfile
  53. echo "set output \"$inputfile.eps\"" >> $gpfile
  54. echo "set key top left" >> $gpfile
  55. echo "set xlabel \"Total data size\"" >> $gpfile
  56. echo "set ylabel \"Execution time (ms)\"" >> $gpfile
  57. echo -n "plot " >> $gpfile
  58. first=1
  59. for arch in $archlist
  60. do
  61. if [ $first = 0 ]
  62. then
  63. echo -n " , " >> $gpfile
  64. else
  65. first=0
  66. fi
  67. echo -n " \"$inputfile.$arch\" using 3:5 title \"${codelet_name//_/\\\\_} arch $arch\"" >> $gpfile
  68. done