mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-12-16 04:09:39 +00:00
VideoCommon/PerformanceMetrics: Display current offset between the latest frame presentation time and the intended presentation time in the "Show Frame Times" box.
This commit is contained in:
parent
c2a1dce246
commit
bf61c890ca
@ -868,6 +868,10 @@ void Callback_FramePresented(const PresentInfo& present_info)
|
|||||||
{
|
{
|
||||||
g_perf_metrics.CountFrame();
|
g_perf_metrics.CountFrame();
|
||||||
|
|
||||||
|
const auto presentation_offset =
|
||||||
|
present_info.actual_present_time - present_info.intended_present_time;
|
||||||
|
g_perf_metrics.SetLatestFramePresentationOffset(presentation_offset);
|
||||||
|
|
||||||
if (present_info.reason == PresentInfo::PresentReason::VideoInterfaceDuplicate)
|
if (present_info.reason == PresentInfo::PresentReason::VideoInterfaceDuplicate)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@ -23,6 +23,8 @@ void PerformanceMetrics::Reset()
|
|||||||
|
|
||||||
m_speed = 0;
|
m_speed = 0;
|
||||||
m_max_speed = 0;
|
m_max_speed = 0;
|
||||||
|
|
||||||
|
m_frame_presentation_offset = DT{};
|
||||||
}
|
}
|
||||||
|
|
||||||
void PerformanceMetrics::CountFrame()
|
void PerformanceMetrics::CountFrame()
|
||||||
@ -98,6 +100,11 @@ double PerformanceMetrics::GetMaxSpeed() const
|
|||||||
return m_max_speed.load(std::memory_order_relaxed);
|
return m_max_speed.load(std::memory_order_relaxed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PerformanceMetrics::SetLatestFramePresentationOffset(DT offset)
|
||||||
|
{
|
||||||
|
m_frame_presentation_offset.store(offset, std::memory_order_relaxed);
|
||||||
|
}
|
||||||
|
|
||||||
void PerformanceMetrics::DrawImGuiStats(const float backbuffer_scale)
|
void PerformanceMetrics::DrawImGuiStats(const float backbuffer_scale)
|
||||||
{
|
{
|
||||||
m_vps_counter.UpdateStats();
|
m_vps_counter.UpdateStats();
|
||||||
@ -293,6 +300,10 @@ void PerformanceMetrics::DrawImGuiStats(const float backbuffer_scale)
|
|||||||
DT_ms(m_fps_counter.GetDtAvg()).count());
|
DT_ms(m_fps_counter.GetDtAvg()).count());
|
||||||
ImGui::TextColored(ImVec4(r, g, b, 1.0f), " ±:%6.2lfms",
|
ImGui::TextColored(ImVec4(r, g, b, 1.0f), " ±:%6.2lfms",
|
||||||
DT_ms(m_fps_counter.GetDtStd()).count());
|
DT_ms(m_fps_counter.GetDtStd()).count());
|
||||||
|
|
||||||
|
const auto offset =
|
||||||
|
DT_ms(m_frame_presentation_offset.load(std::memory_order_relaxed)).count();
|
||||||
|
ImGui::TextColored(ImVec4(r, g, b, 1.0f), "ofs:%5.1lfms", offset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
|
|||||||
@ -43,6 +43,9 @@ public:
|
|||||||
double GetSpeed() const;
|
double GetSpeed() const;
|
||||||
double GetMaxSpeed() const;
|
double GetMaxSpeed() const;
|
||||||
|
|
||||||
|
// Call from any thread.
|
||||||
|
void SetLatestFramePresentationOffset(DT offset);
|
||||||
|
|
||||||
// ImGui Functions
|
// ImGui Functions
|
||||||
void DrawImGuiStats(const float backbuffer_scale);
|
void DrawImGuiStats(const float backbuffer_scale);
|
||||||
|
|
||||||
@ -55,6 +58,8 @@ private:
|
|||||||
std::atomic<double> m_speed{};
|
std::atomic<double> m_speed{};
|
||||||
std::atomic<double> m_max_speed{};
|
std::atomic<double> m_max_speed{};
|
||||||
|
|
||||||
|
std::atomic<DT> m_frame_presentation_offset{};
|
||||||
|
|
||||||
struct PerfSample
|
struct PerfSample
|
||||||
{
|
{
|
||||||
TimePoint clock_time;
|
TimePoint clock_time;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user