lisa.trace.CustomFieldsTxtEventParser#

class lisa.trace.CustomFieldsTxtEventParser(event, fields_regex, fields, raw)[source]#

Bases: TxtEventParser

Subclass of TxtEventParser to be used for funky formats.

When the format of the textual event does not respect at all the raw trace-cmd format, and if raw format cannot be used (e.g. because of const char* fields), this class provides a way out. For example, this event can be parsed with this class, but would be impossible to be parse using TxtEventParser:

# non-raw format lacks a field delimiter for the "reason"
kworker/u16:6-262   [003]   177.417147: ipi_raise:            target_mask=00000000,00000020 (Function call interrupts)
# raw format, even less usable because of the const char* pointer not being resolved
kworker/u16:6-262   [003]   177.417147: ipi_raise:             target_cpus=ARRAY[20, 00, 00, 00, 00, 00, 00, 00] reason=0xffffff8c0774fe6b

Note

Use TxtEventParser if possible, since it provides a more optimized fields regex than what you are likely to come up with, and can deal with missing fields.

Parameters:
  • event (str) – Name of the event.

  • fields_regex (str) – Regex to parse the fields part of the event occurence. Regex groups are used to delimit fields, e.g. r"field1=(?P<field1>[0-9]+)" would recognize "field1=42" as a field1 column.

  • fields (dict(str, object)) – Mapping of field names (group names in the regex) to dtype to use in the pandas.DataFrame. This is passed to lisa.datautils.series_convert() so the accepted values are a bit wider than pandas dtypes.

  • raw (bool) – If True, the event will be parsed as raw by trace-cmd. If you have const char* fields, this must be False in order to get the string instead of the pointer.

Attributes

PARSER_REGEX_TERMINALS inherited

Snippets of regex to be used in building more complex regexes in textual trace parsers.

Properties

bytes_regex inherited

Same as regex but acting on bytes instead of str.

Attributes#

CustomFieldsTxtEventParser.PARSER_REGEX_TERMINALS = {'blank': ' +', 'floating': '\\d+\\.\\d+', 'identifier': '\\w+', 'integer': '\\d+'}#

Inherited attribute, see lisa.trace.EventParserBase.PARSER_REGEX_TERMINALS

Snippets of regex to be used in building more complex regexes in textual trace parsers.

Properties#

property CustomFieldsTxtEventParser.bytes_regex#

Inherited property, see lisa.trace.TxtEventParser.bytes_regex

Same as regex but acting on bytes instead of str.