Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf test: Be tolerant of missing json metric none value

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>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>

authored by

Ian Rogers and committed by
Namhyung Kim
c335b7a9 38367a22

+4 -1
+4 -1
tools/perf/tests/shell/lib/perf_json_output_lint.py
··· 43 43 def is_counter_value(num): 44 44 return isfloat(num) or num == '<not counted>' or num == '<not supported>' 45 45 46 + def is_metric_value(num): 47 + return isfloat(num) or num == 'none' 48 + 46 49 def check_json_output(expected_items): 47 50 checks = { 48 51 'counters': lambda x: isfloat(x), ··· 60 57 'event-runtime': lambda x: isfloat(x), 61 58 'interval': lambda x: isfloat(x), 62 59 'metric-unit': lambda x: True, 63 - 'metric-value': lambda x: isfloat(x), 60 + 'metric-value': lambda x: is_metric_value(x), 64 61 'metric-threshold': lambda x: x in ['unknown', 'good', 'less good', 'nearly bad', 'bad'], 65 62 'metricgroup': lambda x: True, 66 63 'node': lambda x: True,