+ @property
+ def uuid(self):
+ uuid_bytes = native_bt.trace_get_uuid(self._ptr)
+ if uuid_bytes is None:
+ return
+
+ return uuidp.UUID(bytes=uuid_bytes)
+
+ @property
+ def environment(self):
+ return self._trace_env_pycls(self)
+
+ def add_destruction_listener(self, listener):
+ '''Add a listener to be called when the trace is destroyed.'''
+ if not callable(listener):
+ raise TypeError("'listener' parameter is not callable")
+
+ fn = native_bt.bt2_trace_add_destruction_listener
+ listener_from_native = functools.partial(
+ _trace_destruction_listener_from_native, listener
+ )
+
+ status, listener_id = fn(self._ptr, listener_from_native)
+ utils._handle_func_status(
+ status, 'cannot add destruction listener to trace object'
+ )
+
+ return utils._ListenerHandle(listener_id, self)
+
+
+class _Trace(_TraceConst):
+ _borrow_stream_ptr_by_id = staticmethod(native_bt.trace_borrow_stream_by_id)
+ _borrow_stream_ptr_by_index = staticmethod(native_bt.trace_borrow_stream_by_index)
+ _borrow_class_ptr = staticmethod(native_bt.trace_borrow_class)
+ _borrow_user_attributes_ptr = staticmethod(native_bt.trace_borrow_user_attributes)
+ _create_value_from_ptr_and_get_ref = staticmethod(
+ bt2_value._create_from_ptr_and_get_ref
+ )
+ _stream_pycls = property(lambda _: bt2_stream._Stream)
+ _trace_class_pycls = property(lambda _: bt2_trace_class._TraceClass)
+ _trace_env_pycls = property(lambda _: _TraceEnvironment)
+