-
Notifications
You must be signed in to change notification settings - Fork 0
/
output.py
executable file
·57 lines (40 loc) · 1012 Bytes
/
output.py
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
import sys
simoutf = open(sys.argv[2], "w+")
outputf = open("./output/output.txt", "w+")
outBuf = []
def writeSimout(output=""):
global simoutf
simoutf.write(output)
# 0 1
# Event : "IO" | "CPU" |
def writeOutput(output=None, label=None, event=None):
global outBuf
# Will always be ordered to label
if (output is None):
lst = []
for t in outBuf:
if (t[2] == 0):
lst.append(t)
outBuf.remove(t)
outBuf.extend(lst)
# print(outBuf)
out = ""
for tup in outBuf:
out += tup[0]
__writeOutput(out)
outBuf = []
return
if (len(outBuf) == 0):
outBuf = [(output, label, event)]
return
t = (output, label, event)
if not t in outBuf:
outBuf.append((output, label, event))
return
def __writeOutput(output=""):
global outputf
outputf.write(output)
def evenCPU():
return 1
def evenIO():
return 0