Workloads

Introduction

LISA is not intended to automate the execution of complex workloads such as Android benchmarks (Jankbench, PCMark…). For this kind of application, you should turn to Workload Automation instead.

However, a minimal amount of support for running experiments is still useful. That is why LISA provides the wlgen API, which lets you execute commands and binaries while providing some help for managing tasksets, cgroups, and more.

Available workloads

Most of these workloads are based on the Workload class, see the documentation for common functionalities.

Base class

class lisa.wlgen.workload._WorkloadBase[source]

Bases: object

Dummy base class so that Workload is processed by __init_subclass__ as well.

classmethod __init_subclass__(*args, **kwargs)[source]

Automatically decorate _run() so that it returns a context manager.

class lisa.wlgen.workload.Workload(*args, **kwargs)[source]

Bases: _WorkloadBase, PartialInit, Loggable

Handle the execution of a command on a target, with custom output processing.

Parameters:
  • target (Target) – The Target on which to execute this workload

  • name (str or None) – Name of the workload. Useful for naming related artefacts.

  • res_dir (str or None) – Host directory into which artifacts will be stored

  • run_dir (str or None) – Target directory into which artifacts will be created.

  • cpus (list(int) or None) – CPUs on which to restrict the workload execution (taskset)

  • cgroup (str or None) – cgroup in which to run the workload

  • as_root (bool) – Whether to run the workload as root or not

  • timeout (int) – Timeout in seconds for the workload execution.

Note

A Workload instance can be used as a context manager, which ensures cleanup() is eventually invoked.

REQUIRED_TOOLS = []

The tools required to execute the workload. See lisa.target.Target.install_tools().

property output

Attention

Deprecated since version 2.0.

output() is deprecated and will be removed in version 4.0: Processed output is returned by run() or by the “.output” attribute of the value returned by the run_background() context manager

deploy()[source]

Deploy the workload on the target.

If not called manually, it will be called:

Calling it manually ahead of time makes can allow less garbage while tracing during the execution of the workload.

Note

This method can be called any number of times, but will only have an effect the first time.

Note

This method should not be overridden, see _setup().

cleanup()[source]

Remove all the artifacts installed on the target with deploy().

If not called manually, it will be called in __exit__() or __del__ if the workload is used as a context manager.

Note

This method can be called any number of times, but will only have an effect the first time and if the target was deployed.

Note

This method should not be overridden, see _setup().

run_background()[source]

Run the command asynchronously and give control back to the caller.

Returns a transparent wrapper for devlib.connection.BackgroundCommand.

Example:

wload = Workload(...)

with wload.run_background() as bg:
    # do something. "bg" can be monitored, except for stdout/stderr
    # which are captured for later post-processing by the class.
    ...
    time.sleep(42)

# Post-processed output, which would be equal to:
# print(wload.run())
print(bg.output)

Note

Subclasses should implement _run().

run(cpus=None, cgroup=None, as_root=False, timeout=None)[source]

Run the workload and returns the post-processed output.

Calls deploy() if it has not already been done. stdout and stderr will be saved into files in self.res_dir

Note

Subclasses should implement _run().

wipe_run_dir()[source]

Wipe all content from the run_dir target directory and all its empty parents.

Note

This function should only be called directly in interactive sessions. For other purposes, use Workload instances as a context manager.

__exit__(exc_type, exc_val, exc_tb)[source]

Cleanup the artifacts of the workload on the target.

rt-app

This module implements an rt-app JSON programmatic configuration file generator, along the class to run it directly on a Target. This is the backbone of our scheduler tests, allowing to easily run custom workloads.

The most important classes are:

A typical workload would be created this way:

from lisa.wlgen.rta import RTA, RTAPhase, PeriodicWload, RunWload, SleepWload, override, delete, WithProperties, task_factory, RTAConf
from lisa.fuzz import Float, Int
from lisa.platforms.platinfo import PlatformInfo
from lisa.target import Target

task = (
    # Phases can be added together so they will be executed in order
    RTAPhase(
        prop_name='first',
        # The workload of a phase is a subclass of WloadPropertyBase
        prop_wload=RunWload(1),
        prop_uclamp=(256, 512),
    ) +
    RTAPhase(
        prop_name='second',
        prop_wload=(
            # Workloads can be added together too
            SleepWload(5) +
            PeriodicWload(
                duty_cycle_pct=20,
                period=16e-3,
                duration=2,
            )
        )
    )
)

# Alternatively, an async API is available to define tasks.
# Each workload awaited will become a new phase, and WithProperties async
# context manager can be used to set properties for multiple such phases.
#
# Additionally, the random data generators from lisa.fuzz can be used as well.

@task_factory
async def make_task(run_duration):
    async with WithProperties(name='first', uclamp=(256, 512)):
        await RunWload(run_duration)

    # Create a bounded random value
    sleep_duration = await Float(min_=1, max_=5)
    sleep_duration = round(sleep_duration, 2)

    async with WithProperties(name='second'):
        # We could await once on each workload, but that would lead to 2 phases
        # instead of one. Whether this is desired or an issue depends on the
        # use-case.
        await (
            SleepWload(sleep_duration) +
            PeriodicWload(
                duty_cycle_pct=20,
                period=16e-3,
                duration=2,
            )
        )

# "seed" is used to initialize the random number generator. If not
# provided, the seed will be random.
task = make_task(run_duration=1)(seed=1)

# Important note: all the classes in this module are immutable. Modifying
# attributes is not allowed, use the RTAPhase.with_props() if you want to
# get a new object with updated properties.

# You can create a modified RTAPhase using with_props(), and the property
# will be combined with the existing ones.
# For util clamp, it means taking the toughest restrictions, which in this
# case are (300, 512).
task = task.with_props(uclamp=(300, 800))

# If you want to set the clamp and override any existing value rather than
# combining it, you can use the override() function
task = task.with_props(uclamp=override((400, 700)))

# Similarly, you can delete any property that was already set with delete()
task = task.with_props(uclamp=delete())


###################################################
# Alternative 1: create a simple profile and run it
###################################################

# Connect to a target
target = Target.from_default_conf()

# Mapping of rt-app task names to the phases they will execute
profile = {'task1': task}

# Create the RTA object that configures the profile for the given target
wload = RTA.from_profile(target, profile=profile)

# Workloads are context managers to do some cleanup on exit
with wload:
    wload.run()


###################################################
# Alternative 2: a more complex example generating multiple tasks and dumping a JSON.
###################################################

@task_factory
async def make_profile(plat_info, **kwargs):
    nr_tasks = await Int(1, plat_info['cpus-count'])

    profile = {}
    for i in range(nr_tasks):
        async with WithProperties(name=f'task{i}'):
            profile[f'task{i}'] = await make_task(**kwargs)

    # If we return anything else than None, the return value will not be
    # replaced by the phase defined in the function.
    return profile


plat_info = PlatformInfo.from_yaml_map('./doc/traces/plat_info.yml')

# Display a few randomly generated tasks
for _ in range(2):
    # When called, profile_gen() will create a random profiles
    profile_gen = make_profile(plat_info, run_duration=1)

    # seed (or rng) can be fixed for reproducible results
    # profile = profile_gen(seed=1)
    profile = profile_gen(seed=None)

    conf = RTAConf.from_profile(profile, plat_info=plat_info)
    print(conf.json)
exception lisa.wlgen.rta.CalibrationError[source]

Bases: RuntimeError

Exception raised when the rt-app calibration is not consistent with the CPU capacities in a way or another.

class lisa.wlgen.rta.RTAConf(conf)[source]

Bases: Loggable, Mapping

JSON configuration for rt-app.

Parameters:

conf (object) – Python object graph with the JSON content.

ALLOWED_TASK_NAME_REGEX = '^[a-zA-Z0-9_]+$'
property json

rt-app configuration file content as a JSON string.

classmethod from_profile(profile, *, plat_info, force_defaults=False, max_duration_s=None, calibration=None, log_stats=False, trace_events=None, run_dir=None, lock_pages=False, no_force_default_keys=None)[source]

Create an rt-app workload using RTAPhase instances

Parameters:
  • profile (dict) – The workload description in a {task_name : RTATask} shape

  • plat_info (lisa.platforms.platinfo.PlatformInfo) – Platform information used to tweak the configuration file according to the target.

  • force_defaults (bool) – If True, default values for all settings will be set in the first phase (unless they are set by the profile). If False, defaults will be removed from the file (even if they were explicitly set by the user).

  • no_force_default_keys (list(str) or None) – JSON keys for which no default will be forced by force_defaults=True.

  • max_duration_s (int) – Maximum duration of the workload. Will be determined by the longest running task if not specified.

  • calibration (int or str) – The calibration value to be used by rt-app. This can be an integer value or a CPU string (e.g. “CPU0”).

  • log_stats (bool) – Generate a log file with stats for each task

  • lock_pages (bool) – Lock the pages to memory to avoid jitter. Requires running as root.

  • trace_events (list(str)) – A list of trace events to generate. For a full list of trace events which can be generated by rt-app, refer to the tool documentation: https://github.com/scheduler-tools/rt-app/blob/master/doc/tutorial.txt By default, no events are generated.

classmethod _process_template(template, duration=None, pload=None, log_dir=None)[source]

Turn a raw string rt-app description into a JSON dict. Also, process some tokens and replace them.

Parameters:
  • template (str) – The raw string to process

  • duration (int) – The value to replace __DURATION__ with

  • pload (int or str) – The value to replace __PVALUE__ with

  • log_dir (str) – The value to replace __LOGDIR__ and __WORKDIR__ with.

Returns:

a JSON dict

classmethod from_path(path, **kwargs)[source]

Same as from_str() but with a file path instead.

classmethod from_str(str_conf, plat_info, run_dir, max_duration_s=None, calibration=None)[source]

Create an rt-app workload using a pure string description

Parameters:
  • str_conf (str) – The raw string description. This must be a valid json description, with the exception of some tokens (see _process_template()) that will be replaced automagically.

  • plat_info (lisa.platforms.platinfo.PlatformInfo) – Platform information used to tweak the configuration file according to the target.

  • run_dir (str) – Directory used by rt-app to produce artifacts

  • max_duration_s (int) – Maximum duration of the workload.

  • calibration (int or str) – The calibration value to be used by rt-app. This can be an integer value or a CPU string (e.g. “CPU0”).

class lisa.wlgen.rta.RTA(*args, **kwargs)[source]

Bases: Workload

An rt-app workload

Parameters:
  • json_file (str) – Path to the rt-app json description

  • log_level (str or None) – Set rt-app log level. One of: * critical * error * notice * info * debug

Warning

The class constructor only deals with pre-constructed json files. For creating rt-app workloads through other means, see from_profile() and by_str().

For more information about rt-app itself, see https://github.com/scheduler-tools/rt-app

REQUIRED_TOOLS = ['rt-app']

The tools required to execute the workload. See lisa.target.Target.install_tools().

classmethod from_profile(target, profile, name=None, res_dir=None, log_stats=False, *, as_root=False, calibration=None, cgroup=None, cpus=None, force_defaults=False, log_level=None, log_std_streams=True, max_duration_s=None, no_force_default_keys=None, run_dir=None, timeout=None, trace_events=None, update_cpu_capacities=None, wipe_res_dir=False, wipe_run_dir=True)[source]

Create an rt-app workload using RTATask instances

Parameters:
  • target (lisa.target.Target) – Target that the workload will run on.

  • name (str or None) – Name of the workload.

  • res_dir (str or None) – Host folder to store artifacts in.

Variable keyword arguments:

Forwarded to RTAConf.from_profile()

classmethod by_profile(*args, **kwargs)[source]

Attention

Deprecated since version 2.0.

by_profile() is deprecated and will be removed in version 4.0, use lisa.utils.<lisa.utils.PartialInit._PartialFactory object at 0x7ffa5012c190> instead

classmethod from_str(target, str_conf, name=None, res_dir=None, *, as_root=False, calibration=None, cgroup=None, cpus=None, log_level=None, log_stats=False, log_std_streams=True, max_duration_s=None, run_dir=None, timeout=None, update_cpu_capacities=None, wipe_res_dir=False, wipe_run_dir=True)[source]

Create an rt-app workload using a pure string description

Parameters:
  • target (lisa.target.Target) – Target that the workload will run on.

  • str_conf (str) – The raw string description. This must be a valid json description, with the exception of some tokens (see RTAConf.from_str()) that will be replaced automagically.

  • name (str or None) – Name of the workload.

  • res_dir (str or None) – Host folder to store artifacts in.

Variable keyword arguments:

Forwarded to RTAConf.from_profile()

classmethod by_str(*args, **kwargs)[source]

Attention

Deprecated since version 2.0.

by_str() is deprecated and will be removed in version 4.0, use lisa.utils.<lisa.utils.PartialInit._PartialFactory object at 0x7ffa500a2b10> instead

classmethod from_conf(target, conf, name=None, res_dir=None, *, log_stats=False, update_cpu_capacities=None, log_level=None, run_dir=None, cpus=None, cgroup=None, as_root=False, timeout=None, log_std_streams=True, wipe_run_dir=True, wipe_res_dir=False)[source]

Create an rt-app workload using a RTAConf.

Parameters:
  • target (lisa.target.Target) – Target that the workload will run on.

  • conf (RTAConf) – Configuration object.

  • name (str or None) – Name of the workload.

  • res_dir (str or None) – Host folder to store artifacts in.

classmethod warn_capacities_mismatch(orig_capacities, new_capacities)[source]

Compare orig_capacities and new_capacities and log warnings if they are not consistent.

Parameters:
  • orig_capacities (dict(int, int)) – Original CPU capacities, as a map of CPU to capacity.

  • new_capacities (dict(int, int)) – New CPU capacities, as a map of CPU to capacity.

classmethod get_cpu_capacities_from_calibrations(orig_capacities, calibrations)[source]

Compute the CPU capacities out of the rt-app calibration values.

Returns:

A mapping of CPU to capacity.

Parameters:
  • orig_capacities (dict(int, int)) – Original capacities as a mapping of CPU ID to capacity.

  • calibrations (dict) – Mapping of CPU to pload value.

classmethod get_cpu_calibrations(target, res_dir=None)[source]

Get the rt-ap calibration value for all CPUs.

Parameters:

target (lisa.target.Target) – Target to run calibration on.

Returns:

Dict mapping CPU numbers to rt-app calibration values.

classmethod resolve_trace_task_names(trace, names)[source]

Translate an RTA profile task name to a list of lisa.analysis.tasks.TaskID as found in a lisa.trace.Trace.

Returns:

A dictionnary of rt-app profile names to list of lisa.analysis.tasks.TaskID The list will contain more than one item if the task forked.

Parameters:
  • trace (lisa.trace.Trace) – Trace to look at.

  • names (list(str)) – rt-app task names as specified in profile keys

get_trace_task_names(trace)[source]

Get a dictionnary of lisa.analysis.tasks.TaskID used in the given trace for this task.

class lisa.wlgen.rta.PropertyMeta(name, bases, namespace, /, **kwargs)[source]

Bases: ABCMeta

Metaclass for properties.

It overrides __instancecheck__ so that instances of PropertyWrapper can be recognized as instances of the type they wrap, in order to make them as transparent as possible.

__instancecheck__(obj)[source]

Override for isinstance(instance, cls).

class lisa.wlgen.rta.PropertyBase[source]

Bases: SimpleHash

Base class of all properties.

KEY = None

Subclasses can override this attribute so that PropertyBase.from_key() knows that it can call their _from_key() method for that key.

Note

This class attribute will not be inherited automatically so that each class can be uniquely identified by its key. Subclass that do not override the value explicitly will get None.

classmethod __init_subclass__(**kwargs)[source]

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

property key

Key of the instance.

This property will default to getting the value of the KEY class attribute of the first of its ancestor defining it. This way, _from_key() can be shared in a base class between multiple subclasses if needed.

abstract property val

Value “payload” of the property.

Ideally, it should be a valid value that can be given to from_key(), but it’s not mandatory. For complex properties that are not isomorphic to a Python basic type (int, tuple etc.), self should be returned.

classmethod _from_key(key, val)[source]

Build an instance out of key and val.

abstract __and__(other)[source]

Combine two instances of the same property together.

This is used to combine properties at the various levels of the RTAPhaseTree tree, on each path from the root to the leaves. It is guaranteed that the instance closer to the root will be self and the one closer to the leaves will be other.

If the property is a constraint, a good implementation should combine two instances by applying the strongest constraint. For example, CPU affinity are combined by taking the intersection of allowed CPUs.

If the property is some sort of “dummy” structure, it can make sense to allow the instance closer to the root of the tree to override the set members in the instance closer to the leaves.

Otherwise, it’s probably best to just bail with ValueError with a message explaining that there is a conflict.

classmethod _check_key(key)[source]

Check that the key is allowed for this class.

classmethod from_key(key, val)[source]

Alternative constructor that is available with the same signature for all properties.

Parameters:
  • key (str) – Key passed by the user. It will be checked with _check_key() before building an instance.

  • val (object) – Value passed by the user.

classmethod find_cls(key)[source]

Find which subclass can handle key.

It is best called on PropertyBase in order to allow any property to be built.

class lisa.wlgen.rta.ConcretePropertyBase[source]

Bases: PropertyBase, Loggable

Base class for concrete properties.

Concrete properties are properties that will ultimately translated into JSON, as opposed to meta properties that will never make it to the final configuration file.

OPTIMIZE_JSON_KEYS = {}

Configuration driving the JSON optimization, as a dict(str, set(str)).

This is a dictionary mapping JSON key names to set of “barrier” JSON keys. When successive phases of a given task share the same value for the keys of that dictionary, they will be removed in the later phases since rt-app settings are persistent across phases. When any of the barrier key listed in the set has a change in its value, it will be considered as an optimization barrier and the value will be set again, even if it means repeating the same value as earlier.

REQUIRED_KCONFIG_KEYS = []

List of KCONFIG keys that need to be =Y on the target kernel for this property to be usable.

classmethod check_kconfig(plat_info, strict=True)[source]

Check whether plat_info contains the kernel KCONFIG keys contained in REQUIRED_KCONFIG_KEYS.

Parameters:
  • keys (list(str)) – Kernel config keys to check, e.g. [‘CONFIG_FOO_BAR’].

  • strict (bool) – If True, raise an exception if any key is missing. If False, log if any key is missing.

to_json(plat_info, **kwargs)[source]

Snippet of JSON content for that property as Python objects.

Parameters:

plat_info (lisa.platforms.platinfo.PlatformInfo) – Platform information that can be used to generate the default value .

classmethod to_default_json(plat_info, properties)[source]

Similar to to_json() but returns the default values for the keys set in to_json().

Parameters:
  • plat_info (lisa.platforms.platinfo.PlatformInfo) – Platform information that can be used to generate the default value .

  • properties (collections.OrderedDict(str, object)) – collections.OrderedDict of JSON properties for the current phase. This can be used if the default value is context dependent. For example, if two properties depend on each other, they can get the value of the other key from properties. The property might not have been set yet so abscence of the key has to be handled. The calling code will look for a fixpoint for the default properties, so this method will be called iteratively until the result is stable, allowing for arbitrary dependency between keys.

KEY = None

Subclasses can override this attribute so that PropertyBase.from_key() knows that it can call their _from_key() method for that key.

Note

This class attribute will not be inherited automatically so that each class can be uniquely identified by its key. Subclass that do not override the value explicitly will get None.

class lisa.wlgen.rta.MetaPropertyBase[source]

Bases: PropertyBase

Base class for meta properties.

Meta properties are properties that will not be translated into JSON, as opposed to concrete properties.

KEY = None

Subclasses can override this attribute so that PropertyBase.from_key() knows that it can call their _from_key() method for that key.

Note

This class attribute will not be inherited automatically so that each class can be uniquely identified by its key. Subclass that do not override the value explicitly will get None.

class lisa.wlgen.rta.ContaminatingProperty[source]

Bases: PropertyBase

Base class for properties that will “contaminate” other instances when combined with them, even if they are closer to the leaf.

KEY = None

Subclasses can override this attribute so that PropertyBase.from_key() knows that it can call their _from_key() method for that key.

Note

This class attribute will not be inherited automatically so that each class can be uniquely identified by its key. Subclass that do not override the value explicitly will get None.

class lisa.wlgen.rta.PropertyWrapper(prop)[source]

Bases: ContaminatingProperty

Base class for properties that are merely wrapper around another property instance.

It is advised that subclasses use name mangling for attributes (name starting with __), so that the wrapper’s attribute will not conflict with the attributes of the wrapped property, so that the wrapper is as transparent as possible.

__hash__()[source]

Return hash(self).

with_wrapped(wrapped)[source]

Build a new instance with modified wrapped property.

classmethod from_key(key, val, **kwargs)[source]

Alternative constructor that is available with the same signature for all properties.

Parameters:
  • key (str) – Key passed by the user. It will be checked with _check_key() before building an instance.

  • val (object) – Value passed by the user.

property val

Value “payload” of the property.

Ideally, it should be a valid value that can be given to from_key(), but it’s not mandatory. For complex properties that are not isomorphic to a Python basic type (int, tuple etc.), self should be returned.

__getattr__(attr)[source]

Be as transparent as possible, so that this sort of call would work: self.__prop.__and__(self)

KEY = None

Subclasses can override this attribute so that PropertyBase.from_key() knows that it can call their _from_key() method for that key.

Note

This class attribute will not be inherited automatically so that each class can be uniquely identified by its key. Subclass that do not override the value explicitly will get None.

class lisa.wlgen.rta.PlaceHolderValue(val=None, **kwargs)[source]

Bases: object

Placeholder value to be passed to RTAPhaseProperties.from_polymorphic() to hijack the usual PropertyBase.from_key() path and allow PROPERTY_CLS.from_key to be called instead.

Parameters:

val (object) – “payload” value.

Variable keyword arguments:

Saved for later consumption.

PROPERTY_CLS = None

Class on which from_key will be used, rather than looking up the class based on the key name.

class lisa.wlgen.rta.OverridenProperty(prop, deep=True)[source]

Bases: PropertyWrapper

Forcefully override the value of another property.

See also

override()

__and__(other)[source]

We only want to override properties “downards”, which means:

  • OverridenProperty(root) & leaf = OverridenProperty(root)

  • root & OverridenProperty(leaf) = OverridenProperty(root & leaf)

Note

When deep=False is used, this class does not form a semigroup, i.e. the result will depend on the order of the tree traversal.

KEY = None

Subclasses can override this attribute so that PropertyBase.from_key() knows that it can call their _from_key() method for that key.

Note

This class attribute will not be inherited automatically so that each class can be uniquely identified by its key. Subclass that do not override the value explicitly will get None.

class lisa.wlgen.rta.LeafPrecedenceProperty(prop)[source]

Bases: PropertyWrapper

Invert the usual combination of order (root to leaf) of property values.

__and__(other)[source]

Combine two instances of the same property together.

This is used to combine properties at the various levels of the RTAPhaseTree tree, on each path from the root to the leaves. It is guaranteed that the instance closer to the root will be self and the one closer to the leaves will be other.

If the property is a constraint, a good implementation should combine two instances by applying the strongest constraint. For example, CPU affinity are combined by taking the intersection of allowed CPUs.

If the property is some sort of “dummy” structure, it can make sense to allow the instance closer to the root of the tree to override the set members in the instance closer to the leaves.

Otherwise, it’s probably best to just bail with ValueError with a message explaining that there is a conflict.

KEY = None

Subclasses can override this attribute so that PropertyBase.from_key() knows that it can call their _from_key() method for that key.

Note

This class attribute will not be inherited automatically so that each class can be uniquely identified by its key. Subclass that do not override the value explicitly will get None.

lisa.wlgen.rta.leaf_precedence(val, **kwargs)[source]

Give precedence to the leaf values when combining with &:

phase = phase.with_props(meta=({'hello': 'leaf'})
phase = phase.with_props(meta=leaf_precedence({'hello': 'root'})
assert phase['meta'] == {'hello': 'leaf'}

This allows setting a property with some kind of default value on a root node in the phase tree while still allowing it to be combined with the children values in such a way that the children values take precedence.

Note

In order to make the result more predictable, the effect will not propagate beyond one level where the property is set. This means it will work best for properties that are only set in leaves only.

lisa.wlgen.rta.override(val, **kwargs)[source]

Override a property with the given value, rather than combining it with the property-specific & implementation:

phase = phase.with_props(cpus=override({1,2}))
class lisa.wlgen.rta.DeletedProperty(key)[source]

Bases: ContaminatingProperty

Forcefully delete the given property, recursively for all subtrees.

Parameters:

key (str) – Key of the property to delete.

See also

delete()

Note

The property is not actually deleted but just replaced by an instance of this class, which will have specific handling in relevant parts of the code.

property val

Value “payload” of the property.

Ideally, it should be a valid value that can be given to from_key(), but it’s not mandatory. For complex properties that are not isomorphic to a Python basic type (int, tuple etc.), self should be returned.

classmethod from_key(key, val)[source]

Alternative constructor that is available with the same signature for all properties.

Parameters:
  • key (str) – Key passed by the user. It will be checked with _check_key() before building an instance.

  • val (object) – Value passed by the user.

__and__(other)[source]

Combine two instances of the same property together.

This is used to combine properties at the various levels of the RTAPhaseTree tree, on each path from the root to the leaves. It is guaranteed that the instance closer to the root will be self and the one closer to the leaves will be other.

If the property is a constraint, a good implementation should combine two instances by applying the strongest constraint. For example, CPU affinity are combined by taking the intersection of allowed CPUs.

If the property is some sort of “dummy” structure, it can make sense to allow the instance closer to the root of the tree to override the set members in the instance closer to the leaves.

Otherwise, it’s probably best to just bail with ValueError with a message explaining that there is a conflict.

KEY = None

Subclasses can override this attribute so that PropertyBase.from_key() knows that it can call their _from_key() method for that key.

Note

This class attribute will not be inherited automatically so that each class can be uniquely identified by its key. Subclass that do not override the value explicitly will get None.

lisa.wlgen.rta.delete()[source]

Remove the given property from the phase:

phase = phase.with_props(cpus=delete())
class lisa.wlgen.rta.SimpleProperty(key, val)[source]

Bases: PropertyBase

Simple property with dynamic key.

property val

Value “payload” of the property.

Ideally, it should be a valid value that can be given to from_key(), but it’s not mandatory. For complex properties that are not isomorphic to a Python basic type (int, tuple etc.), self should be returned.

classmethod _from_key(key, val)[source]

Build an instance out of key and val.

__and__(other)[source]

Combine two instances of the same property together.

This is used to combine properties at the various levels of the RTAPhaseTree tree, on each path from the root to the leaves. It is guaranteed that the instance closer to the root will be self and the one closer to the leaves will be other.

If the property is a constraint, a good implementation should combine two instances by applying the strongest constraint. For example, CPU affinity are combined by taking the intersection of allowed CPUs.

If the property is some sort of “dummy” structure, it can make sense to allow the instance closer to the root of the tree to override the set members in the instance closer to the leaves.

Otherwise, it’s probably best to just bail with ValueError with a message explaining that there is a conflict.

KEY = None

Subclasses can override this attribute so that PropertyBase.from_key() knows that it can call their _from_key() method for that key.

Note

This class attribute will not be inherited automatically so that each class can be uniquely identified by its key. Subclass that do not override the value explicitly will get None.

class lisa.wlgen.rta.SimpleConcreteProperty(key, val)[source]

Bases: SimpleProperty, ConcretePropertyBase

Base class for simple properties that maps to JSON.

JSON_KEY = None

Name of the JSON key the property will set.

Note

If it needs to be dynamically chose, see json_key.

DEFAULT_JSON = None

JSON value to use as a default.

If None, nothing will be output.

Note

If the default value is context-dependent, it should override to_default_json() instead.

FILTER_NONE = True

If True, no JSON content will be generated when the property value is None

property json_key

Name of the JSON key that will be set.

Defaults to JSON_KEY if it is not None, otherwise key instance attribute will be used.

KEY = None

Subclasses can override this attribute so that PropertyBase.from_key() knows that it can call their _from_key() method for that key.

Note

This class attribute will not be inherited automatically so that each class can be uniquely identified by its key. Subclass that do not override the value explicitly will get None.

class lisa.wlgen.rta._SemigroupProperty[source]

Bases: PropertyBase

Base class for properties forming a semigroup with respect to their __and__ method.

This implies __and__ is associative, i.e. this must hold: (a & b) & c == a & (b & c)

abstract static _SEMIGROUP_OP(x, y)[source]

Function used to combine two non-None values.

__and__(other)[source]

Combine values of the properties using _SEMIGROUP_OP(), except when one of the value is None, in which case the other value is used as is and wrapped into an instance using from_key().

KEY = None

Subclasses can override this attribute so that PropertyBase.from_key() knows that it can call their _from_key() method for that key.

Note

This class attribute will not be inherited automatically so that each class can be uniquely identified by its key. Subclass that do not override the value explicitly will get None.

class lisa.wlgen.rta.MinProperty[source]

Bases: _SemigroupProperty

Semigroup property with the min() operation.

KEY = None

Subclasses can override this attribute so that PropertyBase.from_key() knows that it can call their _from_key() method for that key.

Note

This class attribute will not be inherited automatically so that each class can be uniquely identified by its key. Subclass that do not override the value explicitly will get None.

class lisa.wlgen.rta.MaxProperty[source]

Bases: _SemigroupProperty

Semigroup property with the max() operation.

KEY = None

Subclasses can override this attribute so that PropertyBase.from_key() knows that it can call their _from_key() method for that key.

Note

This class attribute will not be inherited automatically so that each class can be uniquely identified by its key. Subclass that do not override the value explicitly will get None.

class lisa.wlgen.rta.AndProperty[source]

Bases: _SemigroupProperty

Semigroup property with the & operation.

KEY = None

Subclasses can override this attribute so that PropertyBase.from_key() knows that it can call their _from_key() method for that key.

Note

This class attribute will not be inherited automatically so that each class can be uniquely identified by its key. Subclass that do not override the value explicitly will get None.

class lisa.wlgen.rta.OrProperty[source]

Bases: _SemigroupProperty

Semigroup property with the | operation.

KEY = None

Subclasses can override this attribute so that PropertyBase.from_key() knows that it can call their _from_key() method for that key.

Note

This class attribute will not be inherited automatically so that each class can be uniquely identified by its key. Subclass that do not override the value explicitly will get None.

class lisa.wlgen.rta.NameProperty(name, _from_merge=False)[source]

Bases: SimpleProperty, MetaPropertyBase

Name the phase.

KEY = 'name'

Subclasses can override this attribute so that PropertyBase.from_key() knows that it can call their _from_key() method for that key.

Note

This class attribute will not be inherited automatically so that each class can be uniquely identified by its key. Subclass that do not override the value explicitly will get None.

SEPARATOR = '/'
__and__(other)[source]

Names are combined with / along the path to each leaf to reflect names of all levels from the root to the leaves.

class lisa.wlgen.rta.MetaStoreProperty(mapping)[source]

Bases: SimpleProperty, MetaPropertyBase

Plain key-value storage to be used as the user see fit.

Parameters:

mapping (dict) – Dictionary of user-defined keys.

Since this is a meta property, it will not influence the generation of the JSON and can be used to hold any sort of custom metadata needing to be attached to the phases.

KEY = 'meta'

Subclasses can override this attribute so that PropertyBase.from_key() knows that it can call their _from_key() method for that key.

Note

This class attribute will not be inherited automatically so that each class can be uniquely identified by its key. Subclass that do not override the value explicitly will get None.

classmethod _from_key(key, val)[source]

Build an instance out of key and val.

__and__(other)[source]

Combine the key value pairs together. In case of conflict, the value on closer to the root is chosen.

class lisa.wlgen.rta.PolicyProperty(policy)[source]

Bases: SimpleConcreteProperty

Scheduler policy property.

Parameters:

policy (str) – Scheduling policy: * SCHED_OTHER for CFS task * SCHED_FIFO for FIFO realtime task * SCHED_RR for round-robin realtime task * SCHED_DEADLINE for deadline task * SCHED_BATCH for batch task * SCHED_IDLE for idle task

KEY = 'policy'

Subclasses can override this attribute so that PropertyBase.from_key() knows that it can call their _from_key() method for that key.

Note

This class attribute will not be inherited automatically so that each class can be uniquely identified by its key. Subclass that do not override the value explicitly will get None.

JSON_KEY = 'policy'

Name of the JSON key the property will set.

Note

If it needs to be dynamically chose, see json_key.

DEFAULT_JSON = 'SCHED_OTHER'

JSON value to use as a default.

If None, nothing will be output.

Note

If the default value is context-dependent, it should override to_default_json() instead.

OPTIMIZE_JSON_KEYS = {'policy': {}}

Configuration driving the JSON optimization, as a dict(str, set(str)).

This is a dictionary mapping JSON key names to set of “barrier” JSON keys. When successive phases of a given task share the same value for the keys of that dictionary, they will be removed in the later phases since rt-app settings are persistent across phases. When any of the barrier key listed in the set has a change in its value, it will be considered as an optimization barrier and the value will be set again, even if it means repeating the same value as earlier.

classmethod _from_key(key, val)[source]

Build an instance out of key and val.

class lisa.wlgen.rta.TaskGroupProperty(path)[source]

Bases: SimpleConcreteProperty

Task group property.

Parameters:

path (str) – Path of the taskgroup.

Only supported by rt-app for SCHED_OTHER and SCHED_IDLE for now.

KEY = 'taskgroup'

Subclasses can override this attribute so that PropertyBase.from_key() knows that it can call their _from_key() method for that key.

Note

This class attribute will not be inherited automatically so that each class can be uniquely identified by its key. Subclass that do not override the value explicitly will get None.

JSON_KEY = 'taskgroup'

Name of the JSON key the property will set.

Note

If it needs to be dynamically chose, see json_key.

OPTIMIZE_JSON_KEYS = {'taskgroup': {'policy'}}

Configuration driving the JSON optimization, as a dict(str, set(str)).

This is a dictionary mapping JSON key names to set of “barrier” JSON keys. When successive phases of a given task share the same value for the keys of that dictionary, they will be removed in the later phases since rt-app settings are persistent across phases. When any of the barrier key listed in the set has a change in its value, it will be considered as an optimization barrier and the value will be set again, even if it means repeating the same value as earlier.

REQUIRED_KCONFIG_KEYS = ['CONFIG_CGROUP_SCHED']

List of KCONFIG keys that need to be =Y on the target kernel for this property to be usable.

classmethod _from_key(key, val)[source]

Build an instance out of key and val.

class lisa.wlgen.rta.PriorityProperty(priority)[source]

Bases: SimpleConcreteProperty

Task scheduler priority property.

Parameters:

priority (int) – Priority of the task.

KEY = 'priority'

Subclasses can override this attribute so that PropertyBase.from_key() knows that it can call their _from_key() method for that key.

Note

This class attribute will not be inherited automatically so that each class can be uniquely identified by its key. Subclass that do not override the value explicitly will get None.

JSON_KEY = 'priority'

Name of the JSON key the property will set.

Note

If it needs to be dynamically chose, see json_key.

OPTIMIZE_JSON_KEYS = {'priority': {'policy'}}

Configuration driving the JSON optimization, as a dict(str, set(str)).

This is a dictionary mapping JSON key names to set of “barrier” JSON keys. When successive phases of a given task share the same value for the keys of that dictionary, they will be removed in the later phases since rt-app settings are persistent across phases. When any of the barrier key listed in the set has a change in its value, it will be considered as an optimization barrier and the value will be set again, even if it means repeating the same value as earlier.

classmethod _from_key(key, val)[source]

Build an instance out of key and val.

class lisa.wlgen.rta._UsecSimpleConcreteProperty(val)[source]

Bases: SimpleConcreteProperty

Simple property that converts its value from seconds to microseconds for the JSON file.

classmethod _from_key(key, val)[source]

Build an instance out of key and val.

KEY = None

Subclasses can override this attribute so that PropertyBase.from_key() knows that it can call their _from_key() method for that key.

Note

This class attribute will not be inherited automatically so that each class can be uniquely identified by its key. Subclass that do not override the value explicitly will get None.

class lisa.wlgen.rta.DeadlineRuntimeProperty(val)[source]

Bases: _UsecSimpleConcreteProperty

SCHED_DEADLINE scheduler policy’s runtime property.

Parameters:

val (int) – runtime in seconds

KEY = 'dl_runtime'

Subclasses can override this attribute so that PropertyBase.from_key() knows that it can call their _from_key() method for that key.

Note

This class attribute will not be inherited automatically so that each class can be uniquely identified by its key. Subclass that do not override the value explicitly will get None.

JSON_KEY = 'dl-runtime'

Name of the JSON key the property will set.

Note

If it needs to be dynamically chose, see json_key.

OPTIMIZE_JSON_KEYS = {'dl-runtime': {'policy'}}

Configuration driving the JSON optimization, as a dict(str, set(str)).

This is a dictionary mapping JSON key names to set of “barrier” JSON keys. When successive phases of a given task share the same value for the keys of that dictionary, they will be removed in the later phases since rt-app settings are persistent across phases. When any of the barrier key listed in the set has a change in its value, it will be considered as an optimization barrier and the value will be set again, even if it means repeating the same value as earlier.

class lisa.wlgen.rta.DeadlinePeriodProperty(val)[source]

Bases: _UsecSimpleConcreteProperty

SCHED_DEADLINE scheduler policy’s period property.

Parameters:

val (int) – period in seconds

KEY = 'dl_period'

Subclasses can override this attribute so that PropertyBase.from_key() knows that it can call their _from_key() method for that key.

Note

This class attribute will not be inherited automatically so that each class can be uniquely identified by its key. Subclass that do not override the value explicitly will get None.

JSON_KEY = 'dl-period'

Name of the JSON key the property will set.

Note

If it needs to be dynamically chose, see json_key.

OPTIMIZE_JSON_KEYS = {'dl-period': {'policy'}}

Configuration driving the JSON optimization, as a dict(str, set(str)).

This is a dictionary mapping JSON key names to set of “barrier” JSON keys. When successive phases of a given task share the same value for the keys of that dictionary, they will be removed in the later phases since rt-app settings are persistent across phases. When any of the barrier key listed in the set has a change in its value, it will be considered as an optimization barrier and the value will be set again, even if it means repeating the same value as earlier.

class lisa.wlgen.rta.DeadlineDeadlineProperty(val)[source]

Bases: _UsecSimpleConcreteProperty

SCHED_DEADLINE scheduler policy’s deadline property.

Parameters:

val (int) – deadline in seconds

KEY = 'dl_deadline'

Subclasses can override this attribute so that PropertyBase.from_key() knows that it can call their _from_key() method for that key.

Note

This class attribute will not be inherited automatically so that each class can be uniquely identified by its key. Subclass that do not override the value explicitly will get None.

JSON_KEY = 'dl-deadline'

Name of the JSON key the property will set.

Note

If it needs to be dynamically chose, see json_key.

OPTIMIZE_JSON_KEYS = {'dl-deadline': {'policy'}}

Configuration driving the JSON optimization, as a dict(str, set(str)).

This is a dictionary mapping JSON key names to set of “barrier” JSON keys. When successive phases of a given task share the same value for the keys of that dictionary, they will be removed in the later phases since rt-app settings are persistent across phases. When any of the barrier key listed in the set has a change in its value, it will be considered as an optimization barrier and the value will be set again, even if it means repeating the same value as earlier.

class lisa.wlgen.rta.CPUProperty(cpus)[source]

Bases: _AndSetConcreteProperty

CPU affinity property.

Parameters:

cpus (set(int) or None) – Set of CPUs the task will be bound to.

KEY = 'cpus'

Subclasses can override this attribute so that PropertyBase.from_key() knows that it can call their _from_key() method for that key.

Note

This class attribute will not be inherited automatically so that each class can be uniquely identified by its key. Subclass that do not override the value explicitly will get None.

JSON_KEY = 'cpus'

Name of the JSON key the property will set.

Note

If it needs to be dynamically chose, see json_key.

OPTIMIZE_JSON_KEYS = {}

Configuration driving the JSON optimization, as a dict(str, set(str)).

This is a dictionary mapping JSON key names to set of “barrier” JSON keys. When successive phases of a given task share the same value for the keys of that dictionary, they will be removed in the later phases since rt-app settings are persistent across phases. When any of the barrier key listed in the set has a change in its value, it will be considered as an optimization barrier and the value will be set again, even if it means repeating the same value as earlier.

class lisa.wlgen.rta.NUMAMembindProperty(nodes)[source]

Bases: _AndSetConcreteProperty

NUMA node membind property.

Parameters:

nodes (set(int) or None) – Set of NUMA nodes the task will be bound to.

KEY = 'numa_nodes_membind'

Subclasses can override this attribute so that PropertyBase.from_key() knows that it can call their _from_key() method for that key.

Note

This class attribute will not be inherited automatically so that each class can be uniquely identified by its key. Subclass that do not override the value explicitly will get None.

JSON_KEY = 'nodes_membind'

Name of the JSON key the property will set.

Note

If it needs to be dynamically chose, see json_key.

OPTIMIZE_JSON_KEYS = {'nodes_membind': {}}

Configuration driving the JSON optimization, as a dict(str, set(str)).

This is a dictionary mapping JSON key names to set of “barrier” JSON keys. When successive phases of a given task share the same value for the keys of that dictionary, they will be removed in the later phases since rt-app settings are persistent across phases. When any of the barrier key listed in the set has a change in its value, it will be considered as an optimization barrier and the value will be set again, even if it means repeating the same value as earlier.

class lisa.wlgen.rta.MultiProperty[source]

Bases: PropertyBase

Base class for properties setting multiple JSON keys at once.

KEY = None

Subclasses can override this attribute so that PropertyBase.from_key() knows that it can call their _from_key() method for that key.

Note

This class attribute will not be inherited automatically so that each class can be uniquely identified by its key. Subclass that do not override the value explicitly will get None.

class lisa.wlgen.rta.MultiConcreteProperty[source]

Bases: MultiProperty, ConcretePropertyBase

DEFAULT_JSON = None
KEY = None

Subclasses can override this attribute so that PropertyBase.from_key() knows that it can call their _from_key() method for that key.

Note

This class attribute will not be inherited automatically so that each class can be uniquely identified by its key. Subclass that do not override the value explicitly will get None.

class lisa.wlgen.rta.ComposableMultiConcretePropertyBase(**kwargs)[source]

Bases: MultiConcreteProperty

Base class for properties that are a collection of values.

Variable keyword arguments:

attributes to set on the instance.

_ATTRIBUTES = {}

Dictionary of allowed attributes where each value is in the format dict(doc=..., type_=...). This extra information is used to patch the docstrings (see __init_subclass__()).

classmethod __init_subclass__(**kwargs)[source]

Update the docstring used as a str.format() template with the following keys:

  • {params}: replaced by the Sphinx-friendly list of attributes

__getattr__(attr)[source]

Lookup the attributes values defined in _ATTRIBUTES.

classmethod _from_key(key, val)[source]

Build an instance out of key and val.

classmethod from_product(**kwargs)[source]

To be called the same way as the class itself, except that all values are expected to be iterables and the class will be called with all combinations, returning a list of instances.

property val

Value “payload” of the property.

Ideally, it should be a valid value that can be given to from_key(), but it’s not mandatory. For complex properties that are not isomorphic to a Python basic type (int, tuple etc.), self should be returned.

__and__(other)[source]

Combine two instances of the same property together.

This is used to combine properties at the various levels of the RTAPhaseTree tree, on each path from the root to the leaves. It is guaranteed that the instance closer to the root will be self and the one closer to the leaves will be other.

If the property is a constraint, a good implementation should combine two instances by applying the strongest constraint. For example, CPU affinity are combined by taking the intersection of allowed CPUs.

If the property is some sort of “dummy” structure, it can make sense to allow the instance closer to the root of the tree to override the set members in the instance closer to the leaves.

Otherwise, it’s probably best to just bail with ValueError with a message explaining that there is a conflict.

_and(other)[source]

Combine together two instances by taking the non-default values for each attribute, and giving priority to self.

KEY = None

Subclasses can override this attribute so that PropertyBase.from_key() knows that it can call their _from_key() method for that key.

Note

This class attribute will not be inherited automatically so that each class can be uniquely identified by its key. Subclass that do not override the value explicitly will get None.

class lisa.wlgen.rta.UclampProperty(**kwargs)[source]

Bases: ComposableMultiConcretePropertyBase

Set util clamp (uclamp) values.

Parameters:
  • min (int or None) – Minimum value that util can take for this task. If None, min clamp is removed.

  • max (int or None) – Maximum value that util can take for this task. If None, max clamp is removed.

KEY = 'uclamp'

Subclasses can override this attribute so that PropertyBase.from_key() knows that it can call their _from_key() method for that key.

Note

This class attribute will not be inherited automatically so that each class can be uniquely identified by its key. Subclass that do not override the value explicitly will get None.

OPTIMIZE_JSON_KEYS = {'util_max': {'policy', 'priority'}, 'util_min': {'policy', 'priority'}}

Configuration driving the JSON optimization, as a dict(str, set(str)).

This is a dictionary mapping JSON key names to set of “barrier” JSON keys. When successive phases of a given task share the same value for the keys of that dictionary, they will be removed in the later phases since rt-app settings are persistent across phases. When any of the barrier key listed in the set has a change in its value, it will be considered as an optimization barrier and the value will be set again, even if it means repeating the same value as earlier.

REQUIRED_KCONFIG_KEYS = ['CONFIG_UCLAMP_TASK']

List of KCONFIG keys that need to be =Y on the target kernel for this property to be usable.

_ATTRIBUTES = {'max_': {'doc': 'Maximum value that util can take for this task. If ``None``, max clamp is removed.', 'type_': <class 'int'>}, 'min_': {'doc': 'Minimum value that util can take for this task. If ``None``, min clamp is removed.', 'type_': <class 'int'>}}

Dictionary of allowed attributes where each value is in the format dict(doc=..., type_=...). This extra information is used to patch the docstrings (see __init_subclass__()).

_and(other)[source]

Combine clamps by taking the most constraining solution.

class lisa.wlgen.rta.WloadPropertyBase[source]

Bases: ConcretePropertyBase

Phase workload.

Workloads are a sequence of rt-app events such as run.

KEY = 'wload'

Subclasses can override this attribute so that PropertyBase.from_key() knows that it can call their _from_key() method for that key.

Note

This class attribute will not be inherited automatically so that each class can be uniquely identified by its key. Subclass that do not override the value explicitly will get None.

JSON_KEY = 'events'
classmethod _from_key(key, val)[source]

Build an instance out of key and val.

property val

Value “payload” of the property.

Ideally, it should be a valid value that can be given to from_key(), but it’s not mandatory. For complex properties that are not isomorphic to a Python basic type (int, tuple etc.), self should be returned.

__add__(other)[source]

Adding two workloads together concatenates them.

Note

Any subclass implementation of __add__ must be associative, i.e. a+(b+c) == (a+b)+c. This property is relied on.

__mul__(n)[source]

Replicate the given workload n times.

abstract to_events(**kwargs)[source]
class lisa.wlgen.rta.WloadSequence(wloads)[source]

Bases: WloadPropertyBase, SimpleConcreteProperty

Sequence of workloads, to be executed one after another.

Note

Adding together two WloadPropertyBase with + operator will give a WloadSequence, so there is usually no need to create one explicitly.

to_events(**kwargs)[source]
KEY = None

Subclasses can override this attribute so that PropertyBase.from_key() knows that it can call their _from_key() method for that key.

Note

This class attribute will not be inherited automatically so that each class can be uniquely identified by its key. Subclass that do not override the value explicitly will get None.

class lisa.wlgen.rta._SingleWloadBase(action=None)[source]

Bases: WloadPropertyBase

Execute a single rt-app event.

__and__()[source]

Combine two instances of the same property together.

This is used to combine properties at the various levels of the RTAPhaseTree tree, on each path from the root to the leaves. It is guaranteed that the instance closer to the root will be self and the one closer to the leaves will be other.

If the property is a constraint, a good implementation should combine two instances by applying the strongest constraint. For example, CPU affinity are combined by taking the intersection of allowed CPUs.

If the property is some sort of “dummy” structure, it can make sense to allow the instance closer to the root of the tree to override the set members in the instance closer to the leaves.

Otherwise, it’s probably best to just bail with ValueError with a message explaining that there is a conflict.

abstract property json_value

Value to pass to JSON.

to_events(**kwargs)[source]
KEY = None

Subclasses can override this attribute so that PropertyBase.from_key() knows that it can call their _from_key() method for that key.

Note

This class attribute will not be inherited automatically so that each class can be uniquely identified by its key. Subclass that do not override the value explicitly will get None.

class lisa.wlgen.rta.DurationWload(duration, **kwargs)[source]

Bases: DurationWload, _SingleWloadBase

KEY = None

Subclasses can override this attribute so that PropertyBase.from_key() knows that it can call their _from_key() method for that key.

Note

This class attribute will not be inherited automatically so that each class can be uniquely identified by its key. Subclass that do not override the value explicitly will get None.

class lisa.wlgen.rta.RunWload(duration, **kwargs)[source]

Bases: DurationWload

Workload for the run event.

Parameters:

duration (float) – Duration of the run in seconds.

KEY = None

Subclasses can override this attribute so that PropertyBase.from_key() knows that it can call their _from_key() method for that key.

Note

This class attribute will not be inherited automatically so that each class can be uniquely identified by its key. Subclass that do not override the value explicitly will get None.

class lisa.wlgen.rta.RunForTimeWload(duration, **kwargs)[source]

Bases: DurationWload

Workload for the runtime event.

Parameters:

duration (float) – Duration of the run in seconds.

KEY = None

Subclasses can override this attribute so that PropertyBase.from_key() knows that it can call their _from_key() method for that key.

Note

This class attribute will not be inherited automatically so that each class can be uniquely identified by its key. Subclass that do not override the value explicitly will get None.

class lisa.wlgen.rta.SleepWload(duration, **kwargs)[source]

Bases: DurationWload

Workload for the sleep event.

Parameters:

duration (float) – Duration of the sleep in seconds.

KEY = None

Subclasses can override this attribute so that PropertyBase.from_key() knows that it can call their _from_key() method for that key.

Note

This class attribute will not be inherited automatically so that each class can be uniquely identified by its key. Subclass that do not override the value explicitly will get None.

class lisa.wlgen.rta.TimerWload(duration, **kwargs)[source]

Bases: DurationWload

Workload for the timer event.

Parameters:

duration (float) – Duration of the timer period in seconds.

property json_value

Value to pass to JSON.

KEY = None

Subclasses can override this attribute so that PropertyBase.from_key() knows that it can call their _from_key() method for that key.

Note

This class attribute will not be inherited automatically so that each class can be uniquely identified by its key. Subclass that do not override the value explicitly will get None.

class lisa.wlgen.rta.BarrierWload(barrier, **kwargs)[source]

Bases: _SingleWloadBase

Workload for the barrier event.

Parameters:

barrier (str) – Name of the barrier

property json_value

Value to pass to JSON.

KEY = None

Subclasses can override this attribute so that PropertyBase.from_key() knows that it can call their _from_key() method for that key.

Note

This class attribute will not be inherited automatically so that each class can be uniquely identified by its key. Subclass that do not override the value explicitly will get None.

class lisa.wlgen.rta.LockWload(lock, action='lock', **kwargs)[source]

Bases: _SingleWloadBase

Workload for the lock and unlock event.

Parameters:
  • lock (str) – Name of the lock

  • action (str) – One of lock or unlock.

property json_value

Value to pass to JSON.

KEY = None

Subclasses can override this attribute so that PropertyBase.from_key() knows that it can call their _from_key() method for that key.

Note

This class attribute will not be inherited automatically so that each class can be uniquely identified by its key. Subclass that do not override the value explicitly will get None.

class lisa.wlgen.rta.YieldWload(action=None)[source]

Bases: _SingleWloadBase

Workload for the yield event.

property json_value

Value to pass to JSON.

KEY = None

Subclasses can override this attribute so that PropertyBase.from_key() knows that it can call their _from_key() method for that key.

Note

This class attribute will not be inherited automatically so that each class can be uniquely identified by its key. Subclass that do not override the value explicitly will get None.

class lisa.wlgen.rta.WaitWload(resource, action='wait', **kwargs)[source]

Bases: _SingleWloadBase

Workload for the wait, signal and broad events.

Parameters:
  • lock (str) – Name of the lock

  • action (str) – One of wait, signal or broad.

property json_value

Value to pass to JSON.

__add__(other)[source]

Combine a signal WaitWload with a wait WaitWload into a sync workload.

KEY = None

Subclasses can override this attribute so that PropertyBase.from_key() knows that it can call their _from_key() method for that key.

Note

This class attribute will not be inherited automatically so that each class can be uniquely identified by its key. Subclass that do not override the value explicitly will get None.

class lisa.wlgen.rta._SizeSingleWload(size, **kwargs)[source]

Bases: _SingleWloadBase

property json_value

Value to pass to JSON.

KEY = None

Subclasses can override this attribute so that PropertyBase.from_key() knows that it can call their _from_key() method for that key.

Note

This class attribute will not be inherited automatically so that each class can be uniquely identified by its key. Subclass that do not override the value explicitly will get None.

class lisa.wlgen.rta.MemWload(size, **kwargs)[source]

Bases: _SizeSingleWload

Workload for the mem event.

Parameters:

size (int) – Size in bytes to be written to the buffer.

KEY = None

Subclasses can override this attribute so that PropertyBase.from_key() knows that it can call their _from_key() method for that key.

Note

This class attribute will not be inherited automatically so that each class can be uniquely identified by its key. Subclass that do not override the value explicitly will get None.

class lisa.wlgen.rta.IOWload(size, **kwargs)[source]

Bases: _SizeSingleWload

Workload for the iorun event.

Parameters:

size (int) – Size in bytes to be written to the file.

KEY = None

Subclasses can override this attribute so that PropertyBase.from_key() knows that it can call their _from_key() method for that key.

Note

This class attribute will not be inherited automatically so that each class can be uniquely identified by its key. Subclass that do not override the value explicitly will get None.

class lisa.wlgen.rta.PeriodicWload(**kwargs)[source]

Bases: WloadPropertyBase, ComposableMultiConcretePropertyBase

Periodic task workload.

The task runs to complete a given amount of work, then sleeps until the end of the period.

Parameters:
  • duty_cycle_pct (float or None) – Duty cycle of the task in percents (when executing on the fastest CPU at max frequency). This is effectively equivalent to an amount of work.

  • period (float or None) – Period of the activation pattern in seconds

  • duration (float or None) – Duration of the workload in seconds.

  • scale_for_cpu (int or None) – CPU ID used to scale the duty_cycle_pct value on asymmetric systems. If None, it will be assumed to be the fastest CPU on the system.

  • scale_for_freq (int or None) – Frequency used to scale duty_cycle_pct in a similar way to scale_for_cpu. This is only valid in conjunction with scale_for_cpu.

  • run_wload (collections.abc.Callable or None) – Workload factory callback used for the running part. It will be called with a single duration parameter (in seconds) and must return a WloadPropertyBase. Note that the passed duration is scaled according to scale_for_cpu and scale_for_freq

  • sleep_wload (collections.abc.Callable or None) – Workload factory callback used for the sleeping part. It will be called with a duration parameter and period parameter (in seconds) and must return a WloadPropertyBase. Note that the passed duration is scaled according to scale_for_cpu and scale_for_freq

  • guaranteed_time (str or None) – Chooses the default ‘sleep_wload’. Can be ‘period’ (guarantee the period is fixed regardless of preemption) or ‘sleep’ (guarantee the time spent sleeping, stretching the period if the task is preempted)

_ATTRIBUTES = {'duration': {'doc': 'Duration of the workload in seconds.', 'type_': <class 'float'>}, 'duty_cycle_pct': {'doc': 'Duty cycle of the task in percents (when executing on the fastest CPU at max frequency). This is effectively equivalent to an amount of work.', 'type_': <class 'float'>}, 'guaranteed_time': {'doc': "Chooses the default 'sleep_wload'. Can be 'period' (guarantee the period is fixed regardless of preemption) or 'sleep' (guarantee the time spent sleeping, stretching the period if the task is preempted)", 'type_': <class 'str'>}, 'period': {'doc': 'Period of the activation pattern in seconds', 'type_': <class 'float'>}, 'run_wload': {'doc': 'Workload factory callback used for the running part. It will be called with a single ``duration`` parameter (in seconds) and must return a :class:`WloadPropertyBase`. Note that the passed duration is scaled according to ``scale_for_cpu`` and ``scale_for_freq``', 'type_': <class 'collections.abc.Callable'>}, 'scale_for_cpu': {'doc': 'CPU ID used to scale the ``duty_cycle_pct`` value on asymmetric systems. If ``None``, it will be assumed to be the fastest CPU on the system.', 'type_': <class 'int'>}, 'scale_for_freq': {'doc': 'Frequency used to scale ``duty_cycle_pct`` in a similar way to ``scale_for_cpu``. This is only valid in conjunction with ``scale_for_cpu``.', 'type_': <class 'int'>}, 'sleep_wload': {'doc': 'Workload factory callback used for the sleeping part. It will be called with a ``duration`` parameter and ``period`` parameter (in seconds) and must return a :class:`WloadPropertyBase`. Note that the passed duration is scaled according to ``scale_for_cpu`` and ``scale_for_freq``', 'type_': <class 'collections.abc.Callable'>}}

Dictionary of allowed attributes where each value is in the format dict(doc=..., type_=...). This extra information is used to patch the docstrings (see __init_subclass__()).

unscaled_duty_cycle_pct(plat_info)[source]
to_events(plat_info)[source]
KEY = None

Subclasses can override this attribute so that PropertyBase.from_key() knows that it can call their _from_key() method for that key.

Note

This class attribute will not be inherited automatically so that each class can be uniquely identified by its key. Subclass that do not override the value explicitly will get None.

class lisa.wlgen.rta.RTAPhaseProperties(properties)[source]

Bases: SimpleHash, Mapping

Hold the properties of an RTAPhaseBase.

Parameters:

properties (list(PropertyBase)) – List of properties.

classmethod from_polymorphic(obj)[source]

Alternative constructor with polymorphic input:

to_json(plat_info, **kwargs)[source]

Output a JSON object with the values of all properties, including defaults if a given property is not set.

classmethod get_defaults(plat_info, properties=None, trim_defaults=True)[source]

Get the default JSON object for the phase with the given user-derived JSON properties.

Parameters:
  • plat_info (lisa.platforms.platinfo.PlatformInfo) – Platform information used to compute some defaults values, such as the default CPU affinity set based on the number of CPUs.

  • properties (dict(str, object)) – JSON object derived from user-provided properties. It is used to compute some context-sensitive defaults, such as the priority that depends on the policy.

  • trim_defaults (bool) – If True, default values that are already set in properties will be omitted.

__and__(other)[source]

Combine two instances.

Properties are merged according to the following rules:

  • Take the value as-is for all the keys that only appear in one of them.

  • For values set in both properties, combine them with & operator. The value coming from self will be the left operand.

property existing_properties

Trim the properties to only contain the “public” ones, i.e. the ones that have not been deleted.

class lisa.wlgen.rta.RTAPhaseBase(properties=None, **kwargs)[source]

Bases: _RTAPhaseBase, SimpleHash, Mapping, ABC

Base class for rt-app phase modelisation.

Parameters:
with_phase_properties(properties)[source]

Return a cloned instance with the properties combined with the given properties using RTAPhaseProperties.__and__() (&). The properties parameter is the left operand. If properties is None, just return the phase itself.

with_properties_map(properties, **kwargs)[source]

Same as with_phase_properties() but with properties passed to RTAPhaseProperties.from_polymorphic() first.

with_props(**kwargs)[source]

Same as with_phase_properties() but using keyword arguments to set each property. The resulting dictionary is passed to RTAPhaseProperties.from_polymorphic() first.

with_delete_props(properties)[source]

Delete all the given property names, equivalent to with_props(foo=delete())`

abstract get_rtapp_repr(*, task_name, plat_info, force_defaults=False, no_force_default_keys=None, **kwargs)[source]

rt-app JSON representation of the phase.

Parameters:
  • task_name (str) – Name of the task this phase will be attached to.

  • plat_info (lisa.platforms.platinfo.PlatformInfo) – Platform information used to compute default properties and validate them.

  • force_defaults (bool) – If True, a default value will be provided for all properties that are not set. If False, the defaults will not be provided if the user-provided properties don’t touch a given JSON key.

  • no_force_default_keys (list(str) or None) – List of JSON keys for which no default will be emitted when force_defaults=True.

Variable keyword arguments:

Forwarded to RTAPhase.to_json()

__add__(other)[source]

Compose two phases together by running one after the other.

Since this operation returns an RTAPhaseTree, it is possible to set properties on it that will only apply to its children.

__mul__(n)[source]

Multiply the phase by n, in order to repeat it.

__getitem__(key)[source]

Lookup the value of the given property on that phase.

static split_prop_kwargs(kwargs, properties=None)[source]

Split the kwargs into two categories:

  • Arguments with a name starting with prop_. They are then merged with the optional properties.

  • The others

Returns a tuple (properties, other_kwargs).

class lisa.wlgen.rta._RTAPhaseTreeBase(properties=None, **kwargs)[source]

Bases: RTAPhaseBase, ABC

Base class for phases laid out as a tree.

abstract topo_sort()[source]

Topological sort of the subtree.

Return type:

list(RTAPhase)

The merge of :class`PhaseProperties` object is done from root to leaf (pre-order traversal). This is important for some classes that are not semigroup like OverridenProperty.

abstract property is_empty

True if the phase has no content and will result in an empty JSON phase(s).

property phases

Topological sort of the phases in the tree, with the properties merged along each path from the root to the leaves.

get_rtapp_repr(task_name, plat_info, force_defaults=False, no_force_default_keys=None, **kwargs)[source]

rt-app JSON representation of the phase.

Parameters:
  • task_name (str) – Name of the task this phase will be attached to.

  • plat_info (lisa.platforms.platinfo.PlatformInfo) – Platform information used to compute default properties and validate them.

  • force_defaults (bool) – If True, a default value will be provided for all properties that are not set. If False, the defaults will not be provided if the user-provided properties don’t touch a given JSON key.

  • no_force_default_keys (list(str) or None) – List of JSON keys for which no default will be emitted when force_defaults=True.

Variable keyword arguments:

Forwarded to RTAPhase.to_json()

class lisa.wlgen.rta.RTAPhase(properties=None, **kwargs)[source]

Bases: _RTAPhaseTreeBase

Leaf in a tree of RTAPhaseTree.

Parameters:
to_json(**kwargs)[source]

JSON content of the properties of the phase.

topo_sort()[source]

Topological sort of the subtree.

Return type:

list(RTAPhase)

The merge of :class`PhaseProperties` object is done from root to leaf (pre-order traversal). This is important for some classes that are not semigroup like OverridenProperty.

property is_empty

True if the phase has no content and will result in an empty JSON phase(s).

class lisa.wlgen.rta.RTAPhaseTreeChildren(children)[source]

Bases: SimpleHash, Mapping

Proxy object used by RTAPhaseTree to store the children list.

It provides a mapping interface where children can be looked up by name if they have one.

Parameters:

children (list(RTAPhaseTree)) – List of the children.

class lisa.wlgen.rta.RTAPhaseTree(properties=None, children=None, **kwargs)[source]

Bases: _RTAPhaseTreeBase

Tree node in an _RTAPhaseTreeBase.

Parameters:
Variable keyword arguments:

Forwarded to base class.

The properties set on this node will be combined of the properties of the children in topo_sort().

property is_empty

True if the phase has no content and will result in an empty JSON phase(s).

property children

Tree levels are transparent and their children expanded directly in their parent, as long as they have no properties on their own that could change the output of topo_sort(). This allows nested RTAPhaseTree to act as if it was just a flat node, which is useful since repeated composition with + operator will give nested binary trees like that.

topo_sort()[source]

Topological sort of the tree, and combine the properties along each path from root to leaves at the same time.

class lisa.wlgen.rta.ParametricPhase(template=None, properties=None, **kwargs)[source]

Bases: RTAPhaseTree

Base class for phases with special behavior beyond their properties.

Parameters:
Variable keyword arguments:

Forwarded to _make_children().

Extra behaviour is enabled by allowing this phase to have multiple children created based on the parameters.

DEFAULT_PHASE_CLS

If no template is passed, an instance of this class will be used as template.

alias of RTAPhase

abstract classmethod _make_children(template, **kwargs)[source]

Create a list of children RTAPhaseBase based on the parameters passed from the constructor.

class lisa.wlgen.rta.SweepPhase(template=None, properties=None, **kwargs)[source]

Bases: ParametricPhase

Parametric phase creating children by setting the property key to values found in values, in order.

Parameters:
classmethod _make_children(template, *, key, values)[source]

Create a list of children RTAPhaseBase based on the parameters passed from the constructor.

class lisa.wlgen.rta.DutyCycleSweepPhase(template=None, properties=None, **kwargs)[source]

Bases: SweepPhase

Sweep on the duty_cycle_pct parameter of a PeriodicWload.

Parameters:
Variable keyword arguments:

Forwarded to lisa.utils.value_range() to generate the duty_cycle_pct values.

classmethod _make_children(template, *, period, duration, duration_of=None, **kwargs)[source]

Create a list of children RTAPhaseBase based on the parameters passed from the constructor.

class lisa.wlgen.rta.Phase(duration_s, period_ms, duty_cycle_pct, cpus=None, barrier_after=None, uclamp_min=None, uclamp_max=None, numa_nodes_membind=None, **kwargs)[source]

Bases: RTAPhase

Descriptor for an rt-app load phase

Parameters:
  • duration_s (float) – the phase duration in [s].

  • period_ms (float) – the phase period in [ms].

  • duty_cycle_pct (float) – the generated load in percents.

  • cpus (list(int) or None) – the CPUs on which task execution is restricted during this phase. If unspecified, that phase will be allowed to run on any CPU, regardless of the affinity of the previous phases.

  • barrier_after (str) – if provided, the name of the barrier to sync against when reaching the end of this phase. Currently only supported when duty_cycle_pct=100

  • uclamp_min (int) – the task uclamp.min value to set for the task for the duration of the phase.

  • uclamp_max (int) – the task uclamp.max value to set for the task for the duration of the phase.

  • numa_nodes_membind (list(int) or None) – the list of NUMA Nodes. Task will only allocate memory from these nodes during this phase. If unspecified, that phase will be allowed to allocate memory from any NUMA node, regardless of the previous phase settings.

class lisa.wlgen.rta.RTATask(delay_s=0, loops=1, sched_policy=None, priority=None, children=None, **kwargs)[source]

Bases: _RTATask

Base class for conveniently constructing params to RTA.from_profile()

Parameters:
  • delay_s (float) – the delay in seconds before starting.

  • loops (int) – Number of times to repeat the described task.

  • sched_policy (str or None) – the scheduler policy for this task. Defaults to SCHED_OTHER, see sched for information on scheduler policies.

  • priority (int or None) – the scheduler priority for this task. See sched for information on scheduler priorities.

This class represents an rt-app task which may contain multiple Phase. It implements __add__ so that using + on two tasks concatenates their phases. For example Ramp() + Periodic() would yield an RTATask that executes the default phases for Ramp followed by the default phases for Periodic.

Attention

Deprecated since version 2.0.

RTATask is deprecated and will be removed in version 4.0, use lisa.wlgen.rta.RTAPhase instead

__init_subclass__()

Update the docstring used as a str.format() template with the following keys:

  • {prop_kwargs}: replaced by the Sphinx-friendly list of “prop_*” keyword arguments

class lisa.wlgen.rta.Ramp(start_pct=0, end_pct=100, delta_pct=10, time_s=1, period_ms=100, delay_s=0, loops=1, sched_policy=None, priority=None, cpus=None, uclamp_min=None, uclamp_max=None, numa_nodes_membind=None, **kwargs)[source]

Bases: _Ramp

Configure a ramp load.

This class defines a task which load is a ramp with a configured number of steps according to the input parameters.

Parameters:
  • start_pct (float) – the initial load percentage.

  • end_pct (float) – the final load percentage.

  • delta_pct (float) – the load increase/decrease at each step, in percentage points.

  • time_s (float) – the duration in seconds of each load step.

  • period_ms (float) – the period used to define the load in [ms].

See also

See RTATask for the documentation of the following parameters:

  • delay_s

  • loops

  • sched_policy

  • priority

See also

See Phase for the documentation of the following parameters:

  • cpus

  • uclamp_min

  • uclamp_max

  • numa_nodes_membind

Attention

Deprecated since version 2.0.

Ramp is deprecated and will be removed in version 4.0, use lisa.wlgen.rta.DutyCycleSweepPhase instead

__init_subclass__()

Update the docstring used as a str.format() template with the following keys:

  • {prop_kwargs}: replaced by the Sphinx-friendly list of “prop_*” keyword arguments

class lisa.wlgen.rta.Step(start_pct=0, end_pct=100, time_s=1, period_ms=100, delay_s=0, loops=1, sched_policy=None, priority=None, cpus=None, uclamp_min=None, uclamp_max=None, numa_nodes_membind=None, **kwargs)[source]

Bases: _Ramp

Configure a step load.

This class defines a task which load is a step with a configured initial and final load. Using the loops param, this can be used to create a workload that alternates between two load values.

Parameters:
  • start_pct (float) – the initial load percentage.

  • end_pct (float) – the final load percentage.

  • time_s (float) – the duration in seconds of each load step.

  • period_ms (float) – the period used to define the load in [ms].

See also

See RTATask for the documentation of the following parameters:

  • delay_s

  • loops

  • sched_policy

  • priority

See also

See Phase for the documentation of the following parameters:

  • cpus

  • uclamp_min

  • uclamp_max

  • numa_nodes_membind

Attention

Deprecated since version 2.0.

Step is deprecated and will be removed in version 4.0, use lisa.wlgen.rta.DutyCycleSweepPhase instead

__init_subclass__()

Update the docstring used as a str.format() template with the following keys:

  • {prop_kwargs}: replaced by the Sphinx-friendly list of “prop_*” keyword arguments

class lisa.wlgen.rta.Pulse(start_pct=100, end_pct=0, time_s=1, period_ms=100, delay_s=0, loops=1, sched_policy=None, priority=None, cpus=None, uclamp_min=None, uclamp_max=None, numa_nodes_membind=None, **kwargs)[source]

Bases: _Pulse

Configure a pulse load.

This class defines a task which load is a pulse with a configured initial and final load.

The main difference with the ‘step’ class is that a pulse workload is by definition a ‘step down’, i.e. the workload switch from an initial load to a final one which is always lower than the initial one. Moreover, a pulse load does not generate a sleep phase in case of 0[%] load, i.e. the task ends as soon as the non null initial load has completed.

Parameters:
  • start_pct (float) – the initial load percentage.

  • end_pct (float) – the final load percentage.

  • time_s (float) – the duration in seconds of each load step.

  • period_ms (float) – the period used to define the load in [ms].

See also

See RTATask for the documentation of the following parameters:

  • delay_s

  • loops

  • sched_policy

  • priority

See also

See Phase for the documentation of the following parameters:

  • cpus

  • uclamp_min

  • uclamp_max

  • numa_nodes_membind

Attention

Deprecated since version 2.0.

Pulse is deprecated and will be removed in version 4.0, use lisa.wlgen.rta.RTAPhase instead

__init_subclass__()

Update the docstring used as a str.format() template with the following keys:

  • {prop_kwargs}: replaced by the Sphinx-friendly list of “prop_*” keyword arguments

class lisa.wlgen.rta.Periodic(duty_cycle_pct=50, duration_s=1, period_ms=100, delay_s=0, sched_policy=None, priority=None, cpus=None, uclamp_min=None, uclamp_max=None, numa_nodes_membind=None, **kwargs)[source]

Bases: _Pulse

Configure a periodic load. This is the simplest type of RTA task.

This class defines a task which load is periodic with a configured period and duty-cycle.

Parameters:
  • duty_cycle_pct (float) – the generated load in percents.

  • duration_s (float) – the phase duration in [s].

  • period_ms (float) – the period used to define the load in [ms].

See also

See RTATask for the documentation of the following parameters:

  • delay_s

  • loops

  • sched_policy

  • priority

See also

See Phase for the documentation of the following parameters:

  • cpus

  • uclamp_min

  • uclamp_max

  • numa_nodes_membind

Attention

Deprecated since version 2.0.

Periodic is deprecated and will be removed in version 4.0, use lisa.wlgen.rta.RTAPhase instead: Replaced by lisa.wlgen.rta.RTAPhase along with lisa.wlgen.rta.PeriodicWload workload

__init_subclass__()

Update the docstring used as a str.format() template with the following keys:

  • {prop_kwargs}: replaced by the Sphinx-friendly list of “prop_*” keyword arguments

class lisa.wlgen.rta.RunAndSync(barrier, time_s=1, delay_s=0, loops=1, sched_policy=None, priority=None, cpus=None, uclamp_min=None, uclamp_max=None, numa_nodes_membind=None, **kwargs)[source]

Bases: _RTATask

Configure a task that runs 100% then waits on a barrier

Parameters:
  • barrier (str) – name of barrier to wait for. Sleeps until any other tasks that refer to this barrier have reached the barrier too.

  • time_s (float) – time to run for in [s]

See also

See RTATask for the documentation of the following parameters:

  • delay_s

  • loops

  • sched_policy

  • priority

See also

See Phase for the documentation of the following parameters:

  • cpus

  • uclamp_min

  • uclamp_max

  • numa_nodes_membind

Attention

Deprecated since version 2.0.

RunAndSync is deprecated and will be removed in version 4.0, use lisa.wlgen.rta.RTAPhase instead: Replaced by lisa.wlgen.rta.RTAPhase along with lisa.wlgen.rta.RunWload and lisa.wlgen.rta.BarrierWload workloads

__init_subclass__()

Update the docstring used as a str.format() template with the following keys:

  • {prop_kwargs}: replaced by the Sphinx-friendly list of “prop_*” keyword arguments

class lisa.wlgen.rta.RTAMonad(f)[source]

Bases: StateDiscard

Monad from derived from lisa.monad.StateDiscard used to define RTAPhaseBase in a more natural way.

If the function returns None, the return value will be replaced by the RTAPhaseBase created while executing the function, with all the currently active properties applied to it.

See also

See the task_factory() decorator to be able to mix these actions with the ones from lisa.fuzz.Gen.

bind(continuation)

Takes a monadic value Monad[A], a function that takes an A and returns Monad[B], and returns a Monad[B].

Note

It is allowed to return a _TailCall instance.

classmethod make_state()[source]

Create a fresh instance of RTAMonad._State

lisa.wlgen.rta.task_factory(f)[source]

Coroutine function decorator allowing to create tasks using actions from both RTAMonad and lisa.fuzz.GenMonad.

Calling the decorated function will result in another callable that can be called once with:

  • seed: Seed to use to automatically initialize a random.Random.

  • rng: Alternatively, an existing instance of random.Random to use.

If the user-defined coroutine function returns None, the return value will be replaced by an RTAPhaseBase representing all the phases that got added while running the function, on which the current active properties set with WithProperties are applied.

See also

lisa.wlgen.rta for an example.

class lisa.wlgen.rta.WithProperties(**kwargs)[source]

Bases: object

Asynchronous context manager used to set properties on the enclosed phases.

Parameters:

Sysbench

Sysbench is a useful workload to get some performance numbers, e.g. to assert that higher frequencies lead to more work done

class lisa.wlgen.sysbench.SysbenchOutput[source]

Bases: str

A wrapper around sysbench’s stdout to more easily access some results

property nr_events

Number of events as reported on the “total number of events” line

property duration_s

Execution duration as reported on the “total time” line

class lisa.wlgen.sysbench.Sysbench(*args, **kwargs)[source]

Bases: Workload

A sysbench workload

Parameters:
  • target (Target) – The Target on which to execute this workload

  • max_duration_s (int) – Maximum duration in seconds

  • max_requests (int) – Maximum number of event requests

  • cli_options (dict(str, object)) – Dictionary of cli_options passed to sysbench command line. Run sysbench --test=<test> help for available parameters. Character _ in option names is replaced by -.

Variable keyword arguments:

Forwarded to lisa.wlgen.workload.Workload

REQUIRED_TOOLS = ['sysbench']

The tools required to execute the workload. See lisa.target.Target.install_tools().