MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / rtp_WriteBufferLog

Function rtp_WriteBufferLog

rtperformance/rtperformance.cpp:96–207  ·  view source on GitHub ↗

void rtp_WriteBufferLog Writes the buffer of frames to file... */

Source from the content-addressed store, hash-verified

94 Writes the buffer of frames to file...
95*/
96void rtp_WriteBufferLog() {
97#ifdef USE_RTP
98 Runtime_performance_enabled = 1; // make sure it's enabled for the macros
99 // determine how many frames to write out
100 uint32_t Num_frames;
101 uint32_t counter;
102 char buffer[4096];
103
104 Num_frames = std::min<unsigned>(Runtime_performance_counter, MAX_RTP_SAMPLES);
105
106 // Open the log file for writing
107 CFILE *file = cfopen(std::filesystem::path(LocalD3Dir) / "D3Performance.txt", "wt");
108
109 if (file) {
110 mprintf(0, "RTP: Recording Log\n");
111
112 strcpy(buffer, "FrameNum,FrameTime,RenderFrameTime,MultiFrameTime,MusicFrameTime,AmbientSoundTime,WeatherFrameTime,"
113 "PlayerFrameTime,DoorwayFrameTime,LevelGoalFrameTime,MatCenFrameTime,ObjectFrameTime,AIFrameAllTime,"
114 "ProcessKeysTime,REN:NumTexturesUploaded,REN:PolysDrawn,OBJ:CT_FlyingTime,OBJ:CT_AIDoFrameTime,OBJ:"
115 "CT_WeaponFrameTime,OBJ:CT_ExplosionFrameTime,OBJ:CT_DebrisFrameTime,OBJ:CT_SplinterFrameTime,OBJ:"
116 "MT_PhsyicsFrameTime,OBJ:MT_WalkingFrame,OBJ:MT_ShockWaveTime,OBJ:DoEffectTime,OBJ:MovePlayerTime,"
117 "OBJ:D3XIntervalTime,OBJ:ObjLightTime,FRAME:NormalEventTime,AnimCycle,VisEffectMoveAll,"
118 "DoPhysLinkedFrame,ObjDoFrame,NumFVICalls,FVITime");
119 cf_WriteString(file, buffer);
120
121 // Loop through all the frames, and write out the data for each frame
122 for (counter = 0; counter < Num_frames; counter++) {
123 tRTFrameInfo *fi = &RTP_FrameBuffer[counter];
124 double renderframe_time;
125 double multiframe_time;
126 double musicframe_time;
127 double ambsound_frame_time;
128 double weatherframe_time;
129 double playerframe_time;
130 double doorframe_time;
131 double levelgoal_time;
132 double matcenframe_time;
133 double objframe_time;
134 double aiframeall_time;
135 double processkeys_time;
136 double ct_flying_time;
137 double ct_aidoframe_time;
138 double ct_weaponframe_time;
139 double ct_explosionframe_time;
140 double ct_debrisframe_time;
141 double ct_splinterframe_time;
142 double mt_physicsframe_time;
143 double mt_walkingframe_time;
144 double mt_shockwave_time;
145 double obj_doeffect_time;
146 double obj_move_player_time;
147 double obj_d3xint_time;
148 double obj_objlight_time;
149 double normalevent_time;
150 double cycle_anim;
151 double vis_eff_move;
152 double phys_link;
153 double obj_do_frm;

Callers 1

rtp_StopLogFunction · 0.85

Calls 3

cfopenFunction · 0.85
cf_WriteStringFunction · 0.85
cfcloseFunction · 0.85

Tested by

no test coverage detected