diff options
author | Perttu Ahola <celeron55@gmail.com> | 2011-10-16 21:16:44 +0300 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2011-10-16 21:16:44 +0300 |
commit | b8f2dcea4de03b21f353240935a3295f237f258f (patch) | |
tree | 5473861e52a96d1cf93b7d598b97bbe2b28e8fc8 /src/server.cpp | |
parent | 07d000cc54c26001f9f79e5c0d45c2d3c4f614eb (diff) | |
download | minetest-b8f2dcea4de03b21f353240935a3295f237f258f.tar.gz minetest-b8f2dcea4de03b21f353240935a3295f237f258f.tar.bz2 minetest-b8f2dcea4de03b21f353240935a3295f237f258f.zip |
Improve debug profiler usage for investigating CPU usage of server
Diffstat (limited to 'src/server.cpp')
-rw-r--r-- | src/server.cpp | 40 |
1 files changed, 10 insertions, 30 deletions
diff --git a/src/server.cpp b/src/server.cpp index 3e1034f50..ed0c97c29 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -842,31 +842,9 @@ void RemoteClient::SendObjectData( } /* - Get and write object data + Get and write object data (dummy, for compatibility) */ - /* - Get nearby blocks. - - For making players to be able to build to their nearby - environment (building is not possible on blocks that are not - in memory): - - Set blocks changed - - Add blocks to emerge queue if they are not found - - SUGGESTION: These could be ignored from the backside of the player - */ - - Player *player = server->m_env.getPlayer(peer_id); - - assert(player); - - v3f playerpos = player->getPosition(); - v3f playerspeed = player->getSpeed(); - - v3s16 center_nodepos = floatToInt(playerpos, BS); - v3s16 center = getNodeBlockPos(center_nodepos); - // Write block count writeU16(buf, 0); os.write((char*)buf, 2); @@ -1143,6 +1121,8 @@ void Server::AsyncRunStep() { DSTACK(__FUNCTION_NAME); + g_profiler->add("Server::AsyncRunStep (num)", 1); + float dtime; { JMutexAutoLock lock1(m_step_dtime_mutex); @@ -1150,14 +1130,15 @@ void Server::AsyncRunStep() } { - ScopeProfiler sp(g_profiler, "Server: selecting and sending " - "blocks to clients"); + ScopeProfiler sp(g_profiler, "Server: sel and send blocks to clients"); // Send blocks to clients SendBlocks(dtime); } if(dtime < 0.001) return; + + g_profiler->add("Server::AsyncRunStep with dtime (num)", 1); //infostream<<"Server steps "<<dtime<<std::endl; //infostream<<"Server::AsyncRunStep(): dtime="<<dtime<<std::endl; @@ -1184,7 +1165,6 @@ void Server::AsyncRunStep() { // This has to be called so that the client list gets synced // with the peer list of the connection - ScopeProfiler sp(g_profiler, "Server: peer change handling"); handlePeerChanges(); } @@ -1233,7 +1213,8 @@ void Server::AsyncRunStep() { JMutexAutoLock lock(m_env_mutex); // Step environment - ScopeProfiler sp(g_profiler, "Server: environment step"); + ScopeProfiler sp(g_profiler, "SEnv step"); + ScopeProfiler sp2(g_profiler, "SEnv step avg", SPT_LOWPASS); m_env.step(dtime); } @@ -1340,7 +1321,7 @@ void Server::AsyncRunStep() JMutexAutoLock envlock(m_env_mutex); JMutexAutoLock conlock(m_con_mutex); - ScopeProfiler sp(g_profiler, "Server: checking added and deleted objects"); + ScopeProfiler sp(g_profiler, "Server: checking added and deleted objs"); // Radius inside which objects are active s16 radius = g_settings->getS16("active_object_send_range_blocks"); @@ -1720,7 +1701,6 @@ void Server::AsyncRunStep() /* Send object positions - TODO: Get rid of MapBlockObjects */ { float &counter = m_objectdata_timer; @@ -1730,7 +1710,7 @@ void Server::AsyncRunStep() JMutexAutoLock lock1(m_env_mutex); JMutexAutoLock lock2(m_con_mutex); - ScopeProfiler sp(g_profiler, "Server: sending mbo positions"); + ScopeProfiler sp(g_profiler, "Server: sending player positions"); SendObjectData(counter); |