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 inherited

Convenience short-hand for self.get_logger().

Methods

__and__()

Combine two event checkers into one that checks the presence of both.

__bool__()

__call__()

Decorator for methods that require some given trace events.

__contains__()

__getitem__()

__iter__()

__len__()

__matmul__()

Combine two event checkers into an optional one.

__or__()

Combine two event checkers into one that checks the presence of either of them.

check_events()

Check that certain trace events are available in the given set of events.

doc_str()

Top-level function called by Sphinx’s autodoc extension to augment docstrings of the functions.

expand_namespaces()

Build a TraceEventCheckerBase that will fixup the event names to take into account the given namespaces.

get_all_events()

Return a set of all events that are checked by this checker.

map()

Apply the given function to all the children and rebuild a new object with the result.

__class_getitem__() inherited

See collections.abc.Iterable.__class_getitem__()

__reversed__() inherited

See collections.abc.Sequence.__reversed__()

count() inherited

See collections.abc.Sequence.count()

get_logger() inherited

Provides a logging.Logger named after cls.

index() inherited

See collections.abc.Sequence.index()

log_locals() inherited

Debugging 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.

abstract TraceEventCheckerBase.__bool__()[source]#
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.__contains__(event)[source]#
TraceEventCheckerBase.__getitem__(i)[source]#
TraceEventCheckerBase.__iter__()[source]#
TraceEventCheckerBase.__len__(event)[source]#
TraceEventCheckerBase.__matmul__(other)[source]#

Combine two event checkers into an optional one.

TraceEventCheckerBase.__or__(other)[source]#

Combine two event checkers into one that checks the presence of either of them.

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 after cls.

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.