mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 17:20:36 +00:00
tracer: use GQuark or strings for the hook id
This way one can define new tracing probes without changing the core. We are using our own quark table, as 1) we only want to initialize them if we're tracing, 2) we want to share them with the tracers.
This commit is contained in:
parent
1a3e218b89
commit
4881d1c16c
7 changed files with 161 additions and 126 deletions
|
@ -64,8 +64,12 @@ struct _GstTracerClass {
|
||||||
|
|
||||||
GType gst_tracer_get_type (void);
|
GType gst_tracer_get_type (void);
|
||||||
|
|
||||||
void gst_tracer_register_hook (GstTracer *tracer, GstTracerHookId id,
|
void gst_tracer_register_hook (GstTracer *tracer, const gchar *detail,
|
||||||
GstTracerHookFunction func);
|
GstTracerHookFunction func);
|
||||||
|
void gst_tracer_register_hook_id (GstTracer *tracer, GQuark detail,
|
||||||
|
GstTracerHookFunction func);
|
||||||
|
|
||||||
|
void gst_tracer_log_trace (GstStructure * s);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
|
@ -39,11 +39,23 @@
|
||||||
|
|
||||||
#ifndef GST_DISABLE_GST_DEBUG
|
#ifndef GST_DISABLE_GST_DEBUG
|
||||||
|
|
||||||
|
/* tracer quarks */
|
||||||
|
|
||||||
|
/* These strings must match order and number declared in the GstTracerQuarkId
|
||||||
|
* enum in gsttracerutils.h! */
|
||||||
|
static const gchar *_quark_strings[] = {
|
||||||
|
"pad-push-pre", "pad-push-post", "pad-push-list-pre", "pad-push-list-post",
|
||||||
|
"pad-pull-range-pre", "pad-pull-range-post", "pad-push-event-pre",
|
||||||
|
"pad-push-event-post", "element-post-message-pre",
|
||||||
|
"element-post-message-post", "element-query-pre", "element-query-post"
|
||||||
|
};
|
||||||
|
|
||||||
|
GQuark _priv_gst_tracer_quark_table[GST_TRACER_QUARK_MAX];
|
||||||
|
|
||||||
/* tracing helpers */
|
/* tracing helpers */
|
||||||
|
|
||||||
gboolean _priv_tracer_enabled = FALSE;
|
gboolean _priv_tracer_enabled = FALSE;
|
||||||
/* TODO(ensonic): use array of GPtrArray* ? */
|
GHashTable *_priv_tracers = NULL;
|
||||||
GList *_priv_tracers[GST_TRACER_HOOK_ID_LAST] = { NULL, };
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
@ -67,6 +79,18 @@ _priv_gst_tracer_init (void)
|
||||||
|
|
||||||
GST_INFO ("enabling tracers: '%s'", env);
|
GST_INFO ("enabling tracers: '%s'", env);
|
||||||
|
|
||||||
|
if (G_N_ELEMENTS (_quark_strings) != GST_TRACER_QUARK_MAX)
|
||||||
|
g_warning ("the quark table is not consistent! %d != %d",
|
||||||
|
(gint) G_N_ELEMENTS (_quark_strings), GST_TRACER_QUARK_MAX);
|
||||||
|
|
||||||
|
for (i = 0; i < GST_TRACER_QUARK_MAX; i++) {
|
||||||
|
_priv_gst_tracer_quark_table[i] =
|
||||||
|
g_quark_from_static_string (_quark_strings[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
_priv_tracers = g_hash_table_new (NULL, NULL);
|
||||||
|
|
||||||
|
i = 0;
|
||||||
while (t[i]) {
|
while (t[i]) {
|
||||||
// check t[i] for params
|
// check t[i] for params
|
||||||
if ((params = strchr (t[i], '('))) {
|
if ((params = strchr (t[i], '('))) {
|
||||||
|
@ -106,45 +130,74 @@ _priv_gst_tracer_init (void)
|
||||||
void
|
void
|
||||||
_priv_gst_tracer_deinit (void)
|
_priv_gst_tracer_deinit (void)
|
||||||
{
|
{
|
||||||
gint i;
|
GList *h_list, *h_node, *t_node;
|
||||||
GList *node;
|
|
||||||
GstTracerHook *hook;
|
GstTracerHook *hook;
|
||||||
|
|
||||||
|
_priv_tracer_enabled = FALSE;
|
||||||
|
if (!_priv_tracers)
|
||||||
|
return;
|
||||||
|
|
||||||
/* shutdown tracers for final reports */
|
/* shutdown tracers for final reports */
|
||||||
for (i = 0; i < GST_TRACER_HOOK_ID_LAST; i++) {
|
h_list = g_hash_table_get_values (_priv_tracers);
|
||||||
for (node = _priv_tracers[i]; node; node = g_list_next (node)) {
|
for (h_node = h_list; h_node; h_node = g_list_next (h_node)) {
|
||||||
hook = (GstTracerHook *) node->data;
|
for (t_node = h_node->data; t_node; t_node = g_list_next (t_node)) {
|
||||||
|
hook = (GstTracerHook *) t_node->data;
|
||||||
gst_object_unref (hook->tracer);
|
gst_object_unref (hook->tracer);
|
||||||
g_slice_free (GstTracerHook, hook);
|
g_slice_free (GstTracerHook, hook);
|
||||||
}
|
}
|
||||||
g_list_free (_priv_tracers[i]);
|
g_list_free (h_node->data);
|
||||||
_priv_tracers[i] = NULL;
|
|
||||||
}
|
}
|
||||||
_priv_tracer_enabled = FALSE;
|
g_list_free (h_list);
|
||||||
|
g_hash_table_destroy (_priv_tracers);
|
||||||
|
_priv_tracers = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gst_tracer_register_hook (GstTracer * tracer, GstTracerHookId id,
|
gst_tracer_register_hook_id (GstTracer * tracer, GQuark detail,
|
||||||
GstTracerHookFunction func)
|
GstTracerHookFunction func)
|
||||||
{
|
{
|
||||||
|
gpointer key = GINT_TO_POINTER (detail);
|
||||||
|
GList *list = g_hash_table_lookup (_priv_tracers, key);
|
||||||
GstTracerHook *hook = g_slice_new0 (GstTracerHook);
|
GstTracerHook *hook = g_slice_new0 (GstTracerHook);
|
||||||
hook->tracer = gst_object_ref (tracer);
|
hook->tracer = gst_object_ref (tracer);
|
||||||
hook->func = func;
|
hook->func = func;
|
||||||
_priv_tracers[id] = g_list_prepend (_priv_tracers[id], hook);
|
|
||||||
GST_DEBUG_OBJECT (tracer, "added tracer to hook %d", id);
|
list = g_list_prepend (list, hook);
|
||||||
|
g_hash_table_replace (_priv_tracers, key, list);
|
||||||
|
GST_DEBUG ("registering tracer for '%s', list.len=%d",
|
||||||
|
(detail ? g_quark_to_string (detail) : "*"), g_list_length (list));
|
||||||
_priv_tracer_enabled = TRUE;
|
_priv_tracer_enabled = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gst_tracer_dispatch (GstTracerHookId id, ...)
|
gst_tracer_register_hook (GstTracer * tracer, const gchar * detail,
|
||||||
|
GstTracerHookFunction func)
|
||||||
|
{
|
||||||
|
gst_tracer_register_hook_id (tracer, g_quark_try_string (detail), func);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gst_tracer_dispatch (GQuark detail, ...)
|
||||||
{
|
{
|
||||||
va_list var_args;
|
va_list var_args;
|
||||||
GList *node;
|
gpointer key = GINT_TO_POINTER (detail);
|
||||||
|
GList *list, *node;
|
||||||
GstTracerHook *hook;
|
GstTracerHook *hook;
|
||||||
|
|
||||||
for (node = _priv_tracers[id]; node; node = g_list_next (node)) {
|
list = g_hash_table_lookup (_priv_tracers, key);
|
||||||
|
GST_DEBUG ("calling %d tracers for '%s'", g_list_length (list),
|
||||||
|
g_quark_to_string (detail));
|
||||||
|
for (node = list; node; node = g_list_next (node)) {
|
||||||
hook = (GstTracerHook *) node->data;
|
hook = (GstTracerHook *) node->data;
|
||||||
va_start (var_args, id);
|
va_start (var_args, detail);
|
||||||
|
hook->func (hook->tracer, var_args);
|
||||||
|
va_end (var_args);
|
||||||
|
}
|
||||||
|
list = g_hash_table_lookup (_priv_tracers, NULL);
|
||||||
|
GST_DEBUG ("calling %d tracers for '*'", g_list_length (list));
|
||||||
|
for (node = list; node; node = g_list_next (node)) {
|
||||||
|
hook = (GstTracerHook *) node->data;
|
||||||
|
va_start (var_args, detail);
|
||||||
hook->func (hook->tracer, var_args);
|
hook->func (hook->tracer, var_args);
|
||||||
va_end (var_args);
|
va_end (var_args);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,25 +32,6 @@ G_BEGIN_DECLS
|
||||||
|
|
||||||
#ifndef GST_DISABLE_GST_DEBUG
|
#ifndef GST_DISABLE_GST_DEBUG
|
||||||
|
|
||||||
/* tracer hook message ids */
|
|
||||||
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
GST_TRACER_HOOK_ID_PAD_PUSH_PRE = 0,
|
|
||||||
GST_TRACER_HOOK_ID_PAD_PUSH_POST,
|
|
||||||
GST_TRACER_HOOK_ID_PAD_PUSH_LIST_PRE,
|
|
||||||
GST_TRACER_HOOK_ID_PAD_PUSH_LIST_POST,
|
|
||||||
GST_TRACER_HOOK_ID_PAD_PULL_RANGE_PRE,
|
|
||||||
GST_TRACER_HOOK_ID_PAD_PULL_RANGE_POST,
|
|
||||||
GST_TRACER_HOOK_ID_PAD_PUSH_EVENT_PRE,
|
|
||||||
GST_TRACER_HOOK_ID_PAD_PUSH_EVENT_POST,
|
|
||||||
GST_TRACER_HOOK_ID_ELEMENT_POST_MESSAGE_PRE,
|
|
||||||
GST_TRACER_HOOK_ID_ELEMENT_POST_MESSAGE_POST,
|
|
||||||
GST_TRACER_HOOK_ID_ELEMENT_QUERY_PRE,
|
|
||||||
GST_TRACER_HOOK_ID_ELEMENT_QUERY_POST,
|
|
||||||
GST_TRACER_HOOK_ID_LAST
|
|
||||||
} GstTracerHookId;
|
|
||||||
|
|
||||||
/* tracing hooks */
|
/* tracing hooks */
|
||||||
|
|
||||||
void _priv_gst_tracer_init (void);
|
void _priv_gst_tracer_init (void);
|
||||||
|
@ -62,17 +43,41 @@ gboolean gst_tracer_register (GstPlugin * plugin, const gchar * name, GType type
|
||||||
|
|
||||||
/* tracing helpers */
|
/* tracing helpers */
|
||||||
|
|
||||||
void gst_tracer_dispatch (GstTracerHookId id, ...);
|
void gst_tracer_dispatch (GQuark detail, ...);
|
||||||
|
|
||||||
|
/* tracer quarks */
|
||||||
|
|
||||||
|
/* These enums need to match the number and order
|
||||||
|
* of strings declared in _quark_table, in gsttracerutils.c */
|
||||||
|
typedef enum _GstTracerQuarkId
|
||||||
|
{
|
||||||
|
GST_TRACER_QUARK_HOOK_PAD_PUSH_PRE = 0,
|
||||||
|
GST_TRACER_QUARK_HOOK_PAD_PUSH_POST,
|
||||||
|
GST_TRACER_QUARK_HOOK_PAD_PUSH_LIST_PRE,
|
||||||
|
GST_TRACER_QUARK_HOOK_PAD_PUSH_LIST_POST,
|
||||||
|
GST_TRACER_QUARK_HOOK_PAD_PULL_RANGE_PRE,
|
||||||
|
GST_TRACER_QUARK_HOOK_PAD_PULL_RANGE_POST,
|
||||||
|
GST_TRACER_QUARK_HOOK_PAD_PUSH_EVENT_PRE ,
|
||||||
|
GST_TRACER_QUARK_HOOK_PAD_PUSH_EVENT_POST,
|
||||||
|
GST_TRACER_QUARK_HOOK_ELEMENT_POST_MESSAGE_PRE,
|
||||||
|
GST_TRACER_QUARK_HOOK_ELEMENT_POST_MESSAGE_POST,
|
||||||
|
GST_TRACER_QUARK_HOOK_ELEMENT_QUERY_PRE,
|
||||||
|
GST_TRACER_QUARK_HOOK_ELEMENT_QUERY_POST,
|
||||||
|
GST_TRACER_QUARK_MAX
|
||||||
|
} GstTracerQuarkId;
|
||||||
|
|
||||||
|
extern GQuark _priv_gst_tracer_quark_table[GST_TRACER_QUARK_MAX];
|
||||||
|
|
||||||
|
#define GST_TRACER_QUARK(q) _priv_gst_tracer_quark_table[GST_TRACER_QUARK_##q]
|
||||||
|
|
||||||
/* tracing module helpers */
|
/* tracing module helpers */
|
||||||
|
|
||||||
void gst_tracer_log_trace (GstStructure * s);
|
|
||||||
|
|
||||||
extern gboolean _priv_tracer_enabled;
|
extern gboolean _priv_tracer_enabled;
|
||||||
extern GList *_priv_tracers[GST_TRACER_HOOK_ID_LAST];
|
extern GHashTable *_priv_tracers;
|
||||||
|
|
||||||
#define GST_TRACER_IS_ENABLED(id) \
|
#define GST_TRACER_IS_ENABLED(id) \
|
||||||
(_priv_tracer_enabled && (_priv_tracers[id] != NULL))
|
(_priv_tracer_enabled && \
|
||||||
|
(g_hash_table_contains (_priv_tracers, GINT_TO_POINTER(id))))
|
||||||
|
|
||||||
#define GST_TRACER_TS \
|
#define GST_TRACER_TS \
|
||||||
GST_CLOCK_DIFF (_priv_gst_info_start_time, gst_util_get_timestamp ())
|
GST_CLOCK_DIFF (_priv_gst_info_start_time, gst_util_get_timestamp ())
|
||||||
|
@ -80,96 +85,96 @@ extern GList *_priv_tracers[GST_TRACER_HOOK_ID_LAST];
|
||||||
/* tracing hooks */
|
/* tracing hooks */
|
||||||
|
|
||||||
#define GST_TRACER_PAD_PUSH_PRE(pad, buffer) G_STMT_START{ \
|
#define GST_TRACER_PAD_PUSH_PRE(pad, buffer) G_STMT_START{ \
|
||||||
if (GST_TRACER_IS_ENABLED(GST_TRACER_HOOK_ID_PAD_PUSH_PRE)) { \
|
if (GST_TRACER_IS_ENABLED(GST_TRACER_QUARK(HOOK_PAD_PUSH_PRE))) { \
|
||||||
gst_tracer_dispatch (GST_TRACER_HOOK_ID_PAD_PUSH_PRE, \
|
gst_tracer_dispatch (GST_TRACER_QUARK(HOOK_PAD_PUSH_PRE), \
|
||||||
GST_TRACER_TS, \
|
GST_TRACER_TS, \
|
||||||
pad, buffer); \
|
pad, buffer); \
|
||||||
} \
|
} \
|
||||||
}G_STMT_END
|
}G_STMT_END
|
||||||
|
|
||||||
#define GST_TRACER_PAD_PUSH_POST(pad, res) G_STMT_START{ \
|
#define GST_TRACER_PAD_PUSH_POST(pad, res) G_STMT_START{ \
|
||||||
if (GST_TRACER_IS_ENABLED(GST_TRACER_HOOK_ID_PAD_PUSH_POST)) { \
|
if (GST_TRACER_IS_ENABLED(GST_TRACER_QUARK(HOOK_PAD_PUSH_POST))) { \
|
||||||
gst_tracer_dispatch (GST_TRACER_HOOK_ID_PAD_PUSH_POST, \
|
gst_tracer_dispatch (GST_TRACER_QUARK(HOOK_PAD_PUSH_POST), \
|
||||||
GST_TRACER_TS, \
|
GST_TRACER_TS, \
|
||||||
pad, res); \
|
pad, res); \
|
||||||
} \
|
} \
|
||||||
}G_STMT_END
|
}G_STMT_END
|
||||||
|
|
||||||
#define GST_TRACER_PAD_PUSH_LIST_PRE(pad, list) G_STMT_START{ \
|
#define GST_TRACER_PAD_PUSH_LIST_PRE(pad, list) G_STMT_START{ \
|
||||||
if (GST_TRACER_IS_ENABLED(GST_TRACER_HOOK_ID_PAD_PUSH_LIST_PRE)) { \
|
if (GST_TRACER_IS_ENABLED(GST_TRACER_QUARK(HOOK_PAD_PUSH_LIST_PRE))) { \
|
||||||
gst_tracer_dispatch (GST_TRACER_HOOK_ID_PAD_PUSH_LIST_PRE, \
|
gst_tracer_dispatch (GST_TRACER_QUARK(HOOK_PAD_PUSH_LIST_PRE), \
|
||||||
GST_TRACER_TS, \
|
GST_TRACER_TS, \
|
||||||
pad, list); \
|
pad, list); \
|
||||||
} \
|
} \
|
||||||
}G_STMT_END
|
}G_STMT_END
|
||||||
|
|
||||||
#define GST_TRACER_PAD_PUSH_LIST_POST(pad, res) G_STMT_START{ \
|
#define GST_TRACER_PAD_PUSH_LIST_POST(pad, res) G_STMT_START{ \
|
||||||
if (GST_TRACER_IS_ENABLED(GST_TRACER_HOOK_ID_PAD_PUSH_LIST_POST)) { \
|
if (GST_TRACER_IS_ENABLED(GST_TRACER_QUARK(HOOK_PAD_PUSH_LIST_POST))) { \
|
||||||
gst_tracer_dispatch (GST_TRACER_HOOK_ID_PAD_PUSH_LIST_POST, \
|
gst_tracer_dispatch (GST_TRACER_QUARK(HOOK_PAD_PUSH_LIST_POST), \
|
||||||
GST_TRACER_TS, \
|
GST_TRACER_TS, \
|
||||||
pad, res); \
|
pad, res); \
|
||||||
} \
|
} \
|
||||||
}G_STMT_END
|
}G_STMT_END
|
||||||
|
|
||||||
#define GST_TRACER_PAD_PULL_RANGE_PRE(pad, offset, size) G_STMT_START{ \
|
#define GST_TRACER_PAD_PULL_RANGE_PRE(pad, offset, size) G_STMT_START{ \
|
||||||
if (GST_TRACER_IS_ENABLED(GST_TRACER_HOOK_ID_PAD_PULL_RANGE_PRE)) { \
|
if (GST_TRACER_IS_ENABLED(GST_TRACER_QUARK(HOOK_PAD_PULL_RANGE_PRE))) { \
|
||||||
gst_tracer_dispatch (GST_TRACER_HOOK_ID_PAD_PULL_RANGE_PRE, \
|
gst_tracer_dispatch (GST_TRACER_QUARK(HOOK_PAD_PULL_RANGE_PRE), \
|
||||||
GST_TRACER_TS, \
|
GST_TRACER_TS, \
|
||||||
pad, offset, size); \
|
pad, offset, size); \
|
||||||
} \
|
} \
|
||||||
}G_STMT_END
|
}G_STMT_END
|
||||||
|
|
||||||
#define GST_TRACER_PAD_PULL_RANGE_POST(pad, buffer, res) G_STMT_START{ \
|
#define GST_TRACER_PAD_PULL_RANGE_POST(pad, buffer, res) G_STMT_START{ \
|
||||||
if (GST_TRACER_IS_ENABLED(GST_TRACER_HOOK_ID_PAD_PULL_RANGE_POST)) { \
|
if (GST_TRACER_IS_ENABLED(GST_TRACER_QUARK(HOOK_PAD_PULL_RANGE_POST))) { \
|
||||||
gst_tracer_dispatch (GST_TRACER_HOOK_ID_PAD_PULL_RANGE_POST, \
|
gst_tracer_dispatch (GST_TRACER_QUARK(HOOK_PAD_PULL_RANGE_POST), \
|
||||||
GST_TRACER_TS, \
|
GST_TRACER_TS, \
|
||||||
pad, buffer, res); \
|
pad, buffer, res); \
|
||||||
} \
|
} \
|
||||||
}G_STMT_END
|
}G_STMT_END
|
||||||
|
|
||||||
#define GST_TRACER_PAD_PUSH_EVENT_PRE(pad, event) G_STMT_START{ \
|
#define GST_TRACER_PAD_PUSH_EVENT_PRE(pad, event) G_STMT_START{ \
|
||||||
if (GST_TRACER_IS_ENABLED(GST_TRACER_HOOK_ID_PAD_PUSH_EVENT_PRE)) { \
|
if (GST_TRACER_IS_ENABLED(GST_TRACER_QUARK(HOOK_PAD_PUSH_EVENT_PRE))) { \
|
||||||
gst_tracer_dispatch (GST_TRACER_HOOK_ID_PAD_PUSH_EVENT_PRE, \
|
gst_tracer_dispatch (GST_TRACER_QUARK(HOOK_PAD_PUSH_EVENT_PRE), \
|
||||||
GST_TRACER_TS, \
|
GST_TRACER_TS, \
|
||||||
pad, event); \
|
pad, event); \
|
||||||
} \
|
} \
|
||||||
}G_STMT_END
|
}G_STMT_END
|
||||||
|
|
||||||
#define GST_TRACER_PAD_PUSH_EVENT_POST(pad, res) G_STMT_START{ \
|
#define GST_TRACER_PAD_PUSH_EVENT_POST(pad, res) G_STMT_START{ \
|
||||||
if (GST_TRACER_IS_ENABLED(GST_TRACER_HOOK_ID_PAD_PUSH_EVENT_POST)) { \
|
if (GST_TRACER_IS_ENABLED(GST_TRACER_QUARK(HOOK_PAD_PUSH_EVENT_POST))) { \
|
||||||
gst_tracer_dispatch (GST_TRACER_HOOK_ID_PAD_PUSH_EVENT_POST, \
|
gst_tracer_dispatch (GST_TRACER_QUARK(HOOK_PAD_PUSH_EVENT_POST), \
|
||||||
GST_TRACER_TS, \
|
GST_TRACER_TS, \
|
||||||
pad, res); \
|
pad, res); \
|
||||||
} \
|
} \
|
||||||
}G_STMT_END
|
}G_STMT_END
|
||||||
|
|
||||||
#define GST_TRACER_ELEMENT_POST_MESSAGE_PRE(element, message) G_STMT_START{ \
|
#define GST_TRACER_ELEMENT_POST_MESSAGE_PRE(element, message) G_STMT_START{ \
|
||||||
if (GST_TRACER_IS_ENABLED(GST_TRACER_HOOK_ID_ELEMENT_POST_MESSAGE_PRE)) { \
|
if (GST_TRACER_IS_ENABLED(GST_TRACER_QUARK(HOOK_ELEMENT_POST_MESSAGE_PRE))) { \
|
||||||
gst_tracer_dispatch (GST_TRACER_HOOK_ID_ELEMENT_POST_MESSAGE_PRE, \
|
gst_tracer_dispatch (GST_TRACER_QUARK(HOOK_ELEMENT_POST_MESSAGE_PRE), \
|
||||||
GST_TRACER_TS, \
|
GST_TRACER_TS, \
|
||||||
element, message); \
|
element, message); \
|
||||||
} \
|
} \
|
||||||
}G_STMT_END
|
}G_STMT_END
|
||||||
|
|
||||||
#define GST_TRACER_ELEMENT_POST_MESSAGE_POST(element, res) G_STMT_START{ \
|
#define GST_TRACER_ELEMENT_POST_MESSAGE_POST(element, res) G_STMT_START{ \
|
||||||
if (GST_TRACER_IS_ENABLED(GST_TRACER_HOOK_ID_ELEMENT_POST_MESSAGE_POST)) { \
|
if (GST_TRACER_IS_ENABLED(GST_TRACER_QUARK(HOOK_ELEMENT_POST_MESSAGE_POST))) { \
|
||||||
gst_tracer_dispatch (GST_TRACER_HOOK_ID_ELEMENT_POST_MESSAGE_POST, \
|
gst_tracer_dispatch (GST_TRACER_QUARK(HOOK_ELEMENT_POST_MESSAGE_POST), \
|
||||||
GST_TRACER_TS, \
|
GST_TRACER_TS, \
|
||||||
element, res); \
|
element, res); \
|
||||||
} \
|
} \
|
||||||
}G_STMT_END
|
}G_STMT_END
|
||||||
|
|
||||||
#define GST_TRACER_ELEMENT_QUERY_PRE(element, query) G_STMT_START{ \
|
#define GST_TRACER_ELEMENT_QUERY_PRE(element, query) G_STMT_START{ \
|
||||||
if (GST_TRACER_IS_ENABLED(GST_TRACER_HOOK_ID_ELEMENT_QUERY_PRE)) { \
|
if (GST_TRACER_IS_ENABLED(GST_TRACER_QUARK(HOOK_ELEMENT_QUERY_PRE))) { \
|
||||||
gst_tracer_dispatch (GST_TRACER_HOOK_ID_ELEMENT_QUERY_PRE, \
|
gst_tracer_dispatch (GST_TRACER_QUARK(HOOK_ELEMENT_QUERY_PRE), \
|
||||||
GST_TRACER_TS, \
|
GST_TRACER_TS, \
|
||||||
element, query); \
|
element, query); \
|
||||||
} \
|
} \
|
||||||
}G_STMT_END
|
}G_STMT_END
|
||||||
|
|
||||||
#define GST_TRACER_ELEMENT_QUERY_POST(element, res) G_STMT_START{ \
|
#define GST_TRACER_ELEMENT_QUERY_POST(element, res) G_STMT_START{ \
|
||||||
if (GST_TRACER_IS_ENABLED(GST_TRACER_HOOK_ID_ELEMENT_QUERY_POST)) { \
|
if (GST_TRACER_IS_ENABLED(GST_TRACER_QUARK(HOOK_ELEMENT_QUERY_POST))) { \
|
||||||
gst_tracer_dispatch (GST_TRACER_HOOK_ID_ELEMENT_QUERY_POST, \
|
gst_tracer_dispatch (GST_TRACER_QUARK(HOOK_ELEMENT_QUERY_POST), \
|
||||||
GST_TRACER_TS, \
|
GST_TRACER_TS, \
|
||||||
element, res); \
|
element, res); \
|
||||||
} \
|
} \
|
||||||
|
|
|
@ -240,25 +240,11 @@ static void
|
||||||
gst_latency_tracer_init (GstLatencyTracer * self)
|
gst_latency_tracer_init (GstLatencyTracer * self)
|
||||||
{
|
{
|
||||||
GstTracer *tracer = GST_TRACER (self);
|
GstTracer *tracer = GST_TRACER (self);
|
||||||
gst_tracer_register_hook (tracer, GST_TRACER_HOOK_ID_PAD_PUSH_PRE,
|
gst_tracer_register_hook (tracer, "pad-push-pre", do_push_buffer_pre);
|
||||||
do_push_buffer_pre);
|
gst_tracer_register_hook (tracer, "pad-push-list-pre", do_push_buffer_pre);
|
||||||
gst_tracer_register_hook (tracer, GST_TRACER_HOOK_ID_PAD_PUSH_LIST_PRE,
|
gst_tracer_register_hook (tracer, "pad-push-post", do_push_buffer_post);
|
||||||
do_push_buffer_pre);
|
gst_tracer_register_hook (tracer, "pad-push-list-post", do_push_buffer_post);
|
||||||
gst_tracer_register_hook (tracer, GST_TRACER_HOOK_ID_PAD_PUSH_POST,
|
gst_tracer_register_hook (tracer, "pad-pull-range-pre", do_pull_range_pre);
|
||||||
do_push_buffer_post);
|
gst_tracer_register_hook (tracer, "pad-pull-range-post", do_pull_range_post);
|
||||||
gst_tracer_register_hook (tracer, GST_TRACER_HOOK_ID_PAD_PUSH_LIST_POST,
|
gst_tracer_register_hook (tracer, "pad-push-event-pre", do_push_event_pre);
|
||||||
do_push_buffer_post);
|
|
||||||
gst_tracer_register_hook (tracer, GST_TRACER_HOOK_ID_PAD_PULL_RANGE_PRE,
|
|
||||||
do_pull_range_pre);
|
|
||||||
gst_tracer_register_hook (tracer, GST_TRACER_HOOK_ID_PAD_PULL_RANGE_POST,
|
|
||||||
do_pull_range_post);
|
|
||||||
gst_tracer_register_hook (tracer, GST_TRACER_HOOK_ID_PAD_PUSH_EVENT_PRE,
|
|
||||||
do_push_event_pre);
|
|
||||||
/*
|
|
||||||
- we should also replace GstTracerHookId with a 'detail' string like in
|
|
||||||
signals
|
|
||||||
- then we can attach to *all* hooks with 'null' as detail
|
|
||||||
gst_tracer_register_hook (self, gchar *detail, func);
|
|
||||||
gst_tracer_register_hook_id (self, GQuark detail, func);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,28 +162,20 @@ gst_log_tracer_init (GstLogTracer * self)
|
||||||
{
|
{
|
||||||
GstTracer *tracer = GST_TRACER (self);
|
GstTracer *tracer = GST_TRACER (self);
|
||||||
|
|
||||||
gst_tracer_register_hook (tracer, GST_TRACER_HOOK_ID_PAD_PUSH_PRE,
|
gst_tracer_register_hook (tracer, "pad-push-pre", do_push_buffer_pre);
|
||||||
do_push_buffer_pre);
|
gst_tracer_register_hook (tracer, "pad-push-post", do_push_buffer_post);
|
||||||
gst_tracer_register_hook (tracer, GST_TRACER_HOOK_ID_PAD_PUSH_POST,
|
gst_tracer_register_hook (tracer, "pad-push-list-pre",
|
||||||
do_push_buffer_post);
|
|
||||||
gst_tracer_register_hook (tracer, GST_TRACER_HOOK_ID_PAD_PUSH_LIST_PRE,
|
|
||||||
do_push_buffer_list_pre);
|
do_push_buffer_list_pre);
|
||||||
gst_tracer_register_hook (tracer, GST_TRACER_HOOK_ID_PAD_PUSH_LIST_POST,
|
gst_tracer_register_hook (tracer, "pad-push-list-post",
|
||||||
do_push_buffer_list_post);
|
do_push_buffer_list_post);
|
||||||
gst_tracer_register_hook (tracer, GST_TRACER_HOOK_ID_PAD_PULL_RANGE_PRE,
|
gst_tracer_register_hook (tracer, "pad-pull-range-pre", do_pull_range_pre);
|
||||||
do_pull_range_pre);
|
gst_tracer_register_hook (tracer, "pad-pull-range-post", do_pull_range_post);
|
||||||
gst_tracer_register_hook (tracer, GST_TRACER_HOOK_ID_PAD_PULL_RANGE_POST,
|
gst_tracer_register_hook (tracer, "pad-push-event-pre", do_push_event_pre);
|
||||||
do_pull_range_post);
|
gst_tracer_register_hook (tracer, "pad-push-event-post", do_push_event_post);
|
||||||
gst_tracer_register_hook (tracer, GST_TRACER_HOOK_ID_PAD_PUSH_EVENT_PRE,
|
gst_tracer_register_hook (tracer, "element-post-message-pre",
|
||||||
do_push_event_pre);
|
|
||||||
gst_tracer_register_hook (tracer, GST_TRACER_HOOK_ID_PAD_PUSH_EVENT_POST,
|
|
||||||
do_push_event_post);
|
|
||||||
gst_tracer_register_hook (tracer, GST_TRACER_HOOK_ID_ELEMENT_POST_MESSAGE_PRE,
|
|
||||||
do_post_message_pre);
|
do_post_message_pre);
|
||||||
gst_tracer_register_hook (tracer,
|
gst_tracer_register_hook (tracer, "element-post-message-post",
|
||||||
GST_TRACER_HOOK_ID_ELEMENT_POST_MESSAGE_POST, do_post_message_post);
|
do_post_message_post);
|
||||||
gst_tracer_register_hook (tracer, GST_TRACER_HOOK_ID_ELEMENT_QUERY_PRE,
|
gst_tracer_register_hook (tracer, "element-query-pre", do_query_pre);
|
||||||
do_query_pre);
|
gst_tracer_register_hook (tracer, "element-query-post", do_query_post);
|
||||||
gst_tracer_register_hook (tracer, GST_TRACER_HOOK_ID_ELEMENT_QUERY_POST,
|
|
||||||
do_query_post);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -340,11 +340,8 @@ static void
|
||||||
gst_rusage_tracer_init (GstRUsageTracer * self)
|
gst_rusage_tracer_init (GstRUsageTracer * self)
|
||||||
{
|
{
|
||||||
GstTracer *tracer = GST_TRACER (self);
|
GstTracer *tracer = GST_TRACER (self);
|
||||||
gint i;
|
|
||||||
|
|
||||||
for (i = 0; i < GST_TRACER_HOOK_ID_LAST; i++) {
|
gst_tracer_register_hook_id (tracer, 0, do_stats);
|
||||||
gst_tracer_register_hook (tracer, i, do_stats);
|
|
||||||
}
|
|
||||||
|
|
||||||
self->threads = g_hash_table_new_full (NULL, NULL, NULL, free_thread_stats);
|
self->threads = g_hash_table_new_full (NULL, NULL, NULL, free_thread_stats);
|
||||||
|
|
||||||
|
|
|
@ -594,33 +594,31 @@ gst_stats_tracer_init (GstStatsTracer * self)
|
||||||
{
|
{
|
||||||
GstTracer *tracer = GST_TRACER (self);
|
GstTracer *tracer = GST_TRACER (self);
|
||||||
|
|
||||||
gst_tracer_register_hook (tracer, GST_TRACER_HOOK_ID_PAD_PUSH_PRE,
|
gst_tracer_register_hook (tracer, "pad-push-pre",
|
||||||
(GstTracerHookFunction) do_push_buffer_pre);
|
(GstTracerHookFunction) do_push_buffer_pre);
|
||||||
gst_tracer_register_hook (tracer, GST_TRACER_HOOK_ID_PAD_PUSH_POST,
|
gst_tracer_register_hook (tracer, "pad-push-post",
|
||||||
(GstTracerHookFunction) do_push_buffer_post);
|
(GstTracerHookFunction) do_push_buffer_post);
|
||||||
gst_tracer_register_hook (tracer, GST_TRACER_HOOK_ID_PAD_PUSH_LIST_PRE,
|
gst_tracer_register_hook (tracer, "pad-push-list-pre",
|
||||||
(GstTracerHookFunction) do_push_buffer_list_pre);
|
(GstTracerHookFunction) do_push_buffer_list_pre);
|
||||||
gst_tracer_register_hook (tracer, GST_TRACER_HOOK_ID_PAD_PUSH_LIST_POST,
|
gst_tracer_register_hook (tracer, "pad-push-list-post",
|
||||||
(GstTracerHookFunction) do_push_buffer_list_post);
|
(GstTracerHookFunction) do_push_buffer_list_post);
|
||||||
gst_tracer_register_hook (tracer, GST_TRACER_HOOK_ID_PAD_PULL_RANGE_PRE,
|
gst_tracer_register_hook (tracer, "pad-pull-range-pre",
|
||||||
(GstTracerHookFunction) do_pull_range_pre);
|
(GstTracerHookFunction) do_pull_range_pre);
|
||||||
gst_tracer_register_hook (tracer, GST_TRACER_HOOK_ID_PAD_PULL_RANGE_POST,
|
gst_tracer_register_hook (tracer, "pad-pull-range-post",
|
||||||
(GstTracerHookFunction) do_pull_range_post);
|
(GstTracerHookFunction) do_pull_range_post);
|
||||||
gst_tracer_register_hook (tracer, GST_TRACER_HOOK_ID_PAD_PUSH_EVENT_PRE,
|
gst_tracer_register_hook (tracer, "pad-push-event-pre",
|
||||||
(GstTracerHookFunction) do_push_event_pre);
|
(GstTracerHookFunction) do_push_event_pre);
|
||||||
gst_tracer_register_hook (tracer, GST_TRACER_HOOK_ID_PAD_PUSH_EVENT_POST,
|
gst_tracer_register_hook (tracer, "pad-push-event-post",
|
||||||
(GstTracerHookFunction) do_push_event_post);
|
(GstTracerHookFunction) do_push_event_post);
|
||||||
gst_tracer_register_hook (tracer, GST_TRACER_HOOK_ID_ELEMENT_POST_MESSAGE_PRE,
|
gst_tracer_register_hook (tracer, "element-post-message-pre",
|
||||||
(GstTracerHookFunction) do_post_message_pre);
|
(GstTracerHookFunction) do_post_message_pre);
|
||||||
gst_tracer_register_hook (tracer,
|
gst_tracer_register_hook (tracer, "element-post-message-post",
|
||||||
GST_TRACER_HOOK_ID_ELEMENT_POST_MESSAGE_POST,
|
|
||||||
(GstTracerHookFunction) do_post_message_post);
|
(GstTracerHookFunction) do_post_message_post);
|
||||||
gst_tracer_register_hook (tracer, GST_TRACER_HOOK_ID_ELEMENT_QUERY_PRE,
|
gst_tracer_register_hook (tracer, "element-query-pre",
|
||||||
(GstTracerHookFunction) do_query_pre);
|
(GstTracerHookFunction) do_query_pre);
|
||||||
gst_tracer_register_hook (tracer, GST_TRACER_HOOK_ID_ELEMENT_QUERY_POST,
|
gst_tracer_register_hook (tracer, "element-query-post",
|
||||||
(GstTracerHookFunction) do_query_post);
|
(GstTracerHookFunction) do_query_post);
|
||||||
|
|
||||||
|
|
||||||
self->elements = g_ptr_array_new_with_free_func (free_element_stats);
|
self->elements = g_ptr_array_new_with_free_func (free_element_stats);
|
||||||
self->pads = g_ptr_array_new_with_free_func (free_pad_stats);
|
self->pads = g_ptr_array_new_with_free_func (free_pad_stats);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue