CMS 3D CMS Logo

IgTraceMMap Class Reference

List of all members.

Static Public Member Functions

static void initialize (void)
 Initialise mapping profiling.


Detailed Description

Definition at line 21 of file IgTraceMMap.cc.


Member Function Documentation

void IgTraceMMap::initialize ( void   )  [static]

Initialise mapping profiling.

Traps various system calls to keep track of memory usage, and if requested, leaks.

Definition at line 60 of file IgTraceMMap.cc.

References IgTrace::debug(), IgTrace::disable(), IgTrace::enable(), IgHook::hook(), IgTrace::initialize(), IgTrace::options(), Config::options, s_demangle, and s_initialized.

00061 {
00062     if (s_initialized) return;
00063 
00064     s_demanglelen = 1024*1024-32;
00065     if (! (s_demanglehere = (char *) malloc (s_demanglelen)))
00066        return;
00067 
00068     const char  *options = IgTrace::options ();
00069     bool        enable = false;
00070 
00071     while (options && *options)
00072     {
00073         while (*options == ' ' || *options == ',')
00074             ++options;
00075 
00076         if (! strncmp (options, "mmap", 4))
00077         {
00078             enable = true;
00079             options += 4;
00080         }
00081         else if (! strncmp (options, "demangle", 8))
00082         {
00083             s_demangle = true;
00084             options += 8;
00085         }
00086         else
00087             options++;
00088 
00089         while (*options && *options != ',' && *options != ' ')
00090             options++;
00091     }
00092 
00093     if (! enable)
00094         return;
00095 
00096     if (! IgTrace::initialize ())
00097         return;
00098 
00099     IgTrace::disable ();
00100     IgHook::hook (domunmap_hook_main.raw);
00101     IgHook::hook (dommap32_hook_main.raw);
00102     IgHook::hook (dommap64_hook_main.raw);
00103     IgTrace::debug ("Tracing memory mappings\n");
00104     s_initialized = true;
00105     IgTrace::enable ();
00106 }


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:25:48 2009 for CMSSW by  doxygen 1.5.4