Actions
Bug #1220
open
SM
filter.utils.trimmer component does not support streams without packets
Bug #1220:
filter.utils.trimmer component does not support streams without packets
Status:
New
Priority:
Normal
Assignee:
-
Category:
flt.utils.trimmer
Target version:
-
Start date:
02/17/2020
Due date:
% Done:
0%
Estimated time:
Description
When trying to use a trimmer component with a stream that does not have packets, we get:
CAUSED BY [filter.utils.trimmer: 'filter.utils.trimmer'] (/home/smarchi/src/babeltrace/src/plugins/utils/trimmer/trimmer.c:1315) Unsupported stream: packets have no beginning clock snapshot: stream-addr=0x60d000001080, stream-id=0, stream-name="(null)"
The trimmer component does not yet support packet messages that don't have default clock snapshots, but it should support streams that don't have packet messages at all.
It can be reproduced with the following plugin file:
import bt2
class MyIter(bt2._UserMessageIterator):
def __init__(self, config, port):
tc, sc, ec, cc = port.user_data
trace = sc.trace_class()
stream = trace.create_stream(sc)
self._msgs = [
self._create_stream_beginning_message(stream),
self._create_event_message(ec, stream, 123),
self._create_stream_end_message(stream),
]
self._i = 0
def __next__(self):
if self._i >= len(self._msgs):
raise bt2.Stop
msg = self._msgs[self._i]
self._i += 1
return msg
def _user_can_seek_beginning(self):
return True
def _user_seek_beginning(self):
self._i = 0
@bt2.plugin_component_class
class MySource(bt2._UserSourceComponent, message_iterator_class=MyIter):
def __init__(self, config, params, obj):
cc = self._create_clock_class()
tc = self._create_trace_class()
sc = tc.create_stream_class(default_clock_class=cc)
ec = sc.create_event_class(name='hello')
self._add_output_port('out', (tc, sc, ec, cc))
bt2.register_plugin(
__name__, "foo",
)
And the command line:
babeltrace2 --plugin-path . -c source.foo.MySource -c filter.utils.trimmer
JR Updated by Jonathan Rajotte Julien over 5 years ago
- Category set to flt.utils.trimmer
Actions