trappy.bare_trace module

class trappy.bare_trace.BareTrace(name='')[source]

Bases: object

A wrapper class that holds dataframes for all the events in a trace.

BareTrace doesn’t parse any file so it’s a class that should either be (a) subclassed to parse a particular trace (like FTrace) or (b) be instantiated and the events added with add_parsed_event()

Parameters:name (str) – is a string describing the trace.
add_parsed_event(name, dfr, pivot=None)[source]

Add a dataframe to the events in this trace

This function lets you add other events that have been parsed by other tools to the collection of events in this instance. For example, assuming you have some events in a csv, you could add them to a trace instance like this:

>>> trace = trappy.BareTrace()
>>> counters_dfr = pd.DataFrame.from_csv("counters.csv")
>>> trace.add_parsed_event("pmu_counters", counters_dfr)

Now you can access trace.pmu_counters as you would with any other trace event and other trappy classes can interact with them.

Parameters:
  • name (str) – The attribute name in this trace instance. As in the example above, if name is “pmu_counters”, the parsed event will be accessible using trace.pmu_counters.
  • dfr (pandas.DataFrame) – pandas.DataFrame containing the events. Its index should be time in seconds. Its columns are the events.
  • pivot (str) – The data column about which the data can be grouped
finalize_objects()[source]
get_duration()[source]

Returns the largest time value of all classes, returns 0 if the data frames of all classes are empty

get_filters(key='')[source]

Returns an array with the available filters.

Parameters:key – If specified, returns a subset of the available filters that contain ‘key’ in their name (e.g., key="sched" returns only the "sched" related filters).
normalize_time(basetime=None)[source]

Normalize the time of all the trace classes

Parameters:basetime (float) – The offset which needs to be subtracted from the time index