tracer: switch to quarks and add another hook for buffer flow

Use pre-defines quarks as this will be called quite often.
This commit is contained in:
Stefan Sauer 2013-10-27 17:04:32 +01:00
parent 68b1473846
commit 764b5833b9
5 changed files with 67 additions and 10 deletions

View file

@ -4498,8 +4498,29 @@ __gst_pad_push (GstPad * pad, GstBuffer * buffer)
* *
* MT safe. * MT safe.
*/ */
#ifndef GST_DISABLE_GST_DEBUG
static inline GstFlowReturn __gst_pad_push_list (GstPad * pad,
GstBufferList * list);
#endif
GstFlowReturn GstFlowReturn
gst_pad_push_list (GstPad * pad, GstBufferList * list) gst_pad_push_list (GstPad * pad, GstBufferList * list)
#ifndef GST_DISABLE_GST_DEBUG
{
const gboolean trace = gst_tracer_is_enabled (GST_TRACER_HOOK_ID_BUFFERS);
GstFlowReturn res;
if (trace)
gst_tracer_push_buffer_list_pre (pad, list);
res = __gst_pad_push_list (pad, list);
if (trace)
gst_tracer_push_buffer_list_post (pad, res);
return res;
}
static inline GstFlowReturn
__gst_pad_push_list (GstPad * pad, GstBufferList * list)
#endif
{ {
g_return_val_if_fail (GST_IS_PAD (pad), GST_FLOW_ERROR); g_return_val_if_fail (GST_IS_PAD (pad), GST_FLOW_ERROR);
g_return_val_if_fail (GST_PAD_IS_SRC (pad), GST_FLOW_ERROR); g_return_val_if_fail (GST_PAD_IS_SRC (pad), GST_FLOW_ERROR);

View file

@ -70,7 +70,9 @@ static const gchar *_quark_strings[] = {
"GstMessageNeedContext", "GstMessageHaveContext", "context", "context-type", "GstMessageNeedContext", "GstMessageHaveContext", "context", "context-type",
"GstMessageStreamStart", "group-id", "uri-redirection", "GstMessageStreamStart", "group-id", "uri-redirection",
"GstMessageDeviceAdded", "GstMessageDeviceRemoved", "device", "GstMessageDeviceAdded", "GstMessageDeviceRemoved", "device",
"uri-redirection-permanent" "uri-redirection-permanent",
"push_buffer::pre", "push_buffer::post", "push_buffer_list::pre",
"push_buffer_list::post", ".ts", "return", "pad", "buffer", "list"
}; };
GQuark _priv_gst_quark_table[GST_QUARK_MAX]; GQuark _priv_gst_quark_table[GST_QUARK_MAX];

View file

@ -202,7 +202,16 @@ typedef enum _GstQuarkId
GST_QUARK_MESSAGE_DEVICE_REMOVED = 171, GST_QUARK_MESSAGE_DEVICE_REMOVED = 171,
GST_QUARK_DEVICE = 172, GST_QUARK_DEVICE = 172,
GST_QUARK_URI_REDIRECTION_PERMANENT = 173, GST_QUARK_URI_REDIRECTION_PERMANENT = 173,
GST_QUARK_MAX = 174 GST_QUARK_PUSH_BUFFER_PRE = 174,
GST_QUARK_PUSH_BUFFER_POST = 175,
GST_QUARK_PUSH_BUFFER_LIST_PRE = 176,
GST_QUARK_PUSH_BUFFER_LIST_POST = 177,
GST_QUARK_DOT_TS = 178,
GST_QUARK_RETURN = 179,
GST_QUARK_PAD = 180,
GST_QUARK_BUFFER = 181,
GST_QUARK_LIST = 182,
GST_QUARK_MAX = 183
} GstQuarkId; } GstQuarkId;
extern GQuark _priv_gst_quark_table[GST_QUARK_MAX]; extern GQuark _priv_gst_quark_table[GST_QUARK_MAX];

View file

@ -21,6 +21,7 @@
#include "gst_private.h" #include "gst_private.h"
#include "gstenumtypes.h" #include "gstenumtypes.h"
#include "gstquark.h"
#include "gstregistry.h" #include "gstregistry.h"
#include "gsttracer.h" #include "gsttracer.h"
#include "gsttracerfactory.h" #include "gsttracerfactory.h"
@ -295,19 +296,41 @@ dispatch (GstTracerHookId id, GstStructure * s)
void void
gst_tracer_push_buffer_pre (GstPad * pad, GstBuffer * buffer) gst_tracer_push_buffer_pre (GstPad * pad, GstBuffer * buffer)
{ {
// TODO(ensonic): gst_structure_new_id dispatch (GST_TRACER_HOOK_ID_BUFFERS,
dispatch (GST_TRACER_HOOK_ID_BUFFERS, gst_structure_new ("push_buffer::pre", gst_structure_new_id (GST_QUARK (PUSH_BUFFER_PRE),
".ts", G_TYPE_UINT64, gst_util_get_timestamp (), GST_QUARK (DOT_TS), G_TYPE_UINT64, gst_util_get_timestamp (),
"pad", GST_TYPE_PAD, pad, "buffer", GST_TYPE_BUFFER, buffer, NULL)); GST_QUARK (PAD), GST_TYPE_PAD, pad,
GST_QUARK (BUFFER), GST_TYPE_BUFFER, buffer, NULL));
} }
void void
gst_tracer_push_buffer_post (GstPad * pad, GstFlowReturn res) gst_tracer_push_buffer_post (GstPad * pad, GstFlowReturn res)
{ {
// TODO(ensonic): gst_structure_new_id dispatch (GST_TRACER_HOOK_ID_BUFFERS,
dispatch (GST_TRACER_HOOK_ID_BUFFERS, gst_structure_new ("push_buffer::post", gst_structure_new_id (GST_QUARK (PUSH_BUFFER_POST),
".ts", G_TYPE_UINT64, gst_util_get_timestamp (), GST_QUARK (DOT_TS), G_TYPE_UINT64, gst_util_get_timestamp (),
"pad", GST_TYPE_PAD, pad, "return", G_TYPE_INT, res, NULL)); GST_QUARK (PAD), GST_TYPE_PAD, pad,
GST_QUARK (RETURN), G_TYPE_INT, res, NULL));
}
void
gst_tracer_push_buffer_list_pre (GstPad * pad, GstBufferList * list)
{
dispatch (GST_TRACER_HOOK_ID_BUFFERS,
gst_structure_new_id (GST_QUARK (PUSH_BUFFER_LIST_PRE),
GST_QUARK (DOT_TS), G_TYPE_UINT64, gst_util_get_timestamp (),
GST_QUARK (PAD), GST_TYPE_PAD, pad,
GST_QUARK (LIST), GST_TYPE_BUFFER_LIST, list, NULL));
}
void
gst_tracer_push_buffer_list_post (GstPad * pad, GstFlowReturn res)
{
dispatch (GST_TRACER_HOOK_ID_BUFFERS,
gst_structure_new_id (GST_QUARK (PUSH_BUFFER_LIST_POST),
GST_QUARK (DOT_TS), G_TYPE_UINT64, gst_util_get_timestamp (),
GST_QUARK (PAD), GST_TYPE_PAD, pad,
GST_QUARK (RETURN), G_TYPE_INT, res, NULL));
} }
#endif /* GST_DISABLE_GST_DEBUG */ #endif /* GST_DISABLE_GST_DEBUG */

View file

@ -106,6 +106,8 @@ gboolean gst_tracer_is_enabled (GstTracerHookId id);
void gst_tracer_push_buffer_pre (GstPad *pad, GstBuffer *buffer); void gst_tracer_push_buffer_pre (GstPad *pad, GstBuffer *buffer);
void gst_tracer_push_buffer_post (GstPad *pad, GstFlowReturn res); void gst_tracer_push_buffer_post (GstPad *pad, GstFlowReturn res);
void gst_tracer_push_buffer_list_pre (GstPad * pad, GstBufferList * list);
void gst_tracer_push_buffer_list_post (GstPad * pad, GstFlowReturn res);
#endif /* GST_DISABLE_GST_DEBUG */ #endif /* GST_DISABLE_GST_DEBUG */