From: divverent Date: Fri, 24 Feb 2012 14:42:30 +0000 (+0000) Subject: don't accumulate time reports for the first 10 seconds of a match so things can settle X-Git-Tag: xonotic-v0.6.0~7 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=75ca3663c4e0170f635deb25de585b6bacd28e67;p=xonotic%2Fdarkplaces.git don't accumulate time reports for the first 10 seconds of a match so things can settle git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11729 d7cf8633-e32d-0410-b094-e92efae38249 ::stable-branch::merge=aa18f6ecab09516f2af3bf710fc4c9090634d3c3 --- diff --git a/host.c b/host.c index 43ed906b..62530e08 100644 --- a/host.c +++ b/host.c @@ -712,7 +712,13 @@ void Host_Main(void) if(host_client->spawned) if(host_client->netconnection) playing = true; - if(svs.perf_acc_realtime > 5) + if(sv.time < 10) + { + // don't accumulate time for the first 10 seconds of a match + // so things can settle + 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) { svs.perf_cpuload = 1 - svs.perf_acc_sleeptime / svs.perf_acc_realtime; svs.perf_lost = svs.perf_acc_lost / svs.perf_acc_realtime; diff --git a/sv_main.c b/sv_main.c index 47c2ed70..3a50a86b 100644 --- a/sv_main.c +++ b/sv_main.c @@ -3899,11 +3899,17 @@ static int SV_ThreadFunc(void *voiddata) if(host_client->spawned) if(host_client->netconnection) playing = true; - if(svs.perf_acc_realtime > 5) + if(sv.time < 10) + { + // don't accumulate time for the first 10 seconds of a match + // so things can settle + 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) { svs.perf_cpuload = 1 - svs.perf_acc_sleeptime / svs.perf_acc_realtime; svs.perf_lost = svs.perf_acc_lost / svs.perf_acc_realtime; - if(svs.perf_acc_offset_samples > 0) + if(svs.perf_acc_offset_samples > 0 && sv.time > 10) { svs.perf_offset_max = svs.perf_acc_offset_max; svs.perf_offset_avg = svs.perf_acc_offset / svs.perf_acc_offset_samples;