diff options
| -rwxr-xr-x | unit-trace | 53 | ||||
| -rw-r--r-- | unit_trace/sanitizer.py | 24 |
2 files changed, 37 insertions, 40 deletions
| @@ -94,31 +94,28 @@ if options.gedf is True: | |||
| 94 | # import itertools | 94 | # import itertools |
| 95 | # stream1, stream2, stream3 = itertools.tee(stream,3) | 95 | # stream1, stream2, stream3 = itertools.tee(stream,3) |
| 96 | 96 | ||
| 97 | def main(): | 97 | # Call standard out printer |
| 98 | # # Call standard out printer | 98 | if options.stdout is True: |
| 99 | # if options.stdout is True: | 99 | from unit_trace import stdout_printer |
| 100 | # from unit_trace import stdout_printer | 100 | stdout_printer.stdout_printer(stream1) |
| 101 | # stdout_printer.stdout_printer(stream1) | 101 | |
| 102 | 102 | # Print G_EDF inversion statistics | |
| 103 | # # Print G_EDF inversion statistics | 103 | if options.num_inversions > -1: |
| 104 | # if options.num_inversions > -1: | 104 | if options.gedf is not True: |
| 105 | # if options.gedf is not True: | 105 | import sys |
| 106 | # import sys | 106 | sys.stderr.write("You must enable the G-EDF test module to print" + |
| 107 | # sys.stderr.write("You must enable the G-EDF test module to print" + | 107 | " G-EDF inversion statistics\n") |
| 108 | # " G-EDF inversion statistics\n") | 108 | else: |
| 109 | # else: | 109 | from unit_trace import gedf_inversion_stat_printer |
| 110 | # from unit_trace import gedf_inversion_stat_printer | 110 | gedf_inversion_stat_printer.gedf_inversion_stat_printer(stream2,options.num_inversions) |
| 111 | # gedf_inversion_stat_printer.gedf_inversion_stat_printer(stream2,options.num_inversions) | 111 | |
| 112 | 112 | # Call visualizer | |
| 113 | # Call visualizer | 113 | if options.visualize is True: |
| 114 | if options.visualize is True: | 114 | from unit_trace import viz |
| 115 | from unit_trace import viz | 115 | try: |
| 116 | try: | 116 | nsec_time_per_maj = viz.util.parse_time(options.time_per_maj) |
| 117 | nsec_time_per_maj = viz.util.parse_time(options.time_per_maj) | 117 | viz.visualizer.visualizer(stream, nsec_time_per_maj) |
| 118 | viz.visualizer.visualizer(stream, nsec_time_per_maj) | 118 | except ValueError: |
| 119 | except ValueError: | 119 | import sys |
| 120 | import sys | 120 | sys.stderr.write("Time expression should be of the form [TIME] [UNIT]") |
| 121 | sys.stderr.write("Time expression should be of the form [TIME] [UNIT]") | 121 | |
| 122 | |||
| 123 | import cProfile | ||
| 124 | cProfile.run('main()') | ||
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): | |||
| 17 | for record in stream: | 17 | for record in stream: |
| 18 | 18 | ||
| 19 | # Ignore records which are not events (e.g. the num_cpus record) | 19 | # Ignore records which are not events (e.g. the num_cpus record) |
| 20 | if record.record_type != 'event': | 20 | if record['record_type'] != 'event': |
| 21 | yield record | 21 | yield record |
| 22 | continue | 22 | continue |
| 23 | 23 | ||
| 24 | # All records with job < 2 are garbage | 24 | # All records with job < 2 are garbage |
| 25 | if record.job < 2: | 25 | if record['job'] < 2: |
| 26 | continue | 26 | continue |
| 27 | 27 | ||
| 28 | # Some records with job == 2 are garbage | 28 | # Some records with job == 2 are garbage |
| 29 | if record.job==2: | 29 | if record['job']==2: |
| 30 | 30 | ||
| 31 | # There is a duplicate release of every job 2 | 31 | # There is a duplicate release of every job 2 |
| 32 | # This will throw away the second one | 32 | # This will throw away the second one |
| 33 | if record.type_name == 'release': | 33 | if record['type_name'] == 'release': |
| 34 | if record.pid in job_2s_released: | 34 | if record['pid'] in job_2s_released: |
| 35 | continue | 35 | continue |
| 36 | else: | 36 | else: |
| 37 | job_2s_released.append(record.pid) | 37 | job_2s_released.append(record['pid']) |
| 38 | 38 | ||
| 39 | # Job 2 has a resume that is garbage | 39 | # Job 2 has a resume that is garbage |
| 40 | if record.type_name == 'resume': | 40 | if record['type_name'] == 'resume': |
| 41 | continue | 41 | continue |
| 42 | 42 | ||
| 43 | # By default, the switch_away for a job (after it has completed) | 43 | # By default, the switch_away for a job (after it has completed) |
| 44 | # is maked as being for job+1, which has never been switched to. | 44 | # is maked as being for job+1, which has never been switched to. |
| 45 | # We can correct this if we note which jobs really | 45 | # We can correct this if we note which jobs really |
| 46 | # have been switched to. | 46 | # have been switched to. |
| 47 | if record.type_name == 'switch_to': | 47 | if record['type_name'] == 'switch_to': |
| 48 | jobs_switched_to.append((record.pid,record.job)) | 48 | jobs_switched_to.append((record['pid'],record['job'])) |
| 49 | if record.type_name == 'switch_away': | 49 | if record['type_name'] == 'switch_away': |
| 50 | if (record.pid,record.job) not in jobs_switched_to: | 50 | if (record['pid'],record['job']) not in jobs_switched_to: |
| 51 | record.job -= 1 | 51 | record['job'] -= 1 |
| 52 | 52 | ||
| 53 | yield record | 53 | yield record |
