]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
don't accumulate time reports for the first 10 seconds of a match so things can settle
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 24 Feb 2012 14:42:30 +0000 (14:42 +0000)
committerRudolf Polzer <divverent@alientrap.org>
Fri, 24 Feb 2012 14:48:29 +0000 (15:48 +0100)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11729 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=aa18f6ecab09516f2af3bf710fc4c9090634d3c3

host.c
sv_main.c

diff --git a/host.c b/host.c
index 43ed906b01f2b72b27f142c522a84213e127f469..62530e0833b57e4daa9557abc2b4ea6933305152 100644 (file)
--- 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;
index 47c2ed700095d45e03f4dabbbc626e29b0ec9d81..3a50a86b5b3c928514da88996834240f19bdd70b 100644 (file)
--- 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;