HomePhabricator

bench: use std::chrono rather than gettimeofday

Description

bench: use std::chrono rather than gettimeofday

Summary:

  • bench: switch to std::chrono for time measurements

std::chrono removes portability issues.

Rather than storing doubles, store the untouched time_points. Then
convert to nanoseconds for display. This allows for maximum precision, while
keeping results comparable between differing hardware/operating systems.

Also, display full nanosecond counts rather than sub-second floats.

  • bench: prefer a steady clock if the resolution is no worse
  • Require a steady clock for bench with at least micro precision

This is a backport of core PR11562 and PR11646

Test Plan:

make
./src/bench/bench_bitcoin

Reviewers: #bitcoin_abc, jasonbcox

Reviewed By: #bitcoin_abc, jasonbcox

Subscribers: teamcity

Differential Revision: https://reviews.bitcoinabc.org/D1842

Details

Provenance
Cory Fields <cory-nospam-@coryfields.com>Authored on Oct 25 2017, 20:38
deadalnixCommitted on Sep 30 2018, 16:54
deadalnixPushed on Sep 30 2018, 16:54
Reviewer
Restricted Project
Differential Revision
D1842: bench: use std::chrono rather than gettimeofday
Parents
rABC3f4a6bc9d5b6: [cmake] Compile and run bitcoin-qt tests.
Branches
Unknown
Tags
Unknown

Event Timeline