lisa.trace.SimpleTxtTraceParser#

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

Bases: TxtTraceParserBase

Simple text trace parser (base) class.

Parameters:

Note

This class is easier to customize than TxtTraceParser but may have higher processing time and peak memory usage.

Attributes

EVENT_DESCS

Mapping of event names to parser description as a dict.

HEADER_REGEX

Default regex to use to parse event header. It must parse the following groups:.

DEFAULT_EVENT_PARSER_CLS inherited

Class used to create event parsers when inferred from the trace.

DTYPE_INFERENCE_ORDER inherited

When the dtype of a field is not provided by a user-defined parser, these dtypes will be tried in order to convert the column from string to something more appropriate.

HEADER_FIELDS inherited

Pandas dtype of the header fields.

METADATA_KEYS inherited

Possible metadata keys.

Properties

logger inherited

Convenience short-hand for self.get_logger().

Methods

__enter__() inherited

__exit__() inherited

factory() inherited

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

from_string() inherited

Build an instance from a single multiline string.

from_txt_file() inherited

Build an instance from a path to a text file.

get_all_metadata() inherited

Collect all available metadata.

get_logger() inherited

Provides a logging.Logger named after cls.

get_metadata() inherited

Return the metadata value.

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_event() inherited

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

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#

SimpleTxtTraceParser.EVENT_DESCS = {}#

Mapping of event names to parser description as a dict.

Each event description can include the following dict keys:

  • header_regex: Regex to parse the event header. If not set, the header regex from the trace parser will be used.

  • fields_regex: Regex to parse the fields part of the event (i.e. the part after the header). This is the most commonly modified setting to take into account special cases in event formatting.

  • fields: Mapping of field names to pandas.DataFrame column dtype. This allows using a smaller dtype or the use of a non-inferred dtype like boolean.

  • positional_field: Name of the positional field (comming before the named fields). If None, the column will be suppressed in the parsed dataframe.

SimpleTxtTraceParser.HEADER_REGEX = None#

Default regex to use to parse event header. It must parse the following groups:

  • __timestamp: the timestamp of the event

  • __event: the name of the event

  • __cpu (optional): the CPU by which the event was emitted

  • __pid (optional): the currently scheduled PID at the point the event was emitted

  • __comm (optional): the currently scheduled task’s name at the point the event was emitted

Note

It must not capture the event fields, as it will be concatenated with the field regex of each event to parse full lines.

SimpleTxtTraceParser.DEFAULT_EVENT_PARSER_CLS = None#

Inherited attribute, see lisa.trace.TxtTraceParserBase.DEFAULT_EVENT_PARSER_CLS

Class used to create event parsers when inferred from the trace.

SimpleTxtTraceParser.DTYPE_INFERENCE_ORDER = ['int64', 'uint64', 'float64']#

Inherited attribute, see lisa.trace.TxtTraceParserBase.DTYPE_INFERENCE_ORDER

When the dtype of a field is not provided by a user-defined parser, these dtypes will be tried in order to convert the column from string to something more appropriate.

SimpleTxtTraceParser.HEADER_FIELDS = {'__comm': 'string', '__cpu': 'uint32', '__event': 'string', '__pid': 'uint32', '__timestamp': 'float64'}#

Inherited attribute, see lisa.trace.TxtTraceParserBase.HEADER_FIELDS

Pandas dtype of the header fields.

SimpleTxtTraceParser.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 SimpleTxtTraceParser.logger#

Inherited property, see lisa.utils.Loggable.logger

Convenience short-hand for self.get_logger().

Methods#

SimpleTxtTraceParser.__enter__()#

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

SimpleTxtTraceParser.__exit__(*args, **kwargs)#

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

classmethod SimpleTxtTraceParser.factory(f)#

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

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

classmethod SimpleTxtTraceParser.from_string(txt, path=None, *, events=None, needed_metadata=None, event_parsers=None, default_event_parser_cls=None, pre_filled_metadata=None, temp_dir)#

Inherited method, see lisa.trace.TxtTraceParserBase.from_string()

Build an instance from a single multiline string.

classmethod SimpleTxtTraceParser.from_txt_file(path, *, events=None, needed_metadata=None, event_parsers=None, default_event_parser_cls=None, pre_filled_metadata=None, temp_dir)#

Inherited method, see lisa.trace.TxtTraceParserBase.from_txt_file()

Build an instance from a path to a text file.

SimpleTxtTraceParser.get_all_metadata()#

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

Collect all available metadata.

classmethod SimpleTxtTraceParser.get_logger(suffix=None)#

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

Provides a logging.Logger named after cls.

SimpleTxtTraceParser.get_metadata(key)#

Inherited method, see lisa.trace.TxtTraceParserBase.get_metadata()

Return the metadata value.

SimpleTxtTraceParser.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 SimpleTxtTraceParser.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.

SimpleTxtTraceParser.parse_all_events()#

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

Parse all available events.

SimpleTxtTraceParser.parse_event(event)#

Inherited method, see lisa.trace.TxtTraceParserBase.parse_event()

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

SimpleTxtTraceParser.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.