-
Notifications
You must be signed in to change notification settings - Fork 10
/
nooptstats.py
53 lines (44 loc) · 1.22 KB
/
nooptstats.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
from __future__ import division
from collections import defaultdict
from math import sqrt
import sys
current = None
totals = defaultdict(int)
markers = defaultdict(int)
inNoopt = False
loops = set()
for line in sys.stdin:
if "{jit-log-noopt-loop" in line:
inNoopt = True
elif "jit-log-noopt-loop}" in line:
inNoopt = False
if "noopt with" in line:
loops.add(int(line.split()[-2]))
if not inNoopt:
continue
if line.startswith("jit_debug("):
try:
s, _, _ = line.split(",")
name = s[11:-1]
current = name
markers[current] += 1
except ValueError:
totals[current] += 1
else:
totals[current] += 1
for marker in markers:
if marker is None:
continue
m = markers[marker]
t = totals[marker]
avg = t / m
name = marker.ljust(15)
print "%s: %10d instances %10d total %0.2f average" % (name, m, t, avg)
loops = list(loops)
loops.sort()
avg = sum(loops) / len(loops)
stddev = sqrt(sum((l - avg) ** 2 for l in loops) / len(loops))
print len(loops), "loops"
print loops
print "Average loop length", avg, "standard deviation", stddev
print "+3 stddevs from mean", avg + (stddev * 3)