Kernel trace analysis#

Introduction#

LISA comes with a plethora of analysis functions based on Ftrace traces. We convert the trace events into dataframes (polars.LazyFrame and pandas.DataFrame are currently supported).

Trace#

Our Trace takes an Ftrace trace.dat file as input (other text-based formats are also accepted, but mileage may vary since they are ambiguous), and provides access to both the raw trace events, as well as some dataframes (polars.LazyFrame and pandas.DataFrame) built from analysing and aggregating trace events.

You can create one like so:

trace = Trace("path/to/trace.dat")

Raw trace events can be accessed like this:

trace.df_event("sched_switch")

Whereas analysis dataframes can be obtained like that:

# trace.ana.<analysis name>.<analysis method>
trace.ana.tasks.df_tasks_states()

Switching to polars can be done with:

trace = Trace("path/to/trace.dat", df_fmt='polars-lazyframe')

Or from an existing Trace object:

trace = Trace("path/to/trace.dat")
trace = trace.get_view(df_fmt='polars-lazyframe')

Then all the dataframe APIs will return polars.LazyFrame instances instead of pandas.DataFrame.

Here are the main entry points in the trace analysis APIs:

Available analysis#

Dataframes#

The majority of these dataframes are time-indexed (and if they aren’t, it will be called out in the docstring). This makes it easy to create dataframe slices to study specific trace windows.