From c139aef37965d01831ecea49c24d8fc5e5cbcd59 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Fri, 9 Dec 2016 15:44:45 +0100 Subject: [PATCH] Add a way to disable the poor man's profiler Just define DISABLE_PMPROF _before_ #including the header. --- src/support/pmprof.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/support/pmprof.h b/src/support/pmprof.h index 8aa269a6a8..362c12d38f 100644 --- a/src/support/pmprof.h +++ b/src/support/pmprof.h @@ -28,6 +28,9 @@ * hit: 96%, 4.36usec, count=6849, total=29.89msec * miss: 3%, 60.65usec, count=271, total=16.43msec * + * * if DISABLE_PMPROF is defined before including pmprof.h, the + * profiler is replaced by empty macros. This is useful for quickly + * checking the overhead. * * ==== ABOUT PROFILING SCOPE: * @@ -101,6 +104,14 @@ #ifndef PMPROF_H #define PMPROF_H +#if defined(DISABLE_PMPROF) + +// Make pmprof an empty shell +#define PROFILE_THIS_BLOCK(a) +#define PROFILE_CACHE_MISS(a) + +#else + #ifdef _WIN32 #include #else @@ -228,5 +239,6 @@ private: #define PROFILE_CACHE_MISS(a) \ PMPI_##a.hit = false; +#endif // !defined(DISABLE_PMPROF) #endif -- 2.39.2