forked from rainaarya/CA_Project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
plot3.py
47 lines (44 loc) · 1.13 KB
/
plot3.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
from bitarray.util import ba2int
import matplotlib.pyplot as plt
import bitarray
file1 = open('snapshot.txt', 'r')
Lines = file1.readlines()
yaxis=[]
xaxis=[]
count = 0
ins=1
for line in Lines:
if line.startswith("cycle"):
ins=line[6:-2]
print("cycle = ",ins)
xaxis.append(ins)
for line in Lines:
if line.startswith("IF.isStalled:"):
flag = line[len(line)-6:len(line)-5]
# print(flag)
if(flag == "T"):
count+=1
# print(count)
if line.startswith("ID.isStalled:"):
flag = line[len(line)-6:len(line)-5]
# print(flag)
if(flag == "T"):
count+=1
# print(count)
if line.startswith("EX.isStalled:"):
flag = line[len(line)-6:len(line)-5]
# print(flag)
if(flag == "T"):
count+=1
# print(count)
if line.startswith("MEM.isStalled:"):
flag = line[len(line)-6:len(line)-5]
# print(flag)
if(flag == "T"):
count+=1
# print(count)
if line.startswith("WB.nop:"):
yaxis.append(count)
count = 0
plt.plot(xaxis,yaxis,'ro')
plt.show()