debug: Clean up profile/debug symbols

Since we have a _clutter_debug_message() function compiled in
unconditionally we have no further need for the equivalent conditional
version defined in clutter-profile.[ch]: we can simply do the work in
one function.
This commit is contained in:
Emmanuele Bassi 2011-11-18 17:44:42 +00:00
parent 92585be4d8
commit 8a4dc3c011
4 changed files with 24 additions and 36 deletions

View File

@ -3,7 +3,6 @@
#include <glib.h> #include <glib.h>
#include "clutter-main.h" #include "clutter-main.h"
#include "clutter-profile.h"
G_BEGIN_DECLS G_BEGIN_DECLS
@ -51,10 +50,10 @@ typedef enum {
/* Try the GCC extension for valists in macros */ /* Try the GCC extension for valists in macros */
#define CLUTTER_NOTE(type,x,a...) G_STMT_START { \ #define CLUTTER_NOTE(type,x,a...) G_STMT_START { \
if (G_UNLIKELY (CLUTTER_HAS_DEBUG (type))) \ if (G_UNLIKELY (CLUTTER_HAS_DEBUG (type))) { \
{ _clutter_profile_trace_message ("[" #type "]:" \ _clutter_debug_message ("[" #type "]:" \
G_STRLOC ": " x, ##a); } \ G_STRLOC ": " x, ##a); \
} G_STMT_END } } G_STMT_END
#else /* !__GNUC__ */ #else /* !__GNUC__ */
/* Try the C99 version; unfortunately, this does not allow us to pass /* Try the C99 version; unfortunately, this does not allow us to pass
@ -62,11 +61,10 @@ 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 (G_UNLIKELY (CLUTTER_HAS_DEBUG (type))) \ if (G_UNLIKELY (CLUTTER_HAS_DEBUG (type))) { \
{ \
gchar * _fmt = g_strdup_printf (__VA_ARGS__); \ gchar * _fmt = g_strdup_printf (__VA_ARGS__); \
_clutter_profile_trace_message ("[" #type "]:" \ _clutter_debug_message ("[" #type "]:" \
G_STRLOC ": %s",_fmt); \ G_STRLOC ": %s", _fmt); \
g_free (_fmt); \ g_free (_fmt); \
} } G_STMT_END } } G_STMT_END
#endif #endif

View File

@ -3735,6 +3735,11 @@ _clutter_debug_messagev (const char *format,
g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, fmt, var_args); g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, fmt, var_args);
#ifdef CLUTTER_ENABLE_PROFILE
if (_clutter_uprof_context != NULL)
uprof_context_vtrace_message (_clutter_uprof_context, format, args);
#endif
g_free (fmt); g_free (fmt);
} }

View File

@ -280,17 +280,4 @@ _clutter_profile_resume (void)
/* NB: The Cogl context is linked to this so it will also be resumed... */ /* NB: The Cogl context is linked to this so it will also be resumed... */
uprof_context_resume (_clutter_uprof_context); uprof_context_resume (_clutter_uprof_context);
} }
void
_clutter_profile_trace_message (const char *format, ...)
{
va_list ap;
va_start (ap, format);
_clutter_debug_messagev (format, ap);
va_end (ap);
if (_clutter_uprof_context != NULL)
uprof_context_vtrace_message (_clutter_uprof_context, format, ap);
}
#endif #endif

View File

@ -48,21 +48,19 @@ extern guint clutter_profile_flags;
void _clutter_uprof_init (void); void _clutter_uprof_init (void);
void _clutter_profile_suspend (void); void _clutter_profile_suspend (void);
void _clutter_profile_resume (void); void _clutter_profile_resume (void);
void _clutter_profile_trace_message (const char *format, ...);
#else /* CLUTTER_ENABLE_PROFILE */ #else /* CLUTTER_ENABLE_PROFILE */
#define CLUTTER_STATIC_TIMER(A,B,C,D,E) extern void _clutter_dummy_decl (void) #define CLUTTER_STATIC_TIMER(A,B,C,D,E) extern void _clutter_dummy_decl (void)
#define CLUTTER_STATIC_COUNTER(A,B,C,D) extern void _clutter_dummy_decl (void) #define CLUTTER_STATIC_COUNTER(A,B,C,D) extern void _clutter_dummy_decl (void)
#define CLUTTER_COUNTER_INC(A,B) G_STMT_START{ (void)0; }G_STMT_END #define CLUTTER_COUNTER_INC(A,B) G_STMT_START { } G_STMT_END
#define CLUTTER_COUNTER_DEC(A,B) G_STMT_START{ (void)0; }G_STMT_END #define CLUTTER_COUNTER_DEC(A,B) G_STMT_START { } G_STMT_END
#define CLUTTER_TIMER_START(A,B) G_STMT_START{ (void)0; }G_STMT_END #define CLUTTER_TIMER_START(A,B) G_STMT_START { } G_STMT_END
#define CLUTTER_TIMER_STOP(A,B) G_STMT_START{ (void)0; }G_STMT_END #define CLUTTER_TIMER_STOP(A,B) G_STMT_START { } G_STMT_END
#define _clutter_profile_suspend() G_STMT_START {} G_STMT_END #define _clutter_uprof_init G_STMT_START { } G_STMT_END
#define _clutter_profile_resume() G_STMT_START {} G_STMT_END #define _clutter_profile_suspend G_STMT_START { } G_STMT_END
#define _clutter_profile_resume G_STMT_START { } G_STMT_END
#define _clutter_profile_trace_message _clutter_debug_message
#endif /* CLUTTER_ENABLE_PROFILE */ #endif /* CLUTTER_ENABLE_PROFILE */