Static Public Member Functions | |
static void | initialize (void) |
Initialise memory profiling. |
Definition at line 18 of file IgTraceThrow.cc.
Initialise memory profiling.
Traps various system calls to keep track of memory usage, and if requested, leaks.
Definition at line 48 of file IgTraceThrow.cc.
References IgTrace::debug(), IgTrace::disable(), IgTrace::enable(), IgHook::hook(), IgTrace::initialize(), IgTrace::options(), Config::options, s_demangle, and s_initialized.
00049 { 00050 if (s_initialized) return; 00051 s_initialized = true; 00052 00053 s_demanglelen = 1024*1024-32; 00054 if (! (s_demanglehere = (char *) malloc (s_demanglelen))) 00055 return; 00056 00057 const char *options = IgTrace::options (); 00058 bool enable = false; 00059 00060 while (options && *options) 00061 { 00062 while (*options == ' ' || *options == ',') 00063 ++options; 00064 00065 if (! strncmp (options, "throw", 5)) 00066 { 00067 enable = true; 00068 options += 5; 00069 } 00070 else if (! strncmp (options, "demangle", 8)) 00071 { 00072 s_demangle = true; 00073 options += 8; 00074 } 00075 else 00076 options++; 00077 00078 while (*options && *options != ',' && *options != ' ') 00079 options++; 00080 } 00081 00082 if (! enable) 00083 return; 00084 00085 if (! IgTrace::initialize ()) 00086 return; 00087 00088 IgTrace::disable (); 00089 IgHook::hook (dothrow_hook_main.raw); 00090 IgTrace::debug ("Tracing exceptions thrown\n"); 00091 IgTrace::enable (); 00092 }