GPU: Add host/hardware stats
This commit is contained in:
@@ -2778,6 +2778,9 @@ void FullscreenUI::DrawInterfaceSettingsPage()
|
||||
FSUI_CSTR("Shows the number of frames (or v-syncs) displayed per second by the system in the top-right "
|
||||
"corner of the display."),
|
||||
"Display", "ShowFPS", false);
|
||||
DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_BARS, "Show GPU Statistics"),
|
||||
FSUI_CSTR("Shows information about the emulated GPU in the top-right corner of the display."),
|
||||
"Display", "ShowGPUStatistics", false);
|
||||
DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_BATTERY_HALF, "Show CPU Usage"),
|
||||
FSUI_CSTR("Shows the host's CPU usage based on threads in the top-right corner of the display."),
|
||||
"Display", "ShowCPU", false);
|
||||
|
||||
+70
-57
@@ -21,6 +21,7 @@
|
||||
#include "common/file_system.h"
|
||||
#include "common/heap_array.h"
|
||||
#include "common/log.h"
|
||||
#include "common/small_string.h"
|
||||
#include "common/string_util.h"
|
||||
|
||||
#include "stb_image_resize.h"
|
||||
@@ -35,7 +36,10 @@ std::unique_ptr<GPU> g_gpu;
|
||||
|
||||
const GPU::GP0CommandHandlerTable GPU::s_GP0_command_handler_table = GPU::GenerateGP0CommandHandlerTable();
|
||||
|
||||
GPU::GPU() = default;
|
||||
GPU::GPU()
|
||||
{
|
||||
ResetStatistics();
|
||||
}
|
||||
|
||||
GPU::~GPU()
|
||||
{
|
||||
@@ -66,7 +70,7 @@ bool GPU::Initialize()
|
||||
return false;
|
||||
}
|
||||
|
||||
g_gpu_device->SetGPUTimingEnabled(g_settings.display_show_gpu);
|
||||
g_gpu_device->SetGPUTimingEnabled(g_settings.display_show_gpu_usage);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -93,7 +97,7 @@ void GPU::UpdateSettings(const Settings& old_settings)
|
||||
Panic("Failed to compile display pipeline on settings change.");
|
||||
}
|
||||
|
||||
g_gpu_device->SetGPUTimingEnabled(g_settings.display_show_gpu);
|
||||
g_gpu_device->SetGPUTimingEnabled(g_settings.display_show_gpu_usage);
|
||||
}
|
||||
|
||||
void GPU::CPUClockChanged()
|
||||
@@ -2229,59 +2233,7 @@ void GPU::DrawDebugStateWindow()
|
||||
return;
|
||||
}
|
||||
|
||||
const bool is_idle_frame = m_stats.num_polygons == 0;
|
||||
if (!is_idle_frame)
|
||||
{
|
||||
m_last_stats = m_stats;
|
||||
m_stats = {};
|
||||
}
|
||||
|
||||
if (ImGui::CollapsingHeader("Statistics", ImGuiTreeNodeFlags_DefaultOpen))
|
||||
{
|
||||
const Stats& stats = m_last_stats;
|
||||
|
||||
ImGui::Columns(2);
|
||||
ImGui::SetColumnWidth(0, 200.0f * framebuffer_scale);
|
||||
|
||||
ImGui::TextUnformatted("Idle Frame: ");
|
||||
ImGui::NextColumn();
|
||||
ImGui::Text("%s", is_idle_frame ? "Yes" : "No");
|
||||
ImGui::NextColumn();
|
||||
|
||||
ImGui::TextUnformatted("VRAM Reads: ");
|
||||
ImGui::NextColumn();
|
||||
ImGui::Text("%u", stats.num_vram_reads);
|
||||
ImGui::NextColumn();
|
||||
|
||||
ImGui::TextUnformatted("VRAM Fills: ");
|
||||
ImGui::NextColumn();
|
||||
ImGui::Text("%u", stats.num_vram_fills);
|
||||
ImGui::NextColumn();
|
||||
|
||||
ImGui::TextUnformatted("VRAM Writes: ");
|
||||
ImGui::NextColumn();
|
||||
ImGui::Text("%u", stats.num_vram_writes);
|
||||
ImGui::NextColumn();
|
||||
|
||||
ImGui::TextUnformatted("VRAM Copies: ");
|
||||
ImGui::NextColumn();
|
||||
ImGui::Text("%u", stats.num_vram_copies);
|
||||
ImGui::NextColumn();
|
||||
|
||||
ImGui::TextUnformatted("Vertices Processed: ");
|
||||
ImGui::NextColumn();
|
||||
ImGui::Text("%u", stats.num_vertices);
|
||||
ImGui::NextColumn();
|
||||
|
||||
ImGui::TextUnformatted("Polygons Drawn: ");
|
||||
ImGui::NextColumn();
|
||||
ImGui::Text("%u", stats.num_polygons);
|
||||
ImGui::NextColumn();
|
||||
|
||||
ImGui::Columns(1);
|
||||
}
|
||||
|
||||
DrawRendererStats(is_idle_frame);
|
||||
DrawRendererStats();
|
||||
|
||||
if (ImGui::CollapsingHeader("GPU", ImGuiTreeNodeFlags_DefaultOpen))
|
||||
{
|
||||
@@ -2339,6 +2291,67 @@ void GPU::DrawDebugStateWindow()
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
void GPU::DrawRendererStats(bool is_idle_frame)
|
||||
void GPU::DrawRendererStats()
|
||||
{
|
||||
}
|
||||
|
||||
void GPU::GetStatsString(SmallStringBase& str)
|
||||
{
|
||||
if (IsHardwareRenderer())
|
||||
{
|
||||
str.format("{} HW | {} P | {} DC | {} RP | {} RB | {} C | {} W",
|
||||
GPUDevice::RenderAPIToString(g_gpu_device->GetRenderAPI()), m_stats.num_primitives,
|
||||
m_stats.host_num_draws, m_stats.host_num_render_passes, m_stats.num_reads, m_stats.num_copies,
|
||||
m_stats.num_writes);
|
||||
}
|
||||
else
|
||||
{
|
||||
str.format("{} SW | {} P | {} R | {} C | {} W", GPUDevice::RenderAPIToString(g_gpu_device->GetRenderAPI()),
|
||||
m_stats.num_primitives, m_stats.num_reads, m_stats.num_copies, m_stats.num_writes);
|
||||
}
|
||||
}
|
||||
|
||||
void GPU::GetMemoryStatsString(SmallStringBase& str)
|
||||
{
|
||||
const u32 vram_usage_mb = static_cast<u32>((g_gpu_device->GetVRAMUsage() + (1048576 - 1)) / 1048576);
|
||||
const u32 stream_kb = static_cast<u32>((m_stats.host_buffer_streamed + (1024 - 1)) / 1024);
|
||||
|
||||
str.format("{} MB VRAM | {} KB STR | {} TC | {} TU", vram_usage_mb, stream_kb, m_stats.host_num_copies,
|
||||
m_stats.host_num_uploads);
|
||||
}
|
||||
|
||||
void GPU::ResetStatistics()
|
||||
{
|
||||
m_counters = {};
|
||||
g_gpu_device->ResetStatistics();
|
||||
}
|
||||
|
||||
void GPU::UpdateStatistics(u32 frame_count)
|
||||
{
|
||||
const GPUDevice::Statistics& stats = g_gpu_device->GetStatistics();
|
||||
const u32 round = (frame_count - 1);
|
||||
|
||||
#define UPDATE_COUNTER(x) m_stats.x = (m_counters.x + round) / frame_count
|
||||
#define UPDATE_GPU_STAT(x) m_stats.host_##x = (stats.x + round) / frame_count
|
||||
|
||||
UPDATE_COUNTER(num_reads);
|
||||
UPDATE_COUNTER(num_writes);
|
||||
UPDATE_COUNTER(num_copies);
|
||||
UPDATE_COUNTER(num_vertices);
|
||||
UPDATE_COUNTER(num_primitives);
|
||||
|
||||
// UPDATE_COUNTER(num_read_texture_updates);
|
||||
// UPDATE_COUNTER(num_ubo_updates);
|
||||
|
||||
UPDATE_GPU_STAT(buffer_streamed);
|
||||
UPDATE_GPU_STAT(num_draws);
|
||||
UPDATE_GPU_STAT(num_render_passes);
|
||||
UPDATE_GPU_STAT(num_copies);
|
||||
UPDATE_GPU_STAT(num_downloads);
|
||||
UPDATE_GPU_STAT(num_uploads);
|
||||
|
||||
#undef UPDATE_GPU_STAT
|
||||
#undef UPDATE_COUNTER
|
||||
|
||||
ResetStatistics();
|
||||
}
|
||||
|
||||
+27
-8
@@ -20,6 +20,8 @@
|
||||
#include <tuple>
|
||||
#include <vector>
|
||||
|
||||
class SmallStringBase;
|
||||
|
||||
class StateWrapper;
|
||||
|
||||
class GPUDevice;
|
||||
@@ -99,6 +101,10 @@ public:
|
||||
|
||||
// Render statistics debug window.
|
||||
void DrawDebugStateWindow();
|
||||
void GetStatsString(SmallStringBase& str);
|
||||
void GetMemoryStatsString(SmallStringBase& str);
|
||||
void ResetStatistics();
|
||||
void UpdateStatistics(u32 frame_count);
|
||||
|
||||
void CPUClockChanged();
|
||||
|
||||
@@ -308,7 +314,7 @@ protected:
|
||||
virtual void DispatchRenderCommand();
|
||||
virtual void ClearDisplay();
|
||||
virtual void UpdateDisplay();
|
||||
virtual void DrawRendererStats(bool is_idle_frame);
|
||||
virtual void DrawRendererStats();
|
||||
|
||||
ALWAYS_INLINE void AddDrawTriangleTicks(s32 x1, s32 y1, s32 x2, s32 y2, s32 x3, s32 y3, bool shaded, bool textured,
|
||||
bool semitransparent)
|
||||
@@ -589,17 +595,30 @@ protected:
|
||||
s32 m_display_texture_view_width = 0;
|
||||
s32 m_display_texture_view_height = 0;
|
||||
|
||||
struct Stats
|
||||
struct Counters
|
||||
{
|
||||
u32 num_vram_reads;
|
||||
u32 num_vram_fills;
|
||||
u32 num_vram_writes;
|
||||
u32 num_vram_copies;
|
||||
u32 num_reads;
|
||||
u32 num_writes;
|
||||
u32 num_copies;
|
||||
u32 num_vertices;
|
||||
u32 num_polygons;
|
||||
u32 num_primitives;
|
||||
|
||||
// u32 num_read_texture_updates;
|
||||
// u32 num_ubo_updates;
|
||||
};
|
||||
|
||||
struct Stats : Counters
|
||||
{
|
||||
size_t host_buffer_streamed;
|
||||
u32 host_num_draws;
|
||||
u32 host_num_render_passes;
|
||||
u32 host_num_copies;
|
||||
u32 host_num_downloads;
|
||||
u32 host_num_uploads;
|
||||
};
|
||||
|
||||
Counters m_counters = {};
|
||||
Stats m_stats = {};
|
||||
Stats m_last_stats = {};
|
||||
|
||||
private:
|
||||
bool CompileDisplayPipeline();
|
||||
|
||||
+10
-10
@@ -352,8 +352,8 @@ bool GPU::HandleRenderPolygonCommand()
|
||||
SetTexturePalette(Truncate16(FifoPeek(2) >> 16));
|
||||
}
|
||||
|
||||
m_stats.num_vertices += num_vertices;
|
||||
m_stats.num_polygons++;
|
||||
m_counters.num_vertices += num_vertices;
|
||||
m_counters.num_primitives++;
|
||||
m_render_command.bits = rc.bits;
|
||||
m_fifo.RemoveOne();
|
||||
|
||||
@@ -384,8 +384,8 @@ bool GPU::HandleRenderRectangleCommand()
|
||||
rc.texture_enable ? "textured" : "non-textured", rc.shading_enable ? "shaded" : "monochrome",
|
||||
total_words, setup_ticks);
|
||||
|
||||
m_stats.num_vertices++;
|
||||
m_stats.num_polygons++;
|
||||
m_counters.num_vertices++;
|
||||
m_counters.num_primitives++;
|
||||
m_render_command.bits = rc.bits;
|
||||
m_fifo.RemoveOne();
|
||||
|
||||
@@ -406,8 +406,8 @@ bool GPU::HandleRenderLineCommand()
|
||||
Log_TracePrintf("Render %s %s line (%u total words)", rc.transparency_enable ? "semi-transparent" : "opaque",
|
||||
rc.shading_enable ? "shaded" : "monochrome", total_words);
|
||||
|
||||
m_stats.num_vertices += 2;
|
||||
m_stats.num_polygons++;
|
||||
m_counters.num_vertices += 2;
|
||||
m_counters.num_primitives++;
|
||||
m_render_command.bits = rc.bits;
|
||||
m_fifo.RemoveOne();
|
||||
|
||||
@@ -468,7 +468,7 @@ bool GPU::HandleFillRectangleCommand()
|
||||
if (width > 0 && height > 0)
|
||||
FillVRAM(dst_x, dst_y, width, height, color);
|
||||
|
||||
m_stats.num_vram_fills++;
|
||||
m_counters.num_writes++;
|
||||
AddCommandTicks(46 + ((width / 8) + 9) * height);
|
||||
EndCommand();
|
||||
return true;
|
||||
@@ -552,10 +552,10 @@ void GPU::FinishVRAMWrite()
|
||||
}
|
||||
}
|
||||
|
||||
m_counters.num_writes++;
|
||||
m_blit_buffer.clear();
|
||||
m_vram_transfer = {};
|
||||
m_blitter_state = BlitterState::Idle;
|
||||
m_stats.num_vram_writes++;
|
||||
}
|
||||
|
||||
bool GPU::HandleCopyRectangleVRAMToCPUCommand()
|
||||
@@ -586,7 +586,6 @@ bool GPU::HandleCopyRectangleVRAMToCPUCommand()
|
||||
}
|
||||
|
||||
// switch to pixel-by-pixel read state
|
||||
m_stats.num_vram_reads++;
|
||||
m_blitter_state = BlitterState::ReadingVRAM;
|
||||
m_command_total_words = 0;
|
||||
return true;
|
||||
@@ -612,11 +611,12 @@ bool GPU::HandleCopyRectangleVRAMToVRAMCommand()
|
||||
width == 0 || height == 0 || (src_x == dst_x && src_y == dst_y && !m_GPUSTAT.set_mask_while_drawing);
|
||||
if (!skip_copy)
|
||||
{
|
||||
m_counters.num_copies++;
|
||||
|
||||
FlushRender();
|
||||
CopyVRAM(src_x, src_y, dst_x, dst_y, width, height);
|
||||
}
|
||||
|
||||
m_stats.num_vram_copies++;
|
||||
AddCommandTicks(width * height * 2);
|
||||
EndCommand();
|
||||
return true;
|
||||
|
||||
+3
-28
@@ -1262,7 +1262,7 @@ void GPU_HW::UpdateVRAMReadTexture(bool drawn, bool written)
|
||||
scaled_rect.GetWidth(), scaled_rect.GetHeight());
|
||||
}
|
||||
|
||||
m_renderer_stats.num_vram_read_texture_updates++;
|
||||
// m_counters.num_read_texture_updates++;
|
||||
rect.SetInvalid();
|
||||
};
|
||||
|
||||
@@ -2797,7 +2797,7 @@ void GPU_HW::FlushRender()
|
||||
if (m_batch_ubo_dirty)
|
||||
{
|
||||
g_gpu_device->UploadUniformBuffer(&m_batch_ubo_data, sizeof(m_batch_ubo_data));
|
||||
m_renderer_stats.num_uniform_buffer_updates++;
|
||||
// m_counters.num_ubo_updates++;
|
||||
m_batch_ubo_dirty = false;
|
||||
}
|
||||
|
||||
@@ -2805,20 +2805,17 @@ void GPU_HW::FlushRender()
|
||||
{
|
||||
if (NeedsTwoPassRendering())
|
||||
{
|
||||
m_renderer_stats.num_batches += 2;
|
||||
DrawBatchVertices(BatchRenderMode::OnlyOpaque, vertex_count, m_batch_base_vertex);
|
||||
DrawBatchVertices(BatchRenderMode::OnlyTransparent, vertex_count, m_batch_base_vertex);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_renderer_stats.num_batches++;
|
||||
DrawBatchVertices(m_batch.GetRenderMode(), vertex_count, m_batch_base_vertex);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_wireframe_mode != GPUWireframeMode::Disabled)
|
||||
{
|
||||
m_renderer_stats.num_batches++;
|
||||
g_gpu_device->SetPipeline(m_wireframe_pipeline.get());
|
||||
g_gpu_device->Draw(vertex_count, m_batch_base_vertex);
|
||||
}
|
||||
@@ -3094,19 +3091,12 @@ void GPU_HW::DownsampleFramebufferBoxFilter(GPUTexture* source, u32 left, u32 to
|
||||
SetDisplayTexture(m_downsample_texture.get(), 0, 0, ds_width, ds_height);
|
||||
}
|
||||
|
||||
void GPU_HW::DrawRendererStats(bool is_idle_frame)
|
||||
void GPU_HW::DrawRendererStats()
|
||||
{
|
||||
if (!is_idle_frame)
|
||||
{
|
||||
m_last_renderer_stats = m_renderer_stats;
|
||||
m_renderer_stats = {};
|
||||
}
|
||||
|
||||
if (ImGui::CollapsingHeader("Renderer Statistics", ImGuiTreeNodeFlags_DefaultOpen))
|
||||
{
|
||||
static const ImVec4 active_color{1.0f, 1.0f, 1.0f, 1.0f};
|
||||
static const ImVec4 inactive_color{0.4f, 0.4f, 0.4f, 1.0f};
|
||||
const auto& stats = m_last_renderer_stats;
|
||||
|
||||
ImGui::Columns(2);
|
||||
ImGui::SetColumnWidth(0, 200.0f * Host::GetOSDScale());
|
||||
@@ -3158,21 +3148,6 @@ void GPU_HW::DrawRendererStats(bool is_idle_frame)
|
||||
"Cache");
|
||||
ImGui::NextColumn();
|
||||
|
||||
ImGui::TextUnformatted("Batches Drawn:");
|
||||
ImGui::NextColumn();
|
||||
ImGui::Text("%u", stats.num_batches);
|
||||
ImGui::NextColumn();
|
||||
|
||||
ImGui::TextUnformatted("VRAM Read Texture Updates:");
|
||||
ImGui::NextColumn();
|
||||
ImGui::Text("%u", stats.num_vram_read_texture_updates);
|
||||
ImGui::NextColumn();
|
||||
|
||||
ImGui::TextUnformatted("Uniform Buffer Updates: ");
|
||||
ImGui::NextColumn();
|
||||
ImGui::Text("%u", stats.num_uniform_buffer_updates);
|
||||
ImGui::NextColumn();
|
||||
|
||||
ImGui::Columns(1);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-5
@@ -188,7 +188,7 @@ private:
|
||||
void CopyVRAM(u32 src_x, u32 src_y, u32 dst_x, u32 dst_y, u32 width, u32 height) override;
|
||||
void DispatchRenderCommand() override;
|
||||
void FlushRender() override;
|
||||
void DrawRendererStats(bool is_idle_frame) override;
|
||||
void DrawRendererStats() override;
|
||||
|
||||
bool BlitVRAMReplacementTexture(const TextureReplacementTexture* tex, u32 dst_x, u32 dst_y, u32 width, u32 height);
|
||||
|
||||
@@ -297,8 +297,4 @@ private:
|
||||
std::unique_ptr<GPUSampler> m_downsample_lod_sampler;
|
||||
std::unique_ptr<GPUSampler> m_downsample_composite_sampler;
|
||||
u32 m_downsample_scale_or_levels = 0;
|
||||
|
||||
// Statistics
|
||||
RendererStats m_renderer_stats = {};
|
||||
RendererStats m_last_renderer_stats = {};
|
||||
};
|
||||
|
||||
+22
-15
@@ -253,8 +253,8 @@ void ImGuiManager::FormatProcessorStat(SmallStringBase& text, double usage, doub
|
||||
|
||||
void ImGuiManager::DrawPerformanceOverlay()
|
||||
{
|
||||
if (!(g_settings.display_show_fps || g_settings.display_show_speed || g_settings.display_show_resolution ||
|
||||
g_settings.display_show_cpu ||
|
||||
if (!(g_settings.display_show_fps || g_settings.display_show_speed || g_settings.display_show_gpu_stats ||
|
||||
g_settings.display_show_resolution || g_settings.display_show_cpu_usage ||
|
||||
(g_settings.display_show_status_indicators &&
|
||||
(System::IsPaused() || System::IsFastForwardEnabled() || System::IsTurboEnabled()))))
|
||||
{
|
||||
@@ -322,6 +322,15 @@ void ImGuiManager::DrawPerformanceOverlay()
|
||||
DRAW_LINE(fixed_font, text, color);
|
||||
}
|
||||
|
||||
if (g_settings.display_show_gpu_stats)
|
||||
{
|
||||
g_gpu->GetStatsString(text);
|
||||
DRAW_LINE(fixed_font, text, IM_COL32(255, 255, 255, 255));
|
||||
|
||||
g_gpu->GetMemoryStatsString(text);
|
||||
DRAW_LINE(fixed_font, text, IM_COL32(255, 255, 255, 255));
|
||||
}
|
||||
|
||||
if (g_settings.display_show_resolution)
|
||||
{
|
||||
// TODO: this seems wrong?
|
||||
@@ -333,7 +342,7 @@ void ImGuiManager::DrawPerformanceOverlay()
|
||||
DRAW_LINE(fixed_font, text, IM_COL32(255, 255, 255, 255));
|
||||
}
|
||||
|
||||
if (g_settings.display_show_cpu)
|
||||
if (g_settings.display_show_cpu_usage)
|
||||
{
|
||||
text.format("{:.2f}ms | {:.2f}ms | {:.2f}ms", System::GetMinimumFrameTime(), System::GetAverageFrameTime(),
|
||||
System::GetMaximumFrameTime());
|
||||
@@ -405,16 +414,10 @@ void ImGuiManager::DrawPerformanceOverlay()
|
||||
#endif
|
||||
}
|
||||
|
||||
if (g_settings.display_show_gpu)
|
||||
if (g_settings.display_show_gpu_usage && g_gpu_device->IsGPUTimingEnabled())
|
||||
{
|
||||
if (g_gpu_device->IsGPUTimingEnabled())
|
||||
{
|
||||
text.assign("GPU: ");
|
||||
FormatProcessorStat(text, System::GetGPUUsage(), System::GetGPUAverageTime());
|
||||
DRAW_LINE(fixed_font, text, IM_COL32(255, 255, 255, 255));
|
||||
}
|
||||
|
||||
text.format("VRAM: {} MB", (g_gpu_device->GetVRAMUsage() + (1048576 - 1)) / 1048576);
|
||||
text.assign("GPU: ");
|
||||
FormatProcessorStat(text, System::GetGPUUsage(), System::GetGPUAverageTime());
|
||||
DRAW_LINE(fixed_font, text, IM_COL32(255, 255, 255, 255));
|
||||
}
|
||||
|
||||
@@ -525,10 +528,14 @@ void ImGuiManager::DrawEnhancementsOverlay()
|
||||
{
|
||||
text.append_format(" {}x{}", g_settings.gpu_multisamples, g_settings.gpu_per_sample_shading ? "SSAA" : "MSAA");
|
||||
}
|
||||
if (g_settings.gpu_true_color) {
|
||||
if (g_settings.gpu_debanding) {
|
||||
if (g_settings.gpu_true_color)
|
||||
{
|
||||
if (g_settings.gpu_debanding)
|
||||
{
|
||||
text.append(" TrueColDeband");
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
text.append(" TrueCol");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -253,9 +253,10 @@ void Settings::Load(SettingsInterface& si)
|
||||
display_show_osd_messages = si.GetBoolValue("Display", "ShowOSDMessages", true);
|
||||
display_show_fps = si.GetBoolValue("Display", "ShowFPS", false);
|
||||
display_show_speed = si.GetBoolValue("Display", "ShowSpeed", false);
|
||||
display_show_gpu_stats = si.GetBoolValue("Display", "ShowGPUStatistics", false);
|
||||
display_show_resolution = si.GetBoolValue("Display", "ShowResolution", false);
|
||||
display_show_cpu = si.GetBoolValue("Display", "ShowCPU", false);
|
||||
display_show_gpu = si.GetBoolValue("Display", "ShowGPU", false);
|
||||
display_show_cpu_usage = si.GetBoolValue("Display", "ShowCPU", false);
|
||||
display_show_gpu_usage = si.GetBoolValue("Display", "ShowGPU", false);
|
||||
display_show_frame_times = si.GetBoolValue("Display", "ShowFrameTimes", false);
|
||||
display_show_status_indicators = si.GetBoolValue("Display", "ShowStatusIndicators", true);
|
||||
display_show_inputs = si.GetBoolValue("Display", "ShowInputs", false);
|
||||
@@ -495,8 +496,9 @@ void Settings::Save(SettingsInterface& si) const
|
||||
si.SetBoolValue("Display", "ShowFPS", display_show_fps);
|
||||
si.SetBoolValue("Display", "ShowSpeed", display_show_speed);
|
||||
si.SetBoolValue("Display", "ShowResolution", display_show_resolution);
|
||||
si.SetBoolValue("Display", "ShowCPU", display_show_cpu);
|
||||
si.SetBoolValue("Display", "ShowGPU", display_show_gpu);
|
||||
si.SetBoolValue("Display", "ShowGPUStatistics", display_show_gpu_stats);
|
||||
si.SetBoolValue("Display", "ShowCPU", display_show_cpu_usage);
|
||||
si.SetBoolValue("Display", "ShowGPU", display_show_gpu_usage);
|
||||
si.SetBoolValue("Display", "ShowFrameTimes", display_show_frame_times);
|
||||
si.SetBoolValue("Display", "ShowStatusIndicators", display_show_status_indicators);
|
||||
si.SetBoolValue("Display", "ShowInputs", display_show_inputs);
|
||||
|
||||
+3
-2
@@ -144,9 +144,10 @@ struct Settings
|
||||
bool display_show_osd_messages = true;
|
||||
bool display_show_fps = false;
|
||||
bool display_show_speed = false;
|
||||
bool display_show_gpu_stats = false;
|
||||
bool display_show_resolution = false;
|
||||
bool display_show_cpu = false;
|
||||
bool display_show_gpu = false;
|
||||
bool display_show_cpu_usage = false;
|
||||
bool display_show_gpu_usage = false;
|
||||
bool display_show_frame_times = false;
|
||||
bool display_show_status_indicators = true;
|
||||
bool display_show_inputs = false;
|
||||
|
||||
+15
-7
@@ -952,9 +952,10 @@ void System::SetDefaultSettings(SettingsInterface& si)
|
||||
temp.display_show_osd_messages = g_settings.display_show_osd_messages;
|
||||
temp.display_show_fps = g_settings.display_show_fps;
|
||||
temp.display_show_speed = g_settings.display_show_speed;
|
||||
temp.display_show_gpu_stats = g_settings.display_show_gpu_stats;
|
||||
temp.display_show_resolution = g_settings.display_show_resolution;
|
||||
temp.display_show_cpu = g_settings.display_show_cpu;
|
||||
temp.display_show_gpu = g_settings.display_show_gpu;
|
||||
temp.display_show_cpu_usage = g_settings.display_show_cpu_usage;
|
||||
temp.display_show_gpu_usage = g_settings.display_show_gpu_usage;
|
||||
temp.display_show_frame_times = g_settings.display_show_frame_times;
|
||||
|
||||
// keep controller, we reset it elsewhere
|
||||
@@ -2517,7 +2518,8 @@ void System::UpdatePerformanceCounters()
|
||||
if (time < PERFORMANCE_COUNTER_UPDATE_INTERVAL)
|
||||
return;
|
||||
|
||||
const float frames_run = static_cast<float>(s_frame_number - s_last_frame_number);
|
||||
const u32 frames_run = s_frame_number - s_last_frame_number;
|
||||
const float frames_runf = static_cast<float>(frames_run);
|
||||
const u32 global_tick_counter = TimingEvents::GetGlobalTickCounter();
|
||||
|
||||
// TODO: Make the math here less rubbish
|
||||
@@ -2525,13 +2527,13 @@ void System::UpdatePerformanceCounters()
|
||||
100.0 * (1.0 / ((static_cast<double>(ticks_diff) * static_cast<double>(Threading::GetThreadTicksPerSecond())) /
|
||||
Common::Timer::GetFrequency() / 1000000000.0));
|
||||
const double time_divider = 1000.0 * (1.0 / static_cast<double>(Threading::GetThreadTicksPerSecond())) *
|
||||
(1.0 / static_cast<double>(frames_run));
|
||||
(1.0 / static_cast<double>(frames_runf));
|
||||
|
||||
s_minimum_frame_time = std::exchange(s_minimum_frame_time_accumulator, 0.0f);
|
||||
s_average_frame_time = std::exchange(s_average_frame_time_accumulator, 0.0f) / frames_run;
|
||||
s_average_frame_time = std::exchange(s_average_frame_time_accumulator, 0.0f) / frames_runf;
|
||||
s_maximum_frame_time = std::exchange(s_maximum_frame_time_accumulator, 0.0f);
|
||||
|
||||
s_vps = static_cast<float>(frames_run / time);
|
||||
s_vps = static_cast<float>(frames_runf / time);
|
||||
s_last_frame_number = s_frame_number;
|
||||
s_fps = static_cast<float>(s_internal_frame_number - s_last_internal_frame_number) / time;
|
||||
s_last_internal_frame_number = s_internal_frame_number;
|
||||
@@ -2563,6 +2565,9 @@ void System::UpdatePerformanceCounters()
|
||||
s_accumulated_gpu_time = 0.0f;
|
||||
s_presents_since_last_update = 0;
|
||||
|
||||
if (g_settings.display_show_gpu_stats)
|
||||
g_gpu->UpdateStatistics(frames_run);
|
||||
|
||||
Log_VerbosePrintf("FPS: %.2f VPS: %.2f CPU: %.2f GPU: %.2f Average: %.2fms Min: %.2fms Max: %.2f ms", s_fps, s_vps,
|
||||
s_cpu_thread_usage, s_gpu_usage, s_average_frame_time, s_minimum_frame_time, s_maximum_frame_time);
|
||||
|
||||
@@ -3639,7 +3644,7 @@ void System::CheckForSettingsChanges(const Settings& old_settings)
|
||||
g_settings.display_aspect_ratio != old_settings.display_aspect_ratio ||
|
||||
g_settings.display_alignment != old_settings.display_alignment ||
|
||||
g_settings.display_scaling != old_settings.display_scaling ||
|
||||
g_settings.display_show_gpu != old_settings.display_show_gpu ||
|
||||
g_settings.display_show_gpu_usage != old_settings.display_show_gpu_usage ||
|
||||
g_settings.gpu_pgxp_enable != old_settings.gpu_pgxp_enable ||
|
||||
g_settings.gpu_pgxp_texture_correction != old_settings.gpu_pgxp_texture_correction ||
|
||||
g_settings.gpu_pgxp_color_correction != old_settings.gpu_pgxp_color_correction ||
|
||||
@@ -3678,6 +3683,9 @@ void System::CheckForSettingsChanges(const Settings& old_settings)
|
||||
CPU::CodeCache::Reset();
|
||||
}
|
||||
|
||||
if (g_settings.display_show_gpu_stats != old_settings.display_show_gpu_stats)
|
||||
g_gpu->ResetStatistics();
|
||||
|
||||
if (g_settings.cdrom_readahead_sectors != old_settings.cdrom_readahead_sectors)
|
||||
CDROM::SetReadaheadSectors(g_settings.cdrom_readahead_sectors);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user