aboutsummaryrefslogtreecommitdiff
path: root/pw_perf_test
diff options
context:
space:
mode:
authorBrian Barcenas <bbarcenas@google.com>2022-11-03 00:03:07 +0000
committerCQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-11-03 00:03:07 +0000
commit5e40c5547815611c597226141ba56358bee88bed (patch)
tree9d22beae6886302156279dc71ea7766d03ea6961 /pw_perf_test
parent057172e3c58deedc4ff85b52fd1618057f1afccf (diff)
downloadpigweed-5e40c5547815611c597226141ba56358bee88bed.tar.gz
pw_perf_test: Switch unsigned to signed
Change-Id: Icf34d24f607ec8181ec92ea7fd07d0a4bec76176 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/116817 Reviewed-by: Wyatt Hepler <hepler@google.com> Commit-Queue: Brian Barcenas <bbarcenas@google.com>
Diffstat (limited to 'pw_perf_test')
-rw-r--r--pw_perf_test/chrono_test.cc4
-rw-r--r--pw_perf_test/public/pw_perf_test/internal/chrono_timer_interface.h2
-rw-r--r--pw_perf_test/public/pw_perf_test/internal/timer.h4
-rw-r--r--pw_perf_test/timer_test.cc4
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