98930aa66f5fa33a959ec4fdaa0c25c8e6ee63fc
1 # SPDX-License-Identifier: GPL-2.0-only
3 # Copyright (C) 2020 EfficiOS Inc.
9 class TheSourceIterator(bt2
._UserMessageIterator
):
10 def __init__(self
, config
, port
):
11 tc
, sc
, ec
= port
.user_data
15 # Make two streams with the same name, to verify the stream filenames
16 # are de-duplicated properly. Make one with the name "metadata" to
17 # verify the resulting data file is not named "metadata".
18 stream1
= trace
.create_stream(sc
, name
="the-stream")
19 stream2
= trace
.create_stream(sc
, name
="the-stream")
20 stream3
= trace
.create_stream(sc
, name
="metadata")
23 self
._create
_stream
_beginning
_message
(stream1
),
24 self
._create
_stream
_beginning
_message
(stream2
),
25 self
._create
_stream
_beginning
_message
(stream3
),
26 self
._create
_event
_message
(ec
, stream1
),
27 self
._create
_event
_message
(ec
, stream2
),
28 self
._create
_event
_message
(ec
, stream3
),
29 self
._create
_stream
_end
_message
(stream1
),
30 self
._create
_stream
_end
_message
(stream2
),
31 self
._create
_stream
_end
_message
(stream3
),
35 if len(self
._msgs
) == 0:
38 return self
._msgs
.pop(0)
41 @bt2.plugin_component_class
42 class TheSource(bt2
._UserSourceComponent
, message_iterator_class
=TheSourceIterator
):
43 def __init__(self
, config
, params
, obj
):
44 tc
= self
._create
_trace
_class
()
45 sc
= tc
.create_stream_class()
46 ec
= sc
.create_event_class(name
="the-event")
47 self
._add
_output
_port
("out", user_data
=(tc
, sc
, ec
))
50 bt2
.register_plugin(__name__
, "foo")
This page took 0.03168 seconds and 5 git commands to generate.