-
Notifications
You must be signed in to change notification settings - Fork 330
Expand file tree
/
Copy pathparse.py
More file actions
29 lines (25 loc) · 840 Bytes
/
parse.py
File metadata and controls
29 lines (25 loc) · 840 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
import csv
import re
import sys
pattern = re.compile('.*PrecompileId::(\w+), (\w+)[^/]*(/(\d+))?_(mean|stddev)')
data = []
with open(sys.argv[1], newline='') as csvfile:
reader = csv.reader(csvfile)
for row in reader:
name = row[0]
r = re.match(pattern, name)
if r:
id = r.group(1)
impl = r.group(2)
count = r.group(4) if r.group(4) else '1'
type = r.group(5)
if type == 'mean':
data.append([id, impl, count, row[3]])
elif type == 'stddev':
data[-1].append(row[3])
# print(count, row[3])
# print(r.group(0), r.group(1), r.group(2), r.group(3), r.group(4), r.group(5))
# if "_mean" in name:
# print(', '.join(row))
for d in data:
print(",".join(d))