diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/perf_stats.cpp | 10 | ||||
| -rw-r--r-- | src/core/tools/freezer.cpp | 18 |
2 files changed, 14 insertions, 14 deletions
diff --git a/src/core/perf_stats.cpp b/src/core/perf_stats.cpp index 52c43c857..6ef459b7a 100644 --- a/src/core/perf_stats.cpp +++ b/src/core/perf_stats.cpp | |||
| @@ -53,13 +53,13 @@ PerfStats::~PerfStats() { | |||
| 53 | } | 53 | } |
| 54 | 54 | ||
| 55 | void PerfStats::BeginSystemFrame() { | 55 | void PerfStats::BeginSystemFrame() { |
| 56 | std::lock_guard lock{object_mutex}; | 56 | std::scoped_lock lock{object_mutex}; |
| 57 | 57 | ||
| 58 | frame_begin = Clock::now(); | 58 | frame_begin = Clock::now(); |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | void PerfStats::EndSystemFrame() { | 61 | void PerfStats::EndSystemFrame() { |
| 62 | std::lock_guard lock{object_mutex}; | 62 | std::scoped_lock lock{object_mutex}; |
| 63 | 63 | ||
| 64 | auto frame_end = Clock::now(); | 64 | auto frame_end = Clock::now(); |
| 65 | const auto frame_time = frame_end - frame_begin; | 65 | const auto frame_time = frame_end - frame_begin; |
| @@ -79,7 +79,7 @@ void PerfStats::EndGameFrame() { | |||
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | double PerfStats::GetMeanFrametime() const { | 81 | double PerfStats::GetMeanFrametime() const { |
| 82 | std::lock_guard lock{object_mutex}; | 82 | std::scoped_lock lock{object_mutex}; |
| 83 | 83 | ||
| 84 | if (current_index <= IgnoreFrames) { | 84 | if (current_index <= IgnoreFrames) { |
| 85 | return 0; | 85 | return 0; |
| @@ -91,7 +91,7 @@ double PerfStats::GetMeanFrametime() const { | |||
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | PerfStatsResults PerfStats::GetAndResetStats(microseconds current_system_time_us) { | 93 | PerfStatsResults PerfStats::GetAndResetStats(microseconds current_system_time_us) { |
| 94 | std::lock_guard lock{object_mutex}; | 94 | std::scoped_lock lock{object_mutex}; |
| 95 | 95 | ||
| 96 | const auto now = Clock::now(); | 96 | const auto now = Clock::now(); |
| 97 | // Walltime elapsed since stats were reset | 97 | // Walltime elapsed since stats were reset |
| @@ -120,7 +120,7 @@ PerfStatsResults PerfStats::GetAndResetStats(microseconds current_system_time_us | |||
| 120 | } | 120 | } |
| 121 | 121 | ||
| 122 | double PerfStats::GetLastFrameTimeScale() const { | 122 | double PerfStats::GetLastFrameTimeScale() const { |
| 123 | std::lock_guard lock{object_mutex}; | 123 | std::scoped_lock lock{object_mutex}; |
| 124 | 124 | ||
| 125 | constexpr double FRAME_LENGTH = 1.0 / 60; | 125 | constexpr double FRAME_LENGTH = 1.0 / 60; |
| 126 | return duration_cast<DoubleSecs>(previous_frame_length).count() / FRAME_LENGTH; | 126 | return duration_cast<DoubleSecs>(previous_frame_length).count() / FRAME_LENGTH; |
diff --git a/src/core/tools/freezer.cpp b/src/core/tools/freezer.cpp index 032c71aff..c81dc0e52 100644 --- a/src/core/tools/freezer.cpp +++ b/src/core/tools/freezer.cpp | |||
| @@ -80,7 +80,7 @@ bool Freezer::IsActive() const { | |||
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | void Freezer::Clear() { | 82 | void Freezer::Clear() { |
| 83 | std::lock_guard lock{entries_mutex}; | 83 | std::scoped_lock lock{entries_mutex}; |
| 84 | 84 | ||
| 85 | LOG_DEBUG(Common_Memory, "Clearing all frozen memory values."); | 85 | LOG_DEBUG(Common_Memory, "Clearing all frozen memory values."); |
| 86 | 86 | ||
| @@ -88,7 +88,7 @@ void Freezer::Clear() { | |||
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | u64 Freezer::Freeze(VAddr address, u32 width) { | 90 | u64 Freezer::Freeze(VAddr address, u32 width) { |
| 91 | std::lock_guard lock{entries_mutex}; | 91 | std::scoped_lock lock{entries_mutex}; |
| 92 | 92 | ||
| 93 | const auto current_value = MemoryReadWidth(memory, width, address); | 93 | const auto current_value = MemoryReadWidth(memory, width, address); |
| 94 | entries.push_back({address, width, current_value}); | 94 | entries.push_back({address, width, current_value}); |
| @@ -101,7 +101,7 @@ u64 Freezer::Freeze(VAddr address, u32 width) { | |||
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | void Freezer::Unfreeze(VAddr address) { | 103 | void Freezer::Unfreeze(VAddr address) { |
| 104 | std::lock_guard lock{entries_mutex}; | 104 | std::scoped_lock lock{entries_mutex}; |
| 105 | 105 | ||
| 106 | LOG_DEBUG(Common_Memory, "Unfreezing memory for address={:016X}", address); | 106 | LOG_DEBUG(Common_Memory, "Unfreezing memory for address={:016X}", address); |
| 107 | 107 | ||
| @@ -109,13 +109,13 @@ void Freezer::Unfreeze(VAddr address) { | |||
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | bool Freezer::IsFrozen(VAddr address) const { | 111 | bool Freezer::IsFrozen(VAddr address) const { |
| 112 | std::lock_guard lock{entries_mutex}; | 112 | std::scoped_lock lock{entries_mutex}; |
| 113 | 113 | ||
| 114 | return FindEntry(address) != entries.cend(); | 114 | return FindEntry(address) != entries.cend(); |
| 115 | } | 115 | } |
| 116 | 116 | ||
| 117 | void Freezer::SetFrozenValue(VAddr address, u64 value) { | 117 | void Freezer::SetFrozenValue(VAddr address, u64 value) { |
| 118 | std::lock_guard lock{entries_mutex}; | 118 | std::scoped_lock lock{entries_mutex}; |
| 119 | 119 | ||
| 120 | const auto iter = FindEntry(address); | 120 | const auto iter = FindEntry(address); |
| 121 | 121 | ||
| @@ -132,7 +132,7 @@ void Freezer::SetFrozenValue(VAddr address, u64 value) { | |||
| 132 | } | 132 | } |
| 133 | 133 | ||
| 134 | std::optional<Freezer::Entry> Freezer::GetEntry(VAddr address) const { | 134 | std::optional<Freezer::Entry> Freezer::GetEntry(VAddr address) const { |
| 135 | std::lock_guard lock{entries_mutex}; | 135 | std::scoped_lock lock{entries_mutex}; |
| 136 | 136 | ||
| 137 | const auto iter = FindEntry(address); | 137 | const auto iter = FindEntry(address); |
| 138 | 138 | ||
| @@ -144,7 +144,7 @@ std::optional<Freezer::Entry> Freezer::GetEntry(VAddr address) const { | |||
| 144 | } | 144 | } |
| 145 | 145 | ||
| 146 | std::vector<Freezer::Entry> Freezer::GetEntries() const { | 146 | std::vector<Freezer::Entry> Freezer::GetEntries() const { |
| 147 | std::lock_guard lock{entries_mutex}; | 147 | std::scoped_lock lock{entries_mutex}; |
| 148 | 148 | ||
| 149 | return entries; | 149 | return entries; |
| 150 | } | 150 | } |
| @@ -165,7 +165,7 @@ void Freezer::FrameCallback(std::uintptr_t, std::chrono::nanoseconds ns_late) { | |||
| 165 | return; | 165 | return; |
| 166 | } | 166 | } |
| 167 | 167 | ||
| 168 | std::lock_guard lock{entries_mutex}; | 168 | std::scoped_lock lock{entries_mutex}; |
| 169 | 169 | ||
| 170 | for (const auto& entry : entries) { | 170 | for (const auto& entry : entries) { |
| 171 | LOG_DEBUG(Common_Memory, | 171 | LOG_DEBUG(Common_Memory, |
| @@ -178,7 +178,7 @@ void Freezer::FrameCallback(std::uintptr_t, std::chrono::nanoseconds ns_late) { | |||
| 178 | } | 178 | } |
| 179 | 179 | ||
| 180 | void Freezer::FillEntryReads() { | 180 | void Freezer::FillEntryReads() { |
| 181 | std::lock_guard lock{entries_mutex}; | 181 | std::scoped_lock lock{entries_mutex}; |
| 182 | 182 | ||
| 183 | LOG_DEBUG(Common_Memory, "Updating memory freeze entries to current values."); | 183 | LOG_DEBUG(Common_Memory, "Updating memory freeze entries to current values."); |
| 184 | 184 | ||