lisa.tests.base.RTATestBundle#
- class lisa.tests.base.RTATestBundle(res_dir, plat_info, rtapp_profile_kwargs=None)[source]#
Bases:
FtraceTestBundle
,DmesgTestBundle
Abstract Base Class for
lisa.wlgen.rta.RTA
-powered TestBundles- Parameters:
rtapp_profile_kwargs (collections.abc.Mapping or None) – Keyword arguments to pass to
lisa.tests.base.RTATestBundle._get_rtapp_profile()
when called from thelisa.tests.base.RTATestBundle._get_rtapp_profile()
property.
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
Note
As a subclass of
lisa.tests.base.TestBundleBase
, this class is considered as “application” and its API is therefore more subject to change than other parts oflisa
.Classes
__class__
inheritedMetaclass of
TestBundleBase
.Attributes
PID/comm specific tuning for
test_noisy_tasks()
.A task period in seconds you can re-use for your
lisa.wlgen.rta.RTATask
definitions.ATTRIBUTES_SERIALIZATION
inheritedAttributes to be treated specially during serialization.
CANNED_DMESG_IGNORED_PATTERNS
inheritedMapping of canned patterns to avoid repetition while defining
lisa.tests.base.DmesgTestBundleBase.DMESG_IGNORED_PATTERNS
in subclasses.DEFAULT_SERIALIZATION_FMT
inheritedDefault format used when serializing objects.
DMESG_IGNORED_PATTERNS
inheritedList of patterns to ignore in addition to the ones passed to
test_dmesg()
.DMESG_PATH
inheritedPath to the dmesg log in the result directory.
FTRACE_CONF
inheritedTRACE_PATH
inheritedPath to the
trace-cmd
trace.dat file in the result directory.VERIFY_SERIALIZATION
inheritedWhen True, this enforces a serialization/deserialization step in
from_target()
.YAML_ENCODING
inheritedEncoding used for YAML files.
ftrace_conf
inheritedProperties
Compute the cgroup configuration based on
plat_info
.Compute the RTapp profile based on
plat_info
.The rtapp task
lisa.analysis.tasks.TaskID
as found from the trace in this bundle.Mapping of task names as specified in the rtapp profile to list of
lisa.analysis.tasks.TaskID
names found in the trace.Same as
rtapp_task_ids()
but as a list of string.Same as
rtapp_task_ids_map()
but with list of strings for values.A
lisa.trace.Trace
cropped to the window given bytrace_window()
._children_test_bundles
inheriteddmesg_entries
inheritedList of parsed dmesg output entries
devlib.collector.dmesg.KernelLogEntry
.dmesg_path
inheritedPath to the dmesg output log file.
logger
inheritedConvenience short-hand for
self.get_logger()
.trace_path
inheritedPath to the
trace-cmd report
trace.dat file.Methods
- returns:
a DataFrame containing all tasks that participate to the test noise. i.e. all non rt-app tasks.
Factory method to create a bundle using a live target.
- returns:
a
dict
representing the configuration of a particular cgroup.
Returns a
dict
with task names as keys andlisa.wlgen.rta.RTATask
as values.Run the given RTA profile on the target, and collect an ftrace trace.
Test that no non-rtapp (“noisy”) task ran for longer than the specified thresholds.
The time window to consider for this
RTATestBundle
.Convert utilization scaled to a CPU to a ‘raw’, unscaled one.
__copy__()
inheritedRegular shallow copy operation, without dropping any attributes.
__getstate__()
inheritedFilter the instance’s attributes upon serialization.
__setstate__()
inherited_get_filepath()
inheritedadd_undecided_filter()
inheritedTurn any method returning a
ResultBundleBase
into a decorator that can be used as a test method filter.can_create_from_target()
inherited- returns:
Whether the given target can be used to create an instance of this class :rtype: bool.
check_from_target()
inheritedCheck whether the given target can be used to create an instance of this class.
from_dir()
inheritedWrapper around
lisa.utils.Serializable.from_path()
.from_path()
inheritedDeserialize an object from a file.
get_logger()
inheritedProvides a
logging.Logger
named aftercls
.get_tags()
inheritedDictionary of tags and tag values.
get_trace()
inherited- returns:
a
lisa.trace.Trace
collected in the standard location.
log_locals()
inheritedDebugging aid: log the local variables of the calling function.
test_dmesg()
inheritedBasic test on kernel dmesg output.
to_dir()
inheritedto_path()
inheritedSerialize the object to a file.
to_yaml()
inheritedReturn a YAML string with the serialized object.
Classes#
- RTATestBundle.__class__#
alias of
TestBundleMeta
Attributes#
- RTATestBundle.NOISE_ACCOUNTING_THRESHOLDS = {'^irq/\\d+-.*$': 1.5, '^sugov:\\d+$': 5, (0, None): 100}#
PID/comm specific tuning for
test_noisy_tasks()
keys can be PIDs, comms, or regexps for comms.
values are noisiness thresholds (%), IOW below that runtime threshold the associated task will be ignored in the noise accounting.
- RTATestBundle.TASK_PERIOD = 0.016#
A task period in seconds you can re-use for your
lisa.wlgen.rta.RTATask
definitions.
- RTATestBundle.ATTRIBUTES_SERIALIZATION = {'allowed': [], 'ignored': [], 'placeholders': {}}#
Inherited attribute, see
lisa.utils.Serializable.ATTRIBUTES_SERIALIZATION
Attributes to be treated specially during serialization.
- RTATestBundle.CANNED_DMESG_IGNORED_PATTERNS = {'EAS-schedutil': 'Disabling EAS, schedutil is mandatory', 'executable-stack': 'started with executable stack'}#
Inherited attribute, see
lisa.tests.base.DmesgTestBundleBase.CANNED_DMESG_IGNORED_PATTERNS
Mapping of canned patterns to avoid repetition while defining
lisa.tests.base.DmesgTestBundleBase.DMESG_IGNORED_PATTERNS
in subclasses.
- RTATestBundle.DEFAULT_SERIALIZATION_FMT = 'yaml'#
Inherited attribute, see
lisa.utils.Serializable.DEFAULT_SERIALIZATION_FMT
Default format used when serializing objects.
- RTATestBundle.DMESG_IGNORED_PATTERNS = ['started with executable stack']#
Inherited attribute, see
lisa.tests.base.DmesgTestBundleBase.DMESG_IGNORED_PATTERNS
List of patterns to ignore in addition to the ones passed to
test_dmesg()
.
- RTATestBundle.DMESG_PATH = 'dmesg.log'#
Inherited attribute, see
lisa.tests.base.DmesgTestBundleBase.DMESG_PATH
Path to the dmesg log in the result directory.
- RTATestBundle.FTRACE_CONF = <lisa.trace.FtraceConf object>#
- RTATestBundle.TRACE_PATH = 'trace.dat'#
Inherited attribute, see
lisa.tests.base.FtraceTestBundleBase.TRACE_PATH
Path to the
trace-cmd
trace.dat file in the result directory.
- RTATestBundle.VERIFY_SERIALIZATION = True#
Inherited attribute, see
lisa.tests.base.TestBundleBase.VERIFY_SERIALIZATION
When True, this enforces a serialization/deserialization step in
from_target()
.
- RTATestBundle.YAML_ENCODING = 'utf-8'#
Inherited attribute, see
lisa.utils.Serializable.YAML_ENCODING
Encoding used for YAML files.
- RTATestBundle.ftrace_conf = <lisa.trace.FtraceConf object>#
Properties#
- property RTATestBundle.cgroup_configuration[source]#
Compute the cgroup configuration based on
plat_info
- property RTATestBundle.rtapp_task_ids[source]#
The rtapp task
lisa.analysis.tasks.TaskID
as found from the trace in this bundle.- Returns:
the list of actual trace task
lisa.analysis.tasks.TaskID
- Required trace events:
sched_switch
- property RTATestBundle.rtapp_task_ids_map[source]#
Mapping of task names as specified in the rtapp profile to list of
lisa.analysis.tasks.TaskID
names found in the trace.If the task forked, the list will contain more than one item.
- Required trace events:
sched_switch
- property RTATestBundle.rtapp_tasks[source]#
Same as
rtapp_task_ids()
but as a list of string.- Returns:
the list of actual trace task names
- Required trace events:
sched_switch
- property RTATestBundle.rtapp_tasks_map[source]#
Same as
rtapp_task_ids_map()
but with list of strings for values.- Required trace events:
sched_switch
- property RTATestBundle.trace[source]#
A
lisa.trace.Trace
cropped to the window given bytrace_window()
.See also
- property RTATestBundle._children_test_bundles#
Inherited property, see
lisa.tests.base.TestBundleBase._children_test_bundles
- property RTATestBundle.dmesg_entries#
Inherited property, see
lisa.tests.base.DmesgTestBundleBase.dmesg_entries
List of parsed dmesg output entries
devlib.collector.dmesg.KernelLogEntry
.
- property RTATestBundle.dmesg_path#
Inherited property, see
lisa.tests.base.DmesgTestBundleBase.dmesg_path
Path to the dmesg output log file.
- property RTATestBundle.logger#
Inherited property, see
lisa.utils.Loggable.logger
Convenience short-hand for
self.get_logger()
.
- property RTATestBundle.trace_path#
Inherited property, see
lisa.tests.base.FtraceTestBundleBase.trace_path
Path to the
trace-cmd report
trace.dat file.
Methods#
- classmethod RTATestBundle._from_target(target, *, custom_collector=None, ftrace_conf: FtraceConf = None, res_dir: ArtifactPath = None) RTATestBundle [source]#
Internals of the target factory method.
Note
This must be a classmethod, and all parameters except
target
must be keyword-only, i.e. appearing after args* or a lonely *:@classmethod def _from_target(cls, target, *, foo=33, bar): ...
- abstract classmethod RTATestBundle._get_rtapp_profile(plat_info)[source]#
- Returns:
a
dict
with task names as keys andlisa.wlgen.rta.RTATask
as values
This is the method you want to override to specify what is your synthetic workload.
- classmethod RTATestBundle._run_rtapp(*args, **kwargs)[source]#
Has been renamed to
run_rtapp()
, as it really is part of the public API.
- RTATestBundle.df_noisy_tasks(with_threshold_exclusion=True)[source]#
- Returns:
a DataFrame containing all tasks that participate to the test noise. i.e. all non rt-app tasks.
- Parameters:
with_threshold_exclusion – When set to True, known noisy services will be ignored.
- classmethod RTATestBundle.from_target(target: Target, *, res_dir: ArtifactPath = None, custom_collector=None, ftrace_conf: FtraceConf = None) RTATestBundle #
Factory method to create a bundle using a live target
- Parameters:
target (lisa.target.Target) – Target to connect to.
res_dir (str or lisa.utils.ArtifactPath) – Host result directory holding artifacts.
custom_collector (lisa.trace.CollectorBase) – Custom collector that will be used as a context manager when calling the workload.
This is mostly boiler-plate code around
_from_target()
, which lets us introduce common functionalities for daughter classes. Unless you know what you are doing, you should not override this method, but the internallisa.tests.base.TestBundleBase._from_target()
instead.
- classmethod RTATestBundle.get_cgroup_configuration(plat_info)[source]#
- Returns:
a
dict
representing the configuration of a particular cgroup.
This is a method you may optionally override to configure a cgroup for the synthetic workload.
Example of return value:
{ 'name': 'lisa_test', 'controller': 'schedtune', 'attributes' : { 'prefer_idle' : 1, 'boost': 50 } }
- classmethod RTATestBundle.get_rtapp_profile(plat_info, **kwargs)[source]#
Returns a
dict
with task names as keys andlisa.wlgen.rta.RTATask
as values.The following modifications are done on the profile returned by
_get_rtapp_profile()
:A buffer phase may be inserted at the beginning of each task in order to stabilize some kernel signals.
A
from_test
meta key is added to eachlisa.wlgen.rta.RTAPhase
with a boolean value that isTrue
if the phase comes from the test itself andFalse
if it was added here (e.g. the buffer phase). This allows future-proof filtering of phases in the test code when inspecting the profile by looking atphase['meta']['from_test']
.
Note
If you want to override the method in a subclass, override
_get_rtapp_profile()
instead.
- classmethod RTATestBundle.run_rtapp(target, res_dir, profile=None, collector=None, cg_cfg=None, wipe_run_dir=True, update_cpu_capacities=None)[source]#
Run the given RTA profile on the target, and collect an ftrace trace.
- Parameters:
target (lisa.target.Target) – target to execute the workload on.
res_dir (str or lisa.utils.ArtifactPath) – Artifact folder where the artifacts will be stored.
profile (dict(str, lisa.wlgen.rta.RTATask)) –
rt-app
profile, as a dictionary ofdict(task_name, RTATask)
. IfNone
,get_rtapp_profile()
is called withtarget.plat_info
.collector (lisa.trace.ComposedCollector) – Context manager collector to use while running rt-app.
cg_cfg (dict) – CGroup configuration dictionary. If
None
,lisa.tests.base.RTATestBundle.get_cgroup_configuration()
is called withtarget.plat_info
.wipe_run_dir (bool) – Remove the run directory on the target after execution of the workload.
update_cpu_capacities (bool) – Attempt to update the CPU capacities based on the calibration values of rtapp to get the most accurate reproduction of duty cycles.
- RTATestBundle.test_noisy_tasks(*, noise_threshold_pct=None, noise_threshold_ms=None)[source]#
Test that no non-rtapp (“noisy”) task ran for longer than the specified thresholds
- Parameters:
If both are specified, the smallest threshold (in seconds) will be used.
- Required trace events:
sched_switch
sched_wakeup
one group of:
task_rename
optional:
sched_wakeup_new
- RTATestBundle.trace_window(trace)[source]#
The time window to consider for this
RTATestBundle
- Returns:
a (start, stop) tuple
Since we’re using rt-app profiles, we know the name of tasks we are interested in, so we can trim our trace scope to filter out the setup/teardown events we don’t care about.
Override this method if you need a different trace trimming.
Warning
Calling
self.trace
here will raise anAttributeError
exception, to avoid entering infinite recursion.- Required trace events:
userspace@rtapp_loop
sched_switch
- classmethod RTATestBundle.unscaled_utilization(plat_info, cpu, utilization_pct)[source]#
Convert utilization scaled to a CPU to a ‘raw’, unscaled one.
- RTATestBundle.__copy__()#
Inherited method, see
lisa.utils.Serializable.__copy__()
Regular shallow copy operation, without dropping any attributes.
- RTATestBundle.__getstate__()#
Inherited method, see
lisa.utils.Serializable.__getstate__()
Filter the instance’s attributes upon serialization.
- RTATestBundle.__setstate__(dct)#
Inherited method, see
lisa.utils.Serializable.__setstate__()
- classmethod RTATestBundle._get_filepath(res_dir)#
Inherited method, see
lisa.tests.base.TestBundleBase._get_filepath()
- RTATestBundle.add_undecided_filter()#
Inherited method, see
lisa.tests.base.TestBundleBase.add_undecided_filter()
Turn any method returning a
ResultBundleBase
into a decorator that can be used as a test method filter.
- classmethod RTATestBundle.can_create_from_target(target)#
Inherited method, see
lisa.tests.base.TestBundleBase.can_create_from_target()
- Returns:
Whether the given target can be used to create an instance of this class :rtype: bool.
- classmethod RTATestBundle.check_from_target(target)#
Inherited method, see
lisa.tests.base.TestBundleBase.check_from_target()
Check whether the given target can be used to create an instance of this class.
- classmethod RTATestBundle.from_dir(res_dir, update_res_dir=True)#
Inherited method, see
lisa.tests.base.TestBundleBase.from_dir()
Wrapper around
lisa.utils.Serializable.from_path()
.
- classmethod RTATestBundle.from_path(filepath, fmt=None)#
Inherited method, see
lisa.utils.Serializable.from_path()
Deserialize an object from a file.
- classmethod RTATestBundle.get_logger(suffix=None)#
Inherited method, see
lisa.utils.Loggable.get_logger()
Provides a
logging.Logger
named aftercls
.
- RTATestBundle.get_tags()#
Inherited method, see
lisa.tests.base.TestBundleBase.get_tags()
Dictionary of tags and tag values.
- RTATestBundle.get_trace(events=None, **kwargs)#
Inherited method, see
lisa.tests.base.FtraceTestBundleBase.get_trace()
- Returns:
a
lisa.trace.Trace
collected in the standard location.
- classmethod RTATestBundle.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.
- RTATestBundle.test_dmesg(level='warn', facility=None, ignored_patterns: IgnoredPatterns = None) ResultBundle #
Inherited method, see
lisa.tests.base.DmesgTestBundle.test_dmesg()
Basic test on kernel dmesg output.
- RTATestBundle.to_dir(res_dir)#
Inherited method, see
lisa.tests.base.TestBundleBase.to_dir()
- RTATestBundle.to_path(filepath, fmt=None)#
Inherited method, see
lisa.utils.Serializable.to_path()
Serialize the object to a file.
- RTATestBundle.to_yaml()#
Inherited method, see
lisa.utils.Serializable.to_yaml()
Return a YAML string with the serialized object.