From: divverent Date: Fri, 24 Feb 2012 12:28:41 +0000 (+0000) Subject: also count timing info when nobody is playing X-Git-Tag: xonotic-v0.8.0~96^2~299 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=0941085d2f009adeb0f7ce7419074ba2f07ef9cf;p=xonotic%2Fdarkplaces.git also count timing info when nobody is playing git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11727 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/host.c b/host.c index b7bad6c4..3d98c0f3 100644 --- a/host.c +++ b/host.c @@ -706,17 +706,12 @@ void Host_Main(void) svs.perf_acc_realtime += deltacleantime; // Look for clients who have spawned + playing = false; for (i = 0, host_client = svs.clients;i < svs.maxclients;i++, host_client++) if(host_client->spawned) if(host_client->netconnection) - break; - if(i == svs.maxclients) - { - // Nobody is looking? Then we won't do timing... - // Instead, reset it to zero - svs.perf_acc_realtime = svs.perf_acc_sleeptime = svs.perf_acc_lost = svs.perf_acc_offset = svs.perf_acc_offset_squared = svs.perf_acc_offset_max = svs.perf_acc_offset_samples = 0; - } - else if(svs.perf_acc_realtime > 5) + playing = true; + if(svs.perf_acc_realtime > 5) { svs.perf_cpuload = 1 - svs.perf_acc_sleeptime / svs.perf_acc_realtime; svs.perf_lost = svs.perf_acc_lost / svs.perf_acc_realtime; @@ -727,7 +722,8 @@ void Host_Main(void) svs.perf_offset_sdev = sqrt(svs.perf_acc_offset_squared / svs.perf_acc_offset_samples - svs.perf_offset_avg * svs.perf_offset_avg); } if(svs.perf_lost > 0 && developer_extra.integer) - Con_DPrintf("Server can't keep up: %s\n", Host_TimingReport(vabuf, sizeof(vabuf))); + if(playing) // only complain if anyone is looking + Con_DPrintf("Server can't keep up: %s\n", Host_TimingReport(vabuf, sizeof(vabuf))); svs.perf_acc_realtime = svs.perf_acc_sleeptime = svs.perf_acc_lost = svs.perf_acc_offset = svs.perf_acc_offset_squared = svs.perf_acc_offset_max = svs.perf_acc_offset_samples = 0; } } diff --git a/sv_main.c b/sv_main.c index 91716b8f..47c2ed70 100644 --- a/sv_main.c +++ b/sv_main.c @@ -3899,13 +3899,7 @@ static int SV_ThreadFunc(void *voiddata) if(host_client->spawned) if(host_client->netconnection) playing = true; - if(!playing) - { - // Nobody is looking? Then we won't do timing... - // Instead, reset it to zero - svs.perf_acc_realtime = svs.perf_acc_sleeptime = svs.perf_acc_lost = svs.perf_acc_offset = svs.perf_acc_offset_squared = svs.perf_acc_offset_max = svs.perf_acc_offset_samples = 0; - } - else if(svs.perf_acc_realtime > 5) + if(svs.perf_acc_realtime > 5) { svs.perf_cpuload = 1 - svs.perf_acc_sleeptime / svs.perf_acc_realtime; svs.perf_lost = svs.perf_acc_lost / svs.perf_acc_realtime; @@ -3916,7 +3910,8 @@ static int SV_ThreadFunc(void *voiddata) svs.perf_offset_sdev = sqrt(svs.perf_acc_offset_squared / svs.perf_acc_offset_samples - svs.perf_offset_avg * svs.perf_offset_avg); } if(svs.perf_lost > 0 && developer_extra.integer) - Con_DPrintf("Server can't keep up: %s\n", Host_TimingReport(vabuf, sizeof(vabuf))); + if(playing) + Con_DPrintf("Server can't keep up: %s\n", Host_TimingReport(vabuf, sizeof(vabuf))); svs.perf_acc_realtime = svs.perf_acc_sleeptime = svs.perf_acc_lost = svs.perf_acc_offset = svs.perf_acc_offset_squared = svs.perf_acc_offset_max = svs.perf_acc_offset_samples = 0; }