template<typename INDEXTYPE>
class ml::TraceBuffer< INDEXTYPE >
This class manages a list and a stack of pointers to permanent strings.
The constructor initializes the buffers to empty pointers. It will be used by the Trace class called by ML_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 the class design; this way, the buffers have exactly a size identical to the index range of the stack pointer and the list pointer. Accepting overflows limits the stack size and the number of list entries; however, no checks for overflow, etc., are necessary, which permits maximum tracing performance.
- Parameters
-
INDEXTYPE | specifies the data type and indirectly the size of the stack and the list. Normally it should be MLuint8 or MLuint16, which then will result in 256 or 65536 stack and list entries. Other types are supported. WARNING: Tracing is currently not thread-safe for performance reasons. This means that it only works properly to use ML_TRACE_IN macros from the main thread. When calling functions that use ML_TRACE_IN macros from a different thread, this will mix-up the trace stack and list, and the resulting stack and list may miss individual tracing items. It would be possible to support per-thread tracing by using thread local storage (TLS) in the future, but this involves a performance penalty. |
Definition at line 53 of file mlTrace.h.
template<typename INDEXTYPE >
Adds an element.
It appends the passed string reference to the trace buffer and to the top of the trace stack. It then increases the trace index and stack pointer. traceInString
may be NULL. If not NULL, it must point to any NULL-terminated permanent string. VERY TIME CRITICAL!
Definition at line 78 of file mlTrace.h.
Referenced by ml::Trace< INDEXTYPE >::Trace().