# HG changeset patch # User Julien Bect # Date 1403005388 -7200 # mar. juin 17 13:43:08 2014 +0200 # Branch stable # Node ID 9e10b94000502c747ff96974a8ce9390234aff10 # Parent 7bf70dc7f06c7eb11c5fafdfd97b501cd56e5e78 profiler.h: Speed things up when the profiler is not active. * libinterp/corefcn/profiler.h: Speed things up when the profiler is not active by calling profiler.is_active () directly. diff -r 7bf70dc7f06c -r 9e10b9400050 libinterp/corefcn/profiler.h --- a/libinterp/corefcn/profiler.h lun. juin 16 09:03:51 2014 -0700 +++ b/libinterp/corefcn/profiler.h mar. juin 17 13:43:08 2014 +0200 @@ -1,3 +1,4 @@ + /* Copyright (C) 2012-2013 Daniel Kraft @@ -61,7 +62,7 @@ profile_data_accumulator (void); virtual ~profile_data_accumulator (); - bool is_active (void) const { return enabled; } + inline bool is_active (void) const { return enabled; } void set_active (bool); void reset (void); @@ -183,8 +184,11 @@ // Helper macro to profile a block of code. #define BEGIN_PROFILER_BLOCK(name) \ { \ - profile_data_accumulator::enter pe (profiler, (name)); + profile_data_accumulator::enter *pe = \ + (profiler.is_active () ? \ + new profile_data_accumulator::enter(profiler, (name)) : NULL); #define END_PROFILER_BLOCK \ + delete (pe); \ } #endif