diff options
author | Eric <eric@efcs.ca> | 2016-09-02 21:34:34 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-02 21:34:34 -0600 |
commit | cba945e37dd8f336c7c8f5367f3c7d9498d5e09b (patch) | |
tree | a66a3adf8ea893cbd20b031c7661414b85b12eff /tools | |
parent | 94c2a30a3eefa6ae91b2e44825a8ca5884b47707 (diff) | |
download | google-benchmark-cba945e37dd8f336c7c8f5367f3c7d9498d5e09b.tar.gz |
Make `PauseTiming()` and `ResumeTiming()` per thread. (#286)
* Change to using per-thread timers
* fix bad assertions
* fix copy paste error on windows
* Fix thread safety annotations
* Make null-log thread safe
* remove remaining globals
* use chrono for walltime since it is thread safe
* consolidate timer functions
* Add missing ctime include
* Rename to be consistent with Google style
* Format patch using clang-format
* cleanup -Wthread-safety configuration
* Don't trust _POSIX_FEATURE macros because OS X lies.
* Fix OS X thread timings
* attempt to fix mingw build
* Attempt to make mingw work again
* Revert old mingw workaround
* improve diagnostics
* Drastically improve OS X measurements
* Use average real time instead of max
Diffstat (limited to 'tools')
-rw-r--r-- | tools/gbench/report.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/tools/gbench/report.py b/tools/gbench/report.py index 44fa4a5..ac69b9b 100644 --- a/tools/gbench/report.py +++ b/tools/gbench/report.py @@ -59,6 +59,10 @@ def calculate_change(old_val, new_val): """ Return a float representing the decimal change between old_val and new_val. """ + if old_val == 0 and new_val == 0: + return 0.0 + if old_val == 0: + return float(new_val - old_val) / (float(old_val + new_val) / 2) return float(new_val - old_val) / abs(old_val) @@ -73,7 +77,7 @@ def generate_difference_report(json1, json2, use_color=True): if b['name'] == name: return b return None - first_line = "{:<{}s} Time CPU".format( + first_line = "{:<{}s} Time CPU Old New".format( 'Benchmark', first_col_width) output_strs = [first_line, '-' * len(first_line)] for bn in json1['benchmarks']: @@ -88,12 +92,13 @@ def generate_difference_report(json1, json2, use_color=True): return BC_WHITE else: return BC_CYAN - fmt_str = "{}{:<{}s}{endc} {}{:+.2f}{endc} {}{:+.2f}{endc}" + fmt_str = "{}{:<{}s}{endc} {}{:+.2f}{endc} {}{:+.2f}{endc} {:4d} {:4d}" tres = calculate_change(bn['real_time'], other_bench['real_time']) cpures = calculate_change(bn['cpu_time'], other_bench['cpu_time']) output_strs += [color_format(use_color, fmt_str, BC_HEADER, bn['name'], first_col_width, get_color(tres), tres, get_color(cpures), cpures, + bn['cpu_time'], other_bench['cpu_time'], endc=BC_ENDC)] return output_strs |