summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/benchmark/tools/compare_bench.py
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2016-09-03 14:42:01 +0200
committer Miodrag Milanovic <mmicko@gmail.com>2016-09-03 14:42:01 +0200
commitc5f0d660c73a093207994d15abeb7466408c267f (patch)
treee15f649f804c671e76c47b35d5da8798bea46465 /3rdparty/benchmark/tools/compare_bench.py
parentfe95be105b61612362e958be0d83d8bae7f3aba9 (diff)
Update Google Benchmark (nw)
Diffstat (limited to '3rdparty/benchmark/tools/compare_bench.py')
-rw-r--r--3rdparty/benchmark/tools/compare_bench.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/3rdparty/benchmark/tools/compare_bench.py b/3rdparty/benchmark/tools/compare_bench.py
new file mode 100644
index 00000000000..ed0f133e0dc
--- /dev/null
+++ b/3rdparty/benchmark/tools/compare_bench.py
@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+"""
+compare_bench.py - Compare two benchmarks or their results and report the
+ difference.
+"""
+import sys
+import gbench
+from gbench import util, report
+
+def main():
+ # Parse the command line flags
+ def usage():
+ print('compare_bench.py <test1> <test2> [benchmark options]...')
+ exit(1)
+ if '--help' in sys.argv or len(sys.argv) < 3:
+ usage()
+ tests = sys.argv[1:3]
+ bench_opts = sys.argv[3:]
+ bench_opts = list(bench_opts)
+ # Run the benchmarks and report the results
+ json1 = gbench.util.run_or_load_benchmark(tests[0], bench_opts)
+ json2 = gbench.util.run_or_load_benchmark(tests[1], bench_opts)
+ output_lines = gbench.report.generate_difference_report(json1, json2)
+ print 'Comparing %s to %s' % (tests[0], tests[1])
+ for ln in output_lines:
+ print(ln)
+
+
+if __name__ == '__main__':
+ main()