From: Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>
To: Jiri Olsa <jolsa@redhat.com>
Cc: Jin Yao <yao.jin@linux.intel.com>,
jolsa@kernel.org, peterz@infradead.org, mingo@redhat.com,
alexander.shishkin@linux.intel.com, Linux-kernel@vger.kernel.org,
ak@linux.intel.com, kan.liang@intel.com, yao.jin@intel.com
Subject: Re: [PATCH] perf stat: Support --all-kernel/--all-user
Date: Mon, 14 Oct 2019 13:23:39 -0300 [thread overview]
Message-ID: <20191014162339.GN19627@kernel.org> (raw)
In-Reply-To: <20191014144208.GC9700@krava>
Em Mon, Oct 14, 2019 at 04:42:08PM +0200, Jiri Olsa escreveu:
> On Fri, Oct 11, 2019 at 01:05:45PM +0800, Jin Yao wrote:
> > perf record has supported --all-kernel / --all-user to configure all
> > used events to run in kernel space or run in user space. But perf
> > stat doesn't support these options.
> >
> > It would be useful to support these options in perf-stat too to keep
> > the same semantics.
> >
> > Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
>
> Acked-by: Jiri Olsa <jolsa@kernel.org>
What happens if one asks for both? From the patch only the --all-kernel
will stick, right? Is that the behaviour for 'perf record'? Lemme see,
as I recall having this discussion at that time...
Yeah, same thing, and looking at that I wonder why we dong use
perf_evsel__config() in 'perf stat'...
Ok, I'm going to apply it.
> thanks,
> jirka
>
> > ---
> > tools/perf/Documentation/perf-stat.txt | 6 ++++++
> > tools/perf/builtin-stat.c | 6 ++++++
> > tools/perf/util/stat.c | 10 ++++++++++
> > tools/perf/util/stat.h | 2 ++
> > 4 files changed, 24 insertions(+)
> >
> > diff --git a/tools/perf/Documentation/perf-stat.txt b/tools/perf/Documentation/perf-stat.txt
> > index 930c51c01201..a9af4e440e80 100644
> > --- a/tools/perf/Documentation/perf-stat.txt
> > +++ b/tools/perf/Documentation/perf-stat.txt
> > @@ -323,6 +323,12 @@ The output is SMI cycles%, equals to (aperf - unhalted core cycles) / aperf
> >
> > Users who wants to get the actual value can apply --no-metric-only.
> >
> > +--all-kernel::
> > +Configure all used events to run in kernel space.
> > +
> > +--all-user::
> > +Configure all used events to run in user space.
> > +
> > EXAMPLES
> > --------
> >
> > diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
> > index 468fc49420ce..c88d4e118409 100644
> > --- a/tools/perf/builtin-stat.c
> > +++ b/tools/perf/builtin-stat.c
> > @@ -803,6 +803,12 @@ static struct option stat_options[] = {
> > OPT_CALLBACK('M', "metrics", &evsel_list, "metric/metric group list",
> > "monitor specified metrics or metric groups (separated by ,)",
> > parse_metric_groups),
> > + OPT_BOOLEAN_FLAG(0, "all-kernel", &stat_config.all_kernel,
> > + "Configure all used events to run in kernel space.",
> > + PARSE_OPT_EXCLUSIVE),
> > + OPT_BOOLEAN_FLAG(0, "all-user", &stat_config.all_user,
> > + "Configure all used events to run in user space.",
> > + PARSE_OPT_EXCLUSIVE),
> > OPT_END()
> > };
> >
> > diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c
> > index ebdd130557fb..6822e4ffe224 100644
> > --- a/tools/perf/util/stat.c
> > +++ b/tools/perf/util/stat.c
> > @@ -490,6 +490,16 @@ int create_perf_stat_counter(struct evsel *evsel,
> > if (config->identifier)
> > attr->sample_type = PERF_SAMPLE_IDENTIFIER;
> >
> > + if (config->all_user) {
> > + attr->exclude_kernel = 1;
> > + attr->exclude_user = 0;
> > + }
> > +
> > + if (config->all_kernel) {
> > + attr->exclude_kernel = 0;
> > + attr->exclude_user = 1;
> > + }
> > +
> > /*
> > * Disabling all counters initially, they will be enabled
> > * either manually by us or by kernel via enable_on_exec
> > diff --git a/tools/perf/util/stat.h b/tools/perf/util/stat.h
> > index edbeb2f63e8d..081c4a5113c6 100644
> > --- a/tools/perf/util/stat.h
> > +++ b/tools/perf/util/stat.h
> > @@ -106,6 +106,8 @@ struct perf_stat_config {
> > bool big_num;
> > bool no_merge;
> > bool walltime_run_table;
> > + bool all_kernel;
> > + bool all_user;
> > FILE *output;
> > unsigned int interval;
> > unsigned int timeout;
> > --
> > 2.17.1
> >
--
- Arnaldo
next prev parent reply other threads:[~2019-10-14 16:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-11 5:05 Jin Yao
2019-10-14 14:42 ` Jiri Olsa
2019-10-14 16:23 ` Arnaldo Carvalho de Melo [this message]
2019-10-15 1:57 ` Jin, Yao
2019-10-15 15:11 ` Arnaldo Carvalho de Melo
2019-10-16 0:43 ` Jin, Yao
2019-10-21 23:19 ` [tip: perf/core] " tip-bot2 for Jin Yao
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=20191014162339.GN19627@kernel.org \
--to=arnaldo.melo@gmail.com \
--cc=Linux-kernel@vger.kernel.org \
--cc=ak@linux.intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=jolsa@kernel.org \
--cc=jolsa@redhat.com \
--cc=kan.liang@intel.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=yao.jin@intel.com \
--cc=yao.jin@linux.intel.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
Powered by JetHome