lisa.trace.FtraceCollector#

class lisa.trace.FtraceCollector(target, *, events=None, functions=None, buffer_size=10240, output_path=None, autoreport=False, trace_clock=None, saved_cmdlines_nr=8192, tracer=None, kmod_auto_load=True, events_namespaces=('lisa__', None), **kwargs)[source]#

Bases: CollectorBase, Configurable

Thin wrapper around devlib.collector.ftrace.FtraceCollector.

Note

Events are expected to be provided by the target’s kernel, but if they are not lisa._kmod.LISADynamicKmod will build a kernel module to attempt to satisfy the missing events. This will typically require correct target setup, see lisa.target.TargetConf kernel/src configurations.

Parameters:
  • events (Sequence[str] or lisa.trace.TraceEventCheckerBase) – FTrace events to trace

  • functions (Sequence[str]) – FTrace functions to trace

  • buffer_size (int) – FTrace buffer size

  • trace_clock (str or None) – Clock used while tracing (see “trace_clock” in ftrace.txt kernel doc)

  • saved_cmdlines_nr (int) – Number of saved cmdlines with associated PID while tracing

  • tracer (str or None) – FTrace tracer to use

  • events_namespaces (Sequence[Optional[str]] or None) – FTrace events namespaces to use. See Trace namespace constructor parameter.

  • kmod_auto_load (bool) – Compile kernel modules and load them automatically based on the events that are needed.

Classes

CONF_CLASS

Configuration class of FtraceCollector.

Attributes

INIT_KWARGS_KEY_MAP

Dictionary of __init__ parameter names to configuration key path.

NAME

Name of the collector class.

TOOLS

Sequence of tools to install on the target when using the collector.

Properties

logger inherited

Convenience short-hand for self.get_logger().

Methods

__enter__()

__exit__()

from_conf()

Build an FtraceCollector from a FtraceConf.

from_user_conf()

Build an FtraceCollector from two FtraceConf.

get_data()

Similar to devlib.collector.CollectorBase.get_data() but takes the path directly as a parameter in order to disallow representing an invalid state where no path has been set.

__getattr__ inherited

Delegate attribute lookup to a private attribute.

check_init_param() inherited

Take the same parameters as __init__, and check their types according to what is specified in the configuration class.

conf_to_init_kwargs() inherited

Turn a configuration object into a dictionary suitable for passing to __init__ as **kwargs.

get_logger() inherited

Provides a logging.Logger named after cls.

log_locals() inherited

Debugging aid: log the local variables of the calling function.

Classes#

FtraceCollector.CONF_CLASS#

alias of FtraceConf

Attributes#

FtraceCollector.INIT_KWARGS_KEY_MAP = {'buffer_size': ['buffer-size'], 'events': ['events'], 'events_namespaces': ['events-namespaces'], 'functions': ['functions'], 'kmod_auto_load': ['modules', 'auto-load'], 'saved_cmdlines_nr': ['saved-cmdlines-nr'], 'trace_clock': ['trace-clock'], 'tracer': ['tracer']}#

Dictionary of __init__ parameter names to configuration key path.

That path is a list of strings to take into account sublevels like ['level-key', 'sublevel', 'foo'].

FtraceCollector.NAME = 'ftrace'#

Name of the collector class.

FtraceCollector.TOOLS = ['trace-cmd']#

Sequence of tools to install on the target when using the collector.

Properties#

property FtraceCollector.logger#

Inherited property, see lisa.utils.Loggable.logger

Convenience short-hand for self.get_logger().

Methods#

FtraceCollector.__enter__()[source]#
FtraceCollector.__exit__(*args, **kwargs)[source]#
classmethod FtraceCollector.from_conf(target, conf, *, events=None, functions=None, buffer_size=10240, output_path=None, autoreport=False, trace_clock=None, saved_cmdlines_nr=8192, tracer=None, kmod_auto_load=True, events_namespaces=('lisa__', None))[source]#

Build an FtraceCollector from a FtraceConf

Parameters:
Variable keyword arguments:

Forwarded to __init__.

classmethod FtraceCollector.from_user_conf(target, base_conf=None, user_conf=None, merged_src='merged', *, events=None, functions=None, buffer_size=10240, output_path=None, autoreport=False, trace_clock=None, saved_cmdlines_nr=8192, tracer=None, kmod_auto_load=True, events_namespaces=('lisa__', None))[source]#

Build an FtraceCollector from two FtraceConf.

base_conf is expected to contain the minimal configuration, and user_conf some additional settings that are used to augment the base configuration.

Parameters:
  • target (lisa.target.Target) – Target to use when collecting the trace

  • base_conf (FtraceConf) – Base configuration object, merged with user_conf.

  • user_conf (FtraceConf) – User configuration object

  • merged_src (str) – Name of the configuration source created by merging base_conf and user_conf

Other keyword arguments:

Forwarded to from_conf().

FtraceCollector.get_data(*args, **kwargs)[source]#

Similar to devlib.collector.CollectorBase.get_data() but takes the path directly as a parameter in order to disallow representing an invalid state where no path has been set.

FtraceCollector.__getattr__(attr)#

Inherited method, see lisa.trace.CollectorBase.__getattr__

Delegate attribute lookup to a private attribute.

classmethod FtraceCollector.check_init_param(**kwargs)#

Inherited method, see lisa.conf.Configurable.check_init_param()

Take the same parameters as __init__, and check their types according to what is specified in the configuration class.

classmethod FtraceCollector.conf_to_init_kwargs(conf)#

Inherited method, see lisa.conf.Configurable.conf_to_init_kwargs()

Turn a configuration object into a dictionary suitable for passing to __init__ as **kwargs.

classmethod FtraceCollector.get_logger(suffix=None)#

Inherited method, see lisa.utils.Loggable.get_logger()

Provides a logging.Logger named after cls.

classmethod FtraceCollector.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.