lisa.trace.TraceEventCheckerBase#
- class lisa.trace.TraceEventCheckerBase(check=True, checkers=None)[source]#
Bases:
ABC
,Loggable
,Sequence
ABC for events checker classes.
Event checking can be achieved using a boolean expression on expected events.
- Parameters:
check (bool) – Check that the listed events are present in the
self.trace
attribute of the instance on which the decorated method is applied. If no such attribute is found, no check will be done.
Properties
logger
inheritedConvenience short-hand for
self.get_logger()
.Methods
Combine two event checkers into one that checks the presence of both.
Decorator for methods that require some given trace events.
Combine two event checkers into an optional one.
Combine two event checkers into one that checks the presence of either of them.
Check that certain trace events are available in the given set of events.
Top-level function called by Sphinx’s autodoc extension to augment docstrings of the functions.
Build a
TraceEventCheckerBase
that will fixup the event names to take into account the given namespaces.Return a set of all events that are checked by this checker.
Apply the given function to all the children and rebuild a new object with the result.
__class_getitem__()
inheritedSee
collections.abc.Iterable.__class_getitem__()
__reversed__()
inheritedSee
collections.abc.Sequence.__reversed__()
count()
inheritedSee
collections.abc.Sequence.count()
get_logger()
inheritedProvides a
logging.Logger
named aftercls
.index()
inheritedSee
collections.abc.Sequence.index()
log_locals()
inheritedDebugging aid: log the local variables of the calling function.
Properties#
- property TraceEventCheckerBase.logger#
Inherited property, see
lisa.utils.Loggable.logger
Convenience short-hand for
self.get_logger()
.
Methods#
- TraceEventCheckerBase.__and__(other)[source]#
Combine two event checkers into one that checks the presence of both.
See also
- TraceEventCheckerBase.__call__(f)[source]#
Decorator for methods that require some given trace events
- Parameters:
events (list(str or TraceEventCheckerBase)) – The list of required events
The decorated method must operate on instances that have a
self.trace
attribute.If some event requirements have already been defined for it (it has a used_events attribute, i.e. it has already been decorated), these will be combined with the new requirements using an
AndTraceEventChecker
.
- TraceEventCheckerBase.__matmul__(other)[source]#
Combine two event checkers into an optional one.
See also
- TraceEventCheckerBase.__or__(other)[source]#
Combine two event checkers into one that checks the presence of either of them.
See also
- TraceEventCheckerBase.check_events(event_set, check_optional=False, namespaces=None)[source]#
Check that certain trace events are available in the given set of events.
- Returns:
Set of events selected by the checker in
event_set
.- Raises:
MissingTraceEventError if some events are not available. The exception must be raised after inspecting children node and combine their missing events so that the resulting exception is accurate.
- TraceEventCheckerBase.doc_str()[source]#
Top-level function called by Sphinx’s autodoc extension to augment docstrings of the functions.
- TraceEventCheckerBase.expand_namespaces(namespaces=None)[source]#
Build a
TraceEventCheckerBase
that will fixup the event names to take into account the given namespaces.
- abstract TraceEventCheckerBase.get_all_events()[source]#
Return a set of all events that are checked by this checker.
That may be a superset of events that are strictly required, when the checker checks a logical OR combination of events for example.
- abstract TraceEventCheckerBase.map(f)[source]#
Apply the given function to all the children and rebuild a new object with the result.
- classmethod TraceEventCheckerBase.__class_getitem__()#
Inherited method, see
collections.abc.Iterable.__class_getitem__()
- TraceEventCheckerBase.__reversed__()#
Inherited method, see
collections.abc.Sequence.__reversed__()
- TraceEventCheckerBase.count()#
Inherited method, see
collections.abc.Sequence.count()
- classmethod TraceEventCheckerBase.get_logger(suffix=None)#
Inherited method, see
lisa.utils.Loggable.get_logger()
Provides a
logging.Logger
named aftercls
.
- TraceEventCheckerBase.index()#
Inherited method, see
collections.abc.Sequence.index()
- classmethod TraceEventCheckerBase.log_locals(var_names=None, level='debug')#
Inherited method, see
lisa.utils.Loggable.log_locals()
Debugging aid: log the local variables of the calling function.