From: Jiri Olsa <jolsa@redhat.com>
To: Song Liu <song@kernel.org>
Cc: linux-kernel@vger.kernel.org, kernel-team@fb.com,
acme@kernel.org, acme@redhat.com, namhyung@kernel.org,
jolsa@kernel.org, songliubraving@fb.com
Subject: Re: [PATCH v4 3/4] perf-stat: introduce config stat.bpf-counter-events
Date: Tue, 20 Apr 2021 19:31:18 +0200 [thread overview]
Message-ID: <YH8P5ol5JRr5JO5v@krava> (raw)
In-Reply-To: <20210419203649.164121-4-song@kernel.org>
On Mon, Apr 19, 2021 at 01:36:48PM -0700, Song Liu wrote:
SNIP
> if (stat_config.initial_delay < 0) {
> @@ -784,11 +790,11 @@ static int __run_perf_stat(int argc, const char **argv, int run_idx)
> if (affinity__setup(&affinity) < 0)
> return -1;
>
> - if (target__has_bpf(&target)) {
> - evlist__for_each_entry(evsel_list, counter) {
> - if (bpf_counter__load(counter, &target))
> - return -1;
> - }
> + evlist__for_each_entry(evsel_list, counter) {
> + if (bpf_counter__load(counter, &target))
> + return -1;
> + if (!evsel__is_bpf(counter))
> + all_counters_use_bpf = false;
could be done in bpf_counter__load, check below:
> }
>
> evlist__for_each_cpu (evsel_list, i, cpu) {
> diff --git a/tools/perf/util/bpf_counter.c b/tools/perf/util/bpf_counter.c
> index 5de991ab46af9..33b1888103dfa 100644
> --- a/tools/perf/util/bpf_counter.c
> +++ b/tools/perf/util/bpf_counter.c
> @@ -790,7 +790,8 @@ int bpf_counter__load(struct evsel *evsel, struct target *target)
> {
> if (target->bpf_str)
> evsel->bpf_counter_ops = &bpf_program_profiler_ops;
> - else if (target->use_bpf)
> + else if (target->use_bpf ||
> + evsel__match_bpf_counter_events(evsel->name))
> evsel->bpf_counter_ops = &bperf_ops;
with:
else
all_counters_use_bpf = false;
I was also thinking of oving it to evlist, but it's sat specific,
so I think it's good as static.. thanks for changing the implementation
jirka
>
> if (evsel->bpf_counter_ops)
> diff --git a/tools/perf/util/config.c b/tools/perf/util/config.c
> index 6bcb5ef221f8c..63d472b336de2 100644
> --- a/tools/perf/util/config.c
> +++ b/tools/perf/util/config.c
> @@ -18,6 +18,7 @@
> #include "util/hist.h" /* perf_hist_config */
> #include "util/llvm-utils.h" /* perf_llvm_config */
> #include "util/stat.h" /* perf_stat__set_big_num */
> +#include "util/evsel.h" /* evsel__hw_names, evsel__use_bpf_counters */
> #include "build-id.h"
> #include "debug.h"
> #include "config.h"
> @@ -460,6 +461,9 @@ static int perf_stat_config(const char *var, const char *value)
> if (!strcmp(var, "stat.no-csv-summary"))
> perf_stat__set_no_csv_summary(perf_config_bool(var, value));
>
> + if (!strcmp(var, "stat.bpf-counter-events"))
> + evsel__bpf_counter_events = strdup(value);
> +
> /* Add other config variables here. */
> return 0;
> }
SNIP
next prev parent reply other threads:[~2021-04-20 17:31 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-19 20:36 [PATCH v4 0/4] perf util: bpf perf improvements Song Liu
2021-04-19 20:36 ` [PATCH v4 1/4] perf util: move bpf_perf definitions to a libperf header Song Liu
2021-04-19 20:36 ` [PATCH v4 2/4] perf bpf: check perf_attr_map is compatible with the perf binary Song Liu
2021-04-19 20:36 ` [PATCH v4 3/4] perf-stat: introduce config stat.bpf-counter-events Song Liu
2021-04-20 17:31 ` Jiri Olsa [this message]
2021-04-20 21:21 ` Song Liu
2021-04-21 10:18 ` Jiri Olsa
2021-04-25 14:38 ` Arnaldo Carvalho de Melo
2021-04-25 15:16 ` Jiri Olsa
2021-04-25 19:09 ` Song Liu
2021-04-25 21:45 ` Song Liu
2021-04-19 20:36 ` [PATCH v4 4/4] perf-stat: introduce ':b' modifier Song Liu
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=YH8P5ol5JRr5JO5v@krava \
--to=jolsa@redhat.com \
--cc=acme@kernel.org \
--cc=acme@redhat.com \
--cc=jolsa@kernel.org \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=namhyung@kernel.org \
--cc=song@kernel.org \
--cc=songliubraving@fb.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