-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathparse_perf_drop_sigv.py
More file actions
30 lines (28 loc) · 959 Bytes
/
parse_perf_drop_sigv.py
File metadata and controls
30 lines (28 loc) · 959 Bytes
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
import re
import sys
hitm_name = "mem_load_l3_hit_retired_xsnp_hitm"
regex = r"\s+([\d,]+)\s+cache-misses.+\n\s+([\d,]+)\s+" + hitm_name + r".+\s+([\d\.]+)"
with open(sys.argv[1], "r") as file:
lines = file.readlines()
valid_lines = []
i = 0
while i < len(lines):
if 'Segmentation fault' in lines[i]:
i += 8
else:
valid_lines.append(lines[i])
i += 1
filtered_str = ''.join(valid_lines)
matches = re.finditer(regex, filtered_str, re.MULTILINE)
hitms = []
times = []
for match in matches:
_, hitm_str, time_str = match.groups()
hitm_str = hitm_str.replace(",", "")
hitms.append(int(hitm_str))
times.append(float(time_str))
hitms = hitms[:200]
times = times[:200]
avg_time = sum(times) / len(hitms)
avg_hitm = sum(hitms) / len(times)
print("samples = %d, avg_time = %.10f, avg_hitm = %d" % (len(hitms), avg_time, avg_hitm))