]> git.lyx.org Git - lyx.git/blobdiff - src/support/pmprof.h
Fix bug 9798.
[lyx.git] / src / support / pmprof.h
index 8aa269a6a8ce6f1012a6c4de85bfdd2cb785b4e4..d20d4bb02042e77b566645878273161707180dd8 100644 (file)
@@ -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:
  *
 #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
@@ -143,7 +154,7 @@ void dump(long long sec, long long usec, unsigned long long count) {
                          << std::endl;
 }
 
-}
+} // namespace
 
 
 /* Helper class for gathering data. Instantiate this as a static
@@ -228,5 +239,6 @@ private:
 #define PROFILE_CACHE_MISS(a) \
        PMPI_##a.hit = false;
 
+#endif // !defined(DISABLE_PMPROF)
 
 #endif