mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 08:46:40 +00:00
gst/gstinfo.*: Add some G_[UN]LIKELY.
Original commit message from CVS: * 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.
This commit is contained in:
parent
86cf2d272c
commit
7334cbd200
3 changed files with 25 additions and 10 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
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:
|
||||
|
|
|
@ -192,8 +192,7 @@ static gint __use_color;
|
|||
/* 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;
|
||||
|
||||
|
@ -794,9 +793,9 @@ gst_debug_set_active (gboolean active)
|
|||
{
|
||||
__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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1012,8 +1011,10 @@ gst_debug_category_set_threshold (GstDebugCategory * category,
|
|||
{
|
||||
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);
|
||||
}
|
||||
|
@ -1131,11 +1132,11 @@ _gst_debug_nameof_funcptr (GstDebugFuncPtr ptr)
|
|||
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
|
||||
|
|
|
@ -384,6 +384,10 @@ GST_EXPORT GstDebugCategory * GST_CAT_DEFAULT;
|
|||
/* 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
|
||||
|
@ -397,7 +401,7 @@ extern gboolean __gst_debug_enabled;
|
|||
*/
|
||||
#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__); \
|
||||
} \
|
||||
|
@ -405,7 +409,7 @@ extern gboolean __gst_debug_enabled;
|
|||
#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 ); \
|
||||
} \
|
||||
|
@ -423,7 +427,7 @@ static inline void
|
|||
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);
|
||||
|
|
Loading…
Reference in a new issue