Permalink
Browse files

avoid the hot path when debugging isn't enabled

  • Loading branch information...
1 parent ecfdd1f commit 98c7c72ece90b7a6113e6cd5b11bae13e81c270b @postwait postwait committed Jul 20, 2012
Showing with 8 additions and 2 deletions.
  1. +7 −1 fq.h
  2. +1 −1 fq_utils.c
View
8 fq.h
@@ -220,7 +220,13 @@ extern int
} \
} while(0)
-extern void fq_stacktrace(fq_debug_bits_t b, const char *tag, int start, int end);
+#define fq_stacktrace(b,t,s,e) do { \
+ if(0 != (b & fq_debug_bits)) { \
+ fq_debug_stacktrace(b,t,s,e); \
+ } \
+} while(0)
+
+extern void fq_debug_stacktrace(fq_debug_bits_t b, const char *tag, int start, int end);
#ifdef __MACH__
typedef uint64_t hrtime_t;
View
@@ -359,7 +359,7 @@ fq_debug_fl(const char *file, int line, fq_debug_bits_t b, const char *fmt, ...)
}
void
-fq_stacktrace(fq_debug_bits_t b, const char *tag, int start, int end) {
+fq_debug_stacktrace(fq_debug_bits_t b, const char *tag, int start, int end) {
#define STACK_DEPTH 16
int i, cnt;
void *bti[STACK_DEPTH + 1], **bt = bti+1;

0 comments on commit 98c7c72

Please sign in to comment.