aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/profiling
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2017-03-07 17:21:16 -0800
committerGravatar Craig Tiller <ctiller@google.com>2017-03-07 17:21:16 -0800
commit76fc48bc5cff0886493ff39ecbdd3db8a84ceb91 (patch)
tree3abd76faaa93602f06203c22f653581a45803c93 /tools/profiling
parenteb24a7bd847409091893e0f75f97fecaff99ebcf (diff)
Start of diff script
Diffstat (limited to 'tools/profiling')
-rwxr-xr-x[-rw-r--r--]tools/profiling/microbenchmarks/bm_diff.py47
1 files changed, 47 insertions, 0 deletions
diff --git a/tools/profiling/microbenchmarks/bm_diff.py b/tools/profiling/microbenchmarks/bm_diff.py
index e69de29bb2..4dbcc768f7 100644..100755
--- a/tools/profiling/microbenchmarks/bm_diff.py
+++ b/tools/profiling/microbenchmarks/bm_diff.py
@@ -0,0 +1,47 @@
+#!/usr/bin/env python2.7
+
+import sys
+import json
+import bm_json
+
+with open(sys.argv[1]) as f:
+ js_new_ctr = json.loads(f.read())
+with open(sys.argv[2]) as f:
+ js_new_opt = json.loads(f.read())
+with open(sys.argv[3]) as f:
+ js_old_ctr = json.loads(f.read())
+with open(sys.argv[4]) as f:
+ js_old_opt = json.loads(f.read())
+
+new = {}
+old = {}
+
+for row in bm_json.expand_json(js_new_ctr, js_new_opt):
+ new[row['cpp_name']] = row
+for row in bm_json.expand_json(js_old_ctr, js_old_opt):
+ old[row['cpp_name']] = row
+
+def min_change(pct):
+ return lambda n, o: abs((n-o)/o - 1) > pct/100
+
+_INTERESTING = (
+ ('cpu_time', min_change(5)),
+ ('real_time', min_change(5)),
+)
+
+for bm in sorted(new.keys()):
+ if bm not in old: continue
+ hdr = False
+ n = new[bm]
+ o = old[bm]
+ print n
+ print o
+ for fld, chk in _INTERESTING:
+ if fld not in n or fld not in o: continue
+ if chk(n[fld], o[fld]):
+ if not hdr:
+ print '%s shows changes:' % bm
+ hdr = True
+ print ' %s changed %r --> %r' % (fld, o[fld], n[fld])
+ sys.exit(0)
+