From e4c1a3f96fd754d147bd290bbb7dc15bf5dd4270 Mon Sep 17 00:00:00 2001 From: divverent Date: Fri, 24 Feb 2012 12:28:41 +0000 Subject: [PATCH] also count timing info when nobody is playing git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11727 d7cf8633-e32d-0410-b094-e92efae38249 ::stable-branch::merge=0941085d2f009adeb0f7ce7419074ba2f07ef9cf --- host.c | 14 +++++--------- sv_main.c | 11 +++-------- 2 files changed, 8 insertions(+), 17 deletions(-) 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; } -- 2.39.2