From 321ee10bd6a3fec0951e93e3e112603693d86c33 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 27 Jan 2012 17:50:42 +0100 Subject: [PATCH] trace: rework alloc tracing Remove trace, we use debug log for that Make alloc trace simpler, removing some methods. Activate alloc trace with a GST_TRACE=3 environment variable. Dump leaked objects atexit. Provide an offset in the object where the GType can be found so that more verbose info can be given for objects. Remove -T option from gst-launch because tracing is now triggered with the environment variable. --- gst/gst.c | 18 +-- gst/gstcaps.c | 5 +- gst/gstclock.c | 6 +- gst/gstminiobject.c | 6 +- gst/gstobject.c | 7 +- gst/gsttrace.c | 399 +++++++--------------------------------------------- gst/gsttrace.h | 146 +++---------------- tools/gst-launch.c | 14 -- 8 files changed, 83 insertions(+), 518 deletions(-) diff --git a/gst/gst.c b/gst/gst.c index f24d258..f14cfef 100644 --- a/gst/gst.c +++ b/gst/gst.c @@ -626,10 +626,6 @@ init_post (GOptionContext * context, GOptionGroup * group, gpointer data, { GLogLevelFlags llf; -#ifndef GST_DISABLE_TRACE - GstTrace *gst_trace; -#endif /* GST_DISABLE_TRACE */ - if (gst_initialized) { GST_DEBUG ("already initialized"); return TRUE; @@ -638,6 +634,8 @@ init_post (GOptionContext * context, GOptionGroup * group, gpointer data, llf = G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_ERROR | G_LOG_FLAG_FATAL; g_log_set_handler (g_log_domain_gstreamer, llf, debug_log_handler, NULL); + _priv_gst_alloc_trace_initialize (); + _priv_gst_mini_object_initialize (); _priv_gst_quarks_initialize (); _priv_gst_memory_initialize (); @@ -647,8 +645,6 @@ init_post (GOptionContext * context, GOptionGroup * group, gpointer data, _priv_gst_caps_initialize (); _priv_gst_meta_initialize (); - g_mutex_init (&_gst_trace_mutex); - g_type_class_ref (gst_object_get_type ()); g_type_class_ref (gst_pad_get_type ()); g_type_class_ref (gst_element_factory_get_type ()); @@ -767,14 +763,6 @@ init_post (GOptionContext * context, GOptionGroup * group, gpointer data, if (!gst_update_registry ()) return FALSE; -#ifndef GST_DISABLE_TRACE - _gst_trace_on = 0; - if (_gst_trace_on) { - gst_trace = gst_trace_new ("gst.trace", 1024); - gst_trace_set_default (gst_trace); - } -#endif /* GST_DISABLE_TRACE */ - GST_INFO ("GLib runtime version: %d.%d.%d", glib_major_version, glib_minor_version, glib_micro_version); GST_INFO ("GLib headers version: %d.%d.%d", GLIB_MAJOR_VERSION, @@ -1017,7 +1005,7 @@ gst_deinit (void) _priv_gst_registry_cleanup (); - g_mutex_clear (&_gst_trace_mutex); + _priv_gst_alloc_trace_deinit (); g_type_class_unref (g_type_class_peek (gst_object_get_type ())); g_type_class_unref (g_type_class_peek (gst_pad_get_type ())); diff --git a/gst/gstcaps.c b/gst/gstcaps.c index 1cf0263..cc410a3 100644 --- a/gst/gstcaps.c +++ b/gst/gstcaps.c @@ -395,15 +395,14 @@ gst_static_caps_get (GstStaticCaps * static_caps) if (G_UNLIKELY (string == NULL)) goto no_string; - GST_CAT_TRACE (GST_CAT_CAPS, "creating %p", static_caps); - *caps = gst_caps_from_string (string); /* convert to string */ if (G_UNLIKELY (*caps == NULL)) g_critical ("Could not convert static caps \"%s\"", string); - GST_CAT_TRACE (GST_CAT_CAPS, "created %p", static_caps); + GST_CAT_TRACE (GST_CAT_CAPS, "created %p from string %s", static_caps, + string); done: G_UNLOCK (static_caps_lock); } diff --git a/gst/gstclock.c b/gst/gstclock.c index 760feff..be24d9f 100644 --- a/gst/gstclock.c +++ b/gst/gstclock.c @@ -188,7 +188,7 @@ gst_clock_entry_new (GstClock * clock, GstClockTime time, entry = g_slice_new (GstClockEntry); #ifndef GST_DISABLE_TRACE - gst_alloc_trace_new (_gst_clock_entry_trace, entry); + _gst_alloc_trace_new (_gst_clock_entry_trace, entry); #endif GST_CAT_DEBUG_OBJECT (GST_CAT_CLOCK, clock, "created entry %p, time %" GST_TIME_FORMAT, entry, GST_TIME_ARGS (time)); @@ -305,7 +305,7 @@ _gst_clock_id_free (GstClockID id) entry->destroy_data (entry->user_data); #ifndef GST_DISABLE_TRACE - gst_alloc_trace_free (_gst_clock_entry_trace, id); + _gst_alloc_trace_free (_gst_clock_entry_trace, id); #endif g_slice_free (GstClockEntry, id); } @@ -658,7 +658,7 @@ gst_clock_class_init (GstClockClass * klass) #ifndef GST_DISABLE_TRACE _gst_clock_entry_trace = - gst_alloc_trace_register (GST_CLOCK_ENTRY_TRACE_NAME); + _gst_alloc_trace_register (GST_CLOCK_ENTRY_TRACE_NAME, -1); #endif gobject_class->dispose = gst_clock_dispose; diff --git a/gst/gstminiobject.c b/gst/gstminiobject.c index 2a42b61..eff3bb4 100644 --- a/gst/gstminiobject.c +++ b/gst/gstminiobject.c @@ -50,7 +50,7 @@ void _priv_gst_mini_object_initialize (void) { #ifndef GST_DISABLE_TRACE - _gst_mini_object_trace = gst_alloc_trace_register ("GstMiniObject"); + _gst_mini_object_trace = _gst_alloc_trace_register ("GstMiniObject", 0); #endif } @@ -77,7 +77,7 @@ gst_mini_object_init (GstMiniObject * mini_object, GType type, gsize size) mini_object->weak_refs = NULL; #ifndef GST_DISABLE_TRACE - gst_alloc_trace_new (_gst_mini_object_trace, mini_object); + _gst_alloc_trace_new (_gst_mini_object_trace, mini_object); #endif } @@ -237,7 +237,7 @@ gst_mini_object_unref (GstMiniObject * mini_object) weak_refs_notify (mini_object); #ifndef GST_DISABLE_TRACE - gst_alloc_trace_free (_gst_mini_object_trace, mini_object); + _gst_alloc_trace_free (_gst_mini_object_trace, mini_object); #endif if (mini_object->free) mini_object->free (mini_object); diff --git a/gst/gstobject.c b/gst/gstobject.c index 7863256..9ce57fd 100644 --- a/gst/gstobject.c +++ b/gst/gstobject.c @@ -204,7 +204,8 @@ gst_object_class_init (GstObjectClass * klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); #ifndef GST_DISABLE_TRACE - _gst_object_trace = gst_alloc_trace_register (g_type_name (GST_TYPE_OBJECT)); + _gst_object_trace = + _gst_alloc_trace_register (g_type_name (GST_TYPE_OBJECT), 0); #endif gobject_class->set_property = gst_object_set_property; @@ -256,7 +257,7 @@ gst_object_init (GstObject * object) GST_CAT_TRACE_OBJECT (GST_CAT_REFCOUNTING, object, "%p new", object); #ifndef GST_DISABLE_TRACE - gst_alloc_trace_new (_gst_object_trace, object); + _gst_alloc_trace_new (_gst_object_trace, object); #endif object->flags = 0; @@ -451,7 +452,7 @@ gst_object_finalize (GObject * object) g_mutex_clear (&gstobject->lock); #ifndef GST_DISABLE_TRACE - gst_alloc_trace_free (_gst_object_trace, object); + _gst_alloc_trace_free (_gst_object_trace, object); #endif ((GObjectClass *) gst_object_parent_class)->finalize (object); diff --git a/gst/gsttrace.c b/gst/gsttrace.c index 4758691..c591911 100644 --- a/gst/gsttrace.c +++ b/gst/gsttrace.c @@ -68,222 +68,44 @@ GMutex _gst_trace_mutex; -static inline void -read_tsc (gint64 * dst) -{ -#if defined(HAVE_RDTSC) && defined(__GNUC__) - guint64 tsc; - __asm__ __volatile__ ("rdtsc":"=A" (tsc)); - - *dst = tsc; -#else - *dst = 0; -#endif -} - -/** - * gst_trace_read_tsc: - * @dst: (out) pointer to hold the result. - * - * Read a platform independent timer value that can be used in - * benchmarks. - */ -void -gst_trace_read_tsc (gint64 * dst) -{ - read_tsc (dst); -} - -static GstTrace *_gst_trace_default = NULL; -gint _gst_trace_on = 1; - -/** - * gst_trace_new: - * @filename: a filename - * @size: the max size of the file - * - * Create a ringbuffer of @size in the file with @filename to - * store trace results in. - * - * Free-function: gst_trace_destroy - * - * Returns: (transfer full): a new #GstTrace. - */ -GstTrace * -gst_trace_new (const gchar * filename, gint size) -{ - GstTrace *trace = g_slice_new (GstTrace); - - g_return_val_if_fail (trace != NULL, NULL); - trace->filename = g_strdup (filename); - GST_DEBUG ("opening '%s'", trace->filename); -#ifndef S_IWUSR -#define S_IWUSR S_IWRITE -#endif -#ifndef S_IRUSR -#define S_IRUSR S_IREAD -#endif - trace->fd = - open (trace->filename, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); - perror ("opening trace file"); - g_return_val_if_fail (trace->fd > 0, NULL); - trace->buf = g_malloc (size * sizeof (GstTraceEntry)); - g_return_val_if_fail (trace->buf != NULL, NULL); - trace->bufsize = size; - trace->bufoffset = 0; - - return trace; -} - -/** - * gst_trace_destroy: - * @trace: (in) (transfer full): the #GstTrace to destroy - * - * Flush an close the previously allocated @trace. - */ -void -gst_trace_destroy (GstTrace * trace) -{ - g_return_if_fail (trace != NULL); - g_return_if_fail (trace->buf != NULL); +/* global flags */ +static GstAllocTraceFlags _gst_trace_flags = GST_ALLOC_TRACE_NONE; - if (gst_trace_get_remaining (trace) > 0) - gst_trace_flush (trace); - close (trace->fd); - g_free (trace->buf); - g_slice_free (GstTrace, trace); -} +/* list of registered tracers */ +static GList *_gst_alloc_tracers = NULL; -/** - * gst_trace_flush: - * @trace: the #GstTrace to flush. - * - * 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_flush (GstTrace * trace) +static void +_at_exit (void) { - int res, buf_len; - - if (!trace) { - trace = _gst_trace_default; - if (!trace) - return; - } - - buf_len = trace->bufoffset * sizeof (GstTraceEntry); - res = write (trace->fd, trace->buf, buf_len); - if (res < 0) { - g_warning ("Failed to write trace: %s", g_strerror (errno)); - return; - } else if (res < buf_len) { - g_warning ("Failed to write trace: only wrote %d/%d bytes", res, buf_len); - return; - } - trace->bufoffset = 0; + if (_gst_trace_flags) + _priv_gst_alloc_trace_dump (); } -/** - * gst_trace_text_flush: - * @trace: the #GstTrace to flush. - * - * 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. - */ void -gst_trace_text_flush (GstTrace * trace) +_priv_gst_alloc_trace_initialize (void) { - int i; + const gchar *trace; -#define STRSIZE (20 + 1 + 10 + 1 + 10 + 1 + 112 + 1 + 1) - char str[STRSIZE]; - - if (!trace) { - trace = _gst_trace_default; - if (!trace) - return; - } - - for (i = 0; i < trace->bufoffset; i++) { - g_snprintf (str, STRSIZE, "%20" G_GINT64_FORMAT " %10d %10d %s\n", - trace->buf[i].timestamp, - trace->buf[i].sequence, trace->buf[i].data, trace->buf[i].message); - if (write (trace->fd, str, strlen (str)) < 0) { - g_warning ("Failed to write trace %d: %s", i, g_strerror (errno)); - return; - } + trace = g_getenv ("GST_TRACE"); + if (trace != NULL) { + _gst_trace_flags = atoi (trace); + atexit (_at_exit); } - trace->bufoffset = 0; -#undef STRSIZE -} -/** - * gst_trace_set_default: - * @trace: the #GstTrace to set as the default. - * - * Set the default #GstTrace to @trace. - */ -void -gst_trace_set_default (GstTrace * trace) -{ - g_return_if_fail (trace != NULL); - _gst_trace_default = trace; + g_mutex_init (&_gst_trace_mutex); } void -_gst_trace_add_entry (GstTrace * trace, guint32 seq, guint32 data, gchar * msg) -{ - GstTraceEntry *entry; - - if (!trace) { - trace = _gst_trace_default; - if (!trace) - return; - } - - entry = trace->buf + trace->bufoffset; - read_tsc (&(entry->timestamp)); - entry->sequence = seq; - entry->data = data; - strncpy (entry->message, msg, 112); - entry->message[111] = '\0'; - trace->bufoffset++; - - gst_trace_flush (trace); -} - - -/* global flags */ -static GstAllocTraceFlags _gst_trace_flags = GST_ALLOC_TRACE_NONE; - -/* list of registered tracers */ -static GList *_gst_alloc_tracers = NULL; - -/** - * gst_alloc_trace_available: - * - * Check if alloc tracing was compiled into the core - * - * Returns: TRUE if the core was compiled with alloc - * tracing enabled. - */ -gboolean -gst_alloc_trace_available (void) +_priv_gst_alloc_trace_deinit (void) { -#ifdef GST_DISABLE_ALLOC_TRACE - return FALSE; -#else - return TRUE; -#endif + g_mutex_clear (&_gst_trace_mutex); } /** - * _gst_alloc_trace_register: + * _priv_gst_alloc_trace_register: * @name: the name of the new alloc trace object. + * @offset: the offset in the object where a GType an be found. -1 when the + * object has no gtype. * * Register an get a handle to a GstAllocTrace object that * can be used to trace memory allocations. @@ -291,7 +113,7 @@ gst_alloc_trace_available (void) * Returns: A handle to a GstAllocTrace. */ GstAllocTrace * -_gst_alloc_trace_register (const gchar * name) +_priv_gst_alloc_trace_register (const gchar * name, goffset offset) { GstAllocTrace *trace; @@ -302,49 +124,13 @@ _gst_alloc_trace_register (const gchar * name) trace->live = 0; trace->mem_live = NULL; trace->flags = _gst_trace_flags; + trace->offset = offset; _gst_alloc_tracers = g_list_prepend (_gst_alloc_tracers, trace); return trace; } -/** - * gst_alloc_trace_list: - * - * Get a list of all registered alloc trace objects. - * - * Returns: a GList of GstAllocTrace objects. - */ -const GList * -gst_alloc_trace_list (void) -{ - return _gst_alloc_tracers; -} - -/** - * gst_alloc_trace_live_all: - * - * Get the total number of live registered alloc trace objects. - * - * Returns: the total number of live registered alloc trace objects. - */ -int -gst_alloc_trace_live_all (void) -{ - GList *walk = _gst_alloc_tracers; - int num = 0; - - while (walk) { - GstAllocTrace *trace = (GstAllocTrace *) walk->data; - - num += trace->live; - - walk = g_list_next (walk); - } - - return num; -} - static gint compare_func (GstAllocTrace * a, GstAllocTrace * b) { @@ -362,111 +148,7 @@ gst_alloc_trace_list_sorted (void) return ret; } -/** - * gst_alloc_trace_print_all: - * - * Print the status of all registered alloc trace objects. - */ -void -gst_alloc_trace_print_all (void) -{ - GList *orig, *walk; - - orig = walk = gst_alloc_trace_list_sorted (); - - while (walk) { - GstAllocTrace *trace = (GstAllocTrace *) walk->data; - - gst_alloc_trace_print (trace); - - walk = g_list_next (walk); - } - - g_list_free (orig); -} - -/** - * gst_alloc_trace_print_live: - * - * Print the status of all registered alloc trace objects, ignoring those - * without live objects. - */ -void -gst_alloc_trace_print_live (void) -{ - GList *orig, *walk; - - orig = walk = gst_alloc_trace_list_sorted (); - - while (walk) { - GstAllocTrace *trace = (GstAllocTrace *) walk->data; - - if (trace->live) - gst_alloc_trace_print (trace); - - walk = g_list_next (walk); - } - - g_list_free (orig); -} - -/** - * gst_alloc_trace_set_flags_all: - * @flags: the options to enable - * - * Enable the specified options on all registered alloc trace - * objects. - */ -void -gst_alloc_trace_set_flags_all (GstAllocTraceFlags flags) -{ - GList *walk = _gst_alloc_tracers; - - while (walk) { - GstAllocTrace *trace = (GstAllocTrace *) walk->data; - - GST_DEBUG ("setting flags %d on %p", (gint) flags, trace); - gst_alloc_trace_set_flags (trace, flags); - - walk = g_list_next (walk); - } - _gst_trace_flags = flags; -} - -/** - * gst_alloc_trace_get: - * @name: the name of the alloc trace object - * - * Get the named alloc trace object. - * - * Returns: a GstAllocTrace with the given name or NULL when - * no alloc tracer was registered with that name. - */ -GstAllocTrace * -gst_alloc_trace_get (const gchar * name) -{ - GList *walk = _gst_alloc_tracers; - - g_return_val_if_fail (name, NULL); - - while (walk) { - GstAllocTrace *trace = (GstAllocTrace *) walk->data; - - if (!strcmp (trace->name, name)) - return trace; - - walk = g_list_next (walk); - } - return NULL; -} - -/** - * gst_alloc_trace_print: - * @trace: the GstAllocTrace to print - * - * Print the status of the given GstAllocTrace. - */ -void +static void gst_alloc_trace_print (const GstAllocTrace * trace) { GSList *mem_live; @@ -484,28 +166,45 @@ gst_alloc_trace_print (const GstAllocTrace * trace) while (mem_live) { gpointer data = mem_live->data; + const gchar *type_name; if (G_IS_OBJECT (data)) { - g_print ("%-22.22s : %p\n", g_type_name (G_OBJECT_TYPE (data)), data); + type_name = G_OBJECT_TYPE_NAME (data); + } else if (trace->offset != -1) { + GType type; + + type = G_STRUCT_MEMBER (GType, data, trace->offset); + type_name = g_type_name (type); } else { - g_print ("%-22.22s : %p\n", "", data); + type_name = ""; } + + g_print (" %-20.20s : %p\n", type_name, data); + mem_live = mem_live->next; } } } /** - * gst_alloc_trace_set_flags: - * @trace: the GstAllocTrace - * @flags: flags to set + * _priv_gst_alloc_trace_dump: * - * Enable the given features on the given GstAllocTrace object. + * Print the status of all registered alloc trace objects. */ void -gst_alloc_trace_set_flags (GstAllocTrace * trace, GstAllocTraceFlags flags) +_priv_gst_alloc_trace_dump (void) { - g_return_if_fail (trace != NULL); + GList *orig, *walk; + + orig = walk = gst_alloc_trace_list_sorted (); + + while (walk) { + GstAllocTrace *trace = (GstAllocTrace *) walk->data; - trace->flags = flags; + gst_alloc_trace_print (trace); + + walk = g_list_next (walk); + } + + g_list_free (orig); } diff --git a/gst/gsttrace.h b/gst/gsttrace.h index b49ff7c..ca70a83 100644 --- a/gst/gsttrace.h +++ b/gst/gsttrace.h @@ -48,6 +48,7 @@ typedef struct _GstAllocTrace GstAllocTrace; * GstAllocTrace: * @name: The name of the tracing object * @flags: Flags for this object + * @offset: offset of the GType * @live: counter for live memory * @mem_live: list with pointers to unfreed memory * @@ -57,88 +58,20 @@ struct _GstAllocTrace { gchar *name; gint flags; + goffset offset; gint live; GSList *mem_live; }; #ifndef GST_DISABLE_TRACE -typedef struct _GstTrace GstTrace; -typedef struct _GstTraceEntry GstTraceEntry; - -/** - * GstTrace: - * - * Opaque #GstTrace structure. - */ -struct _GstTrace { - /*< private >*/ - /* where this trace is going */ - gchar *filename; - int fd; - - /* current buffer, size, head offset */ - GstTraceEntry *buf; - gint bufsize; - gint bufoffset; -}; - -struct _GstTraceEntry { - gint64 timestamp; - guint32 sequence; - guint32 data; - gchar message[112]; -}; - -GstTrace* gst_trace_new (const gchar *filename, gint size); - -void gst_trace_destroy (GstTrace *trace); -void gst_trace_flush (GstTrace *trace); -void gst_trace_text_flush (GstTrace *trace); -/** - * gst_trace_get_size: - * @trace: a #GstTrace - * - * Retrieve the buffer size of @trace. - */ -#define gst_trace_get_size(trace) ((trace)->bufsize) -/** - * gst_trace_get_offset: - * @trace: a #GstTrace - * - * Retrieve the current buffer offset of @trace. - */ -#define gst_trace_get_offset(trace) ((trace)->bufoffset) -/** - * gst_trace_get_remaining: - * @trace: a #GstTrace - * - * Retrieve the remaining size in the @trace buffer. - */ -#define gst_trace_get_remaining(trace) ((trace)->bufsize - (trace)->bufoffset) -void gst_trace_set_default (GstTrace *trace); - -void _gst_trace_add_entry (GstTrace *trace, guint32 seq, - guint32 data, gchar *msg); - -void gst_trace_read_tsc (gint64 *dst); - - GST_EXPORT GMutex _gst_trace_mutex; -gboolean gst_alloc_trace_available (void); -const GList* gst_alloc_trace_list (void); -GstAllocTrace* _gst_alloc_trace_register (const gchar *name); - -int gst_alloc_trace_live_all (void); -void gst_alloc_trace_print_all (void); -void gst_alloc_trace_print_live (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_set_flags (GstAllocTrace *trace, GstAllocTraceFlags flags); +void _priv_gst_alloc_trace_initialize (void); +void _priv_gst_alloc_trace_deinit (void); +GstAllocTrace* _priv_gst_alloc_trace_register (const gchar *name, goffset offset); +void _priv_gst_alloc_trace_dump (void); #ifndef GST_DISABLE_ALLOC_TRACE /** @@ -147,7 +80,9 @@ void gst_alloc_trace_set_flags (GstAllocTrace *trace, G * * Register a new alloc tracer with the given name */ -#define gst_alloc_trace_register(name) _gst_alloc_trace_register (name); +#define _gst_alloc_trace_register(name,offset) _priv_gst_alloc_trace_register (name,offset) + +#define _gst_alloc_trace_dump _priv_gst_alloc_trace_dump /** * gst_alloc_trace_new: @@ -156,7 +91,7 @@ void gst_alloc_trace_set_flags (GstAllocTrace *trace, G * * Use the tracer to trace a new memory allocation */ -#define gst_alloc_trace_new(trace, mem) \ +#define _gst_alloc_trace_new(trace, mem) \ G_STMT_START { \ if (G_UNLIKELY ((trace)->flags)) { \ g_mutex_lock (&_gst_trace_mutex); \ @@ -176,7 +111,7 @@ G_STMT_START { \ * * Trace a memory free operation */ -#define gst_alloc_trace_free(trace, mem) \ +#define _gst_alloc_trace_free(trace, mem) \ G_STMT_START { \ if (G_UNLIKELY ((trace)->flags)) { \ g_mutex_lock (&_gst_trace_mutex); \ @@ -190,61 +125,18 @@ G_STMT_START { \ } G_STMT_END #else -#define gst_alloc_trace_register(name) (NULL) -#define gst_alloc_trace_new(trace, mem) -#define gst_alloc_trace_free(trace, mem) +#define _gst_alloc_trace_register(name) (NULL) +#define _gst_alloc_trace_new(trace, mem) +#define _gst_alloc_trace_free(trace, mem) +#define _gst_alloc_trace_dump() #endif - -GST_EXPORT gint _gst_trace_on; -/** - * gst_trace_add_entry: - * @trace: a #GstTrace - * @seq: a sequence number - * @data: the data to trace - * @msg: the trace message - * - * 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_add_entry(trace,seq,data,msg) \ - if (_gst_trace_on) { \ - _gst_trace_add_entry(trace,(guint32)seq,(guint32)data,msg); \ - } - #else /* GST_DISABLE_TRACE */ -#if defined __GNUC__ && __GNUC__ >= 3 -#pragma GCC poison gst_trace_new -#pragma GCC poison gst_trace_destroy -#pragma GCC poison gst_trace_flush -#pragma GCC poison gst_trace_text_flush -#pragma GCC poison gst_trace_get_size -#pragma GCC poison gst_trace_get_offset -#pragma GCC poison gst_trace_get_remaining -#pragma GCC poison gst_trace_set_default -#pragma GCC poison _gst_trace_add_entry -#pragma GCC poison gst_trace_read_tsc -#endif - -#define gst_alloc_trace_register(name) (NULL) -#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_live_all() (0) -#define gst_alloc_trace_print_all() -#define gst_alloc_trace_print_live() -#define gst_alloc_trace_set_flags_all(flags) - -#define gst_alloc_trace_get(name) (NULL) -#define gst_alloc_trace_print(trace) -#define gst_alloc_trace_set_flags(trace,flags) - -#define gst_trace_add_entry(trace,seq,data,msg) +#define _gst_alloc_trace_register(name, offset) (NULL) +#define _gst_alloc_trace_new(trace, mem) +#define _gst_alloc_trace_free(trace, mem) +#define _gst_alloc_trace_dump() #endif /* GST_DISABLE_TRACE */ diff --git a/tools/gst-launch.c b/tools/gst-launch.c index 3ea4fff..b3b8c97 100644 --- a/tools/gst-launch.c +++ b/tools/gst-launch.c @@ -822,7 +822,6 @@ main (int argc, char *argv[]) /* options */ gboolean verbose = FALSE; gboolean no_fault = FALSE; - gboolean trace = FALSE; gboolean eos_on_shutdown = FALSE; #if 0 gboolean check_index = FALSE; @@ -843,8 +842,6 @@ main (int argc, char *argv[]) N_("Do not output status information of TYPE"), N_("TYPE1,TYPE2,...")}, {"no-fault", 'f', 0, G_OPTION_ARG_NONE, &no_fault, N_("Do not install a fault handler"), NULL}, - {"trace", 'T', 0, G_OPTION_ARG_NONE, &trace, - N_("Print alloc trace (if enabled at compile time)"), NULL}, {"eos-on-shutdown", 'e', 0, G_OPTION_ARG_NONE, &eos_on_shutdown, N_("Force EOS on sources before shutting the pipeline down"), NULL}, #if 0 @@ -900,15 +897,6 @@ main (int argc, char *argv[]) sigint_setup (); #endif - if (trace) { - if (!gst_alloc_trace_available ()) { - g_warning ("Trace not available (recompile with trace enabled)."); - } - gst_alloc_trace_set_flags_all (GST_ALLOC_TRACE_LIVE | - GST_ALLOC_TRACE_MEM_LIVE); - gst_alloc_trace_print_live (); - } - /* make a null-terminated version of argv */ argvn = g_new0 (char *, argc); memcpy (argvn, argv + 1, sizeof (char *) * (argc - 1)); @@ -1083,8 +1071,6 @@ main (int argc, char *argv[]) gst_object_unref (pipeline); gst_deinit (); - if (trace) - gst_alloc_trace_print_live (); return res; } -- 2.7.4