diff options
-rw-r--r-- | pw_perf_test/chrono_test.cc | 4 | ||||
-rw-r--r-- | pw_perf_test/public/pw_perf_test/internal/chrono_timer_interface.h | 2 | ||||
-rw-r--r-- | pw_perf_test/public/pw_perf_test/internal/timer.h | 4 | ||||
-rw-r--r-- | pw_perf_test/timer_test.cc | 4 |
4 files changed, 7 insertions, 7 deletions
diff --git a/pw_perf_test/chrono_test.cc b/pw_perf_test/chrono_test.cc index bb205a8b7..a708ede17 100644 --- a/pw_perf_test/chrono_test.cc +++ b/pw_perf_test/chrono_test.cc @@ -29,8 +29,8 @@ TEST(ChronoTest, DurationIsReasonable) { Timestamp start = GetCurrentTimestamp(); this_thread::sleep_for(kArbitraryDuration); Timestamp end = GetCurrentTimestamp(); - uint64_t duration = GetDuration(start, end); - EXPECT_GE(duration, 1000000u); + int64_t duration = GetDuration(start, end); + EXPECT_GE(duration, 1000000); } } // namespace diff --git a/pw_perf_test/public/pw_perf_test/internal/chrono_timer_interface.h b/pw_perf_test/public/pw_perf_test/internal/chrono_timer_interface.h index 33981b613..8dfc2594c 100644 --- a/pw_perf_test/public/pw_perf_test/internal/chrono_timer_interface.h +++ b/pw_perf_test/public/pw_perf_test/internal/chrono_timer_interface.h @@ -31,7 +31,7 @@ void TimerCleanup(); inline Timestamp GetCurrentTimestamp() { return chrono::SystemClock::now(); } -inline uint64_t GetDuration(Timestamp begin, Timestamp end) { +inline int64_t GetDuration(Timestamp begin, Timestamp end) { return std::chrono::duration_cast<std::chrono::nanoseconds>(end - begin) .count(); } diff --git a/pw_perf_test/public/pw_perf_test/internal/timer.h b/pw_perf_test/public/pw_perf_test/internal/timer.h index cf32b3e07..849a5d20d 100644 --- a/pw_perf_test/public/pw_perf_test/internal/timer.h +++ b/pw_perf_test/public/pw_perf_test/internal/timer.h @@ -32,11 +32,11 @@ inline Timestamp GetCurrentTimestamp() { } // Obtains the testing unit from the backend. -inline constexpr DurationUnit DurationUnit = +inline constexpr DurationUnit kDurationUnit = backend::kDurationUnit; // <cycles, ns, etc.> // Returns the duration in the specified unit. -uint64_t GetDuration(Timestamp begin, Timestamp end) { +inline int64_t GetDuration(Timestamp begin, Timestamp end) { return backend::GetDuration(begin, end); } diff --git a/pw_perf_test/timer_test.cc b/pw_perf_test/timer_test.cc index 1fffb75ea..ba65ffc01 100644 --- a/pw_perf_test/timer_test.cc +++ b/pw_perf_test/timer_test.cc @@ -24,8 +24,8 @@ TEST(TimerTest, DurationIsPositive) { for (volatile int i = 0; i < 1000; i = i + 1) { } Timestamp end = GetCurrentTimestamp(); - uint64_t duration = GetDuration(start, end); - EXPECT_GT(duration, 0u); + int64_t duration = GetDuration(start, end); + EXPECT_GT(duration, 0); } } // namespace |