trace-projections: Define control functions as no-ops when tracing disabled
authorPhil Miller <mille121@illinois.edu>
Sun, 21 Nov 2010 17:15:35 +0000 (11:15 -0600)
committerPhil Miller <mille121@illinois.edu>
Sun, 21 Nov 2010 17:15:35 +0000 (11:15 -0600)
src/ck-perf/trace-projections.C
src/ck-perf/trace-projections.h

index 78bdaaa536880697cd49e3ebb3dea85f6b9ff9e1..06fbac0cec202c2f7b02d3b3602d04a9ccc97eb8 100644 (file)
@@ -56,6 +56,9 @@ public:
 };
 CkpvStaticDeclare(CkVec<UsrEvent *>*, usrEvents);
 
+// When tracing is disabled, these are defined as empty static inlines
+// in the header, to minimize overhead
+#if CMK_TRACE_ENABLED
 /// Disable the outputting of the trace logs
 void disableTraceLogOutput()
 { 
@@ -73,6 +76,7 @@ void flushTraceLog()
 {
   CkpvAccess(_trace)->traceFlushLog();
 }
+#endif
 
 #if ! CMK_TRACE_ENABLED
 static int warned=0;
index 9fe8c60cf15ecd77722054493033a2e913760c0f..7f9f12a072ef7a5b703782dcaa5733e1d7af6a41 100644 (file)
@@ -543,7 +543,7 @@ class toProjectionsGZFile : public PUP::er {
 
 
 
-
+#if CMK_TRACE_ENABLED
 /// Disable the outputting of the trace logs
 void disableTraceLogOutput();
 
@@ -552,6 +552,11 @@ void enableTraceLogOutput();
 
 /// Force the log file to be flushed
 void flushTraceLog();
+#else
+static inline void disableTraceLogOutput() { }
+static inline void enableTraceLogOutput() { }
+static inline void flushTraceLog() { }
+#endif
 
 #endif