Namhyung Kim
fdc7d60824
perf stat: Fix --metric-only --json output
...
Currently it prints all metric headers for JSON output. But actually it
skips some metrics with valid_only_metric(). So the output looks like:
$ perf stat --metric-only --json true
{"unit" : "CPUs utilized", "unit" : "/sec", "unit" : "/sec", "unit" : "/sec", "unit" : "GHz", "unit" : "insn per cycle", "unit" : "/sec", "unit" : "branch-misses of all branches"}
{"metric-value" : "3.861"}{"metric-value" : "0.79"}{"metric-value" : "3.04"}
As you can see there are 8 units in the header but only 3 metric-values
are there. It should skip the unused headers as well. Also each unit
should be printed as a separate object like metric values.
With this patch:
$ perf stat --metric-only --json true
{"unit" : "GHz"}{"unit" : "insn per cycle"}{"unit" : "branch-misses of all branches"}
{"metric-value" : "4.166"}{"metric-value" : "0.73"}{"metric-value" : "2.96"}
Fixes: df936cadfb58ba93 ("perf stat: Add JSON output option")
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Claire Jensen <cjense@google.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: James Clark <james.clark@arm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
Link: https://lore.kernel.org/r/20221107213314.3239159-6-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2022-11-14 13:21:19 -03:00
..
2022-08-11 19:12:01 -03:00
2022-10-14 10:29:05 -03:00
2022-04-22 18:39:34 -03:00
2021-09-03 08:17:25 -03:00
2022-10-15 10:13:16 -03:00
2022-10-25 17:40:48 -03:00
2022-10-31 11:06:41 -03:00
2022-05-26 12:36:58 -03:00
2022-10-27 16:37:26 -03:00
2022-09-06 09:45:23 -03:00
2019-11-28 08:08:38 -03:00
2022-10-31 11:06:41 -03:00
2022-10-04 08:55:22 -03:00
2022-10-04 08:55:22 -03:00
2019-03-11 11:56:02 -03:00
2022-04-09 12:34:29 -03:00
2022-10-27 16:37:26 -03:00
2022-09-28 11:26:33 -03:00
2022-10-31 11:06:41 -03:00
2022-10-15 10:13:16 -03:00
2021-04-07 16:18:49 -03:00
2020-03-09 21:43:25 -03:00
2019-01-25 15:12:09 +01:00
2019-01-25 15:12:09 +01:00
2022-09-21 10:30:55 -03:00
2022-05-26 12:36:56 -03:00
2022-01-12 14:28:23 -03:00
2022-04-01 16:19:35 -03:00
2022-10-31 11:06:46 -03:00
2022-10-31 11:07:45 -03:00
2022-01-12 17:01:38 -08:00
2022-10-27 16:37:26 -03:00
2022-08-11 17:57:34 -03:00
2022-10-25 17:40:48 -03:00
2022-10-04 08:55:19 -03:00
2022-10-25 17:40:48 -03:00
2020-11-04 09:42:40 -03:00
2020-06-09 12:40:04 -03:00
2022-10-31 11:05:41 -03:00
2022-06-28 12:05:25 -03:00
2021-11-01 18:16:40 -03:00
2022-10-04 08:55:20 -03:00
2022-10-31 11:06:41 -03:00
2022-11-04 11:45:36 -03:00
2022-10-04 08:55:20 -03:00
2022-07-20 11:07:53 -03:00
2019-08-29 17:38:32 -03:00
2019-08-26 11:58:29 -03:00
2019-07-09 10:13:27 -03:00
2021-03-23 17:13:43 -03:00
2022-10-04 08:55:21 -03:00
2021-12-21 18:35:44 -03:00
2019-08-14 10:48:39 -03:00
2020-04-16 12:19:08 -03:00
2021-07-09 14:04:31 -03:00
2021-07-05 14:16:57 -03:00
2020-08-06 09:33:57 -03:00
2020-08-06 09:33:57 -03:00
2020-05-28 10:03:26 -03:00
2019-08-31 22:24:10 -03:00
2019-08-31 22:24:10 -03:00
2019-01-25 15:12:08 +01:00
2019-07-09 10:13:26 -03:00
2019-01-25 15:12:09 +01:00
2019-05-15 16:36:49 -03:00
2022-10-27 16:37:26 -03:00
2022-10-04 08:55:21 -03:00
2019-10-15 12:05:18 -03:00
2019-09-25 09:51:49 -03:00
2022-10-27 16:37:25 -03:00
2022-10-27 16:37:25 -03:00
2019-02-06 10:00:39 -03:00
2022-10-27 16:37:25 -03:00
2022-10-27 16:37:25 -03:00
2022-10-04 08:55:22 -03:00
2022-10-04 08:55:22 -03:00
2022-07-20 11:09:11 -03:00
2021-09-03 08:15:10 -03:00
2022-10-31 11:06:41 -03:00
2022-11-10 15:35:37 -03:00
2021-04-29 10:30:58 -03:00
2022-07-20 11:08:37 -03:00
2022-07-25 18:10:43 -03:00
2021-05-25 10:07:17 -03:00
2021-05-25 10:07:17 -03:00
2022-01-12 14:28:21 -03:00
2021-08-03 17:03:18 -03:00
2021-03-23 17:13:43 -03:00
2021-03-30 12:45:59 -03:00
2021-02-17 15:15:06 -03:00
2019-09-20 09:19:20 -03:00
2022-07-20 11:08:13 -03:00
2021-08-11 09:35:44 -03:00
2022-10-04 08:55:20 -03:00
2022-10-04 08:55:20 -03:00
2022-07-19 16:19:00 -03:00
2019-11-19 19:12:26 -03:00
2022-11-08 22:21:20 -03:00
2022-11-03 09:28:46 -03:00
2021-03-01 14:47:50 -03:00
2022-06-24 13:18:55 -03:00
2022-06-24 13:18:55 -03:00
2022-06-23 11:54:22 -03:00
2022-10-31 11:07:03 -03:00
2022-10-04 08:55:20 -03:00
2022-02-18 09:59:26 -03:00
2021-08-11 16:07:32 -03:00
2022-10-31 11:07:19 -03:00
2022-10-06 08:03:53 -03:00
2020-05-28 10:03:24 -03:00
2021-10-27 20:56:36 -03:00
2020-05-28 10:03:24 -03:00
2022-10-27 16:37:25 -03:00
2022-10-04 08:55:20 -03:00
2020-11-30 09:48:07 -03:00
2019-08-15 12:25:55 -03:00
2022-10-06 08:03:52 -03:00
2022-10-04 08:55:22 -03:00
2022-10-04 08:55:22 -03:00
2022-10-06 08:03:52 -03:00
2019-11-28 08:08:38 -03:00
2019-11-28 08:08:38 -03:00
2022-03-22 17:43:46 -03:00
2020-05-29 16:51:38 -03:00
2022-10-04 08:55:22 -03:00
2022-10-15 10:13:16 -03:00
2021-08-30 10:06:16 -03:00
2019-07-09 10:13:26 -03:00
2022-04-01 16:19:34 -03:00
2020-11-27 14:19:33 -03:00
2022-10-04 08:55:21 -03:00
2022-07-18 10:36:11 -03:00
2019-07-09 10:13:26 -03:00
2022-10-15 10:13:16 -03:00
2022-10-15 10:13:16 -03:00
2022-10-04 08:55:22 -03:00
2022-10-04 08:55:22 -03:00
2021-11-07 12:27:38 -03:00
2019-06-05 17:36:37 +02:00
2022-10-15 10:13:16 -03:00
2019-06-05 17:36:37 +02:00
2021-02-08 17:02:00 -03:00
2021-02-08 17:02:00 -03:00
2021-04-20 08:40:20 -03:00
2021-04-20 08:40:20 -03:00
2021-02-03 13:10:44 -03:00
2022-10-06 08:03:51 -03:00
2020-05-28 10:03:27 -03:00
2019-09-20 10:28:26 -03:00
2022-10-31 11:06:46 -03:00
2021-03-23 17:13:43 -03:00
2022-11-04 11:45:36 -03:00
2019-08-29 17:38:32 -03:00
2022-10-31 11:07:48 -03:00
2021-07-15 17:30:22 -03:00
2022-10-06 08:03:51 -03:00
2022-10-31 11:06:52 -03:00
2022-02-06 09:03:06 -03:00
2022-10-04 08:55:20 -03:00
2022-02-14 16:59:55 -03:00
2022-02-14 16:56:32 -03:00
2022-02-14 16:52:14 -03:00
2020-11-04 09:42:40 -03:00
2019-08-31 19:10:40 -03:00
2022-10-06 16:32:05 -03:00
2022-08-11 19:12:12 -03:00
2019-09-20 09:19:22 -03:00
2022-10-06 08:03:51 -03:00
2022-10-04 08:55:22 -03:00
2022-05-26 12:36:57 -03:00
2022-10-31 11:07:14 -03:00
2022-10-04 08:55:20 -03:00
2022-10-04 08:55:20 -03:00
2022-02-11 14:31:22 -03:00
2022-02-11 14:31:22 -03:00
2022-06-28 11:45:45 -03:00
2022-02-10 16:27:34 -03:00
2022-07-20 11:07:30 -03:00
2022-10-04 08:55:20 -03:00
2022-09-26 10:16:26 -03:00
2021-10-20 10:54:44 -03:00
2022-10-27 16:37:25 -03:00
2022-09-26 10:16:26 -03:00
2022-04-20 13:44:56 -03:00
2022-01-22 17:20:12 -03:00
2020-12-17 14:36:16 -03:00
2019-05-15 16:36:49 -03:00
2020-08-14 09:15:47 -03:00
2021-08-24 15:01:31 -03:00
2022-04-11 16:39:49 -03:00
2022-04-11 16:39:49 -03:00
2022-08-10 14:30:09 -03:00
2021-06-01 10:32:00 -03:00
2022-10-04 08:55:20 -03:00
2022-10-31 11:06:41 -03:00
2021-12-21 18:35:44 -03:00
2019-09-20 09:19:20 -03:00
2022-10-06 08:03:52 -03:00
2021-10-20 10:54:44 -03:00
2020-05-29 16:51:38 -03:00
2021-04-29 10:30:59 -03:00
2021-05-17 10:55:10 -03:00
2022-10-27 16:37:25 -03:00
2022-10-14 12:23:09 -03:00
2022-10-14 12:23:09 -03:00
2022-10-14 12:23:09 -03:00
2020-10-01 12:10:56 -03:00
2022-11-10 15:39:02 -03:00
2022-08-02 16:32:26 -03:00
2022-10-04 08:55:20 -03:00
2021-07-18 09:31:15 -03:00
2021-07-18 09:27:37 -03:00
2019-11-18 19:08:02 -03:00
2022-11-03 09:28:46 -03:00
2021-07-18 09:31:15 -03:00
2020-05-28 10:03:27 -03:00
2022-05-26 12:41:36 -03:00
2022-03-26 10:55:57 -03:00
2019-01-25 15:12:10 +01:00
2019-06-05 17:37:04 +02:00
2019-01-25 15:12:10 +01:00
2022-08-10 14:30:09 -03:00
2022-06-23 11:54:22 -03:00
2019-07-09 14:59:11 -03:00
2019-07-09 14:59:11 -03:00
2019-09-20 09:19:20 -03:00
2020-04-16 12:19:15 -03:00
2022-10-31 11:06:41 -03:00
2022-10-31 11:06:41 -03:00
2021-09-10 18:15:21 -03:00
2021-09-10 18:15:21 -03:00
2022-10-31 11:06:41 -03:00
2022-11-03 09:36:32 -03:00
2022-07-20 11:07:37 -03:00
2019-07-09 10:13:26 -03:00
2022-07-20 15:14:39 -03:00
2022-04-01 16:19:35 -03:00
2022-10-04 08:55:22 -03:00
2022-10-04 08:55:22 -03:00
2022-10-04 08:55:22 -03:00
2022-10-04 08:55:22 -03:00
2019-10-11 10:57:00 -03:00
2019-10-11 10:57:00 -03:00
2021-06-08 09:36:36 -03:00
2019-02-06 10:00:38 -03:00
2021-10-04 09:29:07 -03:00
2019-01-25 15:12:09 +01:00
2022-11-14 13:21:19 -03:00
2022-10-06 08:03:53 -03:00
2022-10-27 16:37:25 -03:00
2022-10-27 16:37:26 -03:00
2019-08-31 19:10:19 -03:00
2021-03-23 17:13:43 -03:00
2021-07-09 14:04:28 -03:00
2020-10-14 13:34:26 -03:00
2019-07-09 10:13:26 -03:00
2021-03-23 17:13:43 -03:00
2021-02-17 15:15:06 -03:00
2022-10-04 08:55:23 -03:00
2019-07-09 10:13:26 -03:00
2019-01-25 15:12:10 +01:00
2022-01-22 17:08:42 -03:00
2019-08-29 17:38:31 -03:00
2022-05-23 10:18:38 -03:00
2021-03-08 11:17:51 -03:00
2022-09-21 16:08:00 -03:00
2020-10-14 08:46:42 -03:00
2022-10-04 08:55:20 -03:00
2022-10-31 11:06:56 -03:00
2019-08-31 22:24:05 -03:00
2022-10-06 11:12:14 -03:00
2022-08-19 12:26:58 -03:00
2021-03-01 14:49:28 -03:00
2020-05-29 16:50:26 -03:00
2021-01-20 14:25:28 -03:00
2021-08-11 16:04:33 -03:00
2019-08-29 08:36:12 -03:00
2019-08-29 08:36:12 -03:00
2020-05-05 16:35:29 -03:00
2021-03-25 08:59:10 -03:00
2022-07-20 11:08:04 -03:00
2022-10-31 11:07:03 -03:00
2019-10-15 08:36:22 -03:00
2019-10-15 08:36:22 -03:00
2022-06-23 11:54:22 -03:00
2022-04-01 16:19:35 -03:00
2022-10-04 08:55:20 -03:00
2022-07-29 13:43:34 -03:00
2022-07-29 13:43:34 -03:00
2022-08-02 16:32:26 -03:00
2022-03-07 14:54:54 -03:00
2021-03-06 16:54:26 -03:00
2022-10-31 11:06:41 -03:00
2019-09-20 09:19:20 -03:00
2021-09-03 08:18:25 -03:00
2022-08-02 16:32:26 -03:00
2022-08-02 16:32:26 -03:00
2019-08-29 17:38:32 -03:00
2021-04-29 10:31:00 -03:00
2022-07-25 12:28:00 -03:00
2021-03-15 11:36:54 -03:00
2021-03-15 11:36:54 -03:00
2022-04-09 12:34:29 -03:00
2022-04-09 12:34:29 -03:00
2022-07-02 09:16:52 -03:00
2022-04-09 12:34:29 -03:00
2022-04-09 12:34:29 -03:00
2019-09-20 09:19:20 -03:00
2022-07-20 11:08:37 -03:00
2022-07-20 11:08:37 -03:00
2019-08-31 19:10:19 -03:00
2021-03-24 10:38:56 -03:00
2019-09-20 09:19:20 -03:00
2020-09-01 12:15:21 -03:00