~lttng/babeltrace/trunk

Viewing all changes in revision 4190.

  • Committer: Francis Deslauriers
  • Author(s): Geneviève Bastien
  • Date: 2020-08-06 18:24:48 UTC
  • Revision ID: git-v1:5288c8aef93013b72a48cec6851a00b0c91f09dc
sink.text.pretty: add optional `print-enum-flags` parameter

`print-enum-flags` parameter
============================
This new parameter tells the component to try to print enum values as
ORed bit flags if it applies.

When printing the value of an enum field that has no corresponding mapping,
the value is divided into its bit values and if each bit has a corresponding
mapping, consider that those mappings are ORed bit flags.

If any of the bits has no mapping, then the value is printed as <unknown>.

Example Babeltrace output of such a field (block_rq* kernel events):

  [13:15:49.024354958] (+0.000003868) wilbrod block_rq_complete: { cpu_id = 4 },
      { dev = 8388624, sector = 375490176, nr_sector = 360, error = 0,
        rwbs = ( "RWBS_FLAG_READ" | "RWBS_FLAG_RAHEAD" : container = 12 ) }

This parameter defaults to `false` as it may trigger unexpected behavior
if a trace contains a bit flag that is not described in the metadata as
is, but can be expressed as a binary OR of two existing values.
This can happen if an application changes the possible values of an
enumeration but forgets to update the metadata associated with
that recorded field. Such value must be printed as <unknown>.

Print all labels matching value
===============================
With this commit, a `sink.text.pretty` component will print all matching
labels inside curly brackets separated by commas. See
`print_enum_value_label_array()`.

So if an enum value matches two labels it will be printed as:
  enum_field = ( { "bit0", "range1to3" } : container = 1 )

Change-Id: I26a17307243d5612c70c0e5b04e6b9567b0720d3
Signed-off-by: Geneviève Bastien <gbastien@versatic.net>
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/3045
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: