diff options
author | Benjamin Otte <otte@gnome.org> | 2003-05-10 12:42:02 +0000 |
---|---|---|
committer | Benjamin Otte <otte@gnome.org> | 2003-05-10 12:42:02 +0000 |
commit | b74e6f24f285c791baf59a5f22b6e1f001bebb3c (patch) | |
tree | 80122dcf1c29a26146c029255c589c2e88355975 | |
parent | b41c935ff72e44785794b44ba0d400103ad1c904 (diff) |
enable allocation tracing for GstObjects and make allocation tracing a configure switch (enable by default for now)
Original commit message from CVS:
enable allocation tracing for GstObjects and make allocation tracing a configure switch (enable by default for now)
-rw-r--r-- | configure.ac | 3 | ||||
-rw-r--r-- | gst/gstobject.c | 41 | ||||
-rw-r--r-- | gst/gsttrace.c | 10 | ||||
-rw-r--r-- | gst/gsttrace.h | 12 |
4 files changed, 54 insertions, 12 deletions
diff --git a/configure.ac b/configure.ac index 4cfeb5173..af4e49724 100644 --- a/configure.ac +++ b/configure.ac @@ -327,6 +327,9 @@ translit(dnm, m, l) AM_CONDITIONAL(GST_DISABLE_PARSE, true) GST_SUBSYSTEM_DISABLE(PARSE,[command-line parser]) translit(dnm, m, l) AM_CONDITIONAL(GST_DISABLE_TRACE, true) GST_SUBSYSTEM_DISABLE(TRACE,[tracing subsystem]) +translit(dnm, m, l) AM_CONDITIONAL(GST_DISABLE_ALLOC_TRACE, true) +GST_SUBSYSTEM_DISABLE(ALLOC_TRACE,[allocation tracing]) + translit(dnm, m, l) AM_CONDITIONAL(GST_DISABLE_REGISTRY, true) GST_SUBSYSTEM_DISABLE(REGISTRY,[plugin registry]) translit(dnm, m, l) AM_CONDITIONAL(GST_DISABLE_ENUMTYPES, true) diff --git a/gst/gstobject.c b/gst/gstobject.c index 2c8adeff4..bcff8a91a 100644 --- a/gst/gstobject.c +++ b/gst/gstobject.c @@ -24,6 +24,9 @@ #include "gstobject.h" #include "gstlog.h" +#ifndef GST_DISABLE_TRACE +#include "gsttrace.h" +#endif /* Object signals and args */ enum { @@ -64,6 +67,10 @@ static guint gst_signal_object_signals[SO_LAST_SIGNAL] = { 0 }; static void gst_object_class_init (GstObjectClass *klass); static void gst_object_init (GstObject *object); +#ifndef GST_DISABLE_TRACE +static GObject * gst_object_constructor (GType type, guint n_construct_properties, + GObjectConstructParam *construct_params); +#endif static void gst_object_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); @@ -156,6 +163,9 @@ gst_object_class_init (GstObjectClass *klass) gobject_class->dispose = gst_object_dispose; gobject_class->finalize = gst_object_finalize; +#ifndef GST_DISABLE_TRACE + gobject_class->constructor = gst_object_constructor; +#endif } static void @@ -169,6 +179,25 @@ gst_object_init (GstObject *object) GST_FLAG_SET (object, GST_FLOATING); } +#ifndef GST_DISABLE_TRACE +static GObject * +gst_object_constructor (GType type, guint n_construct_properties, GObjectConstructParam *construct_params) +{ + const gchar *name; + GstAllocTrace *trace; + GObject *obj = G_OBJECT_CLASS (parent_class)->constructor (type, n_construct_properties, construct_params); + + name = g_type_name (type); + + trace = gst_alloc_trace_get (name); + if (!trace) { + trace = gst_alloc_trace_register (name); + } + gst_alloc_trace_new (trace, obj); + + return obj; +} +#endif /** * gst_object_ref: * @object: GstObject to reference @@ -281,6 +310,18 @@ gst_object_finalize (GObject *object) g_mutex_free (gstobject->lock); +#ifndef GST_DISABLE_TRACE + { + const gchar *name; + GstAllocTrace *trace; + + name = g_type_name (G_OBJECT_TYPE (object)); + trace = gst_alloc_trace_get (name); + g_assert (trace); + gst_alloc_trace_free (trace, object); + } +#endif + parent_class->finalize (object); } diff --git a/gst/gsttrace.c b/gst/gsttrace.c index 25670d371..990d4ed71 100644 --- a/gst/gsttrace.c +++ b/gst/gsttrace.c @@ -171,10 +171,10 @@ static GList *_gst_alloc_tracers = NULL; gboolean gst_alloc_trace_available (void) { -#ifdef GST_WITH_ALLOC_TRACE - return TRUE; -#else +#ifdef GST_DISABLE_ALLOC_TRACE return FALSE; +#else + return TRUE; #endif } @@ -227,7 +227,7 @@ void gst_alloc_trace_print_all (void) { GList *walk = _gst_alloc_tracers; - + while (walk) { GstAllocTrace *trace = (GstAllocTrace *) walk->data; @@ -338,5 +338,3 @@ gst_alloc_trace_set_flags (GstAllocTrace *trace, GstAllocTraceFlags flags) trace->flags = flags; } - - diff --git a/gst/gsttrace.h b/gst/gsttrace.h index f947da5ee..fb84f6fd5 100644 --- a/gst/gsttrace.h +++ b/gst/gsttrace.h @@ -97,7 +97,7 @@ void gst_alloc_trace_print (const GstAllocTrace *trace); void gst_alloc_trace_set_flags (GstAllocTrace *trace, GstAllocTraceFlags flags); -#ifdef GST_WITH_ALLOC_TRACE +#ifndef GST_DISABLE_ALLOC_TRACE #define gst_alloc_trace_register(name) _gst_alloc_trace_register (name); #define gst_alloc_trace_new(trace, mem) \ G_STMT_START { \ @@ -118,7 +118,7 @@ G_STMT_START { \ } G_STMT_END #else -#define gst_alloc_trace_register(name) NULL +#define gst_alloc_trace_register(name) (NULL) #define gst_alloc_trace_new(trace, mem) #define gst_alloc_trace_free(trace, mem) #endif @@ -152,14 +152,14 @@ extern gint _gst_trace_on; #define gst_alloc_trace_new(trace, mem) #define gst_alloc_trace_free(trace, mem) -#define gst_alloc_trace_available() FALSE -#define gst_alloc_trace_list() NULL -#define _gst_alloc_trace_register(name) NULL +#define gst_alloc_trace_available() (FALSE) +#define gst_alloc_trace_list() (NULL) +#define _gst_alloc_trace_register(name) (NULL) #define gst_alloc_trace_print_all() #define gst_alloc_trace_set_flags_all(flags) -#define gst_alloc_trace_get(name) NULL +#define gst_alloc_trace_get(name) (NULL) #define gst_alloc_trace_print(trace) #define gst_alloc_trace_set_flags(trace,flags) |