commit c139aef37965d01831ecea49c24d8fc5e5cbcd59
Author: Jean-Marc Lasgouttes <[email protected]>
Date: Fri Dec 9 15:44:45 2016 +0100
Add a way to disable the poor man's profiler
Just define DISABLE_PMPROF _before_ #including the header.
---
src/support/pmprof.h | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/src/support/pmprof.h b/src/support/pmprof.h
index 8aa269a..362c12d 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 <windows.h>
#else
@@ -228,5 +239,6 @@ private:
#define PROFILE_CACHE_MISS(a) \
PMPI_##a.hit = false;
+#endif // !defined(DISABLE_PMPROF)
#endif