New FrameTime/VBlank Analyzer + Graph
This commit is contained in:
1 parent
2345ba178d
commit
673f81c18a
26 files changed
+721
-240
No files matched your search
@@ -27,7 +27,10 @@ const Info<bool> GFX_CROP{{System::GFX, "Settings", "Crop"}, false};
|
||||
const Info<int> GFX_SAFE_TEXTURE_CACHE_COLOR_SAMPLES{
|
||||
{System::GFX, "Settings", "SafeTextureCacheColorSamples"}, 128};
|
||||
const Info<bool> GFX_SHOW_FPS{{System::GFX, "Settings", "ShowFPS"}, false};
|
||||
const Info<bool> GFX_SHOW_FTIMES{{System::GFX, "Settings", "ShowFTimes"}, false};
|
||||
const Info<bool> GFX_SHOW_VPS{{System::GFX, "Settings", "ShowVPS"}, false};
|
||||
const Info<bool> GFX_SHOW_VTIMES{{System::GFX, "Settings", "ShowVTimes"}, false};
|
||||
const Info<bool> GFX_SHOW_GRAPHS{{System::GFX, "Settings", "ShowGraphs"}, false};
|
||||
const Info<bool> GFX_SHOW_SPEED{{System::GFX, "Settings", "ShowSpeed"}, false};
|
||||
const Info<bool> GFX_SHOW_SPEED_COLORS{{System::GFX, "Settings", "ShowSpeedColors"}, true};
|
||||
const Info<int> GFX_PERF_SAMP_WINDOW{{System::GFX, "Settings", "PerfSampWindowMS"}, 1000};
|
||||
|
||||
@@ -30,7 +30,10 @@ extern const Info<AspectMode> GFX_SUGGESTED_ASPECT_RATIO;
|
||||
extern const Info<bool> GFX_CROP;
|
||||
extern const Info<int> GFX_SAFE_TEXTURE_CACHE_COLOR_SAMPLES;
|
||||
extern const Info<bool> GFX_SHOW_FPS;
|
||||
extern const Info<bool> GFX_SHOW_FTIMES;
|
||||
extern const Info<bool> GFX_SHOW_VPS;
|
||||
extern const Info<bool> GFX_SHOW_VTIMES;
|
||||
extern const Info<bool> GFX_SHOW_GRAPHS;
|
||||
extern const Info<bool> GFX_SHOW_SPEED;
|
||||
extern const Info<bool> GFX_SHOW_SPEED_COLORS;
|
||||
extern const Info<int> GFX_PERF_SAMP_WINDOW;
|
||||
|
||||
+14
-29
@@ -86,6 +86,7 @@
|
||||
#include "VideoCommon/Fifo.h"
|
||||
#include "VideoCommon/HiresTextures.h"
|
||||
#include "VideoCommon/OnScreenDisplay.h"
|
||||
#include "VideoCommon/PerformanceMetrics.h"
|
||||
#include "VideoCommon/RenderBase.h"
|
||||
#include "VideoCommon/VideoBackendBase.h"
|
||||
|
||||
@@ -100,8 +101,6 @@ static bool s_wants_determinism;
|
||||
// Declarations and definitions
|
||||
static Common::Timer s_timer;
|
||||
static u64 s_timer_offset;
|
||||
static std::atomic<u32> s_drawn_frame;
|
||||
static std::atomic<u32> s_drawn_video;
|
||||
|
||||
static bool s_is_stopping = false;
|
||||
static bool s_hardware_initialized = false;
|
||||
@@ -347,6 +346,9 @@ static void CpuThread(const std::optional<std::string>& savestate_path, bool del
|
||||
// This needs to be delayed until after the video backend is ready.
|
||||
DolphinAnalytics::Instance().ReportGameStart();
|
||||
|
||||
// Clear performance data collected from previous threads.
|
||||
g_perf_metrics.Reset();
|
||||
|
||||
#ifdef ANDROID
|
||||
// For some reason, calling the JNI function AttachCurrentThread from the CPU thread after a
|
||||
// certain point causes a crash if fastmem is enabled. Let's call it early to avoid that problem.
|
||||
@@ -843,19 +845,15 @@ void RunOnCPUThread(std::function<void()> function, bool wait_for_completion)
|
||||
// This should only be called from VI
|
||||
void VideoThrottle()
|
||||
{
|
||||
g_perf_metrics.CountVBlank();
|
||||
|
||||
// Update info per second
|
||||
u64 elapsed_ms = s_timer.ElapsedMs();
|
||||
if ((elapsed_ms >= 1000 && s_drawn_video.load() > 0) || s_frame_step)
|
||||
if ((elapsed_ms >= 500) || s_frame_step)
|
||||
{
|
||||
s_timer.Start();
|
||||
|
||||
UpdateTitle(elapsed_ms);
|
||||
|
||||
s_drawn_frame.store(0);
|
||||
s_drawn_video.store(0);
|
||||
UpdateTitle();
|
||||
}
|
||||
|
||||
s_drawn_video++;
|
||||
}
|
||||
|
||||
// --- Callbacks for backends / engine ---
|
||||
@@ -864,9 +862,9 @@ void VideoThrottle()
|
||||
// frame is presented to the host screen
|
||||
void Callback_FramePresented(double actual_emulation_speed)
|
||||
{
|
||||
s_last_actual_emulation_speed = actual_emulation_speed;
|
||||
g_perf_metrics.CountFrame();
|
||||
|
||||
s_drawn_frame++;
|
||||
s_last_actual_emulation_speed = actual_emulation_speed;
|
||||
s_stop_frame_step.store(true);
|
||||
}
|
||||
|
||||
@@ -891,15 +889,11 @@ void Callback_NewField()
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateTitle(u64 elapsed_ms)
|
||||
void UpdateTitle()
|
||||
{
|
||||
if (elapsed_ms == 0)
|
||||
elapsed_ms = 1;
|
||||
|
||||
float FPS = (float)(s_drawn_frame.load() * 1000.0 / elapsed_ms);
|
||||
float VPS = (float)(s_drawn_video.load() * 1000.0 / elapsed_ms);
|
||||
float Speed = (float)(s_drawn_video.load() * (100 * 1000.0) /
|
||||
(VideoInterface::GetTargetRefreshRate() * elapsed_ms));
|
||||
float FPS = g_perf_metrics.GetFPS();
|
||||
float VPS = g_perf_metrics.GetVPS();
|
||||
float Speed = g_perf_metrics.GetSpeed();
|
||||
|
||||
// Settings are shown the same for both extended and summary info
|
||||
const std::string SSettings = fmt::format(
|
||||
@@ -956,15 +950,6 @@ void UpdateTitle(u64 elapsed_ms)
|
||||
message += " | " + title;
|
||||
}
|
||||
|
||||
// Update the audio timestretcher with the current speed
|
||||
auto& system = Core::System::GetInstance();
|
||||
SoundStream* sound_stream = system.GetSoundStream();
|
||||
if (sound_stream)
|
||||
{
|
||||
Mixer* mixer = sound_stream->GetMixer();
|
||||
mixer->UpdateSpeed((float)Speed / 100);
|
||||
}
|
||||
|
||||
Host_UpdateTitle(message);
|
||||
}
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ void OnFrameEnd();
|
||||
|
||||
void VideoThrottle();
|
||||
|
||||
void UpdateTitle(u64 elapsed_ms);
|
||||
void UpdateTitle();
|
||||
|
||||
// Run a function as the CPU thread.
|
||||
//
|
||||
|
||||
Reference in new issue
Block a user