lisa.trace.SysTraceParser#
- class lisa.trace.SysTraceParser(*args, **kwargs)[source]#
Bases:
HRTxtTraceParserParse Google’s systrace format.
Note
This parser is based on
HRTxtTraceParserand is therefore provided for convenience but may lack some events custom field regex.Attributes
DEFAULT_EVENT_PARSER_CLSinheritedClass used to create event parsers when inferred from the trace.
DTYPE_INFERENCE_ORDERinheritedWhen 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_DESCSinheritedMapping of event names to parser description as a dict.
HEADER_FIELDSinheritedPandas dtype of the header fields.
HEADER_REGEXinheritedDefault regex to use to parse event header. It must parse the following groups:.
METADATA_KEYSinheritedPossible metadata keys.
Properties
loggerinheritedConvenience short-hand for
self.get_logger().Methods
Build an instance from a path to a text file.
__enter__()inherited__exit__()inheritedfactory()inheritedDecorator to use on alternative constructors, i.e. classmethods that return instances of the class.
from_string()inheritedBuild an instance from a single multiline string.
from_txt_file()inheritedBuild an instance from a path to a text file.
get_all_metadata()inheritedCollect all available metadata.
get_logger()inheritedProvides a
logging.Loggernamed aftercls.get_metadata()inheritedReturn the metadata value.
get_parser_id()inheritedGet 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()inheritedDebugging aid: log the local variables of the calling function.
parse_all_events()inheritedParse all available events.
parse_event()inheritedParse the given event from the trace and return a
pandas.DataFramewith the following columns:.parse_events()inheritedSame as
parse_event()but taking a list of events as input, and returning a mapping of event names topandas.DataFramefor each.
Attributes#
- SysTraceParser.DEFAULT_EVENT_PARSER_CLS = None#
Inherited attribute, see
lisa.trace.TxtTraceParserBase.DEFAULT_EVENT_PARSER_CLSClass 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_ORDERWhen 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_DESCSMapping 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_FIELDSPandas 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_REGEXDefault 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_KEYSPossible metadata keys.
Properties#
- property SysTraceParser.logger#
Inherited property, see
lisa.utils.Loggable.loggerConvenience 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.Loggernamed aftercls.
- 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.DataFramewith 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 topandas.DataFramefor each.