From 88d7d61be53c082f488ce7e1f25de1e095ed4fdf Mon Sep 17 00:00:00 2001 From: havoc Date: Thu, 25 Feb 2010 15:55:47 +0000 Subject: [PATCH] add several more R_TimeReport calls for better analysis of csqc time git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9998 d7cf8633-e32d-0410-b094-e92efae38249 --- cl_parse.c | 8 ++++++++ clvm_cmds.c | 5 +++++ csprogs.c | 2 ++ host.c | 8 ++++++++ netconn.c | 6 ++++++ 5 files changed, 29 insertions(+) diff --git a/cl_parse.c b/cl_parse.c index 8b5bc0ac..57941d35 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -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) diff --git a/clvm_cmds.c b/clvm_cmds.c index 1031110c..ff8f3da4 100644 --- a/clvm_cmds.c +++ b/clvm_cmds.c @@ -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) diff --git a/csprogs.c b/csprogs.c index ff127451..966a12ce 100644 --- 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 9d2f534c..d3e17cd1 100644 --- 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(); diff --git a/netconn.c b/netconn.c index 4e80136d..075ecd8d 100755 --- 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) { -- 2.39.2