bt2c::Logger: remove unused cLevel() method
[babeltrace.git] / tests / data / plugins / flt.lttng-utils.debug-info / bt_plugin_test_debug_info.py
CommitLineData
0235b0db
MJ
1# SPDX-License-Identifier: GPL-2.0-only
2#
3# Copyright (C) 2019 EfficiOS Inc.
4#
5
8cca03c6
FD
6import math
7
5995b304
SM
8import bt2
9
7132b838 10bt2.register_plugin(__name__, "test-debug-info")
8cca03c6
FD
11
12
13class CompleteIter(bt2._UserMessageIterator):
14 def __init__(self, config, output_port):
15 ec = output_port.user_data
16 sc = ec.stream_class
17 tc = sc.trace_class
18
19 trace = tc()
20 stream = trace.create_stream(sc)
21
22 ev = self._create_event_message(ec, stream, default_clock_snapshot=123)
23
24 ev.event.payload_field["bool"] = False
25 ev.event.payload_field["real_single"] = 2.0
26 ev.event.payload_field["real_double"] = math.pi
27 ev.event.payload_field["int32"] = 121
28 ev.event.payload_field["int3"] = -1
29 ev.event.payload_field["int9_hex"] = -92
30 ev.event.payload_field["uint32"] = 121
31 ev.event.payload_field["uint61"] = 299792458
32 ev.event.payload_field["uint5_oct"] = 29
f5567ea8
FD
33 ev.event.payload_field["struct"]["str"] = "Rotisserie St-Hubert"
34 ev.event.payload_field["struct"]["option_real"] = math.pi
8cca03c6
FD
35 ev.event.payload_field["string"] = "🎉"
36 ev.event.payload_field["dyn_array"] = [1.2, 2 / 3, 42.3, math.pi]
37 ev.event.payload_field["dyn_array_len"] = 4
38 ev.event.payload_field["dyn_array_with_len"] = [5.2, 5 / 3, 42.5, math.pi * 12]
f5567ea8 39 ev.event.payload_field["sta_array"] = ["🕰", "ðŸĶī", " 🎍"]
8cca03c6
FD
40 ev.event.payload_field["option_none"]
41 ev.event.payload_field["option_some"] = "NORMANDIN"
42 ev.event.payload_field["option_bool_selector"] = True
43 ev.event.payload_field["option_bool"] = "Mike's"
44 ev.event.payload_field["option_int_selector"] = 1
45 ev.event.payload_field["option_int"] = "Barbies resto bar grill"
f5567ea8 46 ev.event.payload_field["variant"].selected_option_index = 0
8cca03c6
FD
47 ev.event.payload_field["variant"] = "Couche-Tard"
48
49 self._msgs = [
50 self._create_stream_beginning_message(stream),
51 ev,
52 self._create_stream_end_message(stream),
53 ]
54
55 def __next__(self):
56 if len(self._msgs) > 0:
57 return self._msgs.pop(0)
58 else:
59 raise StopIteration
60
61
62@bt2.plugin_component_class
63class CompleteSrc(bt2._UserSourceComponent, message_iterator_class=CompleteIter):
64 def __init__(self, config, params, obj):
65 tc = self._create_trace_class()
66 cc = self._create_clock_class()
67 sc = tc.create_stream_class(default_clock_class=cc)
68
69 dyn_array_elem_fc = tc.create_double_precision_real_field_class()
70 dyn_array_with_len_elem_fc = tc.create_double_precision_real_field_class()
71 dyn_array_with_len_fc = tc.create_unsigned_integer_field_class(19)
72 sta_array_elem_fc = tc.create_string_field_class()
73 option_some_fc = tc.create_string_field_class()
74 variant_fc = tc.create_variant_field_class()
75 variant_fc.append_option(
f5567ea8 76 name="var_str", field_class=tc.create_string_field_class()
8cca03c6
FD
77 )
78 option_none_fc = tc.create_double_precision_real_field_class()
79 struct_fc = tc.create_structure_field_class()
80 struct_option_fc = tc.create_double_precision_real_field_class()
f5567ea8 81 struct_fc.append_member("str", tc.create_string_field_class())
8cca03c6 82 struct_fc.append_member(
f5567ea8 83 "option_real",
8cca03c6
FD
84 tc.create_option_without_selector_field_class(struct_option_fc),
85 )
86 option_bool_selector_fc = tc.create_bool_field_class()
87 option_int_selector_fc = tc.create_unsigned_integer_field_class(8)
88
89 payload = tc.create_structure_field_class()
90 payload += [
91 ("bool", tc.create_bool_field_class()),
92 ("real_single", tc.create_single_precision_real_field_class()),
93 ("real_double", tc.create_double_precision_real_field_class()),
94 ("int32", tc.create_signed_integer_field_class(32)),
95 ("int3", tc.create_signed_integer_field_class(3)),
96 (
97 "int9_hex",
98 tc.create_signed_integer_field_class(
99 9, preferred_display_base=bt2.IntegerDisplayBase.HEXADECIMAL
100 ),
101 ),
102 ("uint32", tc.create_unsigned_integer_field_class(32)),
103 ("uint61", tc.create_unsigned_integer_field_class(61)),
104 (
105 "uint5_oct",
106 tc.create_unsigned_integer_field_class(
107 5, preferred_display_base=bt2.IntegerDisplayBase.OCTAL
108 ),
109 ),
110 ("struct", struct_fc),
111 ("string", tc.create_string_field_class()),
112 ("dyn_array", tc.create_dynamic_array_field_class(dyn_array_elem_fc)),
113 ("dyn_array_len", dyn_array_with_len_fc),
114 (
115 "dyn_array_with_len",
116 tc.create_dynamic_array_field_class(
117 dyn_array_with_len_elem_fc, length_fc=dyn_array_with_len_fc
118 ),
119 ),
52ea9593 120 ("sta_array", tc.create_static_array_field_class(sta_array_elem_fc, 3)),
8cca03c6
FD
121 (
122 "option_none",
123 tc.create_option_without_selector_field_class(option_none_fc),
124 ),
125 (
126 "option_some",
127 tc.create_option_without_selector_field_class(option_some_fc),
128 ),
129 ("option_bool_selector", option_bool_selector_fc),
130 (
131 "option_bool",
132 tc.create_option_with_bool_selector_field_class(
133 tc.create_string_field_class(), option_bool_selector_fc
134 ),
135 ),
136 (
137 "option_bool_reversed",
138 tc.create_option_with_bool_selector_field_class(
139 tc.create_string_field_class(),
140 option_bool_selector_fc,
141 selector_is_reversed=True,
142 ),
143 ),
144 ("option_int_selector", option_int_selector_fc),
145 (
146 "option_int",
147 tc.create_option_with_integer_selector_field_class(
148 tc.create_string_field_class(),
149 option_int_selector_fc,
150 bt2.UnsignedIntegerRangeSet([(1, 3), (18, 44)]),
151 ),
152 ),
153 ("variant", variant_fc),
154 ]
155 ec = sc.create_event_class(name="my-event", payload_field_class=payload)
156
157 self._add_output_port("some-name", ec)
This page took 0.058793 seconds and 5 git commands to generate.