diff options
author | bunnei <bunneidev@gmail.com> | 2020-07-18 07:45:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-18 07:45:10 +0200 |
commit | 4a8cb9a70671db5684dadf10061f3c3cf1d27741 (patch) | |
tree | 76ff712dc903f71245bd6108519b125ca6fac99e /src/core/tools | |
parent | Merge pull request #4373 from lioncash/allocator (diff) | |
parent | core_timing: Remove unused data member (diff) | |
download | yuzu-4a8cb9a70671db5684dadf10061f3c3cf1d27741.tar yuzu-4a8cb9a70671db5684dadf10061f3c3cf1d27741.tar.gz yuzu-4a8cb9a70671db5684dadf10061f3c3cf1d27741.tar.bz2 yuzu-4a8cb9a70671db5684dadf10061f3c3cf1d27741.tar.lz yuzu-4a8cb9a70671db5684dadf10061f3c3cf1d27741.tar.xz yuzu-4a8cb9a70671db5684dadf10061f3c3cf1d27741.tar.zst yuzu-4a8cb9a70671db5684dadf10061f3c3cf1d27741.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/tools/freezer.cpp | 17 | ||||
-rw-r--r-- | src/core/tools/freezer.h | 3 |
2 files changed, 11 insertions, 9 deletions
diff --git a/src/core/tools/freezer.cpp b/src/core/tools/freezer.cpp index 8b0c50d11..27b894b51 100644 --- a/src/core/tools/freezer.cpp +++ b/src/core/tools/freezer.cpp @@ -14,7 +14,7 @@ namespace Tools { namespace { -constexpr s64 MEMORY_FREEZER_TICKS = static_cast<s64>(1000000000 / 60); +constexpr auto memory_freezer_ns = std::chrono::nanoseconds{1000000000 / 60}; u64 MemoryReadWidth(Core::Memory::Memory& memory, u32 width, VAddr addr) { switch (width) { @@ -55,10 +55,11 @@ void MemoryWriteWidth(Core::Memory::Memory& memory, u32 width, VAddr addr, u64 v Freezer::Freezer(Core::Timing::CoreTiming& core_timing_, Core::Memory::Memory& memory_) : core_timing{core_timing_}, memory{memory_} { - event = Core::Timing::CreateEvent( - "MemoryFreezer::FrameCallback", - [this](u64 userdata, s64 ns_late) { FrameCallback(userdata, ns_late); }); - core_timing.ScheduleEvent(MEMORY_FREEZER_TICKS, event); + event = Core::Timing::CreateEvent("MemoryFreezer::FrameCallback", + [this](u64 userdata, std::chrono::nanoseconds ns_late) { + FrameCallback(userdata, ns_late); + }); + core_timing.ScheduleEvent(memory_freezer_ns, event); } Freezer::~Freezer() { @@ -68,7 +69,7 @@ Freezer::~Freezer() { void Freezer::SetActive(bool active) { if (!this->active.exchange(active)) { FillEntryReads(); - core_timing.ScheduleEvent(MEMORY_FREEZER_TICKS, event); + core_timing.ScheduleEvent(memory_freezer_ns, event); LOG_DEBUG(Common_Memory, "Memory freezer activated!"); } else { LOG_DEBUG(Common_Memory, "Memory freezer deactivated!"); @@ -158,7 +159,7 @@ std::vector<Freezer::Entry> Freezer::GetEntries() const { return entries; } -void Freezer::FrameCallback(u64 userdata, s64 ns_late) { +void Freezer::FrameCallback(u64, std::chrono::nanoseconds ns_late) { if (!IsActive()) { LOG_DEBUG(Common_Memory, "Memory freezer has been deactivated, ending callback events."); return; @@ -173,7 +174,7 @@ void Freezer::FrameCallback(u64 userdata, s64 ns_late) { MemoryWriteWidth(memory, entry.width, entry.address, entry.value); } - core_timing.ScheduleEvent(MEMORY_FREEZER_TICKS - ns_late, event); + core_timing.ScheduleEvent(memory_freezer_ns - ns_late, event); } void Freezer::FillEntryReads() { diff --git a/src/core/tools/freezer.h b/src/core/tools/freezer.h index 62fc6aa6c..8438783d5 100644 --- a/src/core/tools/freezer.h +++ b/src/core/tools/freezer.h @@ -5,6 +5,7 @@ #pragma once #include <atomic> +#include <chrono> #include <memory> #include <mutex> #include <optional> @@ -72,7 +73,7 @@ public: std::vector<Entry> GetEntries() const; private: - void FrameCallback(u64 userdata, s64 cycles_late); + void FrameCallback(u64 userdata, std::chrono::nanoseconds ns_late); void FillEntryReads(); std::atomic_bool active{false}; |