![]() |
![]() |
![]() |
GStreamer 0.10 Core Reference Manual | ![]() |
---|---|---|---|---|
#include <gst/gst.h> GstTrace; GstTrace* gst_trace_new (gchar *filename, gint size); void gst_trace_destroy (GstTrace *trace); void gst_trace_flush (GstTrace *trace); void gst_trace_text_flush (GstTrace *trace); #define gst_trace_add_entry (trace,seq,data,msg) #define gst_trace_get_size (trace) #define gst_trace_get_offset (trace) #define gst_trace_get_remaining (trace) void gst_trace_set_default (GstTrace *trace); void gst_trace_read_tsc (gint64 *dst); enum GstAllocTraceFlags; GstAllocTrace; gboolean gst_alloc_trace_available (void); const GList* gst_alloc_trace_list (void); int gst_alloc_trace_live_all (void); void gst_alloc_trace_print_all (void); void gst_alloc_trace_set_flags_all (GstAllocTraceFlags flags); GstAllocTrace* gst_alloc_trace_get (const gchar *name); void gst_alloc_trace_print (const GstAllocTrace *trace); void gst_alloc_trace_print_live (void); void gst_alloc_trace_set_flags (GstAllocTrace *trace, GstAllocTraceFlags flags); #define gst_alloc_trace_register (name) #define gst_alloc_trace_new (trace, mem) #define gst_alloc_trace_free (trace, mem)
Traces allows to track object allocation. They provide a instance counter per GType. The counter is incremented for each object allocated and decremented it when it's freed.
Example 1. Tracing object instances
// trace un-freed object instances gst_alloc_trace_set_flags_all (GST_ALLOC_TRACE_LIVE); if (!gst_alloc_trace_available()
) { g_warning ("Trace not available (recompile with trace enabled)."); }gst_alloc_trace_print_live()
; // do something heregst_alloc_trace_print_live()
;
Last reviewed on 2005-11-21 (0.9.5)
GstTrace* gst_trace_new (gchar *filename, gint size);
Create a ringbuffer of size
in the file with filename
to
store trace results in.
void gst_trace_destroy (GstTrace *trace);
Flush an close the previously allocated trace
.
void gst_trace_flush (GstTrace *trace);
Flush any pending trace entries in trace
to the trace file.
trace
can be NULL in which case the default GstTrace will be
flushed.
void gst_trace_text_flush (GstTrace *trace);
Flush any pending trace entries in trace
to the trace file,
formatted as a text line with timestamp and sequence numbers.
trace
can be NULL in which case the default GstTrace will be
flushed.
#define gst_trace_add_entry(trace,seq,data,msg)
Add an entry to trace
with sequence number seq
, data
and msg
.
If trace
is NULL, the entry will be added to the default GstTrace.
#define gst_trace_get_size(trace) ((trace)->bufsize)
Retrieve the buffer size of trace
.
#define gst_trace_get_offset(trace) ((trace)->bufoffset)
Retrieve the current buffer offset of trace
.
#define gst_trace_get_remaining(trace) ((trace)->bufsize - (trace)->bufoffset)
Retrieve the remaining size in the trace
buffer.
void gst_trace_set_default (GstTrace *trace);
Set the default GstTrace to trace
.
void gst_trace_read_tsc (gint64 *dst);
Read a platform independent timer value that can be used in benchmarks.
dst
:dst
pointer to hold the result.
pointer to hold the result.
dst : |
pointer to hold the result. |
typedef enum { GST_ALLOC_TRACE_LIVE = (1 << 0), GST_ALLOC_TRACE_MEM_LIVE = (1 << 1) } GstAllocTraceFlags;
Flags indicating which tracing feature to enable.
GST_ALLOC_TRACE_LIVE
GST_ALLOC_TRACE_LIVE
Trace number of non-freed memory
Trace number of non-freed memory
GST_ALLOC_TRACE_MEM_LIVE
GST_ALLOC_TRACE_MEM_LIVE
trace pointers of unfreed memory
trace pointers of unfreed memory
GST_ALLOC_TRACE_LIVE |
Trace number of non-freed memory |
GST_ALLOC_TRACE_MEM_LIVE |
trace pointers of unfreed memory |
typedef struct { gchar *name; gint flags; gint live; GSList *mem_live; } GstAllocTrace;
The main tracing object
name
;gcharname
The name of the tracing object
The name of the tracing object
gint flags
;gintflags
Flags for this object
Flags for this object
gint live
;gintlive
counter for live memory
counter for live memory
GSList *mem_live
;GSListmem_live
list with pointers to unfreed memory
list with pointers to unfreed memory
gchar *name ; |
The name of the tracing object |
gint flags ; |
Flags for this object |
gint live ; |
counter for live memory |
GSList *mem_live ; |
list with pointers to unfreed memory |
gboolean gst_alloc_trace_available (void);
Check if alloc tracing was commiled into the core
Returns : | TRUE if the core was compiled with alloc tracing enabled. |
const GList* gst_alloc_trace_list (void);
Get a list of all registered alloc trace objects.
Returns : | a GList of GstAllocTrace objects. |
int gst_alloc_trace_live_all (void);
Get the total number of live registered alloc trace objects.
Returns : | the total number of live registered alloc trace objects. |
void gst_alloc_trace_print_all (void);
Print the status of all registered alloc trace objects.
void gst_alloc_trace_set_flags_all (GstAllocTraceFlags flags);
Enable the specified options on all registered alloc trace objects.
flags
:flags
the options to enable
the options to enable
flags : |
the options to enable |
GstAllocTrace* gst_alloc_trace_get (const gchar *name);
Get the named alloc trace object.
name
:name
the name of the alloc trace object
the name of the alloc trace object
Returns :Returns a GstAllocTrace with the given name or NULL when
no alloc tracer was registered with that name.
a GstAllocTrace with the given name or NULL when
no alloc tracer was registered with that name.
name : |
the name of the alloc trace object |
Returns : | a GstAllocTrace with the given name or NULL when no alloc tracer was registered with that name. |
void gst_alloc_trace_print (const GstAllocTrace *trace);
Print the status of the given GstAllocTrace.
trace
:trace
the GstAllocTrace to print
the GstAllocTrace to print
trace : |
the GstAllocTrace to print |
void gst_alloc_trace_print_live (void);
Print the status of all registered alloc trace objects, ignoring those without live objects.
void gst_alloc_trace_set_flags (GstAllocTrace *trace, GstAllocTraceFlags flags);
Enable the given features on the given GstAllocTrace object.
trace
:trace
the GstAllocTrace
the GstAllocTrace
flags
:flags
flags to set
flags to set
trace : |
the GstAllocTrace |
flags : |
flags to set |
#define gst_alloc_trace_register(name)
Register a new alloc tracer with the given name
name
:name
The name of the tracer object
The name of the tracer object
name : |
The name of the tracer object |
#define gst_alloc_trace_new(trace, mem)
Use the tracer to trace a new memory allocation
trace
:trace
The tracer to use
The tracer to use
mem
:mem
The memory allocated
The memory allocated
trace : |
The tracer to use |
mem : |
The memory allocated |