From ac6a4576145e8a3436a222288b743341b50f8df0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alicia=20Boya=20Garc=C3=ADa?= Date: Fri, 10 Mar 2023 23:39:25 +0100 Subject: [PATCH] stats: Adapt to new serialization of enums GStreamer 1.18 changed the serialization of enums. This patch updates gsttr-stats.py to handle the new format. In absence of that, the script was failing like this: ``` Traceback (most recent call last): File "/home/ntrrgc/Apps/gstreamer/./subprojects/gst-devtools/tracer/gsttr-stats.py", line 224, in runner.run() File "/home/ntrrgc/Apps/gstreamer/subprojects/gst-devtools/tracer/tracer/analysis_runner.py", line 42, in run self.handle_tracer_entry(event) File "/home/ntrrgc/Apps/gstreamer/subprojects/gst-devtools/tracer/tracer/analysis_runner.py", line 27, in handle_tracer_entry analyzer.handle_tracer_entry(event) File "/home/ntrrgc/Apps/gstreamer/./subprojects/gst-devtools/tracer/gsttr-stats.py", line 114, in handle_tracer_entry key = (_SCOPE_RELATED_TO[sv.values['related-to']] + ":" + str(s.values[sk])) KeyError: 'thread' ``` Part-of: --- subprojects/gst-devtools/tracer/gsttr-stats.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/subprojects/gst-devtools/tracer/gsttr-stats.py b/subprojects/gst-devtools/tracer/gsttr-stats.py index 192db8683f..335aac7623 100644 --- a/subprojects/gst-devtools/tracer/gsttr-stats.py +++ b/subprojects/gst-devtools/tracer/gsttr-stats.py @@ -30,6 +30,16 @@ logging.basicConfig(level=logging.WARNING) logger = logging.getLogger('gsttr-stats') _SCOPE_RELATED_TO = { + # The serialization of enums changed in GStreamer 1.18: + # https://gitlab.freedesktop.org/gstreamer/gstreamer/-/commit/0dafe6e63971ea89a9a9ff9cf30f5a076f915259 + + # Enum nicks (new serialization) + 'pad': 'Pad', + 'element': 'Element', + 'thread': 'Thread', + 'process': 'Process', + + # Enum names (old serialization): 'GST_TRACER_VALUE_SCOPE_PAD': 'Pad', 'GST_TRACER_VALUE_SCOPE_ELEMENT': 'Element', 'GST_TRACER_VALUE_SCOPE_THREAD': 'Thread',