trappy.plotter.EventPlot module

The EventPlot is used to represent Events with two characteristics:

  • A name, which determines the colour on the plot
  • A lane, which determines the lane in which the event occurred

In the case of a cpu residency plot, the term lane can be equated to a CPU and the name attribute can be the PID of the task

class trappy.plotter.EventPlot.EventPlot(data, keys, domain, lane_prefix='Lane: ', num_lanes=0, summary=True, stride=False, lanes=None, color_map=None)[source]

Bases: trappy.plotter.AbstractDataPlotter.AbstractDataPlotter

Input Data should be of the format

{ "<name1>" : [
                 [event_start, event_end, lane],
                  .
                  .
                 [event_start, event_end, lane],
              ],
 .
 .
 .

 "<nameN>" : [
                [event_start, event_end, lane],
                 .
                 .
                [event_start, event_end, lane],
             ],
}
Parameters:
  • data (dict) – Input Data
  • keys (list) – List of unique names in the data dictionary
  • domain (tuple) – Domain of the event data
  • lane_prefix (str) – A string prefix to be used to name each lane
  • num_lanes (int) – Total number of expected lanes
  • summary (bool) – Show a mini plot below the main plot with an overview of where your current view is with respect to the whole trace
  • stride (bool) – Stride can be used if the trace is very large. It results in sampled rendering
  • lanes (list) – The sorted order of lanes
  • color_map (dict) –

    A mapping between events and colours

    { "<name1>" : "colour1",
      .
      .
      .
      "<nameN>" : "colourN"
    }
    

    Colour string can be:

    • Colour names (supported colours are listed in

    https://www.w3.org/TR/SVG/types.html#ColorKeywords)

    • HEX representation of colour, like #FF0000 for “red”, #008000 for

    “green”, #0000FF for “blue” and so on

html()[source]

Return a Raw HTML string for the plot

savefig(path)[source]

Save the plot in the provided path

Warning

Not Implemented for trappy.plotter.EventPlot

view()[source]

Views the Graph Object