mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-23 14:36:24 +00:00
tracer: Add memory init/free hooks
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8510>
This commit is contained in:
parent
ae33acda5d
commit
c3bf39e7a4
3 changed files with 106 additions and 1 deletions
|
@ -95,7 +95,9 @@ _gst_memory_free (GstMemory * mem)
|
|||
|
||||
allocator = mem->allocator;
|
||||
|
||||
GST_TRACER_MEMORY_FREE_PRE (mem);
|
||||
gst_allocator_free (allocator, mem);
|
||||
GST_TRACER_MEMORY_FREE_POST (mem);
|
||||
|
||||
gst_object_unref (allocator);
|
||||
}
|
||||
|
@ -139,6 +141,7 @@ gst_memory_init (GstMemory * mem, GstMemoryFlags flags,
|
|||
GST_CAT_DEBUG (GST_CAT_MEMORY, "new memory %p, maxsize:%" G_GSIZE_FORMAT
|
||||
" offset:%" G_GSIZE_FORMAT " size:%" G_GSIZE_FORMAT, mem, maxsize,
|
||||
offset, size);
|
||||
GST_TRACER_MEMORY_INIT (mem);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -58,6 +58,7 @@ static const gchar *_quark_strings[] = {
|
|||
"object-reffed", "object-unreffed", "plugin-feature-loaded",
|
||||
"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",
|
||||
};
|
||||
|
||||
GQuark _priv_gst_tracer_quark_table[GST_TRACER_QUARK_MAX];
|
||||
|
|
|
@ -86,6 +86,30 @@ typedef enum /*< skip >*/
|
|||
GST_TRACER_QUARK_HOOK_PAD_CHAIN_LIST_POST,
|
||||
GST_TRACER_QUARK_HOOK_PAD_SEND_EVENT_PRE,
|
||||
GST_TRACER_QUARK_HOOK_PAD_SEND_EVENT_POST,
|
||||
/**
|
||||
* GST_TRACER_QUARK_HOOK_MEMORY_INIT:
|
||||
*
|
||||
* Post-hook for memory initialization named "memory-init".
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
GST_TRACER_QUARK_HOOK_MEMORY_INIT,
|
||||
/**
|
||||
* GST_TRACER_QUARK_HOOK_MEMORY_FREE_PRE:
|
||||
*
|
||||
* Pre-hook for memory freeing named "memory-free-pre".
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
GST_TRACER_QUARK_HOOK_MEMORY_FREE_PRE,
|
||||
/**
|
||||
* GST_TRACER_QUARK_HOOK_MEMORY_FREE_POST:
|
||||
*
|
||||
* Post-hook for memory freeing named "memory-free-post".
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
GST_TRACER_QUARK_HOOK_MEMORY_FREE_POST,
|
||||
GST_TRACER_QUARK_MAX
|
||||
} GstTracerQuarkId;
|
||||
|
||||
|
@ -277,7 +301,7 @@ typedef void (*GstTracerHookPadPushEventPost) (GObject *self, GstClockTime ts,
|
|||
* @ts: the current timestamp
|
||||
* @pad: the pad
|
||||
* @event: the event
|
||||
*
|
||||
*
|
||||
* Pre-hook for gst_pad_send_event_unchecked() named "pad-send-event-pre".
|
||||
*/
|
||||
typedef void (*GstTracerHookPadSendEventPre) (GObject *self, GstClockTime ts,
|
||||
|
@ -883,6 +907,79 @@ typedef void (*GstTracerHookPadChainListPost) (GObject *self, GstClockTime ts,
|
|||
GstTracerHookPadChainListPost, (GST_TRACER_ARGS, pad, res)); \
|
||||
}G_STMT_END
|
||||
|
||||
/**
|
||||
* GstTracerHookMemoryInit:
|
||||
* @self: the tracer instance
|
||||
* @ts: the current timestamp
|
||||
* @mem: The GstMemory that was initialized
|
||||
*
|
||||
* Hook for memory initialization named "memory-init".
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
typedef void (*GstTracerHookMemoryInit) (GObject *self, GstClockTime ts,
|
||||
GstMemory *mem);
|
||||
/**
|
||||
* GST_TRACER_MEMORY_INIT:
|
||||
* @mem: a #GstMemory
|
||||
*
|
||||
* Dispatches the "memory-init" hook.
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
#define GST_TRACER_MEMORY_INIT(mem) G_STMT_START{ \
|
||||
GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_MEMORY_INIT), \
|
||||
GstTracerHookMemoryInit, (GST_TRACER_ARGS, mem)); \
|
||||
}G_STMT_END
|
||||
|
||||
/**
|
||||
* GstTracerHookMemoryFreePre:
|
||||
* @self: the tracer instance
|
||||
* @ts: the current timestamp
|
||||
* @mem: the memory object for which the memory will be freed.
|
||||
*
|
||||
* Pre-hook for memory freeing named "memory-free-pre".
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
typedef void (*GstTracerHookMemoryFreePre) (GObject *self, GstClockTime ts, GstMemory *mem);
|
||||
/**
|
||||
* GST_TRACER_MEMORY_FREE_PRE:
|
||||
* @mem: the memory object
|
||||
*
|
||||
* Dispatches the "memory-free-pre" hook.
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
#define GST_TRACER_MEMORY_FREE_PRE(mem) G_STMT_START{ \
|
||||
GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_MEMORY_FREE_PRE), \
|
||||
GstTracerHookMemoryFreePre, (GST_TRACER_ARGS, mem)); \
|
||||
}G_STMT_END
|
||||
|
||||
/**
|
||||
* GstTracerHookMemoryFreePost:
|
||||
* @self: the tracer instance
|
||||
* @ts: the current timestamp
|
||||
* @mem: pointer to the memory object that has been freed
|
||||
*
|
||||
* Post-hook for memory freeing named "memory-free-post".
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
typedef void (*GstTracerHookMemoryFreePost) (GObject *self, GstClockTime ts, GstMemory *mem);
|
||||
/**
|
||||
* GST_TRACER_MEMORY_FREE_POST:
|
||||
* @mem: pointer to the memory object that has been freed
|
||||
*
|
||||
* Dispatches the "memory-free-post" hook.
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
#define GST_TRACER_MEMORY_FREE_POST(mem) G_STMT_START{ \
|
||||
GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_MEMORY_FREE_POST), \
|
||||
GstTracerHookMemoryFreePost, (GST_TRACER_ARGS, mem)); \
|
||||
}G_STMT_END
|
||||
|
||||
#else /* !GST_DISABLE_GST_TRACER_HOOKS */
|
||||
|
||||
static inline void
|
||||
|
@ -938,6 +1035,10 @@ _priv_gst_tracing_deinit (void)
|
|||
#define GST_TRACER_PAD_CHAIN_LIST_POST(pad, res)
|
||||
#define GST_TRACER_PAD_SEND_EVENT_PRE(pad, event)
|
||||
#define GST_TRACER_PAD_SEND_EVENT_POST(pad, res)
|
||||
#define GST_TRACER_MEMORY_INIT(mem)
|
||||
#define GST_TRACER_MEMORY_FREE_PRE(mem)
|
||||
#define GST_TRACER_MEMORY_FREE_POST(mem)
|
||||
|
||||
|
||||
#endif /* GST_DISABLE_GST_TRACER_HOOKS */
|
||||
|
||||
|
|
Loading…
Reference in a new issue