diff options
author | Damien Lespiau <damien.lespiau@intel.com> | 2010-05-03 20:41:17 +0200 |
---|---|---|
committer | Damien Lespiau <damien.lespiau@intel.com> | 2010-05-04 17:01:14 +0100 |
commit | 71f942d03a42e9f0c2a88823aaa20d375f392163 (patch) | |
tree | 05c57faafe092dda3151b7004a52f302e83274cb /clutter/clutter-debug.h | |
parent | f9072b8663728994610d3a26ae41718c94cdcbc7 (diff) | |
download | clutter-71f942d03a42e9f0c2a88823aaa20d375f392163.tar.gz |
debug: Use G_UNLIKELY in the tests
Debugging code is not meant to be run in the nominal code path. Use
G_UNLIKELY to be reduce the number of bubbles in the instruction
pipeline.
Took the opportunity to re-indent the macros.
Diffstat (limited to 'clutter/clutter-debug.h')
-rw-r--r-- | clutter/clutter-debug.h | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/clutter/clutter-debug.h b/clutter/clutter-debug.h index 554eb8e49..d8fc63d3c 100644 --- a/clutter/clutter-debug.h +++ b/clutter/clutter-debug.h @@ -39,39 +39,39 @@ typedef enum { #ifdef CLUTTER_ENABLE_DEBUG #ifdef __GNUC__ -#define CLUTTER_NOTE(type,x,a...) G_STMT_START { \ - if (clutter_debug_flags & CLUTTER_DEBUG_##type) \ - { g_message ("[" #type "] " G_STRLOC ": " x, ##a); } \ - } G_STMT_END - -#define CLUTTER_TIMESTAMP(type,x,a...) G_STMT_START { \ - if (clutter_debug_flags & CLUTTER_DEBUG_##type) \ - { g_message ("[" #type "]" " %li:" G_STRLOC ": " \ - x, clutter_get_timestamp(), ##a); } \ - } G_STMT_END +#define CLUTTER_NOTE(type,x,a...) G_STMT_START { \ + if (G_UNLIKELY (clutter_debug_flags & CLUTTER_DEBUG_##type)) \ + { g_message ("[" #type "] " G_STRLOC ": " x, ##a); } \ + } G_STMT_END + +#define CLUTTER_TIMESTAMP(type,x,a...) G_STMT_START { \ + if (G_UNLIKELY (clutter_debug_flags & CLUTTER_DEBUG_##type)) \ + { g_message ("[" #type "]" " %li:" G_STRLOC ": " \ + x, clutter_get_timestamp(), ##a); } \ + } G_STMT_END #else /* Try the C99 version; unfortunately, this does not allow us to pass * empty arguments to the macro, which means we have to * do an intemediate printf. */ -#define CLUTTER_NOTE(type,...) G_STMT_START { \ - if (clutter_debug_flags & CLUTTER_DEBUG_##type) \ - { \ - gchar * _fmt = g_strdup_printf (__VA_ARGS__); \ - g_message ("[" #type "] " G_STRLOC ": %s",_fmt); \ - g_free (_fmt); \ - } \ - } G_STMT_END - -#define CLUTTER_TIMESTAMP(type,...) G_STMT_START { \ - if (clutter_debug_flags & CLUTTER_DEBUG_##type) \ - { \ - gchar * _fmt = g_strdup_printf (__VA_ARGS__); \ - g_message ("[" #type "]" " %li:" G_STRLOC ": %s", \ - clutter_get_timestamp(), _fmt); \ - g_free (_fmt); \ - } \ - } G_STMT_END +#define CLUTTER_NOTE(type,...) G_STMT_START { \ + if (G_UNLIKELY (clutter_debug_flags & CLUTTER_DEBUG_##type)) \ + { \ + gchar * _fmt = g_strdup_printf (__VA_ARGS__); \ + g_message ("[" #type "] " G_STRLOC ": %s",_fmt); \ + g_free (_fmt); \ + } \ + } G_STMT_END + +#define CLUTTER_TIMESTAMP(type,...) G_STMT_START { \ + if (G_UNLIKELY (clutter_debug_flags & CLUTTER_DEBUG_##type)) \ + { \ + gchar * _fmt = g_strdup_printf (__VA_ARGS__); \ + g_message ("[" #type "]" " %li:" G_STRLOC ": %s", \ + clutter_get_timestamp(), _fmt); \ + g_free (_fmt); \ + } \ + } G_STMT_END #endif #define CLUTTER_MARK() CLUTTER_NOTE(MISC, "== mark ==") |