1 # The MIT License (MIT)
3 # Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
5 # Permission is hereby granted, free of charge, to any person obtaining a copy
6 # of this software and associated documentation files (the "Software"), to deal
7 # in the Software without restriction, including without limitation the rights
8 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 # copies of the Software, and to permit persons to whom the Software is
10 # furnished to do so, subject to the following conditions:
12 # The above copyright notice and this permission notice shall be included in
13 # all copies or substantial portions of the Software.
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 # import all public names
26 from bt2
.clock_class
import ClockClassOffset
27 from bt2
.clock_snapshot
import _ClockSnapshotConst
28 from bt2
.clock_snapshot
import _UnknownClockSnapshot
29 from bt2
.component
import _SourceComponentClassConst
30 from bt2
.component
import _FilterComponentClassConst
31 from bt2
.component
import _SinkComponentClassConst
32 from bt2
.component
import _SourceComponentConst
33 from bt2
.component
import _FilterComponentConst
34 from bt2
.component
import _SinkComponentConst
35 from bt2
.component
import _UserSourceComponent
36 from bt2
.component
import _UserFilterComponent
37 from bt2
.component
import _UserSinkComponent
38 from bt2
.component_descriptor
import ComponentDescriptor
39 from bt2
.error
import ComponentClassType
40 from bt2
.error
import _ErrorCause
41 from bt2
.error
import _ComponentErrorCause
42 from bt2
.error
import _ComponentClassErrorCause
43 from bt2
.error
import _MessageIteratorErrorCause
44 from bt2
.error
import _Error
45 from bt2
.event_class
import EventClassLogLevel
46 from bt2
.field
import _BoolField
47 from bt2
.field
import _BitArrayField
48 from bt2
.field
import _IntegerField
49 from bt2
.field
import _UnsignedIntegerField
50 from bt2
.field
import _SignedIntegerField
51 from bt2
.field
import _RealField
52 from bt2
.field
import _SinglePrecisionRealField
53 from bt2
.field
import _DoublePrecisionRealField
54 from bt2
.field
import _EnumerationField
55 from bt2
.field
import _UnsignedEnumerationField
56 from bt2
.field
import _SignedEnumerationField
57 from bt2
.field
import _StringField
58 from bt2
.field
import _StructureField
59 from bt2
.field
import _OptionField
60 from bt2
.field
import _VariantField
61 from bt2
.field
import _ArrayField
62 from bt2
.field
import _StaticArrayField
63 from bt2
.field
import _DynamicArrayField
64 from bt2
.field
import _BoolFieldConst
65 from bt2
.field
import _BitArrayFieldConst
66 from bt2
.field
import _IntegerFieldConst
67 from bt2
.field
import _UnsignedIntegerFieldConst
68 from bt2
.field
import _SignedIntegerFieldConst
69 from bt2
.field
import _RealFieldConst
70 from bt2
.field
import _SinglePrecisionRealFieldConst
71 from bt2
.field
import _DoublePrecisionRealFieldConst
72 from bt2
.field
import _EnumerationFieldConst
73 from bt2
.field
import _UnsignedEnumerationFieldConst
74 from bt2
.field
import _SignedEnumerationFieldConst
75 from bt2
.field
import _StringFieldConst
76 from bt2
.field
import _StructureFieldConst
77 from bt2
.field
import _OptionFieldConst
78 from bt2
.field
import _VariantFieldConst
79 from bt2
.field
import _ArrayFieldConst
80 from bt2
.field
import _StaticArrayFieldConst
81 from bt2
.field
import _DynamicArrayFieldConst
82 from bt2
.field_class
import IntegerDisplayBase
83 from bt2
.field_class
import _BoolFieldClass
84 from bt2
.field_class
import _BitArrayFieldClass
85 from bt2
.field_class
import _IntegerFieldClass
86 from bt2
.field_class
import _UnsignedIntegerFieldClass
87 from bt2
.field_class
import _SignedIntegerFieldClass
88 from bt2
.field_class
import _RealFieldClass
89 from bt2
.field_class
import _EnumerationFieldClass
90 from bt2
.field_class
import _UnsignedEnumerationFieldClass
91 from bt2
.field_class
import _SignedEnumerationFieldClass
92 from bt2
.field_class
import _StringFieldClass
93 from bt2
.field_class
import _StructureFieldClass
94 from bt2
.field_class
import _OptionFieldClass
95 from bt2
.field_class
import _OptionWithSelectorFieldClass
96 from bt2
.field_class
import _OptionWithBoolSelectorFieldClass
97 from bt2
.field_class
import _OptionWithIntegerSelectorFieldClass
98 from bt2
.field_class
import _OptionWithUnsignedIntegerSelectorFieldClass
99 from bt2
.field_class
import _OptionWithSignedIntegerSelectorFieldClass
100 from bt2
.field_class
import _VariantFieldClass
101 from bt2
.field_class
import _VariantFieldClassWithoutSelector
102 from bt2
.field_class
import _VariantFieldClassWithIntegerSelector
103 from bt2
.field_class
import _VariantFieldClassWithUnsignedIntegerSelector
104 from bt2
.field_class
import _VariantFieldClassWithSignedIntegerSelector
105 from bt2
.field_class
import _ArrayFieldClass
106 from bt2
.field_class
import _StaticArrayFieldClass
107 from bt2
.field_class
import _DynamicArrayFieldClass
108 from bt2
.field_class
import _DynamicArrayWithLengthFieldFieldClass
109 from bt2
.field_class
import _BoolFieldClassConst
110 from bt2
.field_class
import _BitArrayFieldClassConst
111 from bt2
.field_class
import _IntegerFieldClassConst
112 from bt2
.field_class
import _UnsignedIntegerFieldClassConst
113 from bt2
.field_class
import _SignedIntegerFieldClassConst
114 from bt2
.field_class
import _RealFieldClassConst
115 from bt2
.field_class
import _EnumerationFieldClassConst
116 from bt2
.field_class
import _UnsignedEnumerationFieldClassConst
117 from bt2
.field_class
import _SignedEnumerationFieldClassConst
118 from bt2
.field_class
import _StringFieldClassConst
119 from bt2
.field_class
import _StructureFieldClassConst
120 from bt2
.field_class
import _OptionFieldClassConst
121 from bt2
.field_class
import _OptionWithSelectorFieldClassConst
122 from bt2
.field_class
import _OptionWithBoolSelectorFieldClassConst
123 from bt2
.field_class
import _OptionWithIntegerSelectorFieldClassConst
124 from bt2
.field_class
import _OptionWithUnsignedIntegerSelectorFieldClassConst
125 from bt2
.field_class
import _OptionWithSignedIntegerSelectorFieldClassConst
126 from bt2
.field_class
import _VariantFieldClassConst
127 from bt2
.field_class
import _VariantFieldClassWithoutSelectorConst
128 from bt2
.field_class
import _VariantFieldClassWithIntegerSelectorConst
129 from bt2
.field_class
import _VariantFieldClassWithUnsignedIntegerSelectorConst
130 from bt2
.field_class
import _VariantFieldClassWithSignedIntegerSelectorConst
131 from bt2
.field_class
import _ArrayFieldClassConst
132 from bt2
.field_class
import _StaticArrayFieldClassConst
133 from bt2
.field_class
import _DynamicArrayFieldClassConst
134 from bt2
.field_class
import _DynamicArrayWithLengthFieldFieldClassConst
135 from bt2
.field_path
import FieldPathScope
136 from bt2
.field_path
import _IndexFieldPathItem
137 from bt2
.field_path
import _CurrentArrayElementFieldPathItem
138 from bt2
.field_path
import _CurrentOptionContentFieldPathItem
139 from bt2
.graph
import Graph
140 from bt2
.integer_range_set
import SignedIntegerRange
141 from bt2
.integer_range_set
import UnsignedIntegerRange
142 from bt2
.integer_range_set
import SignedIntegerRangeSet
143 from bt2
.integer_range_set
import UnsignedIntegerRangeSet
144 from bt2
.integer_range_set
import _SignedIntegerRangeConst
145 from bt2
.integer_range_set
import _UnsignedIntegerRangeConst
146 from bt2
.integer_range_set
import _SignedIntegerRangeSetConst
147 from bt2
.integer_range_set
import _UnsignedIntegerRangeSetConst
148 from bt2
.interrupter
import Interrupter
149 from bt2
.logging
import LoggingLevel
150 from bt2
.logging
import get_minimal_logging_level
151 from bt2
.logging
import get_global_logging_level
152 from bt2
.logging
import set_global_logging_level
153 from bt2
.message
import _EventMessage
154 from bt2
.message
import _PacketBeginningMessage
155 from bt2
.message
import _PacketEndMessage
156 from bt2
.message
import _StreamBeginningMessage
157 from bt2
.message
import _StreamEndMessage
158 from bt2
.message
import _MessageIteratorInactivityMessage
159 from bt2
.message
import _DiscardedEventsMessage
160 from bt2
.message
import _DiscardedPacketsMessage
161 from bt2
.message
import _EventMessageConst
162 from bt2
.message
import _PacketBeginningMessageConst
163 from bt2
.message
import _PacketEndMessageConst
164 from bt2
.message
import _StreamBeginningMessageConst
165 from bt2
.message
import _StreamEndMessageConst
166 from bt2
.message
import _MessageIteratorInactivityMessageConst
167 from bt2
.message
import _DiscardedEventsMessageConst
168 from bt2
.message
import _DiscardedPacketsMessageConst
169 from bt2
.message_iterator
import _UserMessageIterator
170 from bt2
.mip
import get_greatest_operative_mip_version
171 from bt2
.mip
import get_maximal_mip_version
172 from bt2
.plugin
import find_plugins_in_path
173 from bt2
.plugin
import find_plugins
174 from bt2
.plugin
import find_plugin
175 from bt2
.py_plugin
import plugin_component_class
176 from bt2
.py_plugin
import register_plugin
177 from bt2
.query_executor
import QueryExecutor
178 from bt2
.trace_collection_message_iterator
import AutoSourceComponentSpec
179 from bt2
.trace_collection_message_iterator
import ComponentSpec
180 from bt2
.trace_collection_message_iterator
import TraceCollectionMessageIterator
181 from bt2
.value
import create_value
182 from bt2
.value
import BoolValue
183 from bt2
.value
import _IntegerValue
184 from bt2
.value
import UnsignedIntegerValue
185 from bt2
.value
import SignedIntegerValue
186 from bt2
.value
import RealValue
187 from bt2
.value
import StringValue
188 from bt2
.value
import ArrayValue
189 from bt2
.value
import MapValue
190 from bt2
.value
import _BoolValueConst
191 from bt2
.value
import _IntegerValueConst
192 from bt2
.value
import _UnsignedIntegerValueConst
193 from bt2
.value
import _SignedIntegerValueConst
194 from bt2
.value
import _RealValueConst
195 from bt2
.value
import _StringValueConst
196 from bt2
.value
import _ArrayValueConst
197 from bt2
.value
import _MapValueConst
198 from bt2
.version
import __version__
200 if (sys
.version_info
.major
, sys
.version_info
.minor
) != (3, 4):
202 def _del_global_name(name
):
203 if name
in globals():
206 # remove private module names from the package
207 _del_global_name('_native_bt')
208 _del_global_name('clock_class')
209 _del_global_name('clock_snapshot')
210 _del_global_name('component')
211 _del_global_name('connection')
212 _del_global_name('error')
213 _del_global_name('event')
214 _del_global_name('event_class')
215 _del_global_name('field')
216 _del_global_name('field_class')
217 _del_global_name('field_path')
218 _del_global_name('graph')
219 _del_global_name('integer_range_set')
220 _del_global_name('interrupter')
221 _del_global_name('logging')
222 _del_global_name('message')
223 _del_global_name('message_iterator')
224 _del_global_name('native_bt')
225 _del_global_name('object')
226 _del_global_name('packet')
227 _del_global_name('plugin')
228 _del_global_name('port')
229 _del_global_name('py_plugin')
230 _del_global_name('query_executor')
231 _del_global_name('stream')
232 _del_global_name('stream_class')
233 _del_global_name('trace')
234 _del_global_name('trace_class')
235 _del_global_name('trace_collection_message_iterator')
236 _del_global_name('utils')
237 _del_global_name('value')
238 _del_global_name('version')
240 # remove private `_del_global_name` name from the package
244 # remove sys module name from the package
248 class _MemoryError(_Error
):
249 '''Raised when an operation fails due to memory issues.'''
252 class UnknownObject(Exception):
254 Raised when a component class handles a query for an object it doesn't
261 class _OverflowError(_Error
, OverflowError):
265 class TryAgain(Exception):
269 class Stop(StopIteration):
273 class _IncompleteUserClass(Exception):
277 def _init_and_register_exit():
278 from bt2
import native_bt
281 atexit
.register(native_bt
.bt2_exit_handler
)
282 native_bt
.bt2_init_from_bt2()
285 _init_and_register_exit()
287 # remove private `_init_and_register_exit` name from the package
288 del _init_and_register_exit