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 the lisa.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 of lisa.

Classes

__class__ inherited

Metaclass of TestBundleBase.

Attributes

NOISE_ACCOUNTING_THRESHOLDS

PID/comm specific tuning for test_noisy_tasks().

TASK_PERIOD

A task period in seconds you can re-use for your lisa.wlgen.rta.RTATask definitions.

ATTRIBUTES_SERIALIZATION inherited

Attributes to be treated specially during serialization.

CANNED_DMESG_IGNORED_PATTERNS inherited

Mapping of canned patterns to avoid repetition while defining lisa.tests.base.DmesgTestBundleBase.DMESG_IGNORED_PATTERNS in subclasses.

DEFAULT_SERIALIZATION_FMT inherited

Default format used when serializing objects.

DMESG_IGNORED_PATTERNS inherited

List of patterns to ignore in addition to the ones passed to test_dmesg().

DMESG_PATH inherited

Path to the dmesg log in the result directory.

FTRACE_CONF inherited

TRACE_PATH inherited

Path to the trace-cmd trace.dat file in the result directory.

VERIFY_SERIALIZATION inherited

When True, this enforces a serialization/deserialization step in from_target().

YAML_ENCODING inherited

Encoding used for YAML files.

ftrace_conf inherited

Properties

cgroup_configuration

Compute the cgroup configuration based on plat_info.

rtapp_profile

Compute the RTapp profile based on plat_info.

rtapp_task_ids

The rtapp task lisa.analysis.tasks.TaskID as found from the trace in this bundle.

rtapp_task_ids_map

Mapping of task names as specified in the rtapp profile to list of lisa.analysis.tasks.TaskID names found in the trace.

rtapp_tasks

Same as rtapp_task_ids() but as a list of string.

rtapp_tasks_map

Same as rtapp_task_ids_map() but with list of strings for values.

trace

A lisa.trace.Trace cropped to the window given by trace_window().

_children_test_bundles inherited

dmesg_entries inherited

List of parsed dmesg output entries devlib.collector.dmesg.KernelLogEntry.

dmesg_path inherited

Path to the dmesg output log file.

logger inherited

Convenience short-hand for self.get_logger().

trace_path inherited

Path to the trace-cmd report trace.dat file.

Methods

_from_target

_get_rtapp_profile()

_run_rtapp()

df_noisy_tasks()

returns:

a DataFrame containing all tasks that participate to the test noise. i.e. all non rt-app tasks.

from_target()

Factory method to create a bundle using a live target.

get_cgroup_configuration()

returns:

a dict representing the configuration of a particular cgroup.

get_rtapp_profile()

Returns a dict with task names as keys and lisa.wlgen.rta.RTATask as values.

run_rtapp()

Run the given RTA profile on the target, and collect an ftrace trace.

test_noisy_tasks()

Test that no non-rtapp (“noisy”) task ran for longer than the specified thresholds.

trace_window()

The time window to consider for this RTATestBundle.

unscaled_utilization()

Convert utilization scaled to a CPU to a ‘raw’, unscaled one.

__copy__() inherited

Regular shallow copy operation, without dropping any attributes.

__getstate__() inherited

Filter the instance’s attributes upon serialization.

__setstate__() inherited

_get_filepath() inherited

add_undecided_filter() inherited

Turn 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() inherited

Check whether the given target can be used to create an instance of this class.

from_dir() inherited

Wrapper around lisa.utils.Serializable.from_path().

from_path() inherited

Deserialize an object from a file.

get_logger() inherited

Provides a logging.Logger named after cls.

get_tags() inherited

Dictionary of tags and tag values.

get_trace() inherited

returns:

a lisa.trace.Trace collected in the standard location.

log_locals() inherited

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

test_dmesg() inherited

Basic test on kernel dmesg output.

to_dir() inherited

See lisa.utils.Serializable.to_path().

to_path() inherited

Serialize the object to a file.

to_yaml() inherited

Return 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_profile[source]#

Compute the RTapp profile 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 by trace_window().

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 and lisa.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:

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 internal lisa.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 and lisa.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 each lisa.wlgen.rta.RTAPhase with a boolean value that is True if the phase comes from the test itself and False 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 at phase['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:
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:
  • noise_threshold_pct (float) – The maximum allowed runtime for noisy tasks in percentage of the total rt-app execution time

  • noise_threshold_ms (float) – The maximum allowed runtime for noisy tasks in ms

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 an AttributeError 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.

Parameters:
  • capacity (int) – The CPU against which utilization_pct` is scaled

  • utilization_pct (int) – The scaled utilization in %

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

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()

See lisa.utils.Serializable.to_path().

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.