lisa.trace.FtraceConf#
- class lisa.trace.FtraceConf(conf=None, src='user', add_default_src=True)[source]#
Bases:
SimpleMultiSrcConf
,HideExekallID
Configuration class of
FtraceCollector
Available keys:
ftrace-conf: FTrace configuration
events (
typing.Sequence[str]
orlisa.trace.TraceEventCheckerBase
): FTrace events to trace.events-namespaces (
typing.Sequence[typing.Optional[str]]
orNone
): FTrace events namespaces to use. See Trace namespace constructor parameter..functions (
typing.Sequence[str]
): FTrace functions to trace.buffer-size (
int
): FTrace buffer size.trace-clock (
str
orNone
): 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
orNone
): FTrace tracer to use.modules: Kernel modules settings
auto-load (
bool
): Compile kernel modules and load them automatically based on the events that are needed..
- Example YAML:
# FTrace configuration ftrace-conf: # Kernel modules settings modules: # Compile kernel modules and load them automatically based on # the events that are needed. # type: bool auto-load: _ # FTrace events to trace # type: Sequence[str] or TraceEventCheckerBase events: _ # FTrace events namespaces to use. See Trace namespace # constructor parameter. # type: Sequence[typing.Optional[str]] or None events-namespaces: _ # FTrace functions to trace # type: Sequence[str] functions: _ # FTrace buffer size # type: int buffer-size: _ # Clock used while tracing (see "trace_clock" in ftrace.txt # kernel doc) # type: str or None trace-clock: _ # Number of saved cmdlines with associated PID while tracing # type: int saved-cmdlines-nr: _ # FTrace tracer to use # type: str or None tracer: _
Warning
Arbitrary code can be executed while loading an instance from a YAML or Pickle file. To include untrusted data in YAML, use the !untrusted tag along with a string
Attributes
Source added automatically using
add_src()
under the name ‘default’ when instances are built.Regular top-level key descriptor, with only one level.
ATTRIBUTES_SERIALIZATION
inheritedAttributes to be treated specially during serialization.
DEFAULT_SERIALIZATION_FMT
inheritedDefault format used when serializing objects.
YAML_ENCODING
inheritedEncoding used for YAML files.
__reversed__
inheritedSee
collections.abc.Mapping.__reversed__
Properties
as_yaml_map
inheritedGive a mapping suitable for storing in a YAML configuration file.
logger
inheritedConvenience short-hand for
self.get_logger()
.Methods
Merge-in a configuration source.
__class_getitem__()
inheritedSee
collections.abc.Iterable.__class_getitem__()
__contains__()
inheritedSee
collections.abc.Mapping.__contains__()
__copy__()
inheritedShallow copy of the nested configuration tree, without duplicating the leaf values.
__deepcopy__()
inherited__getitem__()
inherited__getstate__()
inheritedFilter instances of
DeferredValue
that are not computed already since their runtime parameters will probably not be available after deserialization.__iter__()
inherited__len__()
inherited__setstate__()
inheritedadd_src()
inheritedAdd a source of configuration.
eval_deferred()
inheritedEvaluate instances of
DeferredValue
that can be used for values that are expensive to compute.force_src()
inheritedForce the source priority list for a given key.
force_src_nested()
inheritedForce the source priority list for all the keys defined in the nested mapping
key_src_map
.from_map()
inheritedCreate a new configuration instance, using the output of
to_map()
.from_path()
inheritedDeserialize an object from a file.
from_yaml_map()
inheritedAllow reloading from a plain mapping, to avoid having to specify a tag in the configuration file. The content is hosted under the top-level key specified in
STRUCTURE
.from_yaml_map_list()
inheritedCreate a mapping of configuration classes to instance, by loading them from the list of paths using
from_yaml_map()
and merging them.get()
inheritedSee
collections.abc.Mapping.get()
get_help()
inheritedget_key()
inheritedGet the value of the given key. It returns a deepcopy of the value.
get_logger()
inheritedProvides a
logging.Logger
named aftercls
.get_nested_key()
inheritedSame as
get_key()
but works on a list of keys to access nested mappings.get_src_map()
inheritedGet a mapping of all sources for the given
key
, in priority order (first item is the highest priority source).items()
inheritedOverride the default definition of
collections.abc.Mapping.items()
to allow not evaluating deferred values if necessary.keys()
inheritedSee
collections.abc.Mapping.keys()
log_locals()
inheritedDebugging aid: log the local variables of the calling function.
pretty_format()
inheritedGive a pretty string representation of the configuration.
resolve_src()
inheritedGet the source name that will be used to serve the value of
key
.set_default_src()
inheritedSet the default source priority list.
to_map()
inheritedExport the configuration as a mapping.
to_path()
inheritedSerialize the object to a file.
to_yaml()
inheritedReturn a YAML string with the serialized object.
to_yaml_map()
inheritedWrite a configuration file, with the key descriptions in comments.
to_yaml_map_str()
inheritedReturn the content of the file that would be create by
to_yaml_map()
in a string.values()
inheritedSee
collections.abc.Mapping.values()
Attributes#
- FtraceConf.DEFAULT_SRC = {'buffer-size': 10240, 'events-namespaces': ('lisa__', None), 'modules': {'auto-load': True}, 'saved-cmdlines-nr': 8192}#
Source added automatically using
add_src()
under the name ‘default’ when instances are built.
- FtraceConf.STRUCTURE = <lisa.conf.TopLevelKeyDesc object>#
- FtraceConf.ATTRIBUTES_SERIALIZATION = {'allowed': [], 'ignored': [], 'placeholders': {}}#
Inherited attribute, see
lisa.utils.Serializable.ATTRIBUTES_SERIALIZATION
Attributes to be treated specially during serialization.
- FtraceConf.DEFAULT_SERIALIZATION_FMT = 'yaml'#
Inherited attribute, see
lisa.utils.Serializable.DEFAULT_SERIALIZATION_FMT
Default format used when serializing objects.
- FtraceConf.YAML_ENCODING = 'utf-8'#
Inherited attribute, see
lisa.utils.Serializable.YAML_ENCODING
Encoding used for YAML files.
- FtraceConf.__reversed__ = None#
Properties#
- property FtraceConf.as_yaml_map#
Inherited property, see
lisa.conf.MultiSrcConfABC.as_yaml_map
Give a mapping suitable for storing in a YAML configuration file.
- property FtraceConf.logger#
Inherited property, see
lisa.utils.Loggable.logger
Convenience short-hand for
self.get_logger()
.
Methods#
- FtraceConf.add_merged_src(src, conf, optional_events=False, **kwargs)[source]#
Merge-in a configuration source.
- Parameters:
src (str) – Name of the merged source
conf (FtraceConf or dict(str, object)) – Conf to merge in
optional_events (bool) – If
True
, the events brought byconf
will be wrapped inOptionalTraceEventChecker
. This avoids failing just because the user asked for extra events that are not present in the kernel.
- classmethod FtraceConf.__class_getitem__()#
Inherited method, see
collections.abc.Iterable.__class_getitem__()
- FtraceConf.__contains__()#
Inherited method, see
collections.abc.Mapping.__contains__()
- FtraceConf.__copy__()#
Inherited method, see
lisa.conf.MultiSrcConf.__copy__()
Shallow copy of the nested configuration tree, without duplicating the leaf values.
- FtraceConf.__deepcopy__(memo)#
Inherited method, see
lisa.conf.MultiSrcConf.__deepcopy__()
- FtraceConf.__getitem__(key)#
Inherited method, see
lisa.conf.MultiSrcConf.__getitem__()
- FtraceConf.__getstate__()#
Inherited method, see
lisa.conf.MultiSrcConf.__getstate__()
Filter instances of
DeferredValue
that are not computed already since their runtime parameters will probably not be available after deserialization.
- FtraceConf.__iter__()#
Inherited method, see
lisa.conf.MultiSrcConf.__iter__()
- FtraceConf.__len__()#
Inherited method, see
lisa.conf.MultiSrcConf.__len__()
- FtraceConf.__setstate__(dct)#
Inherited method, see
lisa.utils.Serializable.__setstate__()
- FtraceConf.add_src(src, conf, filter_none=False, fallback=False, inplace=True)#
Inherited method, see
lisa.conf.MultiSrcConf.add_src()
Add a source of configuration.
- FtraceConf.eval_deferred(cls=<class 'lisa.conf.DeferredValue'>, src=None, resolve_src=True, error='raise')#
Inherited method, see
lisa.conf.MultiSrcConf.eval_deferred()
Evaluate instances of
DeferredValue
that can be used for values that are expensive to compute.
- FtraceConf.force_src(key, src_prio)#
Inherited method, see
lisa.conf.MultiSrcConf.force_src()
Force the source priority list for a given key.
- FtraceConf.force_src_nested(key_src_map)#
Inherited method, see
lisa.conf.MultiSrcConf.force_src_nested()
Force the source priority list for all the keys defined in the nested mapping
key_src_map
.
- classmethod FtraceConf.from_map(*args, **kwargs)#
Inherited method, see
lisa.conf.SimpleMultiSrcConf.from_map()
Create a new configuration instance, using the output of
to_map()
.
- classmethod FtraceConf.from_path(filepath, fmt=None)#
Inherited method, see
lisa.utils.Serializable.from_path()
Deserialize an object from a file.
- classmethod FtraceConf.from_yaml_map(path, add_default_src=True)#
Inherited method, see
lisa.conf.MultiSrcConfABC.from_yaml_map()
Allow reloading from a plain mapping, to avoid having to specify a tag in the configuration file. The content is hosted under the top-level key specified in
STRUCTURE
.
- classmethod FtraceConf.from_yaml_map_list(path_list, add_default_src=True)#
Inherited method, see
lisa.conf.MultiSrcConfABC.from_yaml_map_list()
Create a mapping of configuration classes to instance, by loading them from the list of paths using
from_yaml_map()
and merging them.
- FtraceConf.get()#
Inherited method, see
collections.abc.Mapping.get()
- classmethod FtraceConf.get_help(*args, **kwargs)#
Inherited method, see
lisa.conf.MultiSrcConf.get_help()
- FtraceConf.get_key(key, src=None, eval_deferred=True, quiet=False)#
Inherited method, see
lisa.conf.MultiSrcConf.get_key()
Get the value of the given key. It returns a deepcopy of the value.
- classmethod FtraceConf.get_logger(suffix=None)#
Inherited method, see
lisa.utils.Loggable.get_logger()
Provides a
logging.Logger
named aftercls
.
- FtraceConf.get_nested_key(key, *args, **kwargs)#
Inherited method, see
lisa.conf.MultiSrcConf.get_nested_key()
Same as
get_key()
but works on a list of keys to access nested mappings.
- FtraceConf.get_src_map(key)#
Inherited method, see
lisa.conf.MultiSrcConf.get_src_map()
Get a mapping of all sources for the given
key
, in priority order (first item is the highest priority source).
- FtraceConf.items(eval_deferred=True)#
Inherited method, see
lisa.conf.MultiSrcConf.items()
Override the default definition of
collections.abc.Mapping.items()
to allow not evaluating deferred values if necessary.
- FtraceConf.keys()#
Inherited method, see
collections.abc.Mapping.keys()
- classmethod FtraceConf.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.
- FtraceConf.pretty_format(eval_deferred=False)#
Inherited method, see
lisa.conf.MultiSrcConf.pretty_format()
Give a pretty string representation of the configuration.
- FtraceConf.resolve_src(key)#
Inherited method, see
lisa.conf.MultiSrcConf.resolve_src()
Get the source name that will be used to serve the value of
key
.
- FtraceConf.set_default_src(src_prio)#
Inherited method, see
lisa.conf.MultiSrcConf.set_default_src()
Set the default source priority list.
- FtraceConf.to_map()#
Inherited method, see
lisa.conf.SimpleMultiSrcConf.to_map()
Export the configuration as a mapping.
- FtraceConf.to_path(filepath, fmt=None)#
Inherited method, see
lisa.utils.Serializable.to_path()
Serialize the object to a file.
- FtraceConf.to_yaml()#
Inherited method, see
lisa.utils.Serializable.to_yaml()
Return a YAML string with the serialized object.
- FtraceConf.to_yaml_map(path, add_placeholder=False, placeholder='<no default>')#
Inherited method, see
lisa.conf.SimpleMultiSrcConf.to_yaml_map()
Write a configuration file, with the key descriptions in comments.
- FtraceConf.to_yaml_map_str(**kwargs)#
Inherited method, see
lisa.conf.MultiSrcConfABC.to_yaml_map_str()
Return the content of the file that would be create by
to_yaml_map()
in a string.
- FtraceConf.values()#
Inherited method, see
collections.abc.Mapping.values()