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
73
74
75
76
77
78
79
80
81
82
83
84
|
#!/usr/bin/env python3
import re
import sys
def main():
file = open(sys.argv[1], "r")
lines = file.read().split('\n')
compute_match = re.compile(r"COMPUTE: START")
gmem_match = re.compile(r": rendering (\S+)x(\S+) tiles")
sysmem_match = re.compile(r": rendering sysmem (\S+)x(\S+)")
blit_match = re.compile(r": END BLIT")
elapsed_match = re.compile(r"ELAPSED: (\S+) ns")
eof_match = re.compile(r"END OF FRAME (\S+)")
# Times in ns:
times_blit = []
times_sysmem = []
times_gmem = []
times_compute = []
times = None
for line in lines:
match = re.search(compute_match, line)
if match is not None:
#printf("GRID/COMPUTE")
if times is not None:
print("expected times to not be set yet")
times = times_compute
continue
match = re.search(gmem_match, line)
if match is not None:
#print("GMEM")
if times is not None:
print("expected times to not be set yet")
times = times_gmem
continue
match = re.search(sysmem_match, line)
if match is not None:
#print("SYSMEM")
if times is not None:
print("expected times to not be set yet")
times = times_sysmem
continue
match = re.search(blit_match, line)
if match is not None:
#print("BLIT")
if times is not None:
print("expected times to not be set yet")
times = times_blit
continue
match = re.search(eof_match, line)
if match is not None:
frame_nr = int(match.group(1))
print("FRAME[{}]: {} blits ({:,} ns), {} SYSMEM ({:,} ns), {} GMEM ({:,} ns), {} COMPUTE ({:,} ns)".format(
frame_nr,
len(times_blit), sum(times_blit),
len(times_sysmem), sum(times_sysmem),
len(times_gmem), sum(times_gmem),
len(times_compute), sum(times_compute)
))
times_blit = []
times_sysmem = []
times_gmem = []
times = None
continue
match = re.search(elapsed_match, line)
if match is not None:
time = int(match.group(1))
#print("ELAPSED: " + str(time) + " ns")
times.append(time)
times = None
continue
if __name__ == "__main__":
main()
|