Commit graph

26 commits

Author SHA1 Message Date
Tim-Philipp Müller
df6cbe64cd tools: gst-stats: parse thread-id in windows debug logs properly
They don't seem to have the "0x" prefix.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/376>
2020-05-01 21:12:31 +00:00
Johan Bjäreholt
ef0df31c5e gst-stats: Fix missing NULL checks
gst-inspect-1.0 segfaults on tracing logs where it fails to find
element stats. So on the pipelines where we get the following WARNING
during execution will afterwards crash with a segfault as the
g_ptr_array has a index for it but it is just a NULL pointer.

WARN default gst-stats.c:444:do_message_stats: no element stats found for ix=X

An example of an pipeline which can reproducibly create a trace log
where this occurs would be this

GST_DEBUG="GST_TRACER:7" GST_TRACERS="stats;rusage;latency" gst-launch-1.0 videotestsrc num-buffers=120 ! autovideosink &> trace.log
gst-stats-1.0 trace.log
2020-02-28 15:14:58 +00:00
Nirbheek Chauhan
e9085043c1 Don't use glib format modifiers with sscanf or printf
We do not have a way to know the format modifiers to use with string
functions provided by the system. `G_GUINT64_FORMAT` and other string
modifiers only work for glib string formatting functions. We cannot
use them for string functions provided by the stdlib. See:
https://developer.gnome.org/glib/stable/glib-Basic-Types.html#glib-Basic-Types.description

F.ex.:

```
 ../tools/gst-stats.c:921:11: error: too many arguments for format [-Werror=format-extra-args]
   printf ("Number of Buffers passed: %" G_GUINT64_FORMAT "\n", num_buffers);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../tools/gst-stats.c:922:11: error: unknown conversion type character 'l' in format [-Werror=format=]
   printf ("Number of Events sent: %" G_GUINT64_FORMAT "\n", num_events);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /builds/nirbheek/cerbero/cerbero-build/dist/windows_x86_64/include/glib-2.0/glib/gtypes.h:32,
                 from /builds/nirbheek/cerbero/cerbero-build/dist/windows_x86_64/include/glib-2.0/glib/galloca.h:32,
                 from /builds/nirbheek/cerbero/cerbero-build/dist/windows_x86_64/include/glib-2.0/glib.h:30,
                 from ../gst/gst.h:27,
                 from ../tools/tools.h:28,
                 from ../tools/gst-stats.c:30:
/builds/nirbheek/cerbero/cerbero-build/dist/windows_x86_64/lib/glib-2.0/include/glibconfig.h:69:28: note: format string is defined here
 #define G_GUINT64_FORMAT "llu"
                            ^
```

and

```
../tests/misc/netclock-replay.c: In function 'main':
../tests/misc/netclock-replay.c:98:23: error: unknown conversion type character 'l' in format [-Werror=format=]
     if (sscanf (line, "%" G_GUINT64_FORMAT " %" G_GUINT64_FORMAT " %"
                       ^~~
In file included from /builds/nirbheek/cerbero/cerbero-build/dist/windows_x86/include/glib-2.0/glib/gtypes.h:32,
                 from /builds/nirbheek/cerbero/cerbero-build/dist/windows_x86/include/glib-2.0/glib/galloca.h:32,
                 from /builds/nirbheek/cerbero/cerbero-build/dist/windows_x86/include/glib-2.0/glib.h:30,
                 from ../tests/misc/../../libs/gst/net/gstntppacket.c:38,
                 from ../tests/misc/netclock-replay.c:31:
/builds/nirbheek/cerbero/cerbero-build/dist/windows_x86/lib/glib-2.0/include/glibconfig.h:69:28: note: format string is defined here
 #define G_GUINT64_FORMAT "llu"
                            ^
```

This is needed for upgrading glib inside Cerbero which builds with
`-Werror` on Windows:
https://gitlab.freedesktop.org/gstreamer/cerbero/merge_requests/419
2020-02-25 21:22:28 +05:30
Guillaume Desmottes
35294f365e gst-stats: fix leaks
String returned from g_match_info_fetch() needs to be freed.
2019-07-08 13:16:08 +02:00
Guillaume Desmottes
71f1b5ec83 gst-stats: sort latency by first activity before displaying
We use to display the latency of each element in random order which is
not very convenient when comparing latency between different runs.
Sort them by "first activity" (the first latency reported for each
element) so it's consistent betwen runs.

This is the same logic when sorting and displaying element stats.
2019-07-08 13:13:40 +02:00
Guillaume Desmottes
ab60a330db gst-stats: format latency as GST_TIME
Latency is easier to read when formatted as time rather than displayed
as a flat number in ns.
Especially when displaying GST_CLOCK_TIME_NONE which is now formated as
99:99:99.999999999 instead of 18446744073709551615.
2019-04-25 06:28:26 +00:00
Julian Bouzas
1ec8114717 tracer: latency: Show element id, element name and pad name 2019-04-09 08:50:16 -04:00
Julian Bouzas
e615a3ddee gst-stats: Add element latency support
This will output latency information when parsing a log file with gst-stats that
has latency trace information. It will show the min, max and mean latency for
the pipeline and all its elements. It will also show the reported latency for
each element of the pipeline. Output example:

Latency Statistics:
	pulsesrc0_src|fakesink0_sink: mean=190000043 min=190000043 max=190000043

Element Latency Statistics:
	flacparse0_src: mean=45561281 min=654988 max=90467575
	flacenc0_src: mean=89938883 min=81913512 max=97964254
	flacdec0_src: mean=45804881 min=228962 max=91380801

Element Reported Latency:
	pulsesrc0: min=10000000 max=200000000 ts=0:00:00.262846528
	flacenc0: min=104489795 max=104489795 ts=0:00:00.262898616
	flacparse0: min=0 max=0 ts=0:00:00.262927962
2019-04-08 12:28:07 -04:00
Scott D Phillips
f37688ef4d tools: gst-stats: Use standard character escapes
Having '\e' expand to '\x1b' is a gnu extension. I didn't see any
document describing the behavior, but gcc also seems to expand
'\[' to '['.

https://bugzilla.gnome.org/show_bug.cgi?id=782028
2017-07-09 20:10:31 +01: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
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
765cf11ff8 gst-stats: update to latest tarcer api
The thread-ids are serialized as uint64. The 'elem-ix' got changed to
'element-ix'. Make the code a bit more robust.
2016-01-16 21:02:39 +01:00
Luis de Bethencourt
587b95a857 stats: always free log
We always want to free the open file log if fopen() succeeded. Independently
of if fgets() succeeds or fails.

CID 1326055

https://bugzilla.gnome.org/show_bug.cgi?id=756864
2015-10-21 11:19:14 +01:00
Stefan Sauer
e5eb05741b stats: TIMESTAMP -> PTS 2015-10-05 20:59:39 +02:00
Stefan Sauer
d9901e7019 stats: fix cpu stats printing
Only print them if we have them. Also scale them by 10.0 as the are in
per-mille now.
2015-10-05 20:59:39 +02:00
Stefan Sauer
f09dd66cf6 stats: don't warn on ".class" log lines 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
b90ee2a84c gst-stats: use the rusage stats
Add cpuload info from rusage traces.
2015-10-05 20:59:39 +02:00
Stefan Sauer
ff7ba1eb8d gst-stats: filter complete thread section if we have no pads 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
81e617fa70 stats: print thread key for stats and filter empty pad-sections 2015-10-05 20:59:39 +02:00
Stefan Sauer
f8390caf2c stats: update buffer flags
Remove some buffer flags that were leftovers from 0.10 and handle new 1.0 buffer
flags.
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