Commit graph

27 commits

Author SHA1 Message Date
Tim-Philipp Müller
b5dc8598be leakstracer: Improve notes in the the get-live-objects API docs
It may not be obvious to the user how this action signal is meant to
be called, so document it.
2019-07-02 15:13:26 +05:30
Nirbheek Chauhan
6ccf59ec06 leakstracer: Add API for tracking and checkpointing objects
This feature was previously available only through the SIGUSR2 signal,
which meant it wasn't available on platforms that don't have UNIX
signals, such as Windows and with applications that already use
SIGUSR1 for something else.

Now we have action-signals for doing the same. These action signals
can also be used for fetching the checkpoint information
programmatically instead of printing to the debug log.
2019-07-02 15:13:26 +05:30
Nirbheek Chauhan
6e3565ca86 leakstracer: Add API for logging leaks in the debug log
This is the equivalent of sending SIGUSR1 to the application, and is
useful on platforms where UNIX signals are not available, such as
Windows.
2019-07-02 15:13:26 +05:30
Nirbheek Chauhan
44198ec4d6 leakstracer: Add API for fetching leaked objects
This allows programs to inspect the leaked objects directly, log them,
and so on. Unlike the existing mechanism to use SIGUSR1, this also
works on platforms that do not support UNIX signals, such as Windows
and with applications that already use SIGUSR1 for something else.
2019-07-02 15:13:26 +05:30
Nirbheek Chauhan
5cdf1b7db8 tracers: Allow setting a name for all tracer objects
This will be useful in combination with the next commit when we add
API to get a list of active tracers so that consumers of the API can
easily distinguish tracer objects.
2019-07-02 15:13:26 +05:30
Nirbheek Chauhan
3e2f24955e leakstracer: Get rid of GSlice usage
It's not faster than malloc, and is slower in most cases. Glib is also
getting rid of it entirely: https://gitlab.gnome.org/GNOME/glib/merge_requests/940
2019-07-01 13:33:13 +00:00
Nirbheek Chauhan
a1c44cca3a leakstracer: Remove unused and redundant record fields
All leak records are obviously scoped to the process, and nothing in
the GstTracerRecord code uses these fields anyway.
2019-07-01 13:33:13 +00:00
Nirbheek Chauhan
bafa7a5ca7 leakstracer: Improve documentation for the element
Also print a useful g_warning() message when leaks are detected.
2019-07-01 13:33:13 +00:00
Nirbheek Chauhan
145f8546c4 gstinfo: Add an explicit enum for GST_STACK_TRACE_SHOW_NONE
The code implicitly uses this value when the stack trace is not FULL.
Mostly useful for documenting the behaviour when each flag is passed
and for translating to/from strings.
2019-07-01 10:36:09 +00:00
Thibault Saunier
f040102d45 docs: Add tracers support 2019-05-31 18:53:43 -04:00
Matthew Waters
a0400a0d28 docs: include tracers in the documentation
Requires exposing the tracer GType from the GstTracerFactory in order
to link the plugin with the tracer in the documentation.

https://bugzilla.gnome.org/show_bug.cgi?id=791253
2017-12-14 14:46:46 +11:00
Mathieu Duponchelle
f911fe4314 gstleaks.c: always log leaks listing
https://bugzilla.gnome.org/show_bug.cgi?id=789556
2017-11-02 14:53:48 +01:00
Thibault Saunier
bd73551cc0 leaks: Handle subclasses in filters even for unhandled/lazy loaded types
Using typename in the set of unhandled types instead of the quark so
that we also handle subclasses as with other filters.
2017-05-20 15:42:16 +02:00
Thibault Saunier
29f0a79880 leaks: Allow user to set the flags to use to retrieve stack traces
https://bugzilla.gnome.org/show_bug.cgi?id=775541
2016-12-20 15:29:10 -03:00
Thibault Saunier
30133909ce leaks: Allow tracing Gst(Mini)Object reffing operations
It makes it much simpler to later debug refcount issues.

https://bugzilla.gnome.org/show_bug.cgi?id=775541
2016-12-20 15:29:10 -03:00
Thibault Saunier
32b17a8f3d leaks: Allow passing a GstStructure to configure the tracer
But keep understanding the simple synthax with a comma separated
list of filters

https://bugzilla.gnome.org/show_bug.cgi?id=775541
2016-12-20 15:29:10 -03:00
Thibault Saunier
33616d47be info: Add a 'flags' parametter to gst_debug_get_stack_trace
This is an API break but that API has not been released yet.

We are passing a flag rather than a simple boolean as we can imagine
to implement more features in the future for example to retrieve a
stack trace for all the threads, etc..

Retrieving source file and line numbers is pretty
expensive while getting a stack trace, this new argument
allows the user to decide to retrieve a backtrace
without those infos instead which is much faster.

For example running $ GST_LEAKS_TRACER_STACK_TRACE=1 GST_DEBUG=GST_TRACER:7 \
GST_TRACERS=leaks time gst-launch-1.0 videotestsrc num-buffers=1 ! fakesink:

* With simple stack traces:

    0.04s user 0.02s system 99% cpu 0.060 total

* With full stack traces:

    0.66s user 0.23s system 96% cpu 0.926 total

https://bugzilla.gnome.org/show_bug.cgi?id=775423
2016-12-12 15:06:20 -03:00
Thibault Saunier
85179a674f tracers: leaks: Use the new gst_debug_get_stack_trace
And remove the local implementation of it.

https://bugzilla.gnome.org/show_bug.cgi?id=772555
2016-11-04 14:22:05 -03:00
Guillaume Desmottes
714ea37282 tracers: leaks: update type filter later for unknown types
This allow us to filter using an object type which is implemented
by a plugin like, say, GstGtkGLSink.

https://bugzilla.gnome.org/show_bug.cgi?id=768989
2016-07-20 14:14:48 +01:00
Guillaume Desmottes
59885c2a92 leaks: check return values of libunwind calls 2016-07-11 12:44:19 +01:00
Guillaume Desmottes
9ba53ff1fc leaks: warn if object is destroyed while the tracer is disposing
This should not happen and generally means some thread is still running.

https://bugzilla.gnome.org/show_bug.cgi?id=768578
2016-07-08 17:35:30 +01:00
Guillaume Desmottes
1ed4140d00 leaks tracer: use G_OS_UNIX to check for signal support
Checking for signal.h is not good enough as it's present in Windows.
Those signals are UNIX specific anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=767857
2016-07-08 12:38:46 +03:00
Guillaume Desmottes
17c37efa83 leaks tracer: add creation stack trace support
This allow us to provide the trace of leaked objects making it easier
to debug.

https://bugzilla.gnome.org/show_bug.cgi?id=767862
2016-07-08 12:07:53 +03:00
Guillaume Desmottes
3bb5c1e73a leaks tracer: add checkpoint support using SIGUSR2
https://bugzilla.gnome.org/show_bug.cgi?id=767857
2016-07-08 11:23:43 +03:00
Guillaume Desmottes
53d2e8c977 leaks tracer: log alive objects when receiving SIGUSR1
We don't want to automatically catch signals so use an env variable to
enable this feature.

https://bugzilla.gnome.org/show_bug.cgi?id=767857
2016-07-08 11:23:38 +03:00
Tim-Philipp Müller
6446a1a45c tracers: leaks: some micro-optimisations
- we know number of filter items is not going to change,
  but compiler doesn't

- only do GST_IS_TRACER check for GObjects, not mini objects

- use non-type check cast macros in performance critical paths
2016-06-03 14:03:25 +01:00
Guillaume Desmottes
0bb7fa9855 tracers: add leaks tracer
https://bugzilla.gnome.org/show_bug.cgi?id=765052
2016-06-03 00:36:46 +01:00