Merge pull request #591 from Armada651/pref_log

FPSCounter: Add "Log render time to file" feature.
This commit is contained in:
Dolphin Bot 2014-07-09 18:06:57 +02:00
commit 7b754d6f99
4 changed files with 21 additions and 13 deletions

View File

@ -126,7 +126,7 @@ wxString wireframe_desc = wxTRANSLATE("Render the scene as a wireframe.\n\nIf un
wxString disable_fog_desc = wxTRANSLATE("Makes distant objects more visible by removing fog, thus increasing the overall detail.\nDisabling fog will break some games which rely on proper fog emulation.\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 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_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.");
@ -322,7 +322,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
{
SettingCheckBox* render_to_main_cb;
szr_other->Add(CreateCheckBox(page_general, _("Show FPS"), wxGetTranslation(show_fps_desc), vconfig.bShowFPS));
szr_other->Add(CreateCheckBox(page_general, _("Log FPS to file"), wxGetTranslation(log_fps_to_file_desc), vconfig.bLogFPSToFile));
szr_other->Add(CreateCheckBox(page_general, _("Log render time to file"), wxGetTranslation(log_render_time_to_file_desc), vconfig.bLogRenderTimeToFile));
szr_other->Add(CreateCheckBox(page_general, _("Auto adjust Window Size"), wxGetTranslation(auto_window_size_desc), SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderWindowAutoSize));
szr_other->Add(CreateCheckBox(page_general, _("Keep window on top"), wxGetTranslation(keep_window_on_top_desc), SConfig::GetInstance().m_LocalCoreStartupParameter.bKeepWindowOnTop));
szr_other->Add(CreateCheckBox(page_general, _("Hide Mouse Cursor"), wxGetTranslation(hide_mouse_cursor_desc), SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor));

View File

@ -17,36 +17,44 @@ namespace FPSCounter
static unsigned int s_counter = 0;
static unsigned int s_fps = 0;
static unsigned int s_fps_last_counter = 0;
static unsigned long s_last_update_time = 0;
static Common::Timer s_update_time;
static Common::Timer s_render_time;
static std::ofstream s_bench_file;
void Initialize()
{
s_counter = s_fps_last_counter = 0;
s_fps = 0;
s_last_update_time = Common::Timer::GetTimeMs();
s_update_time.Update();
s_render_time.Update();
if (s_bench_file.is_open())
s_bench_file.close();
}
static void LogFPSToFile(unsigned long val)
static void LogRenderTimeToFile(u64 val)
{
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) + "render_time.txt");
s_bench_file << StringFromFormat("%lu\n", val);
}
int Update()
{
if (Common::Timer::GetTimeMs() - s_last_update_time >= FPS_REFRESH_INTERVAL)
if (s_update_time.GetTimeDifference() >= FPS_REFRESH_INTERVAL)
{
s_last_update_time = Common::Timer::GetTimeMs();
s_update_time.Update();
s_fps = s_counter - s_fps_last_counter;
s_fps_last_counter = s_counter;
if (g_ActiveConfig.bLogFPSToFile)
LogFPSToFile(s_fps);
}
if (g_ActiveConfig.bLogRenderTimeToFile)
{
LogRenderTimeToFile(s_render_time.GetTimeDifference());
s_render_time.Update();
}
s_counter++;

View File

@ -57,7 +57,7 @@ void VideoConfig::Load(const std::string& ini_file)
settings->Get("UseRealXFB", &bUseRealXFB, 0);
settings->Get("SafeTextureCacheColorSamples", &iSafeTextureCache_ColorSamples,128);
settings->Get("ShowFPS", &bShowFPS, false);
settings->Get("LogFPSToFile", &bLogFPSToFile, false);
settings->Get("LogRenderTimeToFile", &bLogRenderTimeToFile, false);
settings->Get("ShowInputDisplay", &bShowInputDisplay, false);
settings->Get("OverlayStats", &bOverlayStats, false);
settings->Get("OverlayProjStats", &bOverlayProjStats, false);
@ -229,7 +229,7 @@ void VideoConfig::Save(const std::string& ini_file)
settings->Set("UseRealXFB", bUseRealXFB);
settings->Set("SafeTextureCacheColorSamples", iSafeTextureCache_ColorSamples);
settings->Set("ShowFPS", bShowFPS);
settings->Set("LogFPSToFile", bLogFPSToFile);
settings->Set("LogRenderTimeToFile", bLogRenderTimeToFile);
settings->Set("ShowInputDisplay", bShowInputDisplay);
settings->Set("OverlayStats", bOverlayStats);
settings->Set("OverlayProjStats", bOverlayProjStats);

View File

@ -83,7 +83,7 @@ struct VideoConfig final
bool bTexFmtOverlayEnable;
bool bTexFmtOverlayCenter;
bool bShowEFBCopyRegions;
bool bLogFPSToFile;
bool bLogRenderTimeToFile;
// Render
bool bWireFrame;