]> www.infradead.org Git - users/jedix/linux-maple.git/commit
perf test: Add --metric-only to perf stat output tests
authorNamhyung Kim <namhyung@kernel.org>
Tue, 4 Mar 2025 02:28:32 +0000 (18:28 -0800)
committerNamhyung Kim <namhyung@kernel.org>
Wed, 5 Mar 2025 17:17:01 +0000 (09:17 -0800)
commit45a86d017adf4d6ccb86828865622b54f204e52c
tree118a1b1e767456dfaca44f73ee120f797f1b97da
parent2cc2f258a9698078b285793e02b7296fa0f1f47d
perf test: Add --metric-only to perf stat output tests

Add a test case for --metric-only for std, csv, json output mode using
shadow IPC metric from instructions and cycles events.  It should
produce 'insn per cycle' metric.

But currently JSON output has (none) 'GHz' as well.  It looks like a bug
but I don't have enough time to debug it for now so I made it pass. :(

  $ perf stat --metric-only -e instructions,cycles true

   Performance counter stats for 'true':

                    0.56

         0.002127319 seconds time elapsed

         0.002077000 seconds user
         0.000000000 seconds sys

  $ perf stat -x, --metric-only -e instructions,cycles true

  0.55,,

  $ perf stat -j --metric-only -e instructions,cycles true
  {"insn per cycle" : "0.53", "GHz" : "none"}

  $ perf test output -v
    5: Test data source output                                         : Ok
   31: Sort output of hist entries                                     : Ok
   88: perf stat CSV output linter                                     : Ok
   90: perf stat JSON output linter                                    : Ok
   92: perf stat STD output linter                                     : Ok

Tested-by: Thomas Falcon <thomas.falcon@intel.com>
Link: https://lore.kernel.org/r/20250304022837.1877845-2-namhyung@kernel.org
Suggested-by: Ian Rogers <irogers@google.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/perf/tests/shell/lib/perf_json_output_lint.py
tools/perf/tests/shell/lib/stat_output.sh
tools/perf/tests/shell/stat+csv_output.sh
tools/perf/tests/shell/stat+json_output.sh
tools/perf/tests/shell/stat+std_output.sh