From: Ian Rogers <irogers@google.com>
To: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>, Jiri Olsa <jolsa@kernel.org>,
Ian Rogers <irogers@google.com>,
Adrian Hunter <adrian.hunter@intel.com>,
James Clark <james.clark@linaro.org>,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org
Subject: [RFC PATCH v1 11/14] perf stat: Extend JSON output linter to test core aggregation checks
Date: Fri, 22 May 2026 15:33:39 -0700 [thread overview]
Message-ID: <20260522223342.2393553-12-irogers@google.com> (raw)
In-Reply-To: <20260522223342.2393553-1-irogers@google.com>
This patch extends tools/perf/tests/shell/stat+json_output.sh to run
all basic and standard CPU/thread aggregation checks under the --new
JSON print flag:
- check_no_args
- check_system_wide
- check_interval
- check_event
- check_per_thread
- check_per_node
- check_system_wide_no_aggr
- check_per_core
- check_per_socket
- check_per_die
This guarantees that JSON outputs produced by the decoupled, zero-allocation,
and streaming print callbacks are formally validated across standard and interval modes.
Signed-off-by: Ian Rogers <irogers@google.com>
TAG=agy
CONV=7c33d6a0-70a2-454a-82f7-4de2101a5b9c
---
tools/perf/tests/shell/stat+json_output.sh | 43 +++++++++++++++-------
1 file changed, 30 insertions(+), 13 deletions(-)
diff --git a/tools/perf/tests/shell/stat+json_output.sh b/tools/perf/tests/shell/stat+json_output.sh
index 85d1ad7186c6..d35098aae093 100755
--- a/tools/perf/tests/shell/stat+json_output.sh
+++ b/tools/perf/tests/shell/stat+json_output.sh
@@ -13,6 +13,7 @@ shelldir=$(dirname "$0")
. "${shelldir}"/lib/setup_python.sh
pythonchecker=$(dirname $0)/lib/perf_json_output_lint.py
+perf_new_opt=""
stat_output=$(mktemp /tmp/__perf_test.stat_output.json.XXXXX)
cleanup() {
@@ -36,7 +37,7 @@ function ParanoidAndNotRoot()
check_no_args()
{
echo -n "Checking json output: no args "
- perf stat -j -o "${stat_output}" true
+ perf stat -j $perf_new_opt -o "${stat_output}" true
$PYTHON $pythonchecker --no-args --file "${stat_output}"
echo "[Success]"
}
@@ -49,7 +50,7 @@ check_system_wide()
echo "[Skip] paranoia and not root"
return
fi
- perf stat -j -a -o "${stat_output}" true
+ perf stat -j $perf_new_opt -a -o "${stat_output}" true
$PYTHON $pythonchecker --system-wide --file "${stat_output}"
echo "[Success]"
}
@@ -62,7 +63,7 @@ check_system_wide_no_aggr()
echo "[Skip] paranoia and not root"
return
fi
- perf stat -j -A -a --no-merge -o "${stat_output}" true
+ perf stat -j $perf_new_opt -A -a --no-merge -o "${stat_output}" true
$PYTHON $pythonchecker --system-wide-no-aggr --file "${stat_output}"
echo "[Success]"
}
@@ -70,7 +71,7 @@ check_system_wide_no_aggr()
check_interval()
{
echo -n "Checking json output: interval "
- perf stat -j -I 1000 -o "${stat_output}" true
+ perf stat -j $perf_new_opt -I 1000 -o "${stat_output}" true
$PYTHON $pythonchecker --interval --file "${stat_output}"
echo "[Success]"
}
@@ -79,7 +80,7 @@ check_interval()
check_event()
{
echo -n "Checking json output: event "
- perf stat -j -e cpu-clock -o "${stat_output}" true
+ perf stat -j $perf_new_opt -e cpu-clock -o "${stat_output}" true
$PYTHON $pythonchecker --event --file "${stat_output}"
echo "[Success]"
}
@@ -92,7 +93,7 @@ check_per_core()
echo "[Skip] paranoia and not root"
return
fi
- perf stat -j --per-core -a -o "${stat_output}" true
+ perf stat -j $perf_new_opt --per-core -a -o "${stat_output}" true
$PYTHON $pythonchecker --per-core --file "${stat_output}"
echo "[Success]"
}
@@ -105,7 +106,7 @@ check_per_thread()
echo "[Skip] paranoia and not root"
return
fi
- perf stat -j --per-thread -p $$ -o "${stat_output}" true
+ perf stat -j $perf_new_opt --per-thread -p $$ -o "${stat_output}" true
$PYTHON $pythonchecker --per-thread --file "${stat_output}"
echo "[Success]"
}
@@ -118,7 +119,7 @@ check_per_cache_instance()
echo "[Skip] paranoia and not root"
return
fi
- perf stat -j --per-cache -a true 2>&1 | $PYTHON $pythonchecker --per-cache
+ perf stat -j $perf_new_opt --per-cache -a true 2>&1 | $PYTHON $pythonchecker --per-cache
echo "[Success]"
}
@@ -130,7 +131,7 @@ check_per_cluster()
echo "[Skip] paranoia and not root"
return
fi
- perf stat -j --per-cluster -a true 2>&1 | $PYTHON $pythonchecker --per-cluster
+ perf stat -j $perf_new_opt --per-cluster -a true 2>&1 | $PYTHON $pythonchecker --per-cluster
echo "[Success]"
}
@@ -142,7 +143,7 @@ check_per_die()
echo "[Skip] paranoia and not root"
return
fi
- perf stat -j --per-die -a -o "${stat_output}" true
+ perf stat -j $perf_new_opt --per-die -a -o "${stat_output}" true
$PYTHON $pythonchecker --per-die --file "${stat_output}"
echo "[Success]"
}
@@ -155,7 +156,7 @@ check_per_node()
echo "[Skip] paranoia and not root"
return
fi
- perf stat -j --per-node -a -o "${stat_output}" true
+ perf stat -j $perf_new_opt --per-node -a -o "${stat_output}" true
$PYTHON $pythonchecker --per-node --file "${stat_output}"
echo "[Success]"
}
@@ -168,7 +169,7 @@ check_per_socket()
echo "[Skip] paranoia and not root"
return
fi
- perf stat -j --per-socket -a -o "${stat_output}" true
+ perf stat -j $perf_new_opt --per-socket -a -o "${stat_output}" true
$PYTHON $pythonchecker --per-socket --file "${stat_output}"
echo "[Success]"
}
@@ -181,7 +182,7 @@ check_metric_only()
echo "[Skip] CPU-measurement counter facility not installed"
return
fi
- perf stat -j --metric-only -M page_faults_per_second -o "${stat_output}" true
+ perf stat -j $perf_new_opt --metric-only -M page_faults_per_second -o "${stat_output}" true
$PYTHON $pythonchecker --metric-only --file "${stat_output}"
echo "[Success]"
}
@@ -232,5 +233,21 @@ then
else
echo "[Skip] Skipping tests for system_wide_no_aggr, per_core, per_die and per_socket since socket id exposed via topology is invalid"
fi
+# Run New API JSON basic and standard aggregation checks
+perf_new_opt="--new"
+check_no_args
+check_system_wide
+check_interval
+check_event
+check_per_thread
+check_per_node
+if [ $skip_test -ne 1 ]
+then
+ check_system_wide_no_aggr
+ check_per_core
+ check_per_die
+ check_per_socket
+fi
+
cleanup
exit 0
--
2.54.0.794.g4f17f83d09-goog
next prev parent reply other threads:[~2026-05-22 22:34 UTC|newest]
Thread overview: 74+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-22 22:33 [RFC PATCH v1 00/14] perf stat: Decouple and modularize metrics/events output printing API Ian Rogers
2026-05-22 22:33 ` [RFC PATCH v1 01/14] perf stat: Introduce core generic print traversal engine and header stubs Ian Rogers
2026-05-22 22:33 ` [RFC PATCH v1 02/14] perf stat: Implement standard console (STD) formatting callbacks Ian Rogers
2026-05-22 22:33 ` [RFC PATCH v1 03/14] perf stat: Extend STD output linter to test basic New API checks Ian Rogers
2026-05-22 22:33 ` [RFC PATCH v1 04/14] perf stat: Extend STD output linter to test core aggregation checks Ian Rogers
2026-05-22 22:33 ` [RFC PATCH v1 05/14] perf stat: Extend STD output linter to test advanced PMU checks Ian Rogers
2026-05-22 22:33 ` [RFC PATCH v1 06/14] perf stat: Extend STD output linter to test metric-only checks Ian Rogers
2026-05-22 22:33 ` [RFC PATCH v1 07/14] perf stat: Implement CSV formatting callbacks Ian Rogers
2026-05-22 22:33 ` [RFC PATCH v1 08/14] perf stat: Extend CSV output linter to test core aggregation checks Ian Rogers
2026-05-22 22:33 ` [RFC PATCH v1 09/14] perf stat: Extend CSV output linter to test advanced PMU and metric-only checks Ian Rogers
2026-05-22 22:33 ` [RFC PATCH v1 10/14] perf stat: Implement streaming JSON formatting callbacks Ian Rogers
2026-05-22 22:33 ` Ian Rogers [this message]
2026-05-22 22:33 ` [RFC PATCH v1 12/14] perf stat: Extend JSON output linter to test advanced PMU and metric-only checks Ian Rogers
2026-05-22 22:33 ` [RFC PATCH v1 13/14] perf stat: Add --new support to PMU metrics Python validator Ian Rogers
2026-05-22 22:33 ` [RFC PATCH v1 14/14] perf stat: Extend PMU metrics value linter to validate --new outputs Ian Rogers
2026-05-25 23:18 ` [RFC PATCH v2 00/14] perf stat: Decouple and modularize metrics/events output printing API Ian Rogers
2026-05-25 23:18 ` [RFC PATCH v2 01/14] perf stat: Introduce core generic print traversal engine and header stubs Ian Rogers
2026-05-25 23:38 ` Arnaldo Carvalho de Melo
2026-05-25 23:48 ` Ian Rogers
2026-05-26 0:20 ` Arnaldo Carvalho de Melo
2026-05-25 23:18 ` [RFC PATCH v2 02/14] perf stat: Implement standard console (STD) formatting callbacks Ian Rogers
2026-05-25 23:49 ` Arnaldo Carvalho de Melo
2026-05-26 0:09 ` Ian Rogers
2026-05-25 23:18 ` [RFC PATCH v2 03/14] perf stat: Extend STD output linter to test basic New API checks Ian Rogers
2026-05-25 23:39 ` Arnaldo Carvalho de Melo
2026-05-25 23:18 ` [RFC PATCH v2 04/14] perf stat: Extend STD output linter to test core aggregation checks Ian Rogers
2026-05-25 23:18 ` [RFC PATCH v2 05/14] perf stat: Extend STD output linter to test advanced PMU checks Ian Rogers
2026-05-25 23:18 ` [RFC PATCH v2 06/14] perf stat: Extend STD output linter to test metric-only checks Ian Rogers
2026-05-25 23:18 ` [RFC PATCH v2 07/14] perf stat: Implement CSV formatting callbacks Ian Rogers
2026-05-25 23:18 ` [RFC PATCH v2 08/14] perf stat: Extend CSV output linter to test core aggregation checks Ian Rogers
2026-05-25 23:18 ` [RFC PATCH v2 09/14] perf stat: Extend CSV output linter to test advanced PMU and metric-only checks Ian Rogers
2026-05-25 23:18 ` [RFC PATCH v2 10/14] perf stat: Implement streaming JSON formatting callbacks Ian Rogers
2026-05-25 23:18 ` [RFC PATCH v2 11/14] perf stat: Extend JSON output linter to test core aggregation checks Ian Rogers
2026-05-25 23:18 ` [RFC PATCH v2 12/14] perf stat: Extend JSON output linter to test advanced PMU and metric-only checks Ian Rogers
2026-05-25 23:18 ` [RFC PATCH v2 13/14] perf stat: Add --new support to PMU metrics Python validator Ian Rogers
2026-05-25 23:19 ` [RFC PATCH v2 14/14] perf stat: Extend PMU metrics value linter to validate --new outputs Ian Rogers
2026-06-05 18:02 ` [RFC PATCH v2 00/14] perf stat: Decouple and modularize metrics/events output printing API Chun-Tse Shao
2026-07-16 4:32 ` [PATCH v3 00/14] perf stat: Decouple printing API and introduce streaming zero-allocation printers Ian Rogers
2026-07-16 4:32 ` [PATCH v3 01/14] perf stat: Introduce core generic print traversal engine and header stubs Ian Rogers
2026-07-16 4:32 ` [PATCH v3 02/14] perf stat: Implement standard console (STD) formatting callbacks Ian Rogers
2026-07-16 4:32 ` [PATCH v3 03/14] perf stat: Extend STD output linter to test basic New API checks Ian Rogers
2026-07-16 4:32 ` [PATCH v3 04/14] perf stat: Extend STD output linter to test core aggregation checks Ian Rogers
2026-07-16 4:32 ` [PATCH v3 05/14] perf stat: Extend STD output linter to test advanced PMU checks Ian Rogers
2026-07-16 4:32 ` [PATCH v3 06/14] perf stat: Extend STD output linter to test metric-only checks Ian Rogers
2026-07-16 4:32 ` [PATCH v3 07/14] perf stat: Implement CSV formatting callbacks Ian Rogers
2026-07-16 4:32 ` [PATCH v3 08/14] perf stat: Extend CSV output linter to test core aggregation checks Ian Rogers
2026-07-16 4:32 ` [PATCH v3 09/14] perf stat: Extend CSV output linter to test advanced PMU and metric-only checks Ian Rogers
2026-07-16 4:32 ` [PATCH v3 10/14] perf stat: Implement streaming JSON formatting callbacks Ian Rogers
2026-07-16 4:32 ` [PATCH v3 11/14] perf stat: Extend JSON output linter to test core aggregation checks Ian Rogers
2026-07-16 4:32 ` [PATCH v3 12/14] perf stat: Extend JSON output linter to test advanced PMU and metric-only checks Ian Rogers
2026-07-16 4:32 ` [PATCH v3 13/14] perf stat: Add --new support to PMU metrics Python validator Ian Rogers
2026-07-16 4:32 ` [PATCH v3 14/14] perf stat: Extend PMU metrics value linter to validate --new outputs Ian Rogers
2026-07-16 7:02 ` [PATCH v4 00/14] perf stat: Decouple and modularize display formatting Ian Rogers
2026-07-16 7:02 ` [PATCH v4 01/14] perf stat: Introduce core generic print traversal engine and header stubs Ian Rogers
2026-07-16 22:22 ` Namhyung Kim
2026-07-16 7:02 ` [PATCH v4 02/14] perf stat: Implement standard console (STD) formatting callbacks Ian Rogers
2026-07-16 22:30 ` Namhyung Kim
2026-07-16 7:02 ` [PATCH v4 03/14] perf stat: Extend STD output linter to test basic New API checks Ian Rogers
2026-07-16 7:02 ` [PATCH v4 04/14] perf stat: Extend STD output linter to test core aggregation checks Ian Rogers
2026-07-16 7:02 ` [PATCH v4 05/14] perf stat: Extend STD output linter to test advanced PMU checks Ian Rogers
2026-07-16 7:02 ` [PATCH v4 06/14] perf stat: Extend STD output linter to test metric-only checks Ian Rogers
2026-07-16 22:32 ` Namhyung Kim
2026-07-16 7:02 ` [PATCH v4 07/14] perf stat: Implement CSV formatting callbacks Ian Rogers
2026-07-16 22:35 ` Namhyung Kim
2026-07-16 7:02 ` [PATCH v4 08/14] perf stat: Extend CSV output linter to test core aggregation checks Ian Rogers
2026-07-16 7:02 ` [PATCH v4 09/14] perf stat: Extend CSV output linter to test advanced PMU and metric-only checks Ian Rogers
2026-07-16 7:02 ` [PATCH v4 10/14] perf stat: Implement streaming JSON formatting callbacks Ian Rogers
2026-07-16 22:43 ` Namhyung Kim
2026-07-16 7:03 ` [PATCH v4 11/14] perf stat: Extend JSON output linter to test core aggregation checks Ian Rogers
2026-07-16 7:03 ` [PATCH v4 12/14] perf stat: Extend JSON output linter to test advanced PMU and metric-only checks Ian Rogers
2026-07-16 7:03 ` [PATCH v4 13/14] perf stat: Add --new support to PMU metrics Python validator Ian Rogers
2026-07-16 7:03 ` [PATCH v4 14/14] perf stat: Extend PMU metrics value linter to validate --new outputs Ian Rogers
2026-07-16 22:48 ` [PATCH v4 00/14] perf stat: Decouple and modularize display formatting Namhyung Kim
2026-07-17 0:23 ` Ian Rogers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260522223342.2393553-12-irogers@google.com \
--to=irogers@google.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=james.clark@linaro.org \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox