fix profiler

This commit is contained in:
proller 2016-04-14 19:31:49 +03:00
parent 8014b60c59
commit 8b4f3e8209
2 changed files with 16 additions and 2 deletions

View File

@ -739,6 +739,8 @@ void Server::AsyncRunStep(float dtime, bool initial_step)
max_lag = dtime;
}
m_env->reportMaxLagEstimate(max_lag);
g_profiler->add("Server: dtime max_lag", max_lag);
g_profiler->add("Server: dtime", dtime);
// Step environment
ScopeProfiler sp(g_profiler, "SEnv step");
if (!m_more_threads)
@ -3951,8 +3953,6 @@ void dedicated_server_loop(Server &server, bool &kill)
run_time += steplen; // wrong not real time
if (server.m_autoexit && run_time > server.m_autoexit && !server.lan_adv_server.clients_num) {
actionstream << "Profiler:" << std::fixed << std::setprecision(9) << std::endl;
g_profiler->print(actionstream);
server.requestShutdown();
}
@ -3968,4 +3968,10 @@ void dedicated_server_loop(Server &server, bool &kill)
}
}
}
if (server.m_autoexit || g_profiler_enabled) {
actionstream << "Profiler:" << std::fixed << std::setprecision(9) << std::endl;
g_profiler->print(actionstream);
}
}

View File

@ -5,6 +5,8 @@
# sudo apt-get install google-perftools libgoogle-perftools-dev
our $help = qq{
$0 [--this_script_params] [-freeminer_params] [cmd]
#simple task
$0 valgrind_massif
@ -29,6 +31,9 @@ $0 server_gdb
# run server without debug in gdb
$0 server_gdb_nd
# with periodic profiler
$0 stress --options_add=headless,headless_optimize,info --clients_num=10 -profiler_print_interval=5
$0 stress_tsan --clients_autoexit=30 --clients_runs=5 --clients_sleep=25 --options_add=headless
$0 --cgroup=10g bot_tsannta --address=192.168.0.1 --port=30005
@ -154,6 +159,9 @@ our $options = {
no_exit => {
autoexit => 0,
},
info => {
-info => 1,
},
verbose => {
#debug_log_level => 'verbose',
-verbose => 1,