-
Notifications
You must be signed in to change notification settings - Fork 1
/
parsePerfCountsAbs.py
58 lines (49 loc) · 1.41 KB
/
parsePerfCountsAbs.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
# grep -A35 "CPUs utilized" tkhl8.log | awk '{print $1,$2}'
#grep -A1 "CPUs utilized" tkhl8.log | awk '{print $4,$5,$6}'
d = {}
files = ['i7_tkhl4.txt', 'i7_tkhl8.txt',\
'gold_tkhl4.txt', 'gold_tkhl8.txt', 'gold_tkhl4p4.txt',\
'silver_tkhl4.txt', 'silver_tkhl8.txt', 'silver_tkhl4p4.txt'\
]
def parseCounts(fname):
d = {}
with open(fname) as f:
for line in f:
(val, key) = line.split()
d[key] = float(val) if float(val)<1000000. else float(val)/float(1000000)
return d
def parseCountsNC(fname):
d = {}
with open(fname) as f:
for line in f:
(val, key) = line.split()
d[key] = float(val)
cycles = d['cycles']
for k,v, in d.iteritems() :
d[k] = v/cycles
return d
def parseCountsNI(fname):
d = {}
with open(fname) as f:
for line in f:
(val, key) = line.split()
d[key] = float(val)
cycles = d['instructions']
for k,v, in d.iteritems() :
d[k] = v/cycles
return d
print '| | i7-6700K ||| Gold 5122 |||| Silver 4110 ||'
print '| threads | 4 | 8 | 4 | 8 | 2+2 | 4 | 8 | 4+4 ||'
# print d
d =[]
for f in files:
d.append(parseCounts(f))
for k,c in d[0].iteritems() :
s = '|' + k + ' |'
for v in d :
if not k in v : v[k] = 0.
s+= ' '
s+= "{:6.3f}".format(v[k]) if v[k]<1000 else "{:6.0f}".format(v[k])
s+= '|'
s += '|'
print s