mirror of
https://github.com/brl/mutter.git
synced 2024-12-25 04:22:05 +00:00
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.
This commit is contained in:
parent
f9072b8663
commit
71f942d03a
@ -40,12 +40,12 @@ typedef enum {
|
|||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
#define CLUTTER_NOTE(type,x,a...) G_STMT_START { \
|
#define CLUTTER_NOTE(type,x,a...) G_STMT_START { \
|
||||||
if (clutter_debug_flags & CLUTTER_DEBUG_##type) \
|
if (G_UNLIKELY (clutter_debug_flags & CLUTTER_DEBUG_##type)) \
|
||||||
{ g_message ("[" #type "] " G_STRLOC ": " x, ##a); } \
|
{ g_message ("[" #type "] " G_STRLOC ": " x, ##a); } \
|
||||||
} G_STMT_END
|
} G_STMT_END
|
||||||
|
|
||||||
#define CLUTTER_TIMESTAMP(type,x,a...) G_STMT_START { \
|
#define CLUTTER_TIMESTAMP(type,x,a...) G_STMT_START { \
|
||||||
if (clutter_debug_flags & CLUTTER_DEBUG_##type) \
|
if (G_UNLIKELY (clutter_debug_flags & CLUTTER_DEBUG_##type)) \
|
||||||
{ g_message ("[" #type "]" " %li:" G_STRLOC ": " \
|
{ g_message ("[" #type "]" " %li:" G_STRLOC ": " \
|
||||||
x, clutter_get_timestamp(), ##a); } \
|
x, clutter_get_timestamp(), ##a); } \
|
||||||
} G_STMT_END
|
} G_STMT_END
|
||||||
@ -55,7 +55,7 @@ typedef enum {
|
|||||||
* do an intemediate printf.
|
* do an intemediate printf.
|
||||||
*/
|
*/
|
||||||
#define CLUTTER_NOTE(type,...) G_STMT_START { \
|
#define CLUTTER_NOTE(type,...) G_STMT_START { \
|
||||||
if (clutter_debug_flags & CLUTTER_DEBUG_##type) \
|
if (G_UNLIKELY (clutter_debug_flags & CLUTTER_DEBUG_##type)) \
|
||||||
{ \
|
{ \
|
||||||
gchar * _fmt = g_strdup_printf (__VA_ARGS__); \
|
gchar * _fmt = g_strdup_printf (__VA_ARGS__); \
|
||||||
g_message ("[" #type "] " G_STRLOC ": %s",_fmt); \
|
g_message ("[" #type "] " G_STRLOC ": %s",_fmt); \
|
||||||
@ -64,7 +64,7 @@ typedef enum {
|
|||||||
} G_STMT_END
|
} G_STMT_END
|
||||||
|
|
||||||
#define CLUTTER_TIMESTAMP(type,...) G_STMT_START { \
|
#define CLUTTER_TIMESTAMP(type,...) G_STMT_START { \
|
||||||
if (clutter_debug_flags & CLUTTER_DEBUG_##type) \
|
if (G_UNLIKELY (clutter_debug_flags & CLUTTER_DEBUG_##type)) \
|
||||||
{ \
|
{ \
|
||||||
gchar * _fmt = g_strdup_printf (__VA_ARGS__); \
|
gchar * _fmt = g_strdup_printf (__VA_ARGS__); \
|
||||||
g_message ("[" #type "]" " %li:" G_STRLOC ": %s", \
|
g_message ("[" #type "]" " %li:" G_STRLOC ": %s", \
|
||||||
|
@ -53,13 +53,13 @@ typedef enum {
|
|||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
#define COGL_NOTE(type,x,a...) G_STMT_START { \
|
#define COGL_NOTE(type,x,a...) G_STMT_START { \
|
||||||
if (cogl_debug_flags & COGL_DEBUG_##type) { \
|
if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_##type)) { \
|
||||||
g_message ("[" #type "] " G_STRLOC ": " x, ##a); \
|
g_message ("[" #type "] " G_STRLOC ": " x, ##a); \
|
||||||
} } G_STMT_END
|
} } G_STMT_END
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#define COGL_NOTE(type,...) G_STMT_START { \
|
#define COGL_NOTE(type,...) G_STMT_START { \
|
||||||
if (cogl_debug_flags & COGL_DEBUG_##type) { \
|
if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_##type)) { \
|
||||||
char *_fmt = g_strdup_printf (__VA_ARGS__); \
|
char *_fmt = g_strdup_printf (__VA_ARGS__); \
|
||||||
g_message ("[" #type "] " G_STRLOC ": %s", _fmt); \
|
g_message ("[" #type "] " G_STRLOC ": %s", _fmt); \
|
||||||
g_free (_fmt); \
|
g_free (_fmt); \
|
||||||
|
Loading…
Reference in New Issue
Block a user