diff options
| author | Shawn Hoffman <godisgovernment@gmail.com> | 2022-07-17 20:43:47 -0700 |
|---|---|---|
| committer | Shawn Hoffman <godisgovernment@gmail.com> | 2022-08-02 22:24:06 -0700 |
| commit | 09089eeee0bf6022cc7681214e51546d134402ea (patch) | |
| tree | 8a209216e224f8a28c1217459769efba6499a2fb /Source/Core/VideoCommon | |
| parent | 8d16971a6fcd3534c9dd34d625c151d2a5ce3ed9 (diff) | |
Common::Timer: use chrono::steady_clock internally
Diffstat (limited to 'Source/Core/VideoCommon')
| -rw-r--r-- | Source/Core/VideoCommon/FPSCounter.cpp | 8 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/HiresTextures.cpp | 4 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/OnScreenDisplay.cpp | 10 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/PostProcessing.cpp | 2 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/RenderBase.cpp | 4 |
5 files changed, 14 insertions, 14 deletions
diff --git a/Source/Core/VideoCommon/FPSCounter.cpp b/Source/Core/VideoCommon/FPSCounter.cpp index 459856d1ef..e38305eb7f 100644 --- a/Source/Core/VideoCommon/FPSCounter.cpp +++ b/Source/Core/VideoCommon/FPSCounter.cpp @@ -16,7 +16,7 @@ static constexpr u64 FPS_REFRESH_INTERVAL_US = 250000; FPSCounter::FPSCounter() { - m_last_time = Common::Timer::GetTimeUs(); + m_last_time = Common::Timer::NowUs(); m_on_state_changed_handle = Core::AddOnStateChangedCallback([this](Core::State state) { if (state == Core::State::Paused) @@ -44,7 +44,7 @@ void FPSCounter::LogRenderTimeToFile(u64 val) void FPSCounter::Update() { - const u64 time = Common::Timer::GetTimeUs(); + const u64 time = Common::Timer::NowUs(); const u64 diff = time - m_last_time; m_time_diff_secs = static_cast<double>(diff / 1000000.0); if (g_ActiveConfig.bLogRenderTimeToFile) @@ -66,11 +66,11 @@ void FPSCounter::SetPaused(bool paused) { if (paused) { - m_last_time_pause = Common::Timer::GetTimeUs(); + m_last_time_pause = Common::Timer::NowUs(); } else { - const u64 time = Common::Timer::GetTimeUs(); + const u64 time = Common::Timer::NowUs(); const u64 diff = time - m_last_time_pause; m_last_time += diff; } diff --git a/Source/Core/VideoCommon/HiresTextures.cpp b/Source/Core/VideoCommon/HiresTextures.cpp index 9636bfe651..5b0104f9f3 100644 --- a/Source/Core/VideoCommon/HiresTextures.cpp +++ b/Source/Core/VideoCommon/HiresTextures.cpp @@ -159,7 +159,7 @@ void HiresTexture::Prefetch() const size_t max_mem = (sys_mem / 2 < recommended_min_mem) ? (sys_mem / 2) : (sys_mem - recommended_min_mem); - const u32 start_time = Common::Timer::GetTimeMs(); + const u64 start_time = Common::Timer::NowMs(); for (const auto& entry : s_textureMap) { const std::string& base_filename = entry.first; @@ -207,7 +207,7 @@ void HiresTexture::Prefetch() } } - const u32 stop_time = Common::Timer::GetTimeMs(); + const u64 stop_time = Common::Timer::NowMs(); OSD::AddMessage(fmt::format("Custom Textures loaded, {:.1f} MB in {:.1f}s", size_sum / (1024.0 * 1024.0), (stop_time - start_time) / 1000.0), 10000); diff --git a/Source/Core/VideoCommon/OnScreenDisplay.cpp b/Source/Core/VideoCommon/OnScreenDisplay.cpp index 4bc7cd9494..d2c211c861 100644 --- a/Source/Core/VideoCommon/OnScreenDisplay.cpp +++ b/Source/Core/VideoCommon/OnScreenDisplay.cpp @@ -32,12 +32,12 @@ static std::atomic<int> s_obscured_pixels_top = 0; struct Message { Message() = default; - Message(std::string text_, u32 timestamp_, u32 duration_, u32 color_) + Message(std::string text_, u64 timestamp_, u32 duration_, u32 color_) : text(std::move(text_)), timestamp(timestamp_), duration(duration_), color(color_) { } std::string text; - u32 timestamp = 0; + u64 timestamp = 0; u32 duration = 0; bool ever_drawn = false; u32 color = 0; @@ -93,20 +93,20 @@ void AddTypedMessage(MessageType type, std::string message, u32 ms, u32 argb) { std::lock_guard lock{s_messages_mutex}; s_messages.erase(type); - s_messages.emplace(type, Message(std::move(message), Common::Timer::GetTimeMs() + ms, ms, argb)); + s_messages.emplace(type, Message(std::move(message), Common::Timer::NowMs() + ms, ms, argb)); } void AddMessage(std::string message, u32 ms, u32 argb) { std::lock_guard lock{s_messages_mutex}; s_messages.emplace(MessageType::Typeless, - Message(std::move(message), Common::Timer::GetTimeMs() + ms, ms, argb)); + Message(std::move(message), Common::Timer::NowMs() + ms, ms, argb)); } void DrawMessages() { const bool draw_messages = Config::Get(Config::MAIN_OSD_MESSAGES); - const u32 now = Common::Timer::GetTimeMs(); + const u64 now = Common::Timer::NowMs(); const float current_x = LEFT_MARGIN * ImGui::GetIO().DisplayFramebufferScale.x + s_obscured_pixels_left; float current_y = TOP_MARGIN * ImGui::GetIO().DisplayFramebufferScale.y + s_obscured_pixels_top; diff --git a/Source/Core/VideoCommon/PostProcessing.cpp b/Source/Core/VideoCommon/PostProcessing.cpp index 72ee15a776..69e4327bdd 100644 --- a/Source/Core/VideoCommon/PostProcessing.cpp +++ b/Source/Core/VideoCommon/PostProcessing.cpp @@ -640,7 +640,7 @@ void PostProcessing::FillUniformBuffer(const MathUtil::Rectangle<int>& src, static_cast<float>(src.GetWidth()) * rcp_src_width, static_cast<float>(src.GetHeight()) * rcp_src_height}, static_cast<s32>(src_layer), - static_cast<u32>(m_timer.GetTimeElapsed()), + static_cast<u32>(m_timer.ElapsedMs()), }; u8* buf = m_uniform_staging_buffer.data(); diff --git a/Source/Core/VideoCommon/RenderBase.cpp b/Source/Core/VideoCommon/RenderBase.cpp index 412461d409..e51307fa15 100644 --- a/Source/Core/VideoCommon/RenderBase.cpp +++ b/Source/Core/VideoCommon/RenderBase.cpp @@ -1066,7 +1066,7 @@ bool Renderer::InitializeImGui() if (!RecompileImGuiPipeline()) return false; - m_imgui_last_frame_time = Common::Timer::GetTimeUs(); + m_imgui_last_frame_time = Common::Timer::NowUs(); BeginImGuiFrame(); return true; } @@ -1139,7 +1139,7 @@ void Renderer::BeginImGuiFrame() { std::unique_lock<std::mutex> imgui_lock(m_imgui_mutex); - const u64 current_time_us = Common::Timer::GetTimeUs(); + const u64 current_time_us = Common::Timer::NowUs(); const u64 time_diff_us = current_time_us - m_imgui_last_frame_time; const float time_diff_secs = static_cast<float>(time_diff_us / 1000000.0); m_imgui_last_frame_time = current_time_us; |
