Main Function.
61 ''' Main function that parses user inputs, prepares and runs the tests '''
63 from optparse
import OptionParser
64 parser=OptionParser(usage=
'%prog [options]',
65 version=
'%prog 0.1.0')
67 parser.add_option(
'--log-level',
71 choices=[
'critical',
'error',
'warning',
'info',
'debug'],
73 help=
'Logging level (default: info)')
75 parser.add_option(
'--collect',
79 choices=[
'hotspots',
'threading',
'memory-consumption',
80 'hpc-performance',
'memory-access',
'cpugpu-concurrency',
81 'gpu-hotspots',
'gpu-profiling',
'graphics-rendering',
82 'fpga-interaction',
'io',
'system-overview'],
84 help=
'Run the specified analysis type and collect data into a result (default: hotspots)')
86 parser.add_option(
'--strategy',
89 default=
':trace:trace',
90 help=
'Run the specified strategy and collect data into a result. (default: :trace:trace)')
92 parser.add_option(
'--tf',
96 help=
'Run the specified transformation command and collect data into a result.')
98 parser.add_option(
'--resumeEvent',
102 help=
'Start the profiling from the specified event (default: 0).')
104 parser.add_option(
'--pauseEvent',
108 help=
'Start the profiling at the specified event (default: -1).')
110 (options,args) = parser.parse_args()
115 logger.setLevel(options.logLevel.upper())
122 joFragment =
'PerfMonVTune_autoSetup.py'
127 logger.fatal(
'The transformation command is empty, quitting...')
130 args = options.tf.split()
131 if 'preInclude' in args:
132 index = args.index(
'--preInclude')
133 args.insert(index+1,joFragment)
135 args.extend([
'--preInclude',joFragment])
139 ' -collect ' + options.collect +
140 ' -strategy ' + options.strategy +
141 ' -start-paused -- ' )
142 cmd +=
' '.
join(args)
144 logger.info(
'Running the full command "{}"'.
format(cmd))
145 subprocess.call(cmd,shell=
True)
147 logger.info(
'All done...')