In [3]:
import sys,os
import tempfile
import shutil
import trappy
In [ ]:
run1 = trappy.Run("path_to_trace")

Interactive Line Plotting

Interactive Line Plots Supports the same API as the LinePlot but provide an interative plot that can be zoomed by clicking and dragging on the desired area. Double clicking resets the zoom.

In [8]:
        l = trappy.ILinePlot(
            run1,                                            # TRAPpy run Object
            trappy.cpu_power.CpuInPower,                     # TRAPpy Event (maps to a unique word in the Trace)
            column=[                                         # Column(s)
                "dynamic_power",
                "load1"],
            
            filters={                                        # Filter the data  
                "cdev_state": [
                    1,
                    0]},
            pivot="cpus",                                    # One plot for each pivot will be created
        
            per_line=1)                                      # Number of graphs per line
        l.view()

You can also change the drawstyle to "steps-post" for step plots. These are suited if the data is discrete and linear interploation is not required between two data points

In [11]:
        l = trappy.ILinePlot(
            run1,                                            # TRAPpy run Object
            trappy.cpu_power.CpuInPower,                     # TRAPpy Event (maps to a unique word in the Trace)
            column=[                                         # Column(s)
                "dynamic_power",
                "load1"],
            
            filters={                                        # Filter the data  
                "cdev_state": [
                    1,
                    0]},
            pivot="cpus",                                    # One plot for each pivot will be created
        
            per_line=1,                                      # Number of graphs per line
            drawstyle="steps-post")                                     
        l.view()

EventPlot

TRAPpy's Interactive Plotter features an Interactive Event TimeLine Plot. It accepts an input data of the type


                   { "A" : [
                                    [event_start, event_end, lane],
                                    .
                                    .
                                    [event_start, event_end, lane],
                                 ],
                     .
                     .
                     .

                     "B" : [
                                    [event_start, event_end, lane],
                                    .
                                    .
                                    [event_start, event_end, lane],
                    .
                    .
                    .
                   }


Hovering on the rectangles gives the name of the process element and scrolling on the Plot Area and the window in the summary controls the zoom. One can also click and drag for panning a zoomed graph.

For Example:

In [20]:
A = [
    
        [0, 3, 0],
        [4, 5, 2],
]

B = [
        [0, 2, 1],
        [2, 3, 3],
        [3, 4, 0],
]

C =  [
        [0, 2, 3],
        [2, 3, 2],
        [3, 4, 1],
]

EVENTS = {}
EVENTS["A"] = A
EVENTS["B"] = B
EVENTS["C"] = C

trappy.EventPlot(EVENTS,
                 keys=EVENTS.keys,                     # Name of the Process Element
                 lane_prefix="LANE: ",                 # Name of Each TimeLine
                 num_lanes=4,                          # Number of Timelines
                 domain=[0,5]                          # Time Domain
                ).view()

TracePlot

A specification of the EventPlot creates a kernelshark like plot if the sched_switch event is enabled in the traces

In [22]:
trappy.plotter.plot_trace("path_to_trace")