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>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
Adrian Hunter <adrian.hunter@intel.com>,
Kan Liang <kan.liang@linux.intel.com>,
James Clark <james.clark@linaro.org>,
Chun-Tse Shao <ctshao@google.com>,
Thomas Falcon <thomas.falcon@intel.com>,
Yang Li <yang.lee@linux.alibaba.com>,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 1/4] perf test: Be tolerant of missing json metric none value
Date: Wed, 12 Nov 2025 11:53:08 -0800 [thread overview]
Message-ID: <20251112195311.1673981-2-irogers@google.com> (raw)
In-Reply-To: <20251112195311.1673981-1-irogers@google.com>
print_metric_only_json and print_metric_end in stat-display.c may
create a metric value of "none" which fails validation as isfloat. Add
a helper to properly validate metric numeric values.
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/tests/shell/lib/perf_json_output_lint.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tools/perf/tests/shell/lib/perf_json_output_lint.py b/tools/perf/tests/shell/lib/perf_json_output_lint.py
index 1369baaa0361..dafbde56cc76 100644
--- a/tools/perf/tests/shell/lib/perf_json_output_lint.py
+++ b/tools/perf/tests/shell/lib/perf_json_output_lint.py
@@ -43,6 +43,9 @@ def isint(num):
def is_counter_value(num):
return isfloat(num) or num == '<not counted>' or num == '<not supported>'
+def is_metric_value(num):
+ return isfloat(num) or num == 'none'
+
def check_json_output(expected_items):
checks = {
'counters': lambda x: isfloat(x),
@@ -57,7 +60,7 @@ def check_json_output(expected_items):
'event-runtime': lambda x: isfloat(x),
'interval': lambda x: isfloat(x),
'metric-unit': lambda x: True,
- 'metric-value': lambda x: isfloat(x),
+ 'metric-value': lambda x: is_metric_value(x),
'metric-threshold': lambda x: x in ['unknown', 'good', 'less good', 'nearly bad', 'bad'],
'metricgroup': lambda x: True,
'node': lambda x: True,
--
2.51.2.1041.gc1ab5b90ca-goog
next prev parent reply other threads:[~2025-11-12 19:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-12 19:53 [PATCH v2 0/4] Test fixes and debug logging Ian Rogers
2025-11-12 19:53 ` Ian Rogers [this message]
2025-11-12 19:53 ` [PATCH v2 2/4] perf parse-events: Add debug logging to perf_event Ian Rogers
2025-11-12 19:53 ` [PATCH v2 3/4] perf test: Don't fail if user rdpmc returns 0 when disabled Ian Rogers
2025-11-12 19:53 ` [PATCH v2 4/4] perf stat: Display metric-only for 0 counters Ian Rogers
2025-11-18 1:35 ` [PATCH v2 0/4] Test fixes and debug logging Namhyung Kim
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=20251112195311.1673981-2-irogers@google.com \
--to=irogers@google.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=ctshao@google.com \
--cc=james.clark@linaro.org \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--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 \
--cc=thomas.falcon@intel.com \
--cc=yang.lee@linux.alibaba.com \
/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
all inboxes | Powered by JetHome®