Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
luzpaz
gstreamer
Commits
e2cd6ffa
Commit
e2cd6ffa
authored
Aug 13, 2016
by
Tim-Philipp Müller
🐠
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove old alloc tracing code now that we have a GstTracer-based replacement
It's been internal API only in 1.x.
parent
5154dcfb
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
5 additions
and
488 deletions
+5
-488
Makefile.am
Makefile.am
+0
-2
configure.ac
configure.ac
+0
-8
docs/gst/gstreamer-sections.txt
docs/gst/gstreamer-sections.txt
+0
-4
gst/Makefile.am
gst/Makefile.am
+0
-9
gst/gst.c
gst/gst.c
+0
-9
gst/gstclock.c
gst/gstclock.c
+5
-16
gst/gstconfig.h.in
gst/gstconfig.h.in
+0
-19
gst/gstminiobject.c
gst/gstminiobject.c
+0
-15
gst/gstobject.c
gst/gstobject.c
+0
-17
gst/gsttrace.c
gst/gsttrace.c
+0
-228
gst/gsttrace.h
gst/gsttrace.h
+0
-146
po/POTFILES.in
po/POTFILES.in
+0
-1
tests/check/Makefile.am
tests/check/Makefile.am
+0
-2
win32/common/gstconfig.h
win32/common/gstconfig.h
+0
-11
win32/common/libgstreamer.def
win32/common/libgstreamer.def
+0
-1
No files found.
Makefile.am
View file @
e2cd6ffa
...
@@ -153,10 +153,8 @@ include $(top_srcdir)/common/coverage/lcov.mak
...
@@ -153,10 +153,8 @@ include $(top_srcdir)/common/coverage/lcov.mak
# Do not run the check-exports test in case any option which causes the API to
# Do not run the check-exports test in case any option which causes the API to
# change has been used
# change has been used
if
!GST_DISABLE_REGISTRY
if
!GST_DISABLE_REGISTRY
if
!GST_DISABLE_TRACE
CHECK_EXPORTS
=
check-exports
CHECK_EXPORTS
=
check-exports
endif
endif
endif
check
:
$(CHECK_EXPORTS) check-enum-gettypes
check
:
$(CHECK_EXPORTS) check-enum-gettypes
...
...
configure.ac
View file @
e2cd6ffa
...
@@ -101,10 +101,6 @@ if test "x$GST_DISABLE_OPTION_PARSING" = xyes; then
...
@@ -101,10 +101,6 @@ if test "x$GST_DISABLE_OPTION_PARSING" = xyes; then
AC_DEFINE(GST_DISABLE_OPTION_PARSING, 1,
AC_DEFINE(GST_DISABLE_OPTION_PARSING, 1,
[Define if option parsing is disabled])
[Define if option parsing is disabled])
fi
fi
AG_GST_CHECK_SUBSYSTEM_DISABLE(TRACE,[historic tracing subsystem])
AM_CONDITIONAL(GST_DISABLE_TRACE, test "x$GST_DISABLE_TRACE" = "xyes")
AG_GST_CHECK_SUBSYSTEM_DISABLE(ALLOC_TRACE,[allocation tracing])
AM_CONDITIONAL(GST_DISABLE_ALLOC_TRACE, test "x$GST_DISABLE_ALLOC_TRACE" = "xyes")
AG_GST_CHECK_SUBSYSTEM_DISABLE(REGISTRY,[plugin registry])
AG_GST_CHECK_SUBSYSTEM_DISABLE(REGISTRY,[plugin registry])
AM_CONDITIONAL(GST_DISABLE_REGISTRY, test "x$GST_DISABLE_REGISTRY" = "xyes")
AM_CONDITIONAL(GST_DISABLE_REGISTRY, test "x$GST_DISABLE_REGISTRY" = "xyes")
dnl define a substitution to use in docs/gst/gstreamer.types
dnl define a substitution to use in docs/gst/gstreamer.types
...
@@ -1109,8 +1105,6 @@ if test "x${GST_DISABLE_GST_DEBUG}" = "xno"; then enable_gst_debug="yes"; fi
...
@@ -1109,8 +1105,6 @@ if test "x${GST_DISABLE_GST_DEBUG}" = "xno"; then enable_gst_debug="yes"; fi
if test "x${GST_DISABLE_GST_TRACER_HOOKS}" = "xno"; then enable_gst_tracer_hooks="yes"; fi
if test "x${GST_DISABLE_GST_TRACER_HOOKS}" = "xno"; then enable_gst_tracer_hooks="yes"; fi
if test "x${GST_DISABLE_PARSE}" = "xno"; then enable_parse="yes"; fi
if test "x${GST_DISABLE_PARSE}" = "xno"; then enable_parse="yes"; fi
if test "x${GST_DISABLE_OPTION_PARSING}" = "xno"; then enable_option_parsing="yes"; fi
if test "x${GST_DISABLE_OPTION_PARSING}" = "xno"; then enable_option_parsing="yes"; fi
if test "x${GST_DISABLE_TRACE}" = "xno"; then enable_trace="yes"; fi
if test "x${GST_DISABLE_ALLOC_TRACE}" = "xno"; then enable_alloc_trace="yes"; fi
if test "x${GST_DISABLE_PLUGIN}" = "xno"; then enable_plugin="yes"; fi
if test "x${GST_DISABLE_PLUGIN}" = "xno"; then enable_plugin="yes"; fi
if test "x${GST_DISABLE_REGISTRY}" = "xno"; then enable_registry="yes"; fi
if test "x${GST_DISABLE_REGISTRY}" = "xno"; then enable_registry="yes"; fi
...
@@ -1131,8 +1125,6 @@ Configuration
...
@@ -1131,8 +1125,6 @@ Configuration
Tracing subsystem hooks : ${enable_gst_tracer_hooks}
Tracing subsystem hooks : ${enable_gst_tracer_hooks}
Command-line parser : ${enable_parse}
Command-line parser : ${enable_parse}
Option parsing in gst_init : ${enable_option_parsing}
Option parsing in gst_init : ${enable_option_parsing}
Historic tracing subsystem : ${enable_trace}
Allocation tracing : ${enable_alloc_trace}
Plugin registry : ${enable_registry}
Plugin registry : ${enable_registry}
Plugin support : ${enable_plugin}
Plugin support : ${enable_plugin}
Static plugins : ${enable_static_plugins}
Static plugins : ${enable_static_plugins}
...
...
docs/gst/gstreamer-sections.txt
View file @
e2cd6ffa
...
@@ -36,8 +36,6 @@ GST_QUARK
...
@@ -36,8 +36,6 @@ GST_QUARK
GstQuarkId
GstQuarkId
GstPluginLoader
GstPluginLoader
GstPluginLoaderFuncs
GstPluginLoaderFuncs
GstAllocTrace
GstAllocTraceFlags
</SECTION>
</SECTION>
<SECTION>
<SECTION>
...
@@ -698,8 +696,6 @@ gst_adapter_prev_timestamp
...
@@ -698,8 +696,6 @@ gst_adapter_prev_timestamp
<TITLE>GstConfig</TITLE>
<TITLE>GstConfig</TITLE>
GST_DISABLE_GST_DEBUG
GST_DISABLE_GST_DEBUG
GST_DISABLE_PARSE
GST_DISABLE_PARSE
GST_DISABLE_TRACE
GST_DISABLE_ALLOC_TRACE
GST_DISABLE_REGISTRY
GST_DISABLE_REGISTRY
GST_DISABLE_PLUGIN
GST_DISABLE_PLUGIN
<SUBSECTION Private>
<SUBSECTION Private>
...
...
gst/Makefile.am
View file @
e2cd6ffa
...
@@ -14,12 +14,6 @@ SUBDIRS_PARSE = parse
...
@@ -14,12 +14,6 @@ SUBDIRS_PARSE = parse
GST_PARSE_LA
=
parse/libgstparse.la
GST_PARSE_LA
=
parse/libgstparse.la
endif
endif
if
GST_DISABLE_TRACE
GST_TRACE_SRC
=
else
GST_TRACE_SRC
=
gsttrace.c
endif
if
GST_DISABLE_PLUGIN
if
GST_DISABLE_PLUGIN
GST_PLUGIN_SRC
=
GST_PLUGIN_SRC
=
else
else
...
@@ -47,7 +41,6 @@ built_header_make = gstenumtypes.h
...
@@ -47,7 +41,6 @@ built_header_make = gstenumtypes.h
built_source_make
=
gstenumtypes.c
built_source_make
=
gstenumtypes.c
EXTRA_libgstreamer_@GST_API_VERSION@
_la_SOURCES
=
\
EXTRA_libgstreamer_@GST_API_VERSION@
_la_SOURCES
=
\
gsttrace.c
\
gstregistrybinary.c
gstregistrybinary.c
...
@@ -116,7 +109,6 @@ libgstreamer_@GST_API_VERSION@_la_SOURCES = \
...
@@ -116,7 +109,6 @@ libgstreamer_@GST_API_VERSION@_la_SOURCES = \
gsttaskpool.c
\
gsttaskpool.c
\
gsttoc.c
\
gsttoc.c
\
gsttocsetter.c
\
gsttocsetter.c
\
$(GST_TRACE_SRC)
\
gsttracer.c
\
gsttracer.c
\
gsttracerfactory.c
\
gsttracerfactory.c
\
gsttracerrecord.c
\
gsttracerrecord.c
\
...
@@ -255,7 +247,6 @@ noinst_HEADERS = \
...
@@ -255,7 +247,6 @@ noinst_HEADERS = \
gstquark.h
\
gstquark.h
\
gstregistrybinary.h
\
gstregistrybinary.h
\
gstregistrychunks.h
\
gstregistrychunks.h
\
gsttrace.h
\
gsttracerutils.h
\
gsttracerutils.h
\
gst_private.h
gst_private.h
...
...
gst/gst.c
View file @
e2cd6ffa
...
@@ -113,7 +113,6 @@
...
@@ -113,7 +113,6 @@
#include <locale.h>
/* for LC_ALL */
#include <locale.h>
/* for LC_ALL */
#include "gst.h"
#include "gst.h"
#include "gsttrace.h"
#define GST_CAT_DEFAULT GST_CAT_GST_INIT
#define GST_CAT_DEFAULT GST_CAT_GST_INIT
...
@@ -572,10 +571,6 @@ init_post (GOptionContext * context, GOptionGroup * group, gpointer data,
...
@@ -572,10 +571,6 @@ init_post (GOptionContext * context, GOptionGroup * group, gpointer data,
llf
=
G_LOG_LEVEL_CRITICAL
|
G_LOG_LEVEL_ERROR
|
G_LOG_FLAG_FATAL
;
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
);
g_log_set_handler
(
g_log_domain_gstreamer
,
llf
,
debug_log_handler
,
NULL
);
#ifndef GST_DISABLE_TRACE
_priv_gst_alloc_trace_initialize
();
#endif
_priv_gst_mini_object_initialize
();
_priv_gst_mini_object_initialize
();
_priv_gst_quarks_initialize
();
_priv_gst_quarks_initialize
();
_priv_gst_allocator_initialize
();
_priv_gst_allocator_initialize
();
...
@@ -1032,10 +1027,6 @@ gst_deinit (void)
...
@@ -1032,10 +1027,6 @@ gst_deinit (void)
_priv_gst_caps_features_cleanup
();
_priv_gst_caps_features_cleanup
();
_priv_gst_caps_cleanup
();
_priv_gst_caps_cleanup
();
#ifndef GST_DISABLE_TRACE
_priv_gst_alloc_trace_deinit
();
#endif
g_type_class_unref
(
g_type_class_peek
(
gst_object_get_type
()));
g_type_class_unref
(
g_type_class_peek
(
gst_object_get_type
()));
g_type_class_unref
(
g_type_class_peek
(
gst_pad_get_type
()));
g_type_class_unref
(
g_type_class_peek
(
gst_pad_get_type
()));
g_type_class_unref
(
g_type_class_peek
(
gst_element_factory_get_type
()));
g_type_class_unref
(
g_type_class_peek
(
gst_element_factory_get_type
()));
...
...
gst/gstclock.c
View file @
e2cd6ffa
...
@@ -108,12 +108,6 @@
...
@@ -108,12 +108,6 @@
#include "gstutils.h"
#include "gstutils.h"
#include "glib-compat-private.h"
#include "glib-compat-private.h"
#ifndef GST_DISABLE_TRACE
/* #define GST_WITH_ALLOC_TRACE */
#include "gsttrace.h"
static
GstAllocTrace
*
_gst_clock_entry_trace
;
#endif
/* #define DEBUGGING_ENABLED */
/* #define DEBUGGING_ENABLED */
#define DEFAULT_WINDOW_SIZE 32
#define DEFAULT_WINDOW_SIZE 32
...
@@ -246,9 +240,9 @@ gst_clock_entry_new (GstClock * clock, GstClockTime time,
...
@@ -246,9 +240,9 @@ gst_clock_entry_new (GstClock * clock, GstClockTime time,
GstClockEntry
*
entry
;
GstClockEntry
*
entry
;
entry
=
g_slice_new
(
GstClockEntry
);
entry
=
g_slice_new
(
GstClockEntry
);
#ifndef GST_DISABLE_TRACE
_gst_alloc_trace_new
(
_gst_
clock
_
entr
y_trace
,
entry
);
/* FIXME: add tracer hook for struct allocations such as
clock
entr
ies */
#endif
GST_CAT_DEBUG_OBJECT
(
GST_CAT_CLOCK
,
clock
,
GST_CAT_DEBUG_OBJECT
(
GST_CAT_CLOCK
,
clock
,
"created entry %p, time %"
GST_TIME_FORMAT
,
entry
,
GST_TIME_ARGS
(
time
));
"created entry %p, time %"
GST_TIME_FORMAT
,
entry
,
GST_TIME_ARGS
(
time
));
...
@@ -358,9 +352,8 @@ _gst_clock_id_free (GstClockID id)
...
@@ -358,9 +352,8 @@ _gst_clock_id_free (GstClockID id)
if
(
entry
->
destroy_data
)
if
(
entry
->
destroy_data
)
entry
->
destroy_data
(
entry
->
user_data
);
entry
->
destroy_data
(
entry
->
user_data
);
#ifndef GST_DISABLE_TRACE
/* FIXME: add tracer hook for struct allocations such as clock entries */
_gst_alloc_trace_free
(
_gst_clock_entry_trace
,
id
);
#endif
g_slice_free
(
GstClockEntry
,
id
);
g_slice_free
(
GstClockEntry
,
id
);
}
}
...
@@ -680,10 +673,6 @@ gst_clock_class_init (GstClockClass * klass)
...
@@ -680,10 +673,6 @@ gst_clock_class_init (GstClockClass * klass)
{
{
GObjectClass
*
gobject_class
=
G_OBJECT_CLASS
(
klass
);
GObjectClass
*
gobject_class
=
G_OBJECT_CLASS
(
klass
);
#ifndef GST_DISABLE_TRACE
_gst_clock_entry_trace
=
_gst_alloc_trace_register
(
"GstClockEntry"
,
-
1
);
#endif
gobject_class
->
dispose
=
gst_clock_dispose
;
gobject_class
->
dispose
=
gst_clock_dispose
;
gobject_class
->
finalize
=
gst_clock_finalize
;
gobject_class
->
finalize
=
gst_clock_finalize
;
gobject_class
->
set_property
=
gst_clock_set_property
;
gobject_class
->
set_property
=
gst_clock_set_property
;
...
...
gst/gstconfig.h.in
View file @
e2cd6ffa
...
@@ -55,11 +55,8 @@
...
@@ -55,11 +55,8 @@
#if 0
#if 0
#define GST_DISABLE_GST_DEBUG 1
#define GST_DISABLE_GST_DEBUG 1
#define GST_DISABLE_PARSE 1
#define GST_DISABLE_PARSE 1
#define GST_DISABLE_TRACE 1
#define GST_DISABLE_ALLOC_TRACE 1
#define GST_DISABLE_REGISTRY 1
#define GST_DISABLE_REGISTRY 1
#define GST_DISABLE_PLUGIN 1
#define GST_DISABLE_PLUGIN 1
#define GST_HAVE_GLIB_2_8 1
#endif
#endif
/***** default padding of structures *****/
/***** default padding of structures *****/
...
@@ -85,22 +82,6 @@
...
@@ -85,22 +82,6 @@
*/
*/
@GST_DISABLE_PARSE_DEFINE@
@GST_DISABLE_PARSE_DEFINE@
/**
* GST_DISABLE_TRACE:
*
* Configures the inclusion of a resource tracing facility
* (seems to be unused)
*/
@GST_DISABLE_TRACE_DEFINE@
/**
* GST_DISABLE_ALLOC_TRACE:
*
* Configures the use of a memory tracer based on the resource tracer
* if TRACE is disabled, ALLOC_TRACE is disabled as well
*/
@GST_DISABLE_ALLOC_TRACE_DEFINE@
/**
/**
* GST_DISABLE_REGISTRY:
* GST_DISABLE_REGISTRY:
*
*
...
...
gst/gstminiobject.c
View file @
e2cd6ffa
...
@@ -57,11 +57,6 @@
...
@@ -57,11 +57,6 @@
#include "gst/gstinfo.h"
#include "gst/gstinfo.h"
#include <gobject/gvaluecollector.h>
#include <gobject/gvaluecollector.h>
#ifndef GST_DISABLE_TRACE
#include "gsttrace.h"
static
GstAllocTrace
*
_gst_mini_object_trace
;
#endif
/* Mutex used for weak referencing */
/* Mutex used for weak referencing */
G_LOCK_DEFINE_STATIC
(
qdata_mutex
);
G_LOCK_DEFINE_STATIC
(
qdata_mutex
);
static
GQuark
weak_ref_quark
;
static
GQuark
weak_ref_quark
;
...
@@ -93,10 +88,6 @@ void
...
@@ -93,10 +88,6 @@ void
_priv_gst_mini_object_initialize
(
void
)
_priv_gst_mini_object_initialize
(
void
)
{
{
weak_ref_quark
=
g_quark_from_static_string
(
"GstMiniObjectWeakRefQuark"
);
weak_ref_quark
=
g_quark_from_static_string
(
"GstMiniObjectWeakRefQuark"
);
#ifndef GST_DISABLE_TRACE
_gst_mini_object_trace
=
_gst_alloc_trace_register
(
"GstMiniObject"
,
0
);
#endif
}
}
/**
/**
...
@@ -130,9 +121,6 @@ gst_mini_object_init (GstMiniObject * mini_object, guint flags, GType type,
...
@@ -130,9 +121,6 @@ gst_mini_object_init (GstMiniObject * mini_object, guint flags, GType type,
mini_object
->
qdata
=
NULL
;
mini_object
->
qdata
=
NULL
;
GST_TRACER_MINI_OBJECT_CREATED
(
mini_object
);
GST_TRACER_MINI_OBJECT_CREATED
(
mini_object
);
#ifndef GST_DISABLE_TRACE
_gst_alloc_trace_new
(
_gst_mini_object_trace
,
mini_object
);
#endif
}
}
/**
/**
...
@@ -462,9 +450,6 @@ gst_mini_object_unref (GstMiniObject * mini_object)
...
@@ -462,9 +450,6 @@ gst_mini_object_unref (GstMiniObject * mini_object)
g_free
(
mini_object
->
qdata
);
g_free
(
mini_object
->
qdata
);
}
}
GST_TRACER_MINI_OBJECT_DESTROYED
(
mini_object
);
GST_TRACER_MINI_OBJECT_DESTROYED
(
mini_object
);
#ifndef GST_DISABLE_TRACE
_gst_alloc_trace_free
(
_gst_mini_object_trace
,
mini_object
);
#endif
if
(
mini_object
->
free
)
if
(
mini_object
->
free
)
mini_object
->
free
(
mini_object
);
mini_object
->
free
(
mini_object
);
}
}
...
...
gst/gstobject.c
View file @
e2cd6ffa
...
@@ -101,11 +101,6 @@
...
@@ -101,11 +101,6 @@
#include "gstparamspecs.h"
#include "gstparamspecs.h"
#include "gstutils.h"
#include "gstutils.h"
#ifndef GST_DISABLE_TRACE
#include "gsttrace.h"
static
GstAllocTrace
*
_gst_object_trace
;
#endif
#define DEBUG_REFCOUNT
#define DEBUG_REFCOUNT
/* Object signals and args */
/* Object signals and args */
...
@@ -166,11 +161,6 @@ gst_object_class_init (GstObjectClass * klass)
...
@@ -166,11 +161,6 @@ gst_object_class_init (GstObjectClass * klass)
{
{
GObjectClass
*
gobject_class
=
G_OBJECT_CLASS
(
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
),
-
2
);
#endif
gobject_class
->
set_property
=
gst_object_set_property
;
gobject_class
->
set_property
=
gst_object_set_property
;
gobject_class
->
get_property
=
gst_object_get_property
;
gobject_class
->
get_property
=
gst_object_get_property
;
...
@@ -229,10 +219,6 @@ gst_object_init (GstObject * object)
...
@@ -229,10 +219,6 @@ gst_object_init (GstObject * object)
object
->
name
=
NULL
;
object
->
name
=
NULL
;
GST_CAT_TRACE_OBJECT
(
GST_CAT_REFCOUNTING
,
object
,
"%p new"
,
object
);
GST_CAT_TRACE_OBJECT
(
GST_CAT_REFCOUNTING
,
object
,
"%p new"
,
object
);
#ifndef GST_DISABLE_TRACE
_gst_alloc_trace_new
(
_gst_object_trace
,
object
);
#endif
object
->
flags
=
0
;
object
->
flags
=
0
;
object
->
control_rate
=
100
*
GST_MSECOND
;
object
->
control_rate
=
100
*
GST_MSECOND
;
...
@@ -425,9 +411,6 @@ gst_object_finalize (GObject * object)
...
@@ -425,9 +411,6 @@ gst_object_finalize (GObject * object)
g_mutex_clear
(
&
gstobject
->
lock
);
g_mutex_clear
(
&
gstobject
->
lock
);
GST_TRACER_OBJECT_DESTROYED
(
gstobject
);
GST_TRACER_OBJECT_DESTROYED
(
gstobject
);
#ifndef GST_DISABLE_TRACE
_gst_alloc_trace_free
(
_gst_object_trace
,
object
);
#endif
((
GObjectClass
*
)
gst_object_parent_class
)
->
finalize
(
object
);
((
GObjectClass
*
)
gst_object_parent_class
)
->
finalize
(
object
);
}
}
...
...
gst/gsttrace.c
deleted
100644 → 0
View file @
5154dcfb
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wtay@chello.be>
*
* gsttrace.c: Tracing functions (deprecated)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <errno.h>
#if defined (_MSC_VER) && _MSC_VER >= 1400
# include <io.h>
#endif
#include "gst_private.h"
#include "gstinfo.h"
#include "gsttrace.h"
GMutex
_gst_trace_mutex
;
/* global flags */
static
GstAllocTraceFlags
_gst_trace_flags
=
GST_ALLOC_TRACE_NONE
;
/* list of registered tracers */
static
GList
*
_gst_alloc_tracers
=
NULL
;
static
void
_at_exit
(
void
)
{
if
(
_gst_trace_flags
)
_priv_gst_alloc_trace_dump
();
}
void
_priv_gst_alloc_trace_initialize
(
void
)
{
const
gchar
*
trace
;
trace
=
g_getenv
(
"GST_TRACE"
);
if
(
trace
!=
NULL
)
{
const
GDebugKey
keys
[]
=
{
{
"live"
,
GST_ALLOC_TRACE_LIVE
},
{
"mem-live"
,
GST_ALLOC_TRACE_MEM_LIVE
},
};
_gst_trace_flags
=
g_parse_debug_string
(
trace
,
keys
,
G_N_ELEMENTS
(
keys
));
atexit
(
_at_exit
);
}
g_mutex_init
(
&
_gst_trace_mutex
);
}
void
_priv_gst_alloc_trace_deinit
(
void
)
{
g_mutex_clear
(
&
_gst_trace_mutex
);
}
/**
* _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.
*
* Returns: A handle to a GstAllocTrace.
*/
GstAllocTrace
*
_priv_gst_alloc_trace_register
(
const
gchar
*
name
,
goffset
offset
)
{
GstAllocTrace
*
trace
;
g_return_val_if_fail
(
name
,
NULL
);
trace
=
g_slice_new
(
GstAllocTrace
);
trace
->
name
=
g_strdup
(
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
;
}
static
gint
compare_func
(
GstAllocTrace
*
a
,
GstAllocTrace
*
b
)
{
return
strcmp
(
a
->
name
,
b
->
name
);
}
static
GList
*
gst_alloc_trace_list_sorted
(
void
)
{
GList
*
ret
;
ret
=
g_list_sort
(
g_list_copy
(
_gst_alloc_tracers
),
(
GCompareFunc
)
compare_func
);
return
ret
;
}
static
void
gst_alloc_trace_print
(
const
GstAllocTrace
*
trace
)
{
GSList
*
mem_live
;
g_return_if_fail
(
trace
!=
NULL
);
if
(
trace
->
flags
&
GST_ALLOC_TRACE_LIVE
)
{
g_print
(
"%-22.22s : %d
\n
"
,
trace
->
name
,
trace
->
live
);
}
else
{
g_print
(
"%-22.22s : (no live count)
\n
"
,
trace
->
name
);
}
if
(
trace
->
flags
&
GST_ALLOC_TRACE_MEM_LIVE
)
{
mem_live
=
trace
->
mem_live
;
while
(
mem_live
)
{
gpointer
data
=
mem_live
->
data
;
const
gchar
*
type_name
;
gchar
*
extra
=
NULL
;
gint
refcount
=
-
1
;
if
(
trace
->
offset
==
-
2
)
{
if
(
G_IS_OBJECT
(
data
))
{
type_name
=
G_OBJECT_TYPE_NAME
(
data
);
refcount
=
G_OBJECT
(
data
)
->
ref_count
;
}
else
type_name
=
"<invalid>"
;
}
else
if
(
trace
->
offset
==
-
1
)
{
type_name
=
"<unknown>"
;
}
else
{
GType
type
;
type
=
G_STRUCT_MEMBER
(
GType
,
data
,
trace
->
offset
);
type_name
=
g_type_name
(
type
);
if
(
type
==
GST_TYPE_CAPS
)
{
extra
=
gst_caps_to_string
(
data
);
}
else
if
(
type
==
GST_TYPE_EVENT
)
{
const
GstStructure
*
s
=
gst_event_get_structure
(
data
);
if
(
s
==
NULL
)
extra
=
g_strdup_printf
(
"%s"
,
GST_EVENT_TYPE_NAME
(
data
));
else
extra
=
gst_structure_to_string
(
s
);
}
else
if
(
type
==
GST_TYPE_MESSAGE
)
{
const
GstStructure
*
s
=
gst_message_get_structure
(
data
);
if
(
s
==
NULL
)
extra
=
g_strdup_printf
(
"%s"
,
GST_MESSAGE_TYPE_NAME
(
data
));
else
extra
=
gst_structure_to_string
(
s
);
}
else
if
(
type
==
GST_TYPE_BUFFER
)
{
guint
size
=
gst_buffer_get_size
(
data
);
extra
=
g_strdup_printf
(
"%u bytes"
,
size
);
}
else
if
(
type
==
GST_TYPE_MEMORY
)
{
GstMemory
*
mem
=
(
GstMemory
*
)
data
;
extra
=
g_strdup_printf
(
"%u bytes, %s allocator"
,
(
guint
)
mem
->
size
,
mem
->
allocator
?
mem
->
allocator
->
mem_type
:
"unknown"
);
}
refcount
=
GST_MINI_OBJECT_REFCOUNT_VALUE
(
data
);
}
if
(
extra
)
{
g_print
(
" %-20.20s : (%d) %p (
\"
%s
\"
)
\n
"
,
type_name
,
refcount
,
data
,
extra
);
g_free
(
extra
);
}
else
g_print
(
" %-20.20s : (%d) %p
\n
"
,
type_name
,
refcount
,
data
);
mem_live
=
mem_live
->
next
;
}
}
}
/**
* _priv_gst_alloc_trace_dump:
*
* Print the status of all registered alloc trace objects.
*/
void
_priv_gst_alloc_trace_dump
(
void
)
{
GList
*
orig
,
*
walk
;
orig
=
walk
=
gst_alloc_trace_list_sorted
();
while
(
walk
)
{
GstAllocTrace
*
trace
=
(
GstAllocTrace
*
)
walk
->
data
;