starpu_codelet_profile.in 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #!@REALBASH@
  2. # StarPU --- Runtime system for heterogeneous multicore architectures.
  3. #
  4. # Copyright (C) 2008-2021 Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
  5. #
  6. # StarPU 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. # StarPU 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. 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