forked from andikleen/pmu-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcounterdiff.py
More file actions
executable file
·29 lines (27 loc) · 802 Bytes
/
counterdiff.py
File metadata and controls
executable file
·29 lines (27 loc) · 802 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
#!/usr/bin/env python
# counterdiff.py < plog program .. (or general perf arguments)
# verify plog.* output from toplev by running event one by one
# this can be used to estimate multiplexing measurement errors
from __future__ import print_function
import sys, os
def run(x):
print(x)
os.system(x)
for l in sys.stdin:
if l.find(",") < 0:
continue
n = l.strip().split(",")
run("perf stat --output l -x, -e %s %s" %
(n[1], " ".join(sys.argv[1:])))
f = open("l", "r")
for i in f:
if i.find(",") < 0:
continue
j = i.strip().split(",")
break
f.close()
if float(n[0]) > 0:
delta = (float(j[0]) - float(n[0])) / float(n[0])
else:
delta = 0
print(n[1], j[0], n[0], "%.2f" % (delta * 100.0))