bart.sched.SchedMultiAssert module

A library for asserting scheduler scenarios based on the statistics aggregation framework

class bart.sched.SchedMultiAssert.SchedMultiAssert(ftrace, topology, execnames=None, pids=None)[source]

Bases: object

This is vector assertion class built on top of bart.sched.SchedAssert.SchedAssert

Parameters:
  • ftrace (trappy.ftrace.FTrace) – A single trappy.FTrace object or a path that can be passed to trappy.FTrace
  • topology (trappy.stats.Topology.Topology) – A topology that describes the arrangement of CPU’s on a system. This is useful for multi-cluster systems where data needs to be aggregated at different topological levels
  • execnames

    The execnames of the task to be analysed

    A single execname or a list of execnames can be passed. There can be multiple processes associated with a single execname parameter. The execnames are searched using a prefix match.

  • pids (list, int) – The process IDs of the tasks to be analysed

Consider the following processes which need to be analysed

PID execname
11 task_1
22 task_2
33 task_3

A bart.sched.SchedMultiAssert.SchedMultiAssert instance be created following different ways:

  • Using execname prefix match

    SchedMultiAssert(ftrace, topology, execnames="task_")
    
  • Individual Task names

    SchedMultiAssert(ftrace, topology, execnames=["task_1", "task_2", "task_3"])
    
  • Using Process IDs

    SchedMultiAssert(ftrace, topology, pids=[11, 22, 33])
    

All the functionality provided in bart.sched.SchedAssert.SchedAssert is available in this class with the addition of handling vector assertions.

For example consider the use of getDutyCycle()

>>> s = SchedMultiAssert(ftrace, topology, execnames="task_")
>>> s.getDutyCycle(window=(start, end))
{
    "11": {
        "task_name": "task_1",
        "dutycycle": 10.0
    },
    "22": {
        "task_name": "task_2",
        "dutycycle": 20.0
    },
    "33": {
        "task_name": "task_3",
        "dutycycle": 30.0
    },
}

The assertions can be used in a similar way

>>> import operator as op
>>> s = SchedMultiAssert(ftrace, topology, execnames="task_")
>>> s.assertDutyCycle(15, op.ge, window=(start, end))
{
    "11": {
        "task_name": "task_1",
        "dutycycle": False
    },
    "22": {
        "task_name": "task_2",
        "dutycycle": True
    },
    "33": {
        "task_name": "task_3",
        "dutycycle": True
    },
}

The above result can be coalesced using a rank parameter As we know that only 2 processes have duty cycles greater than 15% we can do the following:

>>> import operator as op
>>> s = SchedMultiAssert(ftrace, topology, execnames="task_")
>>> s.assertDutyCycle(15, op.ge, window=(start, end), rank=2)
True

See bart.sched.SchedAssert.SchedAssert for the available functionality

generate_events(level, window=None)[source]

Generate Events for the trace plot

Note

This is an internal function for plotting data

getCPUBusyTime(level, node, window=None, percent=False)[source]

Get the amount of time the cpus in the system were busy executing the tasks

Parameters:
  • level (string) – The topological level to which the group belongs
  • node (list) – The group of CPUs for which to calculate busy time
  • window – A (start, end) tuple to limit the scope of the

calculation. :type window: tuple

Parameters:percent – If True the result is normalized to the total

time of the period, either the window or the full lenght of the trace. :type percent: bool

\[R = \frac{T_{busy} \times 100}{T_{total}}\]
get_task_name(pid)[source]

Get task name for the PID

plot(level='cpu', window=None, xlim=None)[source]
Returns:trappy.plotter.AbstractDataPlotter instance Call view() to draw the graph