Updated Branches:
  refs/heads/master 441c38c10 -> 33770526c

TS-1159: add compiler hints to debug logging


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/33770526
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/33770526
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/33770526

Branch: refs/heads/master
Commit: 33770526cb4dd2bc7002d905e60b326880639fe1
Parents: 441c38c
Author: James Peach <[email protected]>
Authored: Thu Mar 8 21:15:22 2012 -0800
Committer: James Peach <[email protected]>
Committed: Tue Mar 20 20:32:15 2012 -0700

----------------------------------------------------------------------
 CHANGES        |    2 ++
 lib/ts/Diags.h |   11 ++++++-----
 2 files changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/33770526/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index d6f954a..faedb56 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,7 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 3.1.4
+  *) [TS-1159] Add compiler hints to debug logging
+
   *) [TS-1143] Fixed edge case problems in IpMap.
 
   *) [TS-1114] Fix to lock vol for CacheVC::write_vector.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/33770526/lib/ts/Diags.h
----------------------------------------------------------------------
diff --git a/lib/ts/Diags.h b/lib/ts/Diags.h
index eb14afc..f5b47d4 100644
--- a/lib/ts/Diags.h
+++ b/lib/ts/Diags.h
@@ -36,6 +36,7 @@
 #define __DIAGS_H___
 
 #include <stdarg.h>
+#include "ink_unused.h"
 #include "ink_bool.h"
 #include "ink_error.h"
 #include "ink_mutex.h"
@@ -273,8 +274,8 @@ dummy_debug(const char *tag, const char *fmt, ...)
 }
 
 
-#define Diag(tag, ...)      if (diags->on()) diags->log(tag, DTA(DL_Diag), 
__VA_ARGS__)
-#define Debug(tag, ...)     if (diags->on()) diags->log(tag, DTA(DL_Debug), 
__VA_ARGS__)
+#define Diag(tag, ...)      if (unlikely(diags->on())) diags->log(tag, 
DTA(DL_Diag), __VA_ARGS__)
+#define Debug(tag, ...)     if (unlikely(diags->on())) diags->log(tag, 
DTA(DL_Debug), __VA_ARGS__)
 
 #define Status(...)    diags->error(DTA(DL_Status), __VA_ARGS__)
 #define Note(...)      diags->error(DTA(DL_Note), __VA_ARGS__)
@@ -284,11 +285,11 @@ dummy_debug(const char *tag, const char *fmt, ...)
 #define Alert(...)     diags->error(DTA(DL_Alert), __VA_ARGS__)
 #define Emergency(...) diags->error(DTA(DL_Emergency), __VA_ARGS__)
 
-#define is_debug_tag_set(_t)     diags->on(_t,DiagsTagType_Debug)
-#define is_action_tag_set(_t)    diags->on(_t,DiagsTagType_Action)
+#define is_debug_tag_set(_t)     unlikely(diags->on(_t,DiagsTagType_Debug))
+#define is_action_tag_set(_t)    unlikely(diags->on(_t,DiagsTagType_Action))
 #define debug_tag_assert(_t,_a)  (is_debug_tag_set(_t) ? 
(ink_release_assert(_a), 0) : 0)
 #define action_tag_assert(_t,_a) (is_action_tag_set(_t) ? 
(ink_release_assert(_a), 0) : 0)
-#define is_diags_on(_t)          diags->on(_t)
+#define is_diags_on(_t)          unlikely(diags->on(_t))
 
 #else // TS_USE_DIAGS
 

Reply via email to