+2006-06-12 Wim Taymans <wim@fluendo.com>
+
+ * gst/gstinfo.c: (gst_debug_set_active),
+ (gst_debug_category_set_threshold), (_gst_debug_nameof_funcptr):
+ * gst/gstinfo.h:
+ Add some G_[UN]LIKELY.
+ Maintain __gst_debug_min to avoid formatting the arguments of
+ debug messages that will be dropped anyway to avoid a lot of
+ overhead from the debugging system.
+
2006-06-11 Stefan Kost <ensonic@users.sf.net>
* po/POTFILES.in:
/* disabled by default, as soon as some threshold is set > NONE,
* it becomes enabled. */
gboolean __gst_debug_enabled = FALSE;
-static gboolean __gst_debug_min = GST_LEVEL_NONE;
-
+GstDebugLevel __gst_debug_min = GST_LEVEL_NONE;
GstDebugCategory *GST_CAT_DEFAULT = NULL;
{
__gst_debug_enabled = active;
if (active)
- __gst_debug_min = GST_LEVEL_NONE;
- else
__gst_debug_min = GST_LEVEL_COUNT;
+ else
+ __gst_debug_min = GST_LEVEL_NONE;
}
/**
{
g_return_if_fail (category != NULL);
- if (level > __gst_debug_min)
+ if (level > __gst_debug_min) {
__gst_debug_enabled = TRUE;
+ __gst_debug_min = level;
+ }
gst_atomic_int_set (&category->threshold, level);
}
Dl_info dlinfo;
#endif
- if (__gst_function_pointers) {
+ if (G_LIKELY (__gst_function_pointers)) {
g_static_mutex_lock (&__dbg_functions_mutex);
ptrname = g_hash_table_lookup (__gst_function_pointers, ptr);
g_static_mutex_unlock (&__dbg_functions_mutex);
- if (ptrname)
+ if (G_LIKELY (ptrname))
return ptrname;
}
/* we need to create an entry in the hash table for this one so we don't leak
/* this symbol may not be used */
extern gboolean __gst_debug_enabled;
+/* since 0.10.7, the min debug level, used for quickly discarding debug
+ * messages that fall under the threshold. */
+extern GstDebugLevel __gst_debug_min;
+
/**
* GST_CAT_LEVEL_LOG:
* @cat: category to use
*/
#ifdef G_HAVE_ISO_VARARGS
#define GST_CAT_LEVEL_LOG(cat,level,object,...) G_STMT_START{ \
- if (__gst_debug_enabled) { \
+ if (G_UNLIKELY (level <= __gst_debug_min)) { \
gst_debug_log ((cat), (level), __FILE__, GST_FUNCTION, __LINE__, \
(GObject *) (object), __VA_ARGS__); \
} \
#else /* G_HAVE_GNUC_VARARGS */
#ifdef G_HAVE_GNUC_VARARGS
#define GST_CAT_LEVEL_LOG(cat,level,object,args...) G_STMT_START{ \
- if (__gst_debug_enabled) { \
+ if (G_UNLIKELY (level <= __gst_debug_min)) { \
gst_debug_log ((cat), (level), __FILE__, GST_FUNCTION, __LINE__, \
(GObject *) (object), ##args ); \
} \
GST_CAT_LEVEL_LOG (GstDebugCategory * cat, GstDebugLevel level,
gpointer object, const char *format, ...)
{
- if (__gst_debug_enabled) {
+ if (G_UNLIKELY (level <= __gst_debug_min)) { \
va_list varargs;
va_start (varargs, format);