tracer: Add a hook to track when buffers are queued/dequeued in pools
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8617>
This commit is contained in:
parent
1a971d8e12
commit
9979936703
@ -413,11 +413,14 @@ default_stop (GstBufferPool * pool)
|
||||
g_mutex_lock (&priv->queue_lock);
|
||||
while ((buffer = gst_vec_deque_pop_head (priv->queue))) {
|
||||
g_mutex_unlock (&priv->queue_lock);
|
||||
GST_TRACER_POOL_BUFFER_DEQUEUED (pool, buffer);
|
||||
|
||||
do_free_buffer (pool, buffer);
|
||||
g_mutex_lock (&priv->queue_lock);
|
||||
}
|
||||
cleared = priv->cur_buffers == 0;
|
||||
g_mutex_unlock (&priv->queue_lock);
|
||||
|
||||
return cleared;
|
||||
}
|
||||
|
||||
@ -1106,6 +1109,7 @@ default_acquire_buffer (GstBufferPool * pool, GstBuffer ** buffer,
|
||||
g_mutex_unlock (&priv->queue_lock);
|
||||
|
||||
if (G_LIKELY (*buffer)) {
|
||||
GST_TRACER_POOL_BUFFER_DEQUEUED (pool, *buffer);
|
||||
result = GST_FLOW_OK;
|
||||
GST_LOG_OBJECT (pool, "acquired buffer %p", *buffer);
|
||||
break;
|
||||
@ -1293,6 +1297,8 @@ default_release_buffer (GstBufferPool * pool, GstBuffer * buffer)
|
||||
g_cond_signal (&pool->priv->queue_cond);
|
||||
g_mutex_unlock (&pool->priv->queue_lock);
|
||||
|
||||
GST_TRACER_POOL_BUFFER_QUEUED (pool, buffer);
|
||||
|
||||
return;
|
||||
|
||||
memory_tagged:
|
||||
|
@ -59,6 +59,7 @@ static const gchar *_quark_strings[] = {
|
||||
"pad-chain-pre", "pad-chain-post", "pad-chain-list-pre",
|
||||
"pad-chain-list-post", "pad-send-event-pre", "pad-send-event-post",
|
||||
"memory-init", "memory-free-pre", "memory-free-post",
|
||||
"pool-buffer-queued", "pool-buffer-dequeued",
|
||||
};
|
||||
|
||||
GQuark _priv_gst_tracer_quark_table[GST_TRACER_QUARK_MAX];
|
||||
|
@ -110,6 +110,25 @@ typedef enum /*< skip >*/
|
||||
* Since: 1.26
|
||||
*/
|
||||
GST_TRACER_QUARK_HOOK_MEMORY_FREE_POST,
|
||||
|
||||
/**
|
||||
* GST_TRACER_QUARK_HOOK_POOL_BUFFER_QUEUED:
|
||||
*
|
||||
* Hook for buffers queued into a buffer pool.
|
||||
*
|
||||
* Since: 1.28
|
||||
*/
|
||||
GST_TRACER_QUARK_HOOK_POOL_BUFFER_QUEUED,
|
||||
|
||||
/**
|
||||
* GST_TRACER_QUARK_HOOK_POOL_BUFFER_DEQUEUED:
|
||||
*
|
||||
* Hook for buffers dequeued from a buffer pool.
|
||||
*
|
||||
* Since: 1.28
|
||||
*/
|
||||
GST_TRACER_QUARK_HOOK_POOL_BUFFER_DEQUEUED,
|
||||
|
||||
GST_TRACER_QUARK_MAX
|
||||
} GstTracerQuarkId;
|
||||
|
||||
@ -980,6 +999,59 @@ typedef void (*GstTracerHookMemoryFreePost) (GObject *self, GstClockTime ts, Gst
|
||||
GstTracerHookMemoryFreePost, (GST_TRACER_ARGS, mem)); \
|
||||
}G_STMT_END
|
||||
|
||||
|
||||
/**
|
||||
* GstTracerHookPoolBufferQueued:
|
||||
* @self: the tracer instance
|
||||
* @ts: the current timestamp
|
||||
* @pool: a #GstBufferPool
|
||||
* @buffer: pointer to the #GstBuffer that has been queued into @pool
|
||||
*
|
||||
* Hook for pool buffer queued named "pool-buffer-queued".
|
||||
*
|
||||
* Since: 1.28
|
||||
*/
|
||||
typedef void (*GstTracerHookPoolBufferQueued) (GObject *self, GstClockTime ts, GstBufferPool *pool, GstBuffer *buffer);
|
||||
/**
|
||||
* GST_TRACER_POOL_BUFFER_QUEUED:
|
||||
* @pool: a #GstBufferPool
|
||||
* @buffer: pointer to the #GstBuffer that has been queued into @pool
|
||||
*
|
||||
* Dispatches the "pool-buffer-queued" hook.
|
||||
*
|
||||
* Since: 1.28
|
||||
*/
|
||||
#define GST_TRACER_POOL_BUFFER_QUEUED(pool, buf) G_STMT_START{ \
|
||||
GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_POOL_BUFFER_QUEUED), \
|
||||
GstTracerHookPoolBufferQueued, (GST_TRACER_ARGS, pool, buf)); \
|
||||
}G_STMT_END
|
||||
|
||||
/**
|
||||
* GstTracerHookPoolBufferDequeued:
|
||||
* @self: the tracer instance
|
||||
* @ts: the current timestamp
|
||||
* @pool: a #GstBufferPool
|
||||
* @buffer: pointer to the #GstBuffer that has been dequeued from @pool
|
||||
*
|
||||
* Hook for pool buffer dequeued named "pool-buffer-dequeued".
|
||||
*
|
||||
* Since: 1.28
|
||||
*/
|
||||
typedef void (*GstTracerHookPoolBufferDequeued) (GObject *self, GstClockTime ts, GstBufferPool *pool, GstBuffer *buffer);
|
||||
/**
|
||||
* GST_TRACER_POOL_BUFFER_DEQUEUED:
|
||||
* @pool: a #GstBufferPool
|
||||
* @buffer: pointer to the #GstBuffer that has been dequeued from @pool
|
||||
*
|
||||
* Dispatches the "pool-buffer-dequeued" hook.
|
||||
*
|
||||
* Since: 1.28
|
||||
*/
|
||||
#define GST_TRACER_POOL_BUFFER_DEQUEUED(pool, buffer) G_STMT_START{ \
|
||||
GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_POOL_BUFFER_DEQUEUED), \
|
||||
GstTracerHookPoolBufferDequeued, (GST_TRACER_ARGS, pool, buffer)); \
|
||||
}G_STMT_END
|
||||
|
||||
#else /* !GST_DISABLE_GST_TRACER_HOOKS */
|
||||
|
||||
static inline void
|
||||
@ -1038,6 +1110,8 @@ _priv_gst_tracing_deinit (void)
|
||||
#define GST_TRACER_MEMORY_INIT(mem)
|
||||
#define GST_TRACER_MEMORY_FREE_PRE(mem)
|
||||
#define GST_TRACER_MEMORY_FREE_POST(mem)
|
||||
#define GST_TRACER_POOL_BUFFER_QUEUED(mem)
|
||||
#define GST_TRACER_POOL_BUFFER_DEQUEUED(mem)
|
||||
|
||||
|
||||
#endif /* GST_DISABLE_GST_TRACER_HOOKS */
|
||||
|
Loading…
x
Reference in New Issue
Block a user