Page MenuHomePhabricator

bench: use std::chrono rather than gettimeofday
ClosedPublic

Authored by deadalnix on Sep 30 2018, 13:59.

Details

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

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Also include core PR11646

This revision is now accepted and ready to land.Sep 30 2018, 16:53
This revision was automatically updated to reflect the committed changes.