template<typename INDEXTYPE>
class SoTraceBuffer< INDEXTYPE >
The constructor initializes the buffers to empty pointers. It will be used by the Trace class called by SO_TRACE_IN macros on function entries to track the call stack and call list. Overflows especially of the list will occur and are included in class design; so the buffers have exactly of a size identical with index range of the stack pointer and the list pointer. Accepting overflows limits the stack size and the number of list entries; however, so no checks for overflow etc. are necessary which permits maximum tracing performance. INDEXTYPE specifies the data type and indirectly the size of the stack and the list. Normally it should be uint16_t which then will result in 65536 stack and list entries. Other types are not supported.
Definition at line 57 of file SoTrace.h.
template<typename INDEXTYPE >
void SoTraceBuffer< INDEXTYPE >::add |
( |
const char *const |
traceInString | ) |
|
|
inline |
It appends the passed string reference to the trace buffer and to the top of the trace stack. Then it increases trace index and stack pointer. traceInString may be NULL. If not NULL it must point to any null-terminated permanent string. VERY TIME CRITICAL!
Push string address onto the stack. Be sure that _stackTop is incremented after storing pointer to make memory access and incrementation of index independent. So the CPU can execute both statements parallel. Also be sure to increment index NOT within "[" and "]" to avoid that indexing works on 32bit integers which would access areas outside buffers.
Append string address to end of trace list. For optimizing performance also see _traceStack push above.
Definition at line 73 of file SoTrace.h.
Referenced by SoTrace< INDEXTYPE >::SoTrace().
template<typename INDEXTYPE >
A buffer to string number into it.
Scan all trace list in global tracing instance. Start with the newest entry and increment it until it reaches the current one. Note that it is a ring buffer.
Create trace stack string.
Create a number string from indexCounter.
Get entry. Note that it might be empty or NULL.
Go to previous entry.
Create a number string from indexCounter.
Get entry. Note that it might be empty or NULL.
Go to previous entry.
Return composed list.
Definition at line 214 of file SoTrace.h.
References SoGlobalTraceBuffer.
template<typename INDEXTYPE >
It decreases stack pointer and resets last stored string pointer to VERY TIME CRITICAL!
Decrement trace stack top. Be sure that integer index is really limited to size of INDEXTYPE since passing decremented _traceStackTop without masking it could lead to usage of 32 bit index in index "[" "]" and accesses outside buffers. Note that mask calculation is constant and probably will be evaluated on compile time.
Reset stack entry. So unused entries do not use invalid information.
Definition at line 93 of file SoTrace.h.