mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
FPSCounter: Add "Log render time to file" feature.
Allows for a more accurate performance measurement.
This commit is contained in:
@ -127,6 +127,7 @@ wxString disable_fog_desc = wxTRANSLATE("Makes distant objects more visible by r
|
|||||||
wxString disable_dstalpha_desc = wxTRANSLATE("Disables emulation of a hardware feature called destination alpha, which is used in many games for various graphical effects.\n\nIf unsure, leave this unchecked.");
|
wxString disable_dstalpha_desc = wxTRANSLATE("Disables emulation of a hardware feature called destination alpha, which is used in many games for various graphical effects.\n\nIf unsure, leave this unchecked.");
|
||||||
wxString show_fps_desc = wxTRANSLATE("Show the number of frames rendered per second as a measure of emulation speed.\n\nIf unsure, leave this unchecked.");
|
wxString show_fps_desc = wxTRANSLATE("Show the number of frames rendered per second as a measure of emulation speed.\n\nIf unsure, leave this unchecked.");
|
||||||
wxString log_fps_to_file_desc = wxTRANSLATE("Log the number of frames rendered per second to User/Logs/fps.txt. Use this feature when you want to measure the performance of Dolphin.\n\nIf unsure, leave this unchecked.");
|
wxString log_fps_to_file_desc = wxTRANSLATE("Log the number of frames rendered per second to User/Logs/fps.txt. Use this feature when you want to measure the performance of Dolphin.\n\nIf unsure, leave this unchecked.");
|
||||||
|
wxString log_render_time_to_file_desc = wxTRANSLATE("Log the render time of every frame to User/Logs/render_time.txt. Use this feature when you want to measure the performance of Dolphin.\n\nIf unsure, leave this unchecked.");
|
||||||
wxString show_input_display_desc = wxTRANSLATE("Display the inputs read by the emulator.\n\nIf unsure, leave this unchecked.");
|
wxString show_input_display_desc = wxTRANSLATE("Display the inputs read by the emulator.\n\nIf unsure, leave this unchecked.");
|
||||||
wxString show_stats_desc = wxTRANSLATE("Show various statistics.\n\nIf unsure, leave this unchecked.");
|
wxString show_stats_desc = wxTRANSLATE("Show various statistics.\n\nIf unsure, leave this unchecked.");
|
||||||
wxString texfmt_desc = wxTRANSLATE("Modify textures to show the format they're encoded in. Needs an emulation reset in most cases.\n\nIf unsure, leave this unchecked.");
|
wxString texfmt_desc = wxTRANSLATE("Modify textures to show the format they're encoded in. Needs an emulation reset in most cases.\n\nIf unsure, leave this unchecked.");
|
||||||
@ -586,6 +587,8 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
|
|||||||
szr_misc->Add(cb_prog_scan);
|
szr_misc->Add(cb_prog_scan);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
szr_misc->Add(CreateCheckBox(page_advanced, _("Log render time to file"), wxGetTranslation(log_render_time_to_file_desc), vconfig.bLogRenderTimeToFile));
|
||||||
|
|
||||||
wxStaticBoxSizer* const group_misc = new wxStaticBoxSizer(wxVERTICAL, page_advanced, _("Misc"));
|
wxStaticBoxSizer* const group_misc = new wxStaticBoxSizer(wxVERTICAL, page_advanced, _("Misc"));
|
||||||
szr_advanced->Add(group_misc, 0, wxEXPAND | wxALL, 5);
|
szr_advanced->Add(group_misc, 0, wxEXPAND | wxALL, 5);
|
||||||
group_misc->Add(szr_misc, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
|
group_misc->Add(szr_misc, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
|
||||||
|
@ -20,17 +20,24 @@ static unsigned int s_fps_last_counter = 0;
|
|||||||
static unsigned long s_last_update_time = 0;
|
static unsigned long s_last_update_time = 0;
|
||||||
static std::ofstream s_bench_file;
|
static std::ofstream s_bench_file;
|
||||||
|
|
||||||
|
static Common::Timer s_render_time;
|
||||||
|
static std::ofstream s_time_file;
|
||||||
|
|
||||||
void Initialize()
|
void Initialize()
|
||||||
{
|
{
|
||||||
s_counter = s_fps_last_counter = 0;
|
s_counter = s_fps_last_counter = 0;
|
||||||
s_fps = 0;
|
s_fps = 0;
|
||||||
s_last_update_time = Common::Timer::GetTimeMs();
|
s_last_update_time = Common::Timer::GetTimeMs();
|
||||||
|
|
||||||
|
s_render_time.Update();
|
||||||
|
|
||||||
if (s_bench_file.is_open())
|
if (s_bench_file.is_open())
|
||||||
s_bench_file.close();
|
s_bench_file.close();
|
||||||
|
if (s_time_file.is_open())
|
||||||
|
s_time_file.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void LogFPSToFile(unsigned long val)
|
static void LogFPSToFile(u64 val)
|
||||||
{
|
{
|
||||||
if (!s_bench_file.is_open())
|
if (!s_bench_file.is_open())
|
||||||
s_bench_file.open(File::GetUserPath(D_LOGS_IDX) + "fps.txt");
|
s_bench_file.open(File::GetUserPath(D_LOGS_IDX) + "fps.txt");
|
||||||
@ -38,6 +45,14 @@ static void LogFPSToFile(unsigned long val)
|
|||||||
s_bench_file << StringFromFormat("%lu\n", val);
|
s_bench_file << StringFromFormat("%lu\n", val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void LogRenderTimeToFile(u64 val)
|
||||||
|
{
|
||||||
|
if (!s_time_file.is_open())
|
||||||
|
s_time_file.open(File::GetUserPath(D_LOGS_IDX) + "render_time.txt");
|
||||||
|
|
||||||
|
s_time_file << StringFromFormat("%lu\n", val);
|
||||||
|
}
|
||||||
|
|
||||||
int Update()
|
int Update()
|
||||||
{
|
{
|
||||||
if (Common::Timer::GetTimeMs() - s_last_update_time >= FPS_REFRESH_INTERVAL)
|
if (Common::Timer::GetTimeMs() - s_last_update_time >= FPS_REFRESH_INTERVAL)
|
||||||
@ -49,6 +64,12 @@ int Update()
|
|||||||
LogFPSToFile(s_fps);
|
LogFPSToFile(s_fps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (g_ActiveConfig.bLogRenderTimeToFile)
|
||||||
|
{
|
||||||
|
LogRenderTimeToFile(s_render_time.GetTimeDifference());
|
||||||
|
s_render_time.Update();
|
||||||
|
}
|
||||||
|
|
||||||
s_counter++;
|
s_counter++;
|
||||||
return s_fps;
|
return s_fps;
|
||||||
}
|
}
|
||||||
|
@ -58,6 +58,7 @@ void VideoConfig::Load(const std::string& ini_file)
|
|||||||
settings->Get("SafeTextureCacheColorSamples", &iSafeTextureCache_ColorSamples,128);
|
settings->Get("SafeTextureCacheColorSamples", &iSafeTextureCache_ColorSamples,128);
|
||||||
settings->Get("ShowFPS", &bShowFPS, false);
|
settings->Get("ShowFPS", &bShowFPS, false);
|
||||||
settings->Get("LogFPSToFile", &bLogFPSToFile, false);
|
settings->Get("LogFPSToFile", &bLogFPSToFile, false);
|
||||||
|
settings->Get("LogRenderTimeToFile", &bLogRenderTimeToFile, false);
|
||||||
settings->Get("ShowInputDisplay", &bShowInputDisplay, false);
|
settings->Get("ShowInputDisplay", &bShowInputDisplay, false);
|
||||||
settings->Get("OverlayStats", &bOverlayStats, false);
|
settings->Get("OverlayStats", &bOverlayStats, false);
|
||||||
settings->Get("OverlayProjStats", &bOverlayProjStats, false);
|
settings->Get("OverlayProjStats", &bOverlayProjStats, false);
|
||||||
@ -230,6 +231,7 @@ void VideoConfig::Save(const std::string& ini_file)
|
|||||||
settings->Set("SafeTextureCacheColorSamples", iSafeTextureCache_ColorSamples);
|
settings->Set("SafeTextureCacheColorSamples", iSafeTextureCache_ColorSamples);
|
||||||
settings->Set("ShowFPS", bShowFPS);
|
settings->Set("ShowFPS", bShowFPS);
|
||||||
settings->Set("LogFPSToFile", bLogFPSToFile);
|
settings->Set("LogFPSToFile", bLogFPSToFile);
|
||||||
|
settings->Set("LogRenderTimeToFile", bLogRenderTimeToFile);
|
||||||
settings->Set("ShowInputDisplay", bShowInputDisplay);
|
settings->Set("ShowInputDisplay", bShowInputDisplay);
|
||||||
settings->Set("OverlayStats", bOverlayStats);
|
settings->Set("OverlayStats", bOverlayStats);
|
||||||
settings->Set("OverlayProjStats", bOverlayProjStats);
|
settings->Set("OverlayProjStats", bOverlayProjStats);
|
||||||
|
@ -84,6 +84,7 @@ struct VideoConfig final
|
|||||||
bool bTexFmtOverlayCenter;
|
bool bTexFmtOverlayCenter;
|
||||||
bool bShowEFBCopyRegions;
|
bool bShowEFBCopyRegions;
|
||||||
bool bLogFPSToFile;
|
bool bLogFPSToFile;
|
||||||
|
bool bLogRenderTimeToFile;
|
||||||
|
|
||||||
// Render
|
// Render
|
||||||
bool bWireFrame;
|
bool bWireFrame;
|
||||||
|
Reference in New Issue
Block a user