-
Notifications
You must be signed in to change notification settings - Fork 0
/
parsePerfContsOneFile.py
82 lines (69 loc) · 1.89 KB
/
parsePerfContsOneFile.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# grep -A20 "CPUs utilized" perfHWS6.log | awk '{print $1,$2}'
#grep -A29 "CPUs utilized" scimark2BW.log
def parseCountsNorm(di,denName):
do = {}
for wf in di :
den = di[wf][denName]
if (denName=='seconds') : den*=1000.*1000.*1000.
for k in di[wf] :
ko = k
if (k=='msec') :
ko='nsec'
if(k=='seconds') : ko='wall-clock-ns'
if not ko in do : do[ko] = {}
do[ko][wf] = di[wf][k]/den
if (ko=='nsec') : do[ko][wf]*=1000.*1000.
if (ko=='wall-clock-ns') : do[ko][wf]*=1000*1000.*1000.
return do
def doPrint(di) :
s = '|' + ' | '
for wf in di['cycles'] :
s+= ' ' + wf + ' |'
s += '|'
print(s)
for k in di :
s = '|' + k + ' | '
for wf in di[k] :
v = di[k][wf]
s+= ' ' + "{:6.4f}".format(v) + ' | '
s += '|'
print(s)
def parseOne(fname) :
nop=0
d ={}
with open(fname) as f:
print('\n\n---++ '+fname)
for line in f:
try:
(wf, val, key) = line.split()
d[wf] = {}
except:
nop+=1
with open(fname) as f:
for line in f:
try:
(wf, val, key) = line.split()
d[wf][key]= float(val)
except:
nop+=1
#
dc = parseCountsNorm(d,'cycles')
di = parseCountsNorm(d,'instructions')
ds = parseCountsNorm(d,'seconds')
#
print('\n---+++ Normalized to Cycles')
doPrint(dc)
print('\n---+++ Normalized to Instructions')
doPrint(di)
print('\n---+++ Normalized to Wall-Clock (ns)')
doPrint(ds)
dir = '/Users/innocent/cernbox/HepSpec/'
files = [dir+"Haswell/haswell.count",dir+"Skylake/skylake.count",dir+"Icelake/icelake.count"]
print('---+ Deep Dive in HepSpec\n\n')
print('---+ Single Process\n\n')
for f in files:
parseOne(f)
files = [dir+"Haswell/haswellFull.count",dir+"Skylake/skylakeFull.count",dir+"Icelake/icelakeFull.count"]
print('\n\n---+ Full Machine\n\n')
for f in files:
parseOne(f)