changeset 1570:410819150cd3

Eliminate code entirely in release builds
author Chris Cannam
date Wed, 07 Nov 2018 15:46:36 +0000
parents c2c8e071e24f
children 5fe24e4af12c 50fe6d6a5ef0
files base/HitCount.h
diffstat 1 files changed, 16 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/base/HitCount.h	Wed Nov 07 15:46:20 2018 +0000
+++ b/base/HitCount.h	Wed Nov 07 15:46:36 2018 +0000
@@ -21,6 +21,8 @@
 /**
  * Profile class for counting cache hits and the like.
  */
+#ifndef NO_HIT_COUNTS
+
 class HitCount
 {
 public:
@@ -32,7 +34,6 @@
     { }
     
     ~HitCount() {
-#ifndef NO_HIT_COUNTS
         using namespace std;
         int total = m_hit + m_partial + m_miss;
         cerr << "Hit count: " << m_name << ": ";
@@ -53,7 +54,6 @@
             }
         }
         cerr << endl;
-#endif
     }
 
     void hit() { ++m_hit; }
@@ -67,4 +67,18 @@
     int m_miss;
 };
 
+#else // NO_HIT_COUNTS
+
+class HitCount
+{
+public:
+    HitCount(std::string) {}
+
+    void hit() {}
+    void partial() {}
+    void miss() {}
+};
+
 #endif
+
+#endif