diff options
Diffstat (limited to 'stdout_printer.py')
-rw-r--r-- | stdout_printer.py | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/stdout_printer.py b/stdout_printer.py index 466f734..5bbcead 100644 --- a/stdout_printer.py +++ b/stdout_printer.py | |||
@@ -12,10 +12,14 @@ def stdout_printer(stream): | |||
12 | for record in stream: | 12 | for record in stream: |
13 | if record.record_type == "event": | 13 | if record.record_type == "event": |
14 | _print_event(record) | 14 | _print_event(record) |
15 | elif record.type_name == 'inversion_start': | 15 | elif record.record_type == "meta" and record.type_name == "stats": |
16 | _print_stats(record) | ||
17 | elif record.record_type == "error" and record.type_name == 'inversion_start': | ||
16 | _print_inversion_start(record) | 18 | _print_inversion_start(record) |
17 | elif record.type_name == 'inversion_end': | 19 | elif record.record_type == "error" and record.type_name == 'inversion_end': |
18 | _print_inversion_end(record) | 20 | _print_inversion_end(record) |
21 | else: | ||
22 | continue | ||
19 | print("") | 23 | print("") |
20 | 24 | ||
21 | ############################################################################### | 25 | ############################################################################### |
@@ -39,7 +43,7 @@ def _print_inversion_start(record): | |||
39 | print("On CPU: ",end="") | 43 | print("On CPU: ",end="") |
40 | for job in record.on_cpu: | 44 | for job in record.on_cpu: |
41 | print(str(job) + " ",end="") | 45 | print(str(job) + " ",end="") |
42 | print("") | 46 | print("") #newline |
43 | 47 | ||
44 | def _print_inversion_end(record): | 48 | def _print_inversion_end(record): |
45 | print("Type: {}".format("Inversion end")) | 49 | print("Type: {}".format("Inversion end")) |
@@ -55,4 +59,11 @@ def _print_inversion_end(record): | |||
55 | print("On CPU: ",end="") | 59 | print("On CPU: ",end="") |
56 | for job in record.on_cpu: | 60 | for job in record.on_cpu: |
57 | print(str(job) + " ",end="") | 61 | print(str(job) + " ",end="") |
58 | print("") | 62 | print("") #newline |
63 | |||
64 | def _print_stats(record): | ||
65 | print("Inversion statistics") | ||
66 | print("Num inversions: {}".format(record.num_inversions)) | ||
67 | print("Min inversion: {}".format(record.min_inversion)) | ||
68 | print("Max inversion: {}".format(record.max_inversion)) | ||
69 | print("Avg inversion: {}".format(record.avg_inversion)) | ||