[PATCH v6 0/2] JSON output for perf stat

Ian Rogers posted 2 patches 3 years, 9 months ago
There is a newer version of this series
tools/perf/Documentation/perf-stat.txt        |  21 +
tools/perf/builtin-stat.c                     |   6 +
.../tests/shell/lib/perf_json_output_lint.py  |  95 +++++
tools/perf/tests/shell/stat+json_output.sh    | 147 +++++++
tools/perf/util/stat-display.c                | 384 +++++++++++++-----
tools/perf/util/stat.c                        |   1 +
tools/perf/util/stat.h                        |   2 +
7 files changed, 550 insertions(+), 106 deletions(-)
create mode 100644 tools/perf/tests/shell/lib/perf_json_output_lint.py
create mode 100755 tools/perf/tests/shell/stat+json_output.sh
[PATCH v6 0/2] JSON output for perf stat
Posted by Ian Rogers 3 years, 9 months ago
Parsing the CSV or text output of perf stat can be problematic when
new output is added (columns in CSV format). JSON names values and
simplifies the job of parsing. Add a JSON output option to perf-stat
then add unit test that parses and validates the output.

This is a resend of two v2 patches:
https://lore.kernel.org/lkml/20210813220754.2104922-1-cjense@google.com/
https://lore.kernel.org/lkml/20210813220936.2105426-1-cjense@google.com/
with a few formatting changes and improvements to the linter.

v6. Is a rebase.

v5. Drops the merged CSV check, fixes a json test issue found by
    Arnaldo and a typo.

v4. Does some minor fixes to the json linter.

v3. There is some tidy up of CSV code including a potential memory
    over run in the os.nfields set up caught by sanitizers. To
    facilitate this an AGGR_MAX value is added. v3 also adds the CSV
    testing.

v2. Fixes the system wide no aggregation test to not run if the
    paranoia is wrong. It also makes the counter-value check handle
    the "<not counted>" and "<not supported>" cases.

Claire Jensen (2):
  perf stat: Add JSON output option
  perf test: Json format checking

 tools/perf/Documentation/perf-stat.txt        |  21 +
 tools/perf/builtin-stat.c                     |   6 +
 .../tests/shell/lib/perf_json_output_lint.py  |  95 +++++
 tools/perf/tests/shell/stat+json_output.sh    | 147 +++++++
 tools/perf/util/stat-display.c                | 384 +++++++++++++-----
 tools/perf/util/stat.c                        |   1 +
 tools/perf/util/stat.h                        |   2 +
 7 files changed, 550 insertions(+), 106 deletions(-)
 create mode 100644 tools/perf/tests/shell/lib/perf_json_output_lint.py
 create mode 100755 tools/perf/tests/shell/stat+json_output.sh

-- 
2.37.0.rc0.161.g10f37bed90-goog