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 <module>
    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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4155>
This commit is contained in:
Alicia Boya García 2023-03-10 23:39:25 +01:00 committed by GStreamer Marge Bot
parent 85b6625150
commit ac6a457614

View file

@ -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',