Screenshot (See next post / mod of example #11) :
Main features :
* show/hide control key ("d"),
* register/unregister data and function,
* trace a value for a number of frames,
* support of types : bool, u32, s32, f32, vector3df, SColor, string...
* trace the program pointer (kind of simplistic program profiling)
Download irrTRACE example :
>>> Here!
Note :
Trace manager is a singleton and massively uses templates programming. Trace gui requires CGUIStaticText.h/cpp in your project.
Howto :
1) Getting an instance of the Trace Manager :
Code: Select all
CTraceManager * traceMgr = CTraceManager::getInstance();
'var' is a variable (u32, s32, f32, string, vector3df, SColor...). 'traceId' is an identifier to the traced data.
Code: Select all
u32 var;
[...]
// Start tracing 'var'
std::size_t traceId = traceMgr->traceStaticData( &var, "tracename", "traceunit" );
[...]
// Stop tracing 'var'
traceMgr->erase( traceId );
'pvar' is a pointer to a variable (*u32, *s32, *f32, *string, *vector3df, *SColor...).
Code: Select all
u32 * pvar;
[...]
// Start tracing 'pvar'
std::size_t traceId = traceMgr->traceStaticData( pvar, "tracename", "traceunit" );
[...]
// Stop tracing 'pvar'
traceMgr->erase( traceId );
'func' is a function that return a 'type' (*u32, *s32, *f32, *string, *vector3df, *SColor...).
Code: Select all
u32 * func();
[...]
// Start tracing 'func'
std::size_t traceId = traceMgr->traceStaticData<u32>( &func, "tracename", "traceunit" );
[...]
// Stop tracing 'func'
traceMgr->erase( traceId );
'mvar' is a public member data (*u32, *s32, *f32, *string, *vector3df, *SColor...).
Code: Select all
struct object
{
u32 * mvar;
};
[...]
object o1;
[...]
// Start tracing 'object::mvar'
std::size_t traceId = traceMgr->traceMemberData<object,u32>( &o1, &object::mvar, "tracename", "traceunit" );
[...]
// Stop tracing 'object::mvar'
traceMgr->erase( traceId );
'mfunc' is a public member function that returns a type (*u32, *s32, *f32, *string, *vector3df, *SColor...).
a) without constness:
Code: Select all
struct object
{
u32 * mfunc();
};
[...]
object o1;
[...]
// Start tracing 'object::mfunc'
std::size_t traceId = traceMgr->traceMemberFunction<object,u32>( &o1, &object::mfunc, "tracename", "traceunit" );
[...]
// Stop tracing 'object::mfunc'
traceMgr->erase( traceId );
Code: Select all
struct object
{
u32 * mfunc() const;
};
[...]
object o1;
[...]
// Start tracing 'object::mfunc'
std::size_t traceId = traceMgr->traceMemberFunctionConst<object,u32>( &o1, &object::mfunc, "tracename", "traceunit" );
[...]
// Stop tracing 'object::mfunc'
traceMgr->erase( traceId );
'var' is a variable (u32, s32, f32, string, vector3df, SColor...). The value will be displayed into the gui manager for N frames. The displayed value do not change even though the content of 'var' is altered.
Code: Select all
u32 var;
[...]
// Display the value of 'var' for 500 frames
traceMgr->traceInstantValue( var, "tracename", "traceunit", 500 );
Trace manager allows tracing the program pointer. A tag will be displayed into the trace gui for N frames.
Code: Select all
[...]
// Trace the program pointer here. Display 'tag' for 500 frames
traceMgr->markProgram( "tag", __FILE__, __LINE__, 500 );
[...]
All trace are erased.
Code: Select all
traceMgr->clean();