From: Jiri Olsa <jolsa@redhat.com>
To: Andi Kleen <andi@firstfloor.org>
Cc: acme@kernel.org, jolsa@kernel.org, linux-kernel@vger.kernel.org,
alexey.budankov@linux.intel.com, Andi Kleen <ak@linux.intel.com>
Subject: Re: [PATCH 2/2] perf tools: Support -x for perf stat report
Date: Tue, 27 Oct 2020 14:09:32 +0100 [thread overview]
Message-ID: <20201027130932.GG2900849@krava> (raw)
In-Reply-To: <20201027002737.30942-2-andi@firstfloor.org>
On Mon, Oct 26, 2020 at 05:27:37PM -0700, Andi Kleen wrote:
> Add support for the -x, option to enable CSV output with perf stat
> report. Useful to parse the information with other programs.
>
> % perf stat record --quiet -a -I 1000 sleep 5
> % perf stat report -x,
> 1.000838672,4003.55,msec,cpu-clock,4003548736,100.00,,
> 1.000838672,11243,,context-switches,4003631885,100.00,0.003,M/sec
> 1.000838672,1682,,cpu-migrations,4003672150,100.00,0.420,K/sec
> 1.000838672,13244,,page-faults,4003697471,100.00,0.003,M/sec
> 1.000838672,2953214077,,cycles,4003715495,100.00,0.738,GHz
> 1.000838672,4380820799,,instructions,4003738270,100.00,1.48,insn per cycle
> 1.000838672,809865653,,branches,4003760616,100.00,202.287,M/sec
> 1.000838672,12439843,,branch-misses,4003780785,100.00,1.54,of all branches
> ...
>
> Signed-off-by: Andi Kleen <ak@linux.intel.com>
> ---
> tools/perf/builtin-stat.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
> index 743fe47e7a88..31e7bd877f1d 100644
> --- a/tools/perf/builtin-stat.c
> +++ b/tools/perf/builtin-stat.c
> @@ -1988,6 +1988,8 @@ static int __cmd_report(int argc, const char **argv)
> "aggregate counts per numa node", AGGR_NODE),
> OPT_SET_UINT('A', "no-aggr", &perf_stat.aggr_mode,
> "disable CPU count aggregation", AGGR_NONE),
> + OPT_STRING('x', "field-separator", &stat_config.csv_sep, "separator",
> + "print counts with custom separator"),
> OPT_END()
> };
> struct stat st;
> @@ -2002,6 +2004,11 @@ static int __cmd_report(int argc, const char **argv)
> input_name = "perf.data";
> }
>
> + if (stat_config.csv_sep) {
> + stat_config.csv_output = true;
> + stat_config.big_num = false;
> + }
stat_config.csv_sep is by default ' ' so this will force
the standard output to be with -x
jirka
> +
> perf_stat.data.path = input_name;
> perf_stat.data.mode = PERF_DATA_MODE_READ;
>
> --
> 2.28.0
>
next prev parent reply other threads:[~2020-10-27 13:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-27 0:27 [PATCH 1/2] perf tools: Add --quiet option to perf stat Andi Kleen
2020-10-27 0:27 ` [PATCH 2/2] perf tools: Support -x for perf stat report Andi Kleen
2020-10-27 13:09 ` Jiri Olsa [this message]
2020-10-27 15:09 ` [PATCH 1/2] perf tools: Add --quiet option to perf stat Arnaldo Carvalho de Melo
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=20201027130932.GG2900849@krava \
--to=jolsa@redhat.com \
--cc=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=alexey.budankov@linux.intel.com \
--cc=andi@firstfloor.org \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.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