summaryrefslogtreecommitdiff
path: root/libs/pbd/pbd/debug.h
diff options
context:
space:
mode:
authorTim Mayberry <mojofunk@gmail.com>2014-12-27 13:18:38 +0700
committerTim Mayberry <mojofunk@gmail.com>2015-01-01 19:04:14 +0700
commitd606a37204a0603144cd3592bc9825f82e144741 (patch)
tree878f97c29ba3796b686a21700eca5b26dbefd7a0 /libs/pbd/pbd/debug.h
parentd415bb7bca12f42269efc4bcd5b25e73edd57fd2 (diff)
Add PBD debug macros for recording timing data
Diffstat (limited to 'libs/pbd/pbd/debug.h')
-rw-r--r--libs/pbd/pbd/debug.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/libs/pbd/pbd/debug.h b/libs/pbd/pbd/debug.h
index e9a94dfe35..4af1025cb2 100644
--- a/libs/pbd/pbd/debug.h
+++ b/libs/pbd/pbd/debug.h
@@ -25,6 +25,7 @@
#include <sstream>
#include "pbd/libpbd_visibility.h"
+#include "pbd/timing.h"
namespace PBD {
@@ -57,6 +58,11 @@ namespace PBD {
#define DEBUG_STR_APPEND(id,s) __debug_str ## id << s;
#define DEBUG_ENABLED(bits) ((bits) & PBD::debug_bits)
#define DEBUG_THREAD_SELF 0
+
+#define DEBUG_TIMING_START(bits,td) if ((bits) & PBD::debug_bits) { td.start_timing (); }
+#define DEBUG_TIMING_ADD_ELAPSED(bits,td) if ((bits) & PBD::debug_bits) { td.add_elapsed (); }
+#define DEBUG_TIMING_RESET(bits,td) if ((bits) & PBD::debug_bits) { td.reset (); }
+
#else
#define DEBUG_TRACE(bits,fmt,...) /*empty*/
#define DEBUG_STR(a) /* empty */
@@ -67,6 +73,11 @@ namespace PBD {
#else
#define DEBUG_THREAD_SELF pthread_self()
#endif
+
+#define DEBUG_TIMING_START(bits,td) /*empty*/
+#define DEBUG_TIMING_ADD_ELAPSED(bits,td) /*empty*/
+#define DEBUG_TIMING_RESET(bits,td) /*empty*/
+
#endif
#endif /* __libpbd_debug_h__ */