2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

Tests/HostTiming: Correct GCC Compile error.

This commit is contained in:
Fernando Sahmkow 2020-05-14 14:10:49 -04:00
parent e77ee67bfa
commit 45d29436b3

View file

@ -22,7 +22,6 @@ static std::array<s64, 5> delays{};
static std::bitset<CB_IDS.size()> callbacks_ran_flags; static std::bitset<CB_IDS.size()> callbacks_ran_flags;
static u64 expected_callback = 0; static u64 expected_callback = 0;
static s64 lateness = 0;
template <unsigned int IDX> template <unsigned int IDX>
void HostCallbackTemplate(u64 userdata, s64 nanoseconds_late) { void HostCallbackTemplate(u64 userdata, s64 nanoseconds_late) {
@ -34,8 +33,6 @@ void HostCallbackTemplate(u64 userdata, s64 nanoseconds_late) {
++expected_callback; ++expected_callback;
} }
static u64 callbacks_done = 0;
struct ScopeInit final { struct ScopeInit final {
ScopeInit() { ScopeInit() {
core_timing.Initialize(); core_timing.Initialize();
@ -47,6 +44,20 @@ struct ScopeInit final {
Core::HostTiming::CoreTiming core_timing; Core::HostTiming::CoreTiming core_timing;
}; };
#pragma optimize("", off)
static u64 TestTimerSpeed(Core::HostTiming::CoreTiming& core_timing) {
u64 start = core_timing.GetGlobalTimeNs().count();
u64 placebo = 0;
for (std::size_t i = 0; i < 1000; i++) {
placebo += core_timing.GetGlobalTimeNs().count();
}
u64 end = core_timing.GetGlobalTimeNs().count();
return (end - start);
}
#pragma optimize("", on)
TEST_CASE("HostTiming[BasicOrder]", "[core]") { TEST_CASE("HostTiming[BasicOrder]", "[core]") {
ScopeInit guard; ScopeInit guard;
auto& core_timing = guard.core_timing; auto& core_timing = guard.core_timing;
@ -85,18 +96,6 @@ TEST_CASE("HostTiming[BasicOrder]", "[core]") {
} }
} }
#pragma optimize("", off)
u64 TestTimerSpeed(Core::HostTiming::CoreTiming& core_timing) {
u64 start = core_timing.GetGlobalTimeNs().count();
u64 placebo = 0;
for (std::size_t i = 0; i < 1000; i++) {
placebo += core_timing.GetGlobalTimeNs().count();
}
u64 end = core_timing.GetGlobalTimeNs().count();
return (end - start);
}
#pragma optimize("", on)
TEST_CASE("HostTiming[BasicOrderNoPausing]", "[core]") { TEST_CASE("HostTiming[BasicOrderNoPausing]", "[core]") {
ScopeInit guard; ScopeInit guard;
auto& core_timing = guard.core_timing; auto& core_timing = guard.core_timing;