What is TRAPpy?
TRAPpy is a framework written in python for analysing and plotting FTrace data by converting it into standardised PANDAS DataFrames (tabular times series data representation). The goal is to allow developers easy and systematic access to FTrace data and leverage the flexibility of PANDAS for the analysis.
Trace Events and FTrace Objects
An event maps an FTrace event to a single DataFrame in the FTrace object. One can also create events based on custom trace_printks from within the kernel.
Creating an FTrace object
ftrace = trappy.FTrace("path/to/trace/file")
Registering an Event with TRAPpy
Consider the following trace_printk from within the kernel.
trace_printk("my_custom_event: key1=%s key2=%d", value_1, value_2);
Which produces the following trace output:
kworker/6:1-459  2806.211584: my_custom_event: key1=some_string key2=10
This event can then be registered in TRAPpy as follows:
And will be available in the ftrace object as follows:
TRAPpy's plotter provides an interface to create plots which can span multiple runs, events, columns. It also provides pivoting and filtering capabilities. Here is the general structure the plotter:
Some examples of plots created by TRAPpy:
The interactive line plots use dygraphs.
Click and Drag to Zoom. Double Click to reset
The event plot can be used for the creation of a timeline for multiple event's that follow a start-stop semantic. TRAPpy provides a rudimentary kernelshark like plot of the trace as follows:
Scroll on the Plot area to Zoom. Click and Drag to Pan Zoom
For more detailed information on how to use plotter you can read the documentation notebook here
The statistic framework is an API designed to aggregate and operate on data. Stats provides a simple grammar which uses the event and underlying data.
BART is an opensource framework which uses the TRAPpy's stats module to provide behavioural assertions for the Linux scheduler and also some example usages for the Linux thermal framework.