Hey everyone,
I'm working on a school project that has got something to do with profiling performance of first person shooters.
What I've done so far is insert a few bits of code in the OpenArena engine rendering loop and output onto the console the number of cycles it takes to process a frame (or at least I hope that's what it does!)
snippet in tr_backend.c :
void RB_ExecuteRenderCommands( const void *data ) {
int t1, t2;
unsigned long long a,b;
t1 = ri.Milliseconds ();
a = rdtsc(); //this function is defined elsewhere
if ( !r_smp->integer || data == backEndData[0]->commands.cmds ) {
backEnd.smpFrame = 0;
...
...
case RC_END_OF_LIST:
default:
// stop rendering on this thread
b = rdtsc(); //i assume this is where the processing ends
t2 = ri.Milliseconds ();
backEnd.pc.msec = t2 - t1;
ri.Printf( PRINT_ALL, "time: %llu\n", b - a ); //print difference
return;
}
}
The next step is to some how output these numbers into a file for further analysis and I'm stuck on that. The idea is instead of printing it on the console we should write it to a file. I've tried a few of the FS_WriteFile methods but nothing seems to work. I'm not very familiar with C ("grew up" with java) and I'm not sure whether plain C file-write functions will work when it gets compiled into the qvm.
I've tried condumping but i think the console buffer is limited and can't capture the length of the entire demo I'm trying profile. One idea is to try and extend this buffersize but I'm still trying to locate where this variable is stored. Any help here would be appreciated.
So what I'm asking is can someone give me some idea where are some of inbuilt functions in the quake program that can help me accomplish what i'm trying to do. I've been looking through the source code for a while but it's quite mind-boggling, especially when I'm not familiar with the C paradigm. I noticed that the game logs some of the console commands and game information in a 'q3history' and 'games.log' file and I was hoping I could make use of that part of the code. But I can't seem to find which part of the source that handles this!
Any help would be appreciated. The deadline's coming up soon. -_-. Thanks and Happy new year.