Commit graph

45 commits

Author SHA1 Message Date
Nicolas Dufresne
f11e9b3aa0 latency tracer: Fix leaks in the reported latency trace
The stack item was not freed as it was supposed, causing leaks.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/269>
2020-07-15 16:28:34 -04:00
Jan Schmidt
e07bb52bf7 latency tracer: Fix unsafe and NULL pointer accesses
Use thread-safe accesses to pad peers and parent objects. This
fixes some crashers and all the non-safe access patterns I could
spot. There's still some weirdness when using the latency
tracer on pipeline chains that aren't yet linked, but this
at least stops it segfaulting.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/269>
2020-07-15 16:28:32 -04:00
Edward Hervey
f590a861be tracers: Don't leak temporary GstStructure
CID: 1455462
2019-11-28 08:03:51 +00:00
Guillaume Desmottes
b7c1195f29 latency: fix custom event leaks
If the element before the sink needs $n buffers to produce one output
buffer, we were reffing $n events and unreffing only one.
Prevent this by using g_object_set_qdata_full() to handle the event
unreffing so we're sure no ref will be lost.
2019-08-13 09:09:55 +05:30
Guillaume Desmottes
e4cba8a0bf tracers: set MAY_BE_LEAKED on tracer records
The records are static and so appear as false positives when using those
tracers with the leaks tracer as well.
The leaks tracer was already setting this flag on its record so let's
set it on the other ones as well.
2019-08-02 13:07:58 +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
Guillaume Desmottes
f321f42359 latency: display event pointer in logs
This is quite useful for debugging when tracer is reporting the wrong
latency because of an element breaking the events/buffers ordering.
2019-06-20 16:42:01 +05:30
Thibault Saunier
f040102d45 docs: Add tracers support 2019-05-31 18:53:43 -04:00
Julian Bouzas
35788c8563 tracer: latency: Don't compare element name as element Id is already unique 2019-04-15 11:29:32 +00:00
Julian Bouzas
e128c7310c tracer: latency: Remove redundant if conditions 2019-04-15 11:29:32 +00:00
Julian Bouzas
780bf26e43 tracer: latency: Make GST_DEBUG logs consistent 2019-04-15 11:29:32 +00:00
Julian Bouzas
a376bab21d tracer: latency: Fix bug when dropping sub-latency probe event
Fixes #373
2019-04-15 11:29:32 +00:00
Julian Bouzas
d908dee9e9 tracer: latency: Fix typo bug 2019-04-10 09:17:01 -04:00
Julian Bouzas
308f505110 tracer: latency: Fix bug when storing latency probe event
The pad name sotred in the latency event has no longer the name of the element,
so we have to get the element Id, element name and pad name values from the data
structure and compare all 3 values.
2019-04-10 09:16:03 -04:00
Julian Bouzas
1ec8114717 tracer: latency: Show element id, element name and pad name 2019-04-09 08:50:16 -04:00
Julian Bouzas
0f0403e5d9 tracer: latency: Show per-element reported latency 2019-04-08 12:28:07 -04:00
Julian Bouzas
e975d5d1c4 tracer: latency: Show element's source pad name instead of element's name
The full pad name gives more information than the element's name, which is very
useful when elements have multiple source pads.
2019-04-08 12:28:07 -04:00
Nicolas Dufresne
5470f6df00 latency: Dot not override already stored events
First, the event would be leaved, but also when an element takes
several buffers before producing one, we want the reported latency to be
the aggregation, so the distance from the oldest buffer.
2019-04-08 12:28:07 -04:00
Nicolas Dufresne
bdb75a1450 tracer: latency: Add parameter to select latency type
This sets back the default to trace only pipeline latency, and add flags
to enabled element tracing. It is now possible to only trace element
latency, only trace pipeline latency, trace both or none.
2019-04-08 12:28:07 -04:00
Nicolas Dufresne
6a35153e4e tracer: latency: Add per element latency tracer
This adds per element latency tracing.
2019-04-08 12:28:07 -04:00
Nicolas Dufresne
4585d22a8d tracer: Don't pass pads inside GstEvent
This removes the passing of pad inside of a GstEvent. While this is not
a bug, it may affect the live time of the pad, hense change the pipeline
behaviour.
2019-04-08 12:28:07 -04:00
luz.paz
4a402c1c7d Fix typos in comments and docs
Found via `codespell`

https://bugzilla.gnome.org/show_bug.cgi?id=795610
2018-05-01 11:18:03 +01:00
Matthew Waters
7fad93d035 tracers: latency: allow for non parented pads to send latency probes
Such a setup is used in rtspsrc for its TCP connection

https://bugzilla.gnome.org/show_bug.cgi?id=793478
2018-02-16 13:14:40 +00: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
Guillaume Desmottes
4670036691 latency tracer: add timestamp to tracer records
Include the timestamp of the recorded log as in the 'stats' tracer.
This can be useful, for example, to plot a graph showing the latency
over time.

https://bugzilla.gnome.org/show_bug.cgi?id=781315
2017-11-04 13:51:00 -04: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
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
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
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
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
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
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
4f6f8cb811 tracers: add metadata for the logged values 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