Static Public Member Functions | |
static void | initialize (void) |
Initialise memory tracing. |
Definition at line 16 of file IgTraceMem.cc.
Initialise memory tracing.
Definition at line 40 of file IgTraceMem.cc.
References IgTrace::debug(), IgTrace::disable(), IgTrace::enable(), IgHook::hook(), IgTrace::initialize(), IgTrace::options(), Config::options, and s_initialized.
00041 { 00042 if (s_initialized) return; 00043 s_initialized = true; 00044 00045 const char *options = IgTrace::options (); 00046 bool enable = false; 00047 00048 while (options && *options) 00049 { 00050 while (*options == ' ' || *options == ',') 00051 ++options; 00052 00053 if (! strncmp (options, "mem", 3)) 00054 { 00055 options += 3; 00056 enable = true; 00057 } 00058 else 00059 options++; 00060 00061 while (*options && *options != ',' && *options != ' ') 00062 options++; 00063 } 00064 00065 if (! enable) 00066 return; 00067 00068 if (! IgTrace::initialize ()) 00069 return; 00070 00071 IgTrace::disable (); 00072 IgHook::hook (domalloc_hook_main.raw); 00073 #if __linux__ 00074 if (domalloc_hook_main.raw.chain) IgHook::hook (domalloc_hook_libc.raw); 00075 #endif 00076 00077 IgTrace::debug ("Tracing memory allocations\n"); 00078 IgTrace::enable (); 00079 }