Pol  Revision:3cfda13
tracebuf.h
Go to the documentation of this file.
1 
7 #ifndef CLIB_TRACEBUF_H
8 #define CLIB_TRACEBUF_H
9 
10 namespace Pol
11 {
12 namespace Clib
13 {
14 #ifndef NDEBUG
15 
16 #ifndef TRACEBUF_DEPTH
17 #define TRACEBUF_DEPTH 5000
18 #endif
19 
21 {
22  const char* tag;
23  unsigned int value;
24 };
25 
27 extern unsigned tracebuffer_insertpoint;
28 
29 inline void _tracebuffer_addelem( const char* tag, unsigned int value )
30 {
31  tracebuffer[tracebuffer_insertpoint].tag = tag;
32  tracebuffer[tracebuffer_insertpoint].value = value;
34  if ( tracebuffer_insertpoint >= TRACEBUF_DEPTH )
35  tracebuffer_insertpoint = 0;
36 }
37 #endif
38 
39 void LogTraceBuffer();
40 }
41 
42 #ifdef NDEBUG
43 #define TRACEBUF_ADDELEM( tag, value )
44 #else
45 #define TRACEBUF_ADDELEM( tag, value ) Clib::_tracebuffer_addelem( tag, value )
46 #endif
47 }
48 
49 #endif // CLIB_TRACEBUF_H
void LogTraceBuffer()
Definition: tracebuf.cpp:23
#define TRACEBUF_DEPTH
Definition: tracebuf.h:17
TraceBufferElem tracebuffer[TRACEBUF_DEPTH]
Definition: tracebuf.cpp:19
void _tracebuffer_addelem(const char *tag, unsigned int value)
Definition: tracebuf.h:29
unsigned tracebuffer_insertpoint
Definition: tracebuf.cpp:20
Definition: berror.cpp:12