23 from AthenaCommon.Logging
import logging
24 logger = logging.getLogger( os.path.splitext( os.path.basename( sys.argv[ 0 ] ) )[ 0 ] )
28 desc =
"This is a simple helper script for easily turning profile files into " \
29 "something that's more easily readable. It doesn't provide too many " \
30 "options, but it prints everyhing that it's doing. So it's easy to " \
31 "tweak a bit what it did. Usage instructions can be found on: " \
33 vers =
"$Revision: 783179 $"
34 parser = optparse.OptionParser( description = desc,
36 usage =
"%prog [options] <profile file> <output file>" )
37 parser.add_option(
"-v",
"--verbosity", dest =
"verbosity",
38 action =
"store", type =
"int", default = 3,
39 help =
"Script message verbosity level" )
41 ( options, files ) = parser.parse_args()
45 logger.error(
"You have to provide one input and output file for the script!" )
50 logging.getLogger(
"" ).
setLevel( options.verbosity )
53 input_file = files[ 0 ]
54 output_file = files[ 1 ]
57 if output_file.endswith(
".pdf" ):
58 return makePdf( input_file, output_file )
59 elif output_file.endswith(
".callgrind" ):
62 logger.error(
"Output format not recognized" )
77 from AthenaCommon.Logging
import logging
78 logger = logging.getLogger(
"makePdf" )
82 command =
"pprof --pdf --nodecount=200 --nodefraction=0.001 " \
83 "--edgefraction=0.0002 `which python` " + input_file +
" > " + output_file
84 logger.info(
"Running command: " + command )
85 return os.system( command )
99 from AthenaCommon.Logging
import logging
100 logger = logging.getLogger(
"makeCallgrind" )
104 command =
"pprof --callgrind `which python` " + \
105 input_file +
" > " + output_file
106 logger.info(
"Running command: " + command )
107 return os.system( command )
112 if __name__ ==
"__main__":