From 820017ec1c23125bab3bdbd11377040e04702795 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Tue, 31 Jan 2012 21:29:27 -0500 Subject: perf: some obs were not converted to records --- unit-trace | 53 +++++++++++++++++++++++-------------------------- unit_trace/sanitizer.py | 24 +++++++++++----------- 2 files changed, 37 insertions(+), 40 deletions(-) diff --git a/unit-trace b/unit-trace index b4e80f4..9c50488 100755 --- a/unit-trace +++ b/unit-trace @@ -94,31 +94,28 @@ if options.gedf is True: # import itertools # stream1, stream2, stream3 = itertools.tee(stream,3) -def main(): - # # Call standard out printer - # if options.stdout is True: - # from unit_trace import stdout_printer - # stdout_printer.stdout_printer(stream1) - - # # Print G_EDF inversion statistics - # if options.num_inversions > -1: - # if options.gedf is not True: - # import sys - # sys.stderr.write("You must enable the G-EDF test module to print" + - # " G-EDF inversion statistics\n") - # else: - # from unit_trace import gedf_inversion_stat_printer - # gedf_inversion_stat_printer.gedf_inversion_stat_printer(stream2,options.num_inversions) - - # Call visualizer - if options.visualize is True: - from unit_trace import viz - try: - nsec_time_per_maj = viz.util.parse_time(options.time_per_maj) - viz.visualizer.visualizer(stream, nsec_time_per_maj) - except ValueError: - import sys - sys.stderr.write("Time expression should be of the form [TIME] [UNIT]") - -import cProfile -cProfile.run('main()') +# Call standard out printer +if options.stdout is True: + from unit_trace import stdout_printer + stdout_printer.stdout_printer(stream1) + +# Print G_EDF inversion statistics +if options.num_inversions > -1: + if options.gedf is not True: + import sys + sys.stderr.write("You must enable the G-EDF test module to print" + + " G-EDF inversion statistics\n") + else: + from unit_trace import gedf_inversion_stat_printer + gedf_inversion_stat_printer.gedf_inversion_stat_printer(stream2,options.num_inversions) + +# Call visualizer +if options.visualize is True: + from unit_trace import viz + try: + nsec_time_per_maj = viz.util.parse_time(options.time_per_maj) + viz.visualizer.visualizer(stream, nsec_time_per_maj) + except ValueError: + import sys + sys.stderr.write("Time expression should be of the form [TIME] [UNIT]") + diff --git a/unit_trace/sanitizer.py b/unit_trace/sanitizer.py index 598379a..3245e70 100644 --- a/unit_trace/sanitizer.py +++ b/unit_trace/sanitizer.py @@ -17,37 +17,37 @@ def sanitizer(stream): for record in stream: # Ignore records which are not events (e.g. the num_cpus record) - if record.record_type != 'event': + if record['record_type'] != 'event': yield record continue # All records with job < 2 are garbage - if record.job < 2: + if record['job'] < 2: continue # Some records with job == 2 are garbage - if record.job==2: + if record['job']==2: # There is a duplicate release of every job 2 # This will throw away the second one - if record.type_name == 'release': - if record.pid in job_2s_released: + if record['type_name'] == 'release': + if record['pid'] in job_2s_released: continue else: - job_2s_released.append(record.pid) + job_2s_released.append(record['pid']) # Job 2 has a resume that is garbage - if record.type_name == 'resume': + if record['type_name'] == 'resume': continue # By default, the switch_away for a job (after it has completed) # is maked as being for job+1, which has never been switched to. # We can correct this if we note which jobs really # have been switched to. - if record.type_name == 'switch_to': - jobs_switched_to.append((record.pid,record.job)) - if record.type_name == 'switch_away': - if (record.pid,record.job) not in jobs_switched_to: - record.job -= 1 + if record['type_name'] == 'switch_to': + jobs_switched_to.append((record['pid'],record['job'])) + if record['type_name'] == 'switch_away': + if (record['pid'],record['job']) not in jobs_switched_to: + record['job'] -= 1 yield record -- cgit v1.2.2