Commit graph

144 commits

Author SHA1 Message Date
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
Nicolas Dufresne 41e35c334b latency-tracer: Exclude synchronization time
The goal of this tracer is to measure the processing latency between a
src and a sink. In push mode, the time was read after the chain function
have returned. As the amount of time we wait to get synched is reverse
to the amount of latency the source introduced, the result was quite
surprising.

This patch moves the latency calculation in the pre-push hook. When
there is no processing in a a pipeline (e.g. fakesrc ! fakesink), the
latency will now be 0 as it's supposed to. For pull mode, the code was
already correct. When GstBaseSink operate in pull mode, the processing
time is done durring the pull, so pull-post is the right hook. The
synchronization will happen after the pull has ended. Note that
GstBaseSink rarely operate in pull mode.

https://bugzilla.gnome.org/show_bug.cgi?id=788431
2017-10-30 15:33:15 -04: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
Nicolas Dufresne d143af2c77 Remove plugin specific static build option
Static and dynamic plugins now have the same interface. The standard
--enable-static/--enable-shared toggle are sufficient.
2017-05-16 13:29:38 -04:00
Stefan Sauer a5246f91af gstrusage: explicitly register to hooks
We were attaching to any probe point to take rusage samples. The new refcount
hooks are called way too frequently though to make this still feasible.
2016-12-21 22:19:51 +01:00
Nirbheek Chauhan 97f39cae63 meson: Derive defines from header/function names
This is what Autoconf already does for us, so just do this. Avoids
people making typos while adding header or function checks. Because we
use a config.h.meson, such typos won't even be noticed.

Also, starting from Meson 0.36.0, the XCode 8 workaround that we use for
clock_gettime is no longer needed.
2016-12-21 23:51:36 +05:30
Stefan Sauer 11cc260448 latency: the latency is not an aggregated value
The logged latencies are individual meassurements.
2016-12-20 21:07:14 +01: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
Stefan Sauer 1bfd04a5fe tracers/stats: log optional fields instead of GST_CLOCK_TIME_NONE
Simplify the traces and avoid trace analyzer to know that ((1<<64) - 1) means
we had no value.
2016-12-16 15:55:21 +01: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 16bd0e7bac meson: Fix build 2016-12-09 19:31:51 -03:00
Thibault Saunier bd5d43e8f9 meson: Support building with Gst debug disabled 2016-12-09 17:57:10 -03:00
Stefan Sauer a25453c2c6 tracers/log: log more detail
Log the objects like we would in GST_TRACE_OBJECT. Add the hook function into
the fucntion field.
2016-12-08 22:03:19 +01:00
Stefan Sauer 8d819a51b8 tracer/log: fix hook prototype
s/GstElement/GstPad/
2016-12-08 22:02:17 +01:00
Stefan Sauer cfb6c7d4f5 tracer/latency: clear qdata
When reading the qdata, clear it to avoid it being read and unreffed again.
Fixes #774332
2016-12-07 21:53:49 +01:00
Stefan Sauer 788c0d220a tracers/log: log messages in message category 2016-12-04 12:15:54 +01: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
Thibault Saunier a8d4857555 gst: Use libunwind/libdw to generate backtraces if avalaible
Making the gst_debug_print_trace function more generally useful.

API:
  + gst_debug_get_trace

https://bugzilla.gnome.org/show_bug.cgi?id=772555
2016-11-04 14:22:05 -03:00
Thibault Saunier 2c6dd70217 stats: Fix warning 2016-10-14 17:30:01 +02:00
Vincent Penquerc'h 18d5d118ab tracers: fix structure leak
https://bugzilla.gnome.org/show_bug.cgi?id=772851
2016-10-13 13:06:40 +01:00
Stefan Sauer ede686c39b tracer/rusage: fix format string args
The format string contains a process id, but we did not provice one. This
caused us to log garbage since all args got shifted.
2016-10-08 13:22:23 +02:00
Tim-Philipp Müller 9791669ac3 meson: tracers: signal availability of libunwind and backtrace() to code
Not setting cdata here on purpose because of .. complications.
2016-09-27 18:24:02 +01:00
Thibault Saunier c4aed66eff meson: Build tracers 2016-09-26 18:27:00 -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
Guillaume Desmottes e0757e1d80 rusage: properly free the queue memory
The queue is allocated as part of the tracer struct so we should not
use g_queue_free() to free it.

https://bugzilla.gnome.org/show_bug.cgi?id=764985
2016-04-13 12:40:41 +03:00
Stefan Sauer ec75b68984 tracerrecord: don't leak the spec structures
Change the gst_tracer_record_new() api to take the parameters the make the
spec structure directly. This allows us to own the top-level structure and
also collect the args so that we can take ownership of the sub-structures.

https://bugzilla.gnome.org/show_bug.cgi?id=760821
2016-01-22 10:07:26 +01:00
Stefan Sauer f69382c5f9 tracer/gststats: fix mismatch between '.class' and tracer args
Clean up from the recent changes. The logging descriptiors did not match what we logged.
2016-01-20 09:14:12 +01:00
Tim-Philipp Müller 8641d7c911 tracers: fix thread-id casts to 64-bit ints on 32-bit systems
https://bugzilla.gnome.org/show_bug.cgi?id=760762
2016-01-18 11:28:28 +00:00
Stefan Sauer 84554af301 tracer/stats: use the right log template
When porting we used the wrong record (copy and paste).
2016-01-16 21:23:10 +01:00
Stefan Sauer af91d23204 tracer: use the new flags to create the optional field in the format string
This spares us explicitly listing the field in the spec. and thus hide this
implementation detail.
2016-01-16 19:21:00 +01:00
Stefan Sauer 8cd76a918a tracer: add a GstTracerValueFlags and replace strings
This allows us to document the flags and makes the logs a bit smaller.
2016-01-16 18:52:32 +01:00
Tim-Philipp Müller 8b88fc487f gst.h: Don't spew warnings if GST_USE_UNSTABLE_API is not defined
Only hide GstTracer and GstTracerRecord API behind GST_USE_UNSTABLE_API,
but don't spew any warnings, otherwise everyone has to define this
to avoid compiler warnings.

This reverts parts of commit 89ee5d948d.
2016-01-16 16:00:16 +00:00
Stefan Sauer 89ee5d948d tracer: add a GFlag for the tracer scope
Port all tracers. Add the GST_USE_UNSTABLE_API flag to the internal CFLAGS so
that we don't have to specify this for gir, docs, mkenum, ...
2016-01-16 13:31:51 +01:00
Stefan Sauer 10b78d872b tracerrecord: add a log record class
We use this class to register tracer log entry metadata and build a log
template. With the log template we can serialize log data very efficiently.
This also simplifies the logging code, since that is now a simple varargs
function that is not exposing the implementation details.

Add docs for the new class and basic tests.

Remove the previous log handler.

Fixes #760267
2016-01-15 21:54:01 +01:00
Stefan Sauer 30741e0206 tracers: code clean ups
Drop some trailing whilespace. Make field order consistent.
2016-01-10 14:30:05 +01:00
Stefan Sauer 2f41e7bc6a tracer: harmonize the query hooks
In post hooks always pass the return value as the last param. Pass the query
also to post hooks since it is still alive.
2016-01-07 23:03:48 +01:00
Stefan Sauer fb249dadcb tracers/stats: add missing parameters to callback functions 2016-01-07 22:47:37 +01:00
Stefan Sauer 5e40639be7 tracer: make gst_tracing_register_hook_id static
We don't need to expose this as public API. Change the only plugin that was
using it.
2016-01-06 20:46:58 +01:00
Thiago Santos 9f26e5cc63 tracers: log: add missing hooks
Log all possible hooks
2015-11-12 15:39:32 -03:00
Thiago Santos cf5e7c03c2 stats: log the element-new hook properly
To be able to get the time the elements were created instead of
just logging them without a time
2015-10-29 07:27:35 -03:00
Sebastian Dröge 2b8413e1cd tracers: Only link against libgstprintf.la if the debugging system is enabled
It does not exist otherwise and linking will fail.
2015-10-07 12:01:16 +01:00
Stefan Sauer d626c5b996 Revert "tracers: Only build getrusage() tracer if RUSAGE_THREAD is available"
This reverts commit 8ddbf76626.
2015-10-07 12:22:34 +02:00
Stefan Sauer 03045d428b tracers/rusage: ifdef the RUSAGE_THREAD usage
Some versions of andoid don't seem to have it.
2015-10-07 12:21:56 +02:00
Sebastian Dröge 8ddbf76626 tracers: Only build getrusage() tracer if RUSAGE_THREAD is available 2015-10-07 11:13:28 +01:00
Stefan Sauer 03821d18a0 tracers: disable the log tracer if debug logging is disabled 2015-10-06 18:46:24 +02:00
Stefan Sauer 34cf8f3252 makefile.am: Remove obsolete Android build cruft
This is not needed any longer.
2015-10-06 18:45:41 +02:00
Thiago Santos 7c5f7173c8 tracers: stats: add message structure to output
The name of the message is not enough. For example, state-change
is not enough to know the transition.

https://bugzilla.gnome.org/show_bug.cgi?id=754496
2015-10-05 19:06:41 -03:00
Thiago Santos 0913f699e2 tracer: gststats: add thread-id to log line 2015-10-05 20:59:39 +02:00
Thiago Santos 567865c81c tracer: add pad query hooks 2015-10-05 20:59:39 +02:00
Mathieu Duponchelle a9aab3c6c7 tracer: Use GST_TIME_ARGS when printing with GST_TIME_FORMAT. 2015-10-05 20:59:39 +02:00
Stefan Sauer e5eb05741b stats: TIMESTAMP -> PTS 2015-10-05 20:59:39 +02:00
Stefan Sauer 660049bb38 tracing: rename the global api to gst_tracing
This makes it more obvious what is the api for tracer elements and what is api
for the global state.
2015-10-05 20:59:39 +02:00
Stefan Sauer 5e2770566f tracers: eliminate var_args
Register tracer hooks as GCallback. Use macros for hook dispatch and cast the
hook functions back to the appropriate type.
2015-10-05 20:59:39 +02:00
Stefan Sauer b10b10cf1e tracers: code cleanups
Move static variables to instance variables. Add finalize methods. Remove code
that is commented out. Cleanup locking code.
2015-10-05 20:59:39 +02:00
Stefan Sauer 4881d1c16c tracer: use GQuark or strings for the hook id
This way one can define new tracing probes without changing the core. We are
using our own quark table, as 1) we only want to initialize them if we're
tracing, 2) we want to share them with the tracers.
2015-10-05 20:59:39 +02:00
Stefan Sauer 1a3e218b89 tracer: simplify hook api
Instead of a single invoke() function and a 'mask', register to individual
hooks. This avoids one level of indirection and allows us to remove the
hook enums. The message enms are now renamed to hook enums.
2015-10-05 20:59:39 +02:00
Stefan Sauer 7b24d76260 tracer: drop the HookId hid from the invoke method
The MessageId is more detailed and anyway needed to interpret the varargs.
2015-10-05 20:59:39 +02:00
Stefan Sauer 4ab1e6e3f7 stats: fixup doc name and remove commented code 2015-10-05 20:59:39 +02:00
Stefan Sauer 4f6f8cb811 tracers: add metadata for the logged values 2015-10-05 20:59:39 +02:00
Stefan Sauer 3baaa4ba6f rusage: improve cpu load meassurements
Get the number of cpus and scale process cpu-load accordingly. Switch the
cpuload to be per-mille to get smoother graphs. Add a bit more logging and use
the _OBJECT variant.
2015-10-05 20:59:39 +02:00
Stefan Sauer dbb1897e9b rusage: implement windowing of cpuload
Add a local help to the rusage plugin that supports windowing of values. We want
to generalize this for use in other plugins.
2015-10-05 20:59:39 +02:00
Stefan Sauer 018858980b rusage: announce the data format
Rusage will now announce what is meassures and how it is logged. Use the new format in stats.
Cleanup the the code and naming.
2015-10-05 20:59:39 +02:00
Stefan Sauer c13ee1f2e9 stats: improve cpu load meassurements
Rename variables for clarity. Handle the initial disparity between debug time
and the time already spent in the proc and main thread.
2015-10-05 20:59:39 +02:00
Stefan Sauer 46ea9729df tracer: split into tracer and tracerutils
Keep tracer base class in tracer and move core support into the utils module.
Add a unstable-api guard to the tracer.h so that external modules would need to
acknowledge the status by setting GST_USE_UNSTABLE_API.
2015-10-05 20:59:39 +02:00
Stefan Sauer 6ea2b41364 docs: add gtk-doc blobs 2015-10-05 20:59:39 +02:00
Stefan Sauer 757d3400cd latency: take stop time when buffer is handled
Now we meassure time from 'before buffer transfer on src' to when the 'buffer is processed on sink'.
2015-10-05 20:59:39 +02:00
Stefan Sauer 7dfc0a8ead tracers: add a logging helper to remove identical copies from the tracers 2015-10-05 20:59:39 +02:00
Stefan Sauer 635a4b5c00 tracers: tweak the get_real_pad_parent()
By using the we ended up on the actual element, not the parent.
2015-10-05 20:59:39 +02:00
Stefan Sauer 111b18115a tracers: add a new latency tracer
Add a new tracer with pushes extra events to meassure src-to-sink processing latency.
2015-10-05 20:59:39 +02:00
Stefan Sauer fc9392c10f rusage: add a new rusage tracer
The tracer hooks up to all probes and logs resource usage figures.
2015-10-05 20:59:39 +02:00
Stefan Sauer 0c26387e62 stats: improve the handling of parentage
Log new object after we did the check for parents.
2015-10-05 20:59:39 +02:00
Stefan Sauer b8eef6ba2c stats: add a stats frontend
Parse the log and collect data from tracer messages.
2015-10-05 20:59:39 +02:00
Stefan Sauer ac92e5674e log: add query log category 2015-10-05 20:59:39 +02:00
Stefan Sauer ce7ce2d866 tracer: add more hooks and handle it in the plugins 2015-10-05 20:59:39 +02:00
Stefan Sauer 37721fdc9d stats: handle buffer lists 2015-10-05 20:59:39 +02:00
Stefan Sauer 75fb1f1a73 log: make the log tracer more verbose again
Define log formats per message type and print details.
2015-10-05 20:59:39 +02:00
Stefan Sauer 11d6e13d73 tracer: use a macros for the enabled check
Avoid a function call and check the variables from the macro.
2015-10-05 20:59:39 +02:00
Stefan Sauer 9d3975b5da tracer: pass the timestamp directly
Avoid the structure mashalling (and weird field naming).
2015-10-05 20:59:39 +02:00
Stefan Sauer d663b78612 stats: add a tracer that collects pipeline statistics
This is more or less equiv to the the statistics in gst-tracelib.
2015-10-05 20:59:39 +02:00
Stefan Sauer 2c6672435f log: add cast macro 2015-10-05 20:59:39 +02:00
Stefan Sauer c2d5b35332 tracer: pass the instance to the vmethod 2015-10-05 20:59:39 +02:00
Stefan Sauer 8a8f16863b design: more planning 2015-10-05 20:59:39 +02:00
Stefan Sauer 68b1473846 tracer: add the hook-id to the invoke signature
Tracers that subscribe to multiple hooks can know what hook was used.
2015-10-05 20:59:39 +02:00
Stefan Sauer 4e5d586c7d tracer: initial prototype for the tracing subsystem 2015-10-05 20:59:39 +02:00