diff options
author | Lioncash <mathew1800@gmail.com> | 2020-07-16 01:14:21 +0200 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2020-07-16 01:41:22 +0200 |
commit | bef1844a51a37c1c8dc531e67069ef00821ffa9c (patch) | |
tree | 2e46f404c3f0baf1b854e1bea916c19469fe424a /src/tests | |
parent | core_timing: Make use of std::chrono with ScheduleEvent (diff) | |
download | yuzu-bef1844a51a37c1c8dc531e67069ef00821ffa9c.tar yuzu-bef1844a51a37c1c8dc531e67069ef00821ffa9c.tar.gz yuzu-bef1844a51a37c1c8dc531e67069ef00821ffa9c.tar.bz2 yuzu-bef1844a51a37c1c8dc531e67069ef00821ffa9c.tar.lz yuzu-bef1844a51a37c1c8dc531e67069ef00821ffa9c.tar.xz yuzu-bef1844a51a37c1c8dc531e67069ef00821ffa9c.tar.zst yuzu-bef1844a51a37c1c8dc531e67069ef00821ffa9c.zip |
Diffstat (limited to '')
-rw-r--r-- | src/tests/core/core_timing.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/tests/core/core_timing.cpp b/src/tests/core/core_timing.cpp index 4ede1bc2e..244463a47 100644 --- a/src/tests/core/core_timing.cpp +++ b/src/tests/core/core_timing.cpp @@ -6,6 +6,7 @@ #include <array> #include <bitset> +#include <chrono> #include <cstdlib> #include <memory> #include <string> @@ -17,7 +18,6 @@ namespace { // Numbers are chosen randomly to make sure the correct one is given. constexpr std::array<u64, 5> CB_IDS{{42, 144, 93, 1026, UINT64_C(0xFFFF7FFFF7FFFF)}}; -constexpr int MAX_SLICE_LENGTH = 10000; // Copied from CoreTiming internals constexpr std::array<u64, 5> calls_order{{2, 0, 1, 4, 3}}; std::array<s64, 5> delays{}; @@ -25,12 +25,12 @@ std::bitset<CB_IDS.size()> callbacks_ran_flags; u64 expected_callback = 0; template <unsigned int IDX> -void HostCallbackTemplate(u64 userdata, s64 nanoseconds_late) { +void HostCallbackTemplate(u64 userdata, std::chrono::nanoseconds ns_late) { static_assert(IDX < CB_IDS.size(), "IDX out of range"); callbacks_ran_flags.set(IDX); REQUIRE(CB_IDS[IDX] == userdata); REQUIRE(CB_IDS[IDX] == CB_IDS[calls_order[expected_callback]]); - delays[IDX] = nanoseconds_late; + delays[IDX] = ns_late.count(); ++expected_callback; } @@ -77,10 +77,12 @@ TEST_CASE("CoreTiming[BasicOrder]", "[core]") { core_timing.SyncPause(true); - u64 one_micro = 1000U; + const u64 one_micro = 1000U; for (std::size_t i = 0; i < events.size(); i++) { - u64 order = calls_order[i]; - core_timing.ScheduleEvent(i * one_micro + 100U, events[order], CB_IDS[order]); + const u64 order = calls_order[i]; + const auto future_ns = std::chrono::nanoseconds{static_cast<s64>(i * one_micro + 100)}; + + core_timing.ScheduleEvent(future_ns, events[order], CB_IDS[order]); } /// test pause REQUIRE(callbacks_ran_flags.none()); |