lisa.trace.TraceDumpTraceParser#

class lisa.trace.TraceDumpTraceParser(*args, **kwargs)[source]#

Bases: TraceParserBase

trace.dat parser shipped by LISA

Attributes

METADATA_KEYS inherited

Possible metadata keys.

Properties

logger inherited

Convenience short-hand for self.get_logger().

Methods

__enter__()

__exit__()

from_dat()

get_metadata()

Return the metadata value.

parse_event()

Parse the given event from the trace and return a pandas.DataFrame with the following columns:.

factory() inherited

Decorator to use on alternative constructors, i.e. classmethods that return instances of the class.

get_all_metadata() inherited

Collect all available metadata.

get_logger() inherited

Provides a logging.Logger named after cls.

get_parser_id() inherited

Get the unique ID of that parser. Any parameter affecting the output dataframes or metadata must be somehow part of that ID, so that the cache is not accidentally hit with stale data.

log_locals() inherited

Debugging aid: log the local variables of the calling function.

parse_all_events() inherited

Parse all available events.

parse_events() inherited

Same as parse_event() but taking a list of events as input, and returning a mapping of event names to pandas.DataFrame for each.

Attributes#

TraceDumpTraceParser.METADATA_KEYS = ['time-range', 'symbols-address', 'cpus-count', 'available-events', 'trace-id']#

Inherited attribute, see lisa.trace.TraceParserBase.METADATA_KEYS

Possible metadata keys.

Properties#

property TraceDumpTraceParser.logger#

Inherited property, see lisa.utils.Loggable.logger

Convenience short-hand for self.get_logger().

Methods#

TraceDumpTraceParser.__enter__()[source]#
TraceDumpTraceParser.__exit__(*args, **kwargs)[source]#
classmethod TraceDumpTraceParser.from_dat(path, events, **kwargs)[source]#
TraceDumpTraceParser.get_metadata(key)[source]#

Return the metadata value.

Parameters:

key (str) –

Name of the metadata. Can be one of:

  • time-range: tuple (start, end) of the timestamps in the trace. This must be the first timestamp to appear in the trace, regardless of what events is being parsed. Otherwise, it would be impossible to use the time range of a parser in the mother TraceBase when requesting specific events.

  • symbols-address: Dictionnary of address (int) to symbol names in the kernel (str) that was used to create the trace. This allows resolving the fields of events that recorded addresses rather than function names.

  • cpus-count: Number of CPUs on the system the trace was collected on.

  • available-events: List of all available events stored in the trace. The list must be exhaustive, not limited to the events that were requested. If an exhaustive list cannot be gathered, this metadata should not be implemented.

  • trace-id: Unique identifier for that trace file used to

    validate the cache. If not available, a checksum will be used.

Raises:

MissingMetadataError if the metadata is not available on that parser.

Note

A given metadata can only be expected to be available if asked for in the constructor, but bear in mind that there is no promise on the availability of any except for the following that must be provided if asked for:

  • time-range

Metadata may still be made available if not asked for, but only if it’s a very cheap byproduct of parsing that incurs no extra cost.

TraceDumpTraceParser.parse_event(event)[source]#

Parse the given event from the trace and return a pandas.DataFrame with the following columns:

  • Time index: floating point absolute timestamp in seconds. The index must not have any duplicated values.

  • One column per event field, with the appropriate dtype.

  • Columns prefixed with __: Header of each event, usually containing the following fields:

    • __cpu: CPU number the event was emitted from

    • __pid: PID of the current process scheduled at the time the event was emitted

    • __comm: Task command name going with __pid at the point the event was emitted

Parameters:

event (str) – name of the event to parse

Raises:

MissingTraceEventError – If the event cannot be parsed.

Note

The caller is free to modify the index of the data, and it must not affect other dataframes.

classmethod TraceDumpTraceParser.factory(f)#

Inherited method, see lisa.utils.PartialInit.factory()

Decorator to use on alternative constructors, i.e. classmethods that return instances of the class.

TraceDumpTraceParser.get_all_metadata()#

Inherited method, see lisa.trace.TraceParserBase.get_all_metadata()

Collect all available metadata.

classmethod TraceDumpTraceParser.get_logger(suffix=None)#

Inherited method, see lisa.utils.Loggable.get_logger()

Provides a logging.Logger named after cls.

TraceDumpTraceParser.get_parser_id()#

Inherited method, see lisa.trace.TraceParserBase.get_parser_id()

Get the unique ID of that parser. Any parameter affecting the output dataframes or metadata must be somehow part of that ID, so that the cache is not accidentally hit with stale data.

classmethod TraceDumpTraceParser.log_locals(var_names=None, level='debug')#

Inherited method, see lisa.utils.Loggable.log_locals()

Debugging aid: log the local variables of the calling function.

TraceDumpTraceParser.parse_all_events()#

Inherited method, see lisa.trace.TraceParserBase.parse_all_events()

Parse all available events.

TraceDumpTraceParser.parse_events(events, best_effort=False, **kwargs)#

Inherited method, see lisa.trace.TraceParserBase.parse_events()

Same as parse_event() but taking a list of events as input, and returning a mapping of event names to pandas.DataFrame for each.