[vsipl++] [patch] Profiler Configuration Options

Mark Mitchell mark at codesourcery.com
Sun Aug 13 17:29:43 UTC 2006


Jules Bergmann wrote:

> For example, instead of disabling a Scope_event class with an ifdef:
> 
>     #if PROFILING_ENABLED
>        Scope_event ev("name");
>     #endif

I expected you to suggest making the Scope_event class itself conditional:

  class Scope_event {
    Scope_event (const char *name) {
#if PROFILING_ENABLED
     // Do interesting stuff.
#endif
    }

In theory, the compiler should optimize away completely empty functions
and such.  I'm not sure that's true, in pratice, though, so your way may
be more robust in the real world.

Just a random thought,

-- 
Mark Mitchell
CodeSourcery
mark at codesourcery.com
(650) 331-3385 x713



More information about the vsipl++ mailing list