add several more R_TimeReport calls for better analysis of csqc time
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 25 Feb 2010 15:55:47 +0000 (15:55 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 25 Feb 2010 15:55:47 +0000 (15:55 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9998 d7cf8633-e32d-0410-b094-e92efae38249

cl_parse.c
clvm_cmds.c
csprogs.c
host.c
netconn.c

index 8b5bc0a..57941d3 100644 (file)
@@ -3630,6 +3630,7 @@ void CL_ParseServerMessage(void)
 
                        if (cmd == -1)
                        {
+                               R_TimeReport("END OF MESSAGE");
                                SHOWNET("END OF MESSAGE");
                                break;          // end of message
                        }
@@ -4074,22 +4075,29 @@ void CL_ParseServerMessage(void)
                                CL_ParsePointParticles1();
                                break;
                        }
+                       R_TimeReport(svc_strings[cmd]);
                }
        }
 
        if (cls.signon == SIGNONS)
                CL_UpdateItemsAndWeapon();
+       R_TimeReport("UpdateItems");
 
        EntityFrameQuake_ISeeDeadEntities();
+       R_TimeReport("ISeeDeadEntities");
 
        CL_UpdateMoveVars();
+       R_TimeReport("UpdateMoveVars");
 
        parsingerror = false;
 
        // LordHavoc: this was at the start of the function before cl_autodemo was
        // implemented
        if (cls.demorecording)
+       {
                CL_WriteDemoMessage (&net_message);
+               R_TimeReport("WriteDemo");
+       }
 }
 
 void CL_Parse_DumpPacket(void)
index 1031110..ff8f3da 100644 (file)
@@ -252,6 +252,8 @@ static void VM_CL_traceline (void)
        int             move, svent;
        prvm_edict_t    *ent;
 
+       R_TimeReport("pretraceline");
+
        VM_SAFEPARMCOUNTRANGE(4, 4, VM_CL_traceline);
 
        prog->xfunction->builtinsprofile += 30;
@@ -267,6 +269,7 @@ static void VM_CL_traceline (void)
        trace = CL_TraceLine(v1, v2, move, ent, CL_GenericHitSuperContentsMask(ent), CL_HitNetworkBrushModels(move), CL_HitNetworkPlayers(move), &svent, true);
 
        CL_VM_SetTraceGlobals(&trace, svent);
+       R_TimeReport("traceline");
 }
 
 /*
@@ -288,6 +291,7 @@ static void VM_CL_tracebox (void)
        int             move, svent;
        prvm_edict_t    *ent;
 
+       R_TimeReport("pretracebox");
        VM_SAFEPARMCOUNTRANGE(6, 8, VM_CL_tracebox); // allow more parameters for future expansion
 
        prog->xfunction->builtinsprofile += 30;
@@ -305,6 +309,7 @@ static void VM_CL_tracebox (void)
        trace = CL_TraceBox(v1, m1, m2, v2, move, ent, CL_GenericHitSuperContentsMask(ent), CL_HitNetworkBrushModels(move), CL_HitNetworkPlayers(move), &svent, true);
 
        CL_VM_SetTraceGlobals(&trace, svent);
+       R_TimeReport("tracebox");
 }
 
 trace_t CL_Trace_Toss (prvm_edict_t *tossent, prvm_edict_t *ignore, int *svent)
index ff12745..966a12c 100644 (file)
--- a/csprogs.c
+++ b/csprogs.c
@@ -339,6 +339,7 @@ qboolean CL_VM_UpdateView (void)
 //     vec3_t oldangles;
        if(!cl.csqc_loaded)
                return false;
+       R_TimeReport("pre-UpdateView");
        CSQC_BEGIN
                //VectorCopy(cl.viewangles, oldangles);
                prog->globals.client->time = cl.time;
@@ -356,6 +357,7 @@ qboolean CL_VM_UpdateView (void)
                // Dresk : Reset Dmg Globals Here
                CL_VM_UpdateDmgGlobals(0, 0, emptyvector);
        CSQC_END
+       R_TimeReport("UpdateView");
        return true;
 }
 
diff --git a/host.c b/host.c
index 9d2f534..d3e17cd 100644 (file)
--- a/host.c
+++ b/host.c
@@ -700,6 +700,7 @@ void Host_Main(void)
                if (sv.active ? sv_timer > 0 : cl_timer > 0)
                {
                        // process console commands
+                       R_TimeReport("preconsole");
                        CL_VM_PreventInformationLeaks();
                        Cbuf_Execute();
                        R_TimeReport("console");
@@ -724,6 +725,7 @@ void Host_Main(void)
                        else
                                Sys_Sleep((int)wait);
                        svs.perf_acc_sleeptime += Sys_DoubleTime() - time0;
+                       R_TimeReport("sleep");
                        continue;
                }
 
@@ -895,21 +897,27 @@ void Host_Main(void)
                        // update video
                        if (host_speeds.integer)
                                time1 = Sys_DoubleTime();
+                       R_TimeReport("pre-input");
 
                        // Collect input into cmd
                        CL_Input();
 
+                       R_TimeReport("input");
+
                        // check for new packets
                        NetConn_ClientFrame();
 
                        // read a new frame from a demo if needed
                        CL_ReadDemoMessage();
+                       R_TimeReport("clientnetwork");
 
                        // now that packets have been read, send input to server
                        CL_SendMove();
+                       R_TimeReport("sendmove");
 
                        // update client world (interpolate entities, create trails, etc)
                        CL_UpdateWorld();
+                       R_TimeReport("lerpworld");
 
                        CL_Video_Frame();
                        CL_Gecko_Frame();
index 4e80136..075ecd8 100755 (executable)
--- a/netconn.c
+++ b/netconn.c
@@ -2125,8 +2125,14 @@ void NetConn_ClientFrame(void)
                SZ_Clear(&net_message);
        }
        for (i = 0;i < cl_numsockets;i++)
+       {
                while (cl_sockets[i] && (length = NetConn_Read(cl_sockets[i], readbuffer, sizeof(readbuffer), &peeraddress)) > 0)
+               {
+                       R_TimeReport("clientreadnetwork");
                        NetConn_ClientParsePacket(cl_sockets[i], readbuffer, length, &peeraddress);
+                       R_TimeReport("clientparsepacket");
+               }
+       }
        NetConn_QueryQueueFrame();
        if (cls.netcon && realtime > cls.netcon->timeout && !sv.active)
        {