]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
also count timing info when nobody is playing
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 24 Feb 2012 12:28:41 +0000 (12:28 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 24 Feb 2012 12:28:41 +0000 (12:28 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11727 d7cf8633-e32d-0410-b094-e92efae38249

host.c
sv_main.c

diff --git a/host.c b/host.c
index b7bad6c41e99423176d342b5c41694276ea26e88..3d98c0f38cacb118d32edcbd14d6e6939f59b762 100644 (file)
--- 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;
                        }
                }
index 91716b8fbcdc4382773189db047cc9e200950e6d..47c2ed700095d45e03f4dabbbc626e29b0ec9d81 100644 (file)
--- 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;
                }