lisa.trace.SysTraceParser#

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

Bases: HRTxtTraceParser

Parse Google’s systrace format.

Note

This parser is based on HRTxtTraceParser and is therefore provided for convenience but may lack some events custom field regex.

Attributes

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.

EVENT_DESCS inherited

Mapping of event names to parser description as a dict.

HEADER_FIELDS inherited

Pandas dtype of the header fields.

HEADER_REGEX inherited

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

METADATA_KEYS inherited

Possible metadata keys.

Properties

logger inherited

Convenience short-hand for self.get_logger().

Methods

from_html()

Build an instance from a path to a text file.

__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#

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

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

SysTraceParser.EVENT_DESCS = {'sched_switch': {'fields': {'next_comm': 'string', 'next_pid': 'uint32', 'next_prio': 'int16', 'prev_comm': 'string', 'prev_pid': 'uint32', 'prev_prio': 'int16', 'prev_state': 'string'}, 'fields_regex': 'prev_comm=(?P<prev_comm>.+?) +prev_pid=(?P<prev_pid>\\d+) +prev_prio=(?P<prev_prio>\\d+) +prev_state=(?P<prev_state>[^ ]+) ==> next_comm=(?P<next_comm>.+?) +next_pid=(?P<next_pid>\\d+) +next_prio=(?P<next_prio>\\d+)'}, 'tracing_mark_write': {'fields': {'buf': 'bytes'}, 'positional_field': 'buf'}}#

Inherited attribute, see lisa.trace.HRTxtTraceParser.EVENT_DESCS

Mapping of event names to parser description as a dict.

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

SysTraceParser.HEADER_REGEX = '\\s*(?P<__comm>.+)-(?P<__pid>\\d+)[^[]*\\[(?P<__cpu>\\d*)\\][^\\d]+(?P<__timestamp>\\d+\\.\\d+): +(?P<__event>\\w+):'#

Inherited attribute, see lisa.trace.HRTxtTraceParser.HEADER_REGEX

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

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

Inherited property, see lisa.utils.Loggable.logger

Convenience short-hand for self.get_logger().

Methods#

classmethod SysTraceParser.from_html(path, *, events=None, needed_metadata=None, event_parsers=None, default_event_parser_cls=None, pre_filled_metadata=None, temp_dir)[source]#

Build an instance from a path to a text file.

Variable keyword arguments:

Forwarded to __init__

SysTraceParser.__enter__()#

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

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

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

classmethod SysTraceParser.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 SysTraceParser.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 SysTraceParser.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.

SysTraceParser.get_all_metadata()#

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

Collect all available metadata.

classmethod SysTraceParser.get_logger(suffix=None)#

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

Provides a logging.Logger named after cls.

SysTraceParser.get_metadata(key)#

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

Return the metadata value.

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

SysTraceParser.parse_all_events()#

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

Parse all available events.

SysTraceParser.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:.

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