Skip to content

Commit d276466

Browse files
committed
Simplify now_ns() implementation
1 parent 7ec679d commit d276466

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

bench/bench_utils.hpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ volatile int bench_utils_sink = 0;
4343

4444
class cpu_timer
4545
{
46-
typedef boost::move_detail::cpu_times cpu_times;
4746
typedef boost::move_detail::nanosecond_type nanosecond_type;
4847

4948
nanosecond_type start_ns_;
@@ -52,9 +51,7 @@ class cpu_timer
5251

5352
BOOST_CONTAINER_FORCEINLINE static nanosecond_type now_ns()
5453
{
55-
cpu_times t;
56-
boost::move_detail::get_cpu_times(t);
57-
return t.wall;
54+
return boost::move_detail::nsec_clock();
5855
}
5956

6057
nanosecond_type robust_median() const
@@ -87,11 +84,9 @@ class cpu_timer
8784
BOOST_CONTAINER_FORCEINLINE bool is_stopped() const
8885
{ return !running_; }
8986

90-
cpu_times elapsed() const
87+
nanosecond_type elapsed() const
9188
{
92-
cpu_times t;
93-
t.wall = robust_median() * static_cast<nanosecond_type>(samples_.size());
94-
return t;
89+
return robust_median() * static_cast<nanosecond_type>(samples_.size());
9590
}
9691

9792
void start()
@@ -100,7 +95,7 @@ class cpu_timer
10095
start_ns_ = now_ns();
10196
running_ = true;
10297
}
103-
98+
10499
void stop()
105100
{
106101
if(!running_)

0 commit comments

Comments
 (0)