Claire Jensen
df936cadfb
perf stat: Add JSON output option
CSV output is tricky to format and column layout changes are susceptible
to breaking parsers. New JSON-formatted output has variable names to
identify fields that are consistent and informative, making the output
parseable.
CSV output example:
1.20,msec,task-clock:u,1204272,100.00,0.697,CPUs utilized
0,,context-switches:u,1204272,100.00,0.000,/sec
0,,cpu-migrations:u,1204272,100.00,0.000,/sec
70,,page-faults:u,1204272,100.00,58.126,K/sec
JSON output example:
{"counter-value" : "3805.723968", "unit" : "msec", "event" :
"cpu-clock", "event-runtime" : 3805731510100.00, "pcnt-running"
: 100.00, "metric-value" : 4.007571, "metric-unit" : "CPUs utilized"}
{"counter-value" : "6166.000000", "unit" : "", "event" :
"context-switches", "event-runtime" : 3805723045100.00, "pcnt-running"
: 100.00, "metric-value" : 1.620191, "metric-unit" : "K/sec"}
{"counter-value" : "466.000000", "unit" : "", "event" :
"cpu-migrations", "event-runtime" : 3805727613100.00, "pcnt-running"
: 100.00, "metric-value" : 122.447136, "metric-unit" : "/sec"}
{"counter-value" : "208.000000", "unit" : "", "event" :
"page-faults", "event-runtime" : 3805726799100.00, "pcnt-running"
: 100.00, "metric-value" : 54.654516, "metric-unit" : "/sec"}
Also added documentation for JSON option.
There is some tidy up of CSV code including a potential memory over run
in the os.nfields set up. To facilitate this an AGGR_MAX value is added.
Committer notes:
Fixed up using PRIu64 to format u64 values, not %lu.
Committer testing:
⬢[acme@toolbox perf]$ perf stat -j sleep 1
{"counter-value" : "0.731750", "unit" : "msec", "event" : "task-clock:u", "event-runtime" : 731750, "pcnt-running" : 100.00, "metric-value" : 0.000731, "metric-unit" : "CPUs utilized"}
{"counter-value" : "0.000000", "unit" : "", "event" : "context-switches:u", "event-runtime" : 731750, "pcnt-running" : 100.00, "metric-value" : 0.000000, "metric-unit" : "/sec"}
{"counter-value" : "0.000000", "unit" : "", "event" : "cpu-migrations:u", "event-runtime" : 731750, "pcnt-running" : 100.00, "metric-value" : 0.000000, "metric-unit" : "/sec"}
{"counter-value" : "75.000000", "unit" : "", "event" : "page-faults:u", "event-runtime" : 731750, "pcnt-running" : 100.00, "metric-value" : 102.494021, "metric-unit" : "K/sec"}
{"counter-value" : "578765.000000", "unit" : "", "event" : "cycles:u", "event-runtime" : 379366, "pcnt-running" : 49.00, "metric-value" : 0.790933, "metric-unit" : "GHz"}
{"counter-value" : "1298.000000", "unit" : "", "event" : "stalled-cycles-frontend:u", "event-runtime" : 768020, "pcnt-running" : 100.00, "metric-value" : 0.224271, "metric-unit" : "frontend cycles idle"}
{"counter-value" : "21984.000000", "unit" : "", "event" : "stalled-cycles-backend:u", "event-runtime" : 768020, "pcnt-running" : 100.00, "metric-value" : 3.798433, "metric-unit" : "backend cycles idle"}
{"counter-value" : "468197.000000", "unit" : "", "event" : "instructions:u", "event-runtime" : 768020, "pcnt-running" : 100.00, "metric-value" : 0.808959, "metric-unit" : "insn per cycle"}
{"metric-value" : 0.046955, "metric-unit" : "stalled cycles per insn"}
{"counter-value" : "103335.000000", "unit" : "", "event" : "branches:u", "event-runtime" : 768020, "pcnt-running" : 100.00, "metric-value" : 141.216262, "metric-unit" : "M/sec"}
{"counter-value" : "2381.000000", "unit" : "", "event" : "branch-misses:u", "event-runtime" : 388654, "pcnt-running" : 50.00, "metric-value" : 2.304156, "metric-unit" : "of all branches"}
⬢[acme@toolbox perf]$
Signed-off-by: Claire Jensen <cjense@google.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alyssa Ross <hi@alyssa.is>
Cc: Claire Jensen <clairej735@gmail.com>
Cc: Florian Fischer <florian.fischer@muhq.space>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@arm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Like Xu <likexu@tencent.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sandipan Das <sandipan.das@amd.com>
Cc: Stephane Eranian <eranian@google.com>
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
Link: https://lore.kernel.org/r/20220805200105.2020995-2-irogers@google.com
Signed-off-by: Ian Rogers <irogers@google.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2022-08-10 10:43:29 -03:00
..
2021-12-16 12:18:11 -03:00
2022-08-02 18:03:31 -03:00
2022-04-22 18:39:34 -03:00
2021-09-03 08:17:25 -03:00
2022-02-22 16:21:34 +00:00
2022-05-17 11:55:49 -03:00
2022-05-26 12:36:58 -03:00
2022-08-02 16:32:28 -03:00
2022-01-18 09:24:58 -03:00
2019-11-28 08:08:38 -03:00
2022-06-24 13:18:55 -03:00
2022-08-01 15:30:22 -03:00
2021-11-13 18:11:51 -03:00
2022-04-09 12:34:29 -03:00
2021-12-21 18:37:13 -03:00
2022-06-19 10:41:43 -03:00
2022-07-20 11:08:17 -03:00
2022-07-20 11:08:17 -03:00
2021-04-07 16:18:49 -03:00
2020-03-09 21:43:25 -03:00
2022-05-05 14:07:27 -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-07-26 16:31:54 -03:00
2022-08-02 18:03:31 -03:00
2022-01-12 17:01:38 -08:00
2022-06-28 11:45:45 -03:00
2022-05-26 11:02:02 -03:00
2021-11-01 18:16:40 -03:00
2022-08-01 14:45:56 -03:00
2020-11-04 09:42:40 -03:00
2020-06-09 12:40:04 -03:00
2022-06-28 12:05:25 -03:00
2021-11-01 18:16:40 -03:00
2022-03-01 16:19:01 +01:00
2020-05-28 10:03:27 -03:00
2022-08-02 16:32:26 -03:00
2022-07-20 11:07:58 -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-07-12 09:56:05 -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-07-09 10:13:26 -03:00
2021-09-27 09:32:28 -03:00
2021-01-20 14:34:21 -03:00
2019-10-15 12:05:18 -03:00
2019-09-25 09:51:49 -03:00
2022-01-22 17:08:42 -03:00
2022-01-12 14:28:22 -03:00
2022-01-12 14:28:23 -03:00
2022-01-22 17:12:23 -03:00
2022-01-22 17:08:42 -03:00
2021-11-13 18:11:50 -03:00
2022-07-20 11:09:11 -03:00
2021-09-03 08:15:10 -03:00
2021-12-06 15:37:22 -05:00
2022-06-23 11:54:21 -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-02-10 15:32:25 -03:00
2022-07-20 11:07:02 -03:00
2022-07-19 16:19:00 -03:00
2019-11-19 19:12:26 -03:00
2021-07-18 09:31:15 -03:00
2021-07-18 09:31:15 -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-07-20 11:08:42 -03:00
2021-09-03 08:29:55 -03:00
2022-02-18 09:59:26 -03:00
2021-08-11 16:07:32 -03:00
2022-07-29 13:42:35 -03:00
2022-07-29 13:42:35 -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-07-29 13:41:19 -03:00
2022-07-29 13:41:19 -03:00
2020-11-30 09:48:07 -03:00
2019-08-15 12:25:55 -03:00
2022-07-25 12:28:00 -03:00
2021-11-13 18:11:50 -03:00
2022-06-19 10:41:43 -03:00
2021-11-13 18:11:50 -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-08-02 16:32:28 -03:00
2022-04-11 16:37:26 -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-07-18 10:36:11 -03:00
2022-07-18 10:36:11 -03:00
2019-07-09 10:13:26 -03:00
2022-02-16 11:21:22 -03:00
2022-02-16 11:21:22 -03:00
2021-11-07 12:27:38 -03:00
2019-06-05 17:36:37 +02:00
2022-07-20 11:09:04 -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-02-11 14:31:22 -03:00
2020-05-28 10:03:27 -03:00
2019-09-20 10:28:26 -03:00
2022-07-26 16:31:54 -03:00
2021-03-23 17:13:43 -03:00
2022-08-01 14:43:13 -03:00
2019-08-29 17:38:32 -03:00
2022-08-02 18:03:31 -03:00
2021-07-15 17:30:22 -03:00
2022-07-20 11:08:37 -03:00
2022-07-20 11:08:37 -03:00
2022-02-06 09:03:06 -03:00
2022-03-12 11:01:12 -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-05-23 09:36:12 -03:00
2022-05-23 09:36:12 -03:00
2019-09-20 09:19:22 -03:00
2022-06-19 11:24:05 -03:00
2021-10-25 13:47:42 -03:00
2022-05-26 12:36:57 -03:00
2022-02-10 16:26:24 -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
2019-08-31 19:10:19 -03:00
2021-12-07 22:18:25 -03:00
2021-10-20 10:54:44 -03:00
2022-08-02 16:32:26 -03:00
2022-08-02 16:32: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
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-01-22 17:08:42 -03:00
2021-06-01 10:32:00 -03:00
2022-02-06 09:03:06 -03:00
2022-05-27 13:21:33 -03:00
2021-12-21 18:35:44 -03:00
2019-09-20 09:19:20 -03:00
2022-03-22 17:12:40 -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-06-24 13:18:55 -03:00
2022-06-24 13:18:55 -03:00
2020-10-01 12:10:56 -03:00
2022-08-02 16:32:26 -03:00
2022-08-02 16:32:26 -03:00
2022-07-20 11:09:11 -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
2021-07-18 09:31:15 -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-06-05 17:37:04 +02:00
2022-06-23 11:54:22 -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
2021-11-07 12:27:38 -03:00
2021-10-20 10:32:33 -03:00
2021-09-10 18:15:21 -03:00
2021-09-10 18:15:21 -03:00
2022-07-20 11:08:37 -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-01-12 14:43:34 -03:00
2022-02-16 11:21:22 -03:00
2022-02-16 11:21: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
2021-10-04 09:29:07 -03:00
2022-08-10 10:43:29 -03:00
2022-05-09 10:16:49 -03:00
2022-08-10 10:43:29 -03:00
2022-08-10 10:43:29 -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
2021-02-17 15:15:06 -03:00
2019-07-09 10:13:26 -03: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-08-01 09:30:36 -03:00
2020-10-14 08:46:42 -03:00
2022-07-20 11:08:37 -03:00
2022-04-28 10:51:40 -03:00
2019-08-31 22:24:05 -03:00
2022-07-20 11:07:58 -03:00
2022-07-20 11:07: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-07-20 11:08:04 -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-02-15 17:15:29 -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
2021-06-01 10:03:17 -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