lisa.tests.base.RTATestBundle#
- class lisa.tests.base.RTATestBundle(res_dir, plat_info, rtapp_profile_kwargs=None)[source]#
Bases:
FtraceTestBundle,DmesgTestBundleAbstract 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.RTATaskdefinitions.ATTRIBUTES_SERIALIZATIONinheritedAttributes to be treated specially during serialization.
CANNED_DMESG_IGNORED_PATTERNSinheritedMapping of canned patterns to avoid repetition while defining
lisa.tests.base.DmesgTestBundleBase.DMESG_IGNORED_PATTERNSin subclasses.DEFAULT_SERIALIZATION_FMTinheritedDefault format used when serializing objects.
DMESG_IGNORED_PATTERNSinheritedList of patterns to ignore in addition to the ones passed to
test_dmesg().DMESG_PATHinheritedPath to the dmesg log in the result directory.
FTRACE_CONFinheritedTRACE_PATHinheritedPath to the
trace-cmdtrace.dat file in the result directory.VERIFY_SERIALIZATIONinheritedWhen True, this enforces a serialization/deserialization step in
from_target().YAML_ENCODINGinheritedEncoding used for YAML files.
ftrace_confinheritedProperties
Compute the cgroup configuration based on
plat_info.Compute the RTapp profile based on
plat_info.The rtapp task
lisa.analysis.tasks.TaskIDas found from the trace in this bundle.Mapping of task names as specified in the rtapp profile to list of
lisa.analysis.tasks.TaskIDnames 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.Tracecropped to the window given bytrace_window()._children_test_bundlesinheriteddmesg_entriesinheritedList of parsed dmesg output entries
devlib.collector.dmesg.KernelLogEntry.dmesg_pathinheritedPath to the dmesg output log file.
loggerinheritedConvenience short-hand for
self.get_logger().trace_pathinheritedPath to the
trace-cmd reporttrace.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
dictrepresenting the configuration of a particular cgroup.
Returns a
dictwith task names as keys andlisa.wlgen.rta.RTATaskas 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
ResultBundleBaseinto 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.Loggernamed aftercls.get_tags()inheritedDictionary of tags and tag values.
get_trace()inherited- returns:
a
lisa.trace.Tracecollected 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.RTATaskdefinitions.
- RTATestBundle.ATTRIBUTES_SERIALIZATION = {'allowed': [], 'ignored': [], 'placeholders': {}}#
Inherited attribute, see
lisa.utils.Serializable.ATTRIBUTES_SERIALIZATIONAttributes 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_PATTERNSMapping of canned patterns to avoid repetition while defining
lisa.tests.base.DmesgTestBundleBase.DMESG_IGNORED_PATTERNSin subclasses.
- RTATestBundle.DEFAULT_SERIALIZATION_FMT = 'yaml'#
Inherited attribute, see
lisa.utils.Serializable.DEFAULT_SERIALIZATION_FMTDefault format used when serializing objects.
- RTATestBundle.DMESG_IGNORED_PATTERNS = ['started with executable stack']#
Inherited attribute, see
lisa.tests.base.DmesgTestBundleBase.DMESG_IGNORED_PATTERNSList 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_PATHPath 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_PATHPath to the
trace-cmdtrace.dat file in the result directory.
- RTATestBundle.VERIFY_SERIALIZATION = True#
Inherited attribute, see
lisa.tests.base.TestBundleBase.VERIFY_SERIALIZATIONWhen True, this enforces a serialization/deserialization step in
from_target().
- RTATestBundle.YAML_ENCODING = 'utf-8'#
Inherited attribute, see
lisa.utils.Serializable.YAML_ENCODINGEncoding 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.TaskIDas 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.TaskIDnames 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.Tracecropped 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_entriesList of parsed dmesg output entries
devlib.collector.dmesg.KernelLogEntry.
- property RTATestBundle.dmesg_path#
Inherited property, see
lisa.tests.base.DmesgTestBundleBase.dmesg_pathPath to the dmesg output log file.
- property RTATestBundle.logger#
Inherited property, see
lisa.utils.Loggable.loggerConvenience short-hand for
self.get_logger().
- property RTATestBundle.trace_path#
Inherited property, see
lisa.tests.base.FtraceTestBundleBase.trace_pathPath to the
trace-cmd reporttrace.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
targetmust 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
dictwith task names as keys andlisa.wlgen.rta.RTATaskas 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
dictrepresenting 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
dictwith task names as keys andlisa.wlgen.rta.RTATaskas 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_testmeta key is added to eachlisa.wlgen.rta.RTAPhasewith a boolean value that isTrueif the phase comes from the test itself andFalseif 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-appprofile, 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_switchsched_wakeupone group of:
task_renameoptional:
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.tracehere will raise anAttributeErrorexception, to avoid entering infinite recursion.- Required trace events:
userspace@rtapp_loopsched_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
ResultBundleBaseinto 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.Loggernamed 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.Tracecollected 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.