public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: Song Liu <songliubraving@fb.com>
Cc: lkml <linux-kernel@vger.kernel.org>,
	Kernel Team <Kernel-team@fb.com>,
	"peterz@infradead.org" <peterz@infradead.org>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"acme@kernel.org" <acme@kernel.org>,
	"mark.rutland@arm.com" <mark.rutland@arm.com>,
	"alexander.shishkin@linux.intel.com" 
	<alexander.shishkin@linux.intel.com>,
	"namhyung@kernel.org" <namhyung@kernel.org>
Subject: Re: [PATCH v3 2/2] perf-stat: enable counting events for BPF programs
Date: Sun, 13 Dec 2020 23:34:55 +0100	[thread overview]
Message-ID: <20201213223455.GA502638@krava> (raw)
In-Reply-To: <FE4D28BB-E0D8-4F33-A6F5-F3FD4D1A3F25@fb.com>

On Thu, Dec 10, 2020 at 12:15:16AM +0000, Song Liu wrote:
> 
> 
> > On Dec 9, 2020, at 9:03 AM, Jiri Olsa <jolsa@redhat.com> wrote:
> > 
> > On Tue, Dec 08, 2020 at 10:16:46AM -0800, Song Liu wrote:
> >> Introduce perf-stat -b option, which counts events for BPF programs, like:
> >> 
> >> [root@localhost ~]# ~/perf stat -e ref-cycles,cycles -b 254 -I 1000
> >>     1.487903822            115,200      ref-cycles
> >>     1.487903822             86,012      cycles
> >>     2.489147029             80,560      ref-cycles
> >>     2.489147029             73,784      cycles
> >>     3.490341825             60,720      ref-cycles
> >>     3.490341825             37,797      cycles
> >>     4.491540887             37,120      ref-cycles
> >>     4.491540887             31,963      cycles
> >> 
> >> The example above counts cycles and ref-cycles of BPF program of id 254.
> >> This is similar to bpftool-prog-profile command, but more flexible.
> >> 
> >> perf-stat -b creates per-cpu perf_event and loads fentry/fexit BPF
> >> programs (monitor-progs) to the target BPF program (target-prog). The
> >> monitor-progs read perf_event before and after the target-prog, and
> >> aggregate the difference in a BPF map. Then the user space reads data
> >> from these maps.
> >> 
> >> A new struct bpf_counter is introduced to provide common interface that
> >> uses BPF programs/maps to count perf events.
> >> 
> >> Signed-off-by: Song Liu <songliubraving@fb.com>
> > 
> > I'm getting this at the end of the compilation:
> > 
> >  LINK     perf
> > rm /home/jolsa/linux-perf/tools/perf/util/bpf_skel/.tmp/bpf_prog_profiler.bpf.o
> > 
> > I guess we can keep it or make it silent somehow
> 
> I also noticed this, but haven't figured out how to silent it. I guess 
> we can fix it out later.

I think this might do it:

.PRECIOUS: $(SKEL_TMP_OUT)/%.bpf.o

SNIP

> >> tools/perf/util/evsel.c                       |  11 +
> >> tools/perf/util/evsel.h                       |   6 +
> >> tools/perf/util/stat-display.c                |   4 +-
> >> tools/perf/util/target.c                      |  34 +-
> >> tools/perf/util/target.h                      |  10 +
> >> 11 files changed, 591 insertions(+), 17 deletions(-)
> >> create mode 100644 tools/perf/util/bpf_counter.c
> >> create mode 100644 tools/perf/util/bpf_counter.h
> >> create mode 100644 tools/perf/util/bpf_skel/bpf_prog_profiler.bpf.c
> > 
> > we need man page update, would be great with some example
> 
> How about we do this in a follow up patch?

sry, we need to add man changes with new option

thanks,
jirka


  reply	other threads:[~2020-12-13 22:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-08 18:16 [PATCH v3 0/2] Introduce perf-stat -b for BPF programs Song Liu
2020-12-08 18:16 ` [PATCH v3 1/2] perf: support build BPF skeletons with perf Song Liu
2020-12-09 17:03   ` Jiri Olsa
2020-12-09 23:32     ` Song Liu
2020-12-08 18:16 ` [PATCH v3 2/2] perf-stat: enable counting events for BPF programs Song Liu
2020-12-09 17:03   ` Jiri Olsa
2020-12-10  0:15     ` Song Liu
2020-12-13 22:34       ` Jiri Olsa [this message]
2020-12-09 17:36 ` [PATCH v3 0/2] Introduce perf-stat -b " Arnaldo Carvalho de Melo
2020-12-09 23:30   ` Song Liu
2020-12-10  0:32     ` 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=20201213223455.GA502638@krava \
    --to=jolsa@redhat.com \
    --cc=Kernel-team@fb.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.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