Profiler
This is an engine profiler hook extension. It supports three processing modes.
Modes
- Function timing profiler: use SGS_PROF_FUNCTIME to initialize
- Instruction timing profiler: use SGS_PROF_OPTIME to initialize
- Memory usage profiler: use SGS_PROF_MEMUSAGE to initialize
Functions
- void sgs_ProfInit( sgs_Context* C, sgs_Prof* P, int mode ) - initialize the profiler
- void sgs_ProfClose( sgs_Prof* P ) - free the profiler
- void sgs_ProfDump( sgs_Prof* P ) - dump the data
Usage example
sgs_Prof profiler; // keep this allocated while it is linked to engine // initialize and attach the profiler sgs_ProfInit( contextPtr, &profiler, [SGS_PROF_FUNCTIME|SGS_PROF_OPTIME|SGS_PROF_MEMUSAGE] ); // ...do things with the engine... sgs_ProfDump( &profiler ); // dump the data (done through @sgs_Write* functions) // free the profiler - must be done before freeing the engine sgs_ProfClose( &profiler );