1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
###############################################################################
# Description
###############################################################################
# Prints records to standard out
###############################################################################
# Public functions
###############################################################################
def stdout_printer(stream):
for record in stream:
if record['record_type'] == "event":
_print_event(record)
elif record['record_type'] == "meta" and record['type_name'] == "stats":
_print_stats(record)
elif record['record_type'] == "error" and \
record['type_name'] == "inversion_start":
_print_inversion_start(record)
elif record['record_type'] == "error" and record['type_name'] == "inversion_end":
_print_inversion_end(record)
else:
continue
print ""
###############################################################################
# Private functions
###############################################################################
def _print_event(record):
print "Event ID: %d" % (record['id'])
print "Job: %d.%d" % (record['pid'],record['job'])
print "Type: %s" % (record['type_name'])
print "Time: %d" % (record['when'])
def _print_inversion_start(record):
print "Type: %s" % ("Inversion start")
print "Inversion Record IDs: (%d, U)" % (record['id'])
print "Triggering Event IDs: (%d, U)" % (record['triggering_event_id'])
print "Time: %d" % (record['job']['inversion_start'])
print "Job: %d.%d" % (record['job']['pid'],record['job']['job'])
print "Deadline']: %d" % (record['job']['deadline'])
print "Off CPU: ",
for job in record['off_cpu']:
print str(job) + " ",
print
print "On CPU: ",
for job in record['on_cpu']:
print str(job) + " ",
print #newline
def _print_inversion_end(record):
print "Type: %s" % ("Inversion end")
print "Inversion record IDs: (%d, %d)" % (record['inversion_start'],
record['id'])
print("Triggering Event IDs: (%d, %d)" %
(record['inversion_start'], record['triggering_event_id']))
print "Time: %d" % (record['job']['inversion_end'])
# NOTE: Here, we assume nanoseconds as the time unit.
# May have to be changed in the future.
print "Duration: %f ms" % (
float(record['job']['inversion_end'] - record['job']['inversion_start'])/1000000)
print "Job: %d.%d" % (record['job']['pid'],record['job']['job'])
print "Deadline']: %d" % (record['job']['deadline'])
print "Off CPU: ",
for job in record['off_cpu']:
print str(job) + " ",
print
print "On CPU: ",
for job in record['on_cpu']:
print str(job) + " ",
print #newline
|