mirror of
https://github.com/minetest/minetest.git
synced 2025-03-01 08:04:41 +01:00
Print profiler at end of session
This commit is contained in:
@ -258,6 +258,13 @@ bool ClientLauncher::run(GameStartData &start_data, const Settings &cmd_args)
|
|||||||
}
|
}
|
||||||
} // Menu-game loop
|
} // Menu-game loop
|
||||||
|
|
||||||
|
// If profiler was enabled print it one last time
|
||||||
|
if (g_settings->getFloat("profiler_print_interval") > 0) {
|
||||||
|
infostream << "Profiler:" << std::endl;
|
||||||
|
g_profiler->print(infostream);
|
||||||
|
g_profiler->clear();
|
||||||
|
}
|
||||||
|
|
||||||
assert(g_menucloudsmgr->getReferenceCount() == 1);
|
assert(g_menucloudsmgr->getReferenceCount() == 1);
|
||||||
g_menucloudsmgr->drop();
|
g_menucloudsmgr->drop();
|
||||||
g_menucloudsmgr = nullptr;
|
g_menucloudsmgr = nullptr;
|
||||||
|
@ -1904,7 +1904,8 @@ void Game::updateProfilers(const RunStats &stats, const FpsControl &draw_times,
|
|||||||
g_settings->getFloat("profiler_print_interval");
|
g_settings->getFloat("profiler_print_interval");
|
||||||
bool print_to_log = true;
|
bool print_to_log = true;
|
||||||
|
|
||||||
if (profiler_print_interval == 0) {
|
// Update game UI anyway but don't log
|
||||||
|
if (profiler_print_interval <= 0) {
|
||||||
print_to_log = false;
|
print_to_log = false;
|
||||||
profiler_print_interval = 3;
|
profiler_print_interval = 3;
|
||||||
}
|
}
|
||||||
@ -1919,12 +1920,12 @@ void Game::updateProfilers(const RunStats &stats, const FpsControl &draw_times,
|
|||||||
g_profiler->clear();
|
g_profiler->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update update graphs
|
// Update graphs
|
||||||
g_profiler->graphAdd("Time non-rendering [us]",
|
g_profiler->graphAdd("Time non-rendering [us]",
|
||||||
draw_times.busy_time - stats.drawtime);
|
draw_times.busy_time - stats.drawtime);
|
||||||
|
|
||||||
g_profiler->graphAdd("Sleep [us]", draw_times.sleep_time);
|
g_profiler->graphAdd("Sleep [us]", draw_times.sleep_time);
|
||||||
g_profiler->graphAdd("FPS", 1.0f / dtime);
|
|
||||||
|
g_profiler->graphSet("FPS", 1.0f / dtime);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Game::updateStats(RunStats *stats, const FpsControl &draw_times,
|
void Game::updateStats(RunStats *stats, const FpsControl &draw_times,
|
||||||
|
@ -4096,9 +4096,8 @@ void dedicated_server_loop(Server &server, bool &kill)
|
|||||||
/*
|
/*
|
||||||
Profiler
|
Profiler
|
||||||
*/
|
*/
|
||||||
if (profiler_print_interval != 0) {
|
if (profiler_print_interval > 0) {
|
||||||
if(m_profiler_interval.step(steplen, profiler_print_interval))
|
if (m_profiler_interval.step(steplen, profiler_print_interval)) {
|
||||||
{
|
|
||||||
infostream << "Profiler:" << std::endl;
|
infostream << "Profiler:" << std::endl;
|
||||||
g_profiler->print(infostream);
|
g_profiler->print(infostream);
|
||||||
g_profiler->clear();
|
g_profiler->clear();
|
||||||
@ -4112,6 +4111,12 @@ void dedicated_server_loop(Server &server, bool &kill)
|
|||||||
ServerList::sendAnnounce(ServerList::AA_DELETE,
|
ServerList::sendAnnounce(ServerList::AA_DELETE,
|
||||||
server.m_bind_addr.getPort());
|
server.m_bind_addr.getPort());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (profiler_print_interval > 0) {
|
||||||
|
infostream << "Profiler:" << std::endl;
|
||||||
|
g_profiler->print(infostream);
|
||||||
|
g_profiler->clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user