netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: Song Liu <songliubraving@fb.com>
Cc: netdev@vger.kernel.org, bpf@vger.kernel.org,
	quentin@isovalent.com, kernel-team@fb.com, ast@kernel.org,
	daniel@iogearbox.net, arnaldo.melo@gmail.com, jolsa@kernel.org
Subject: Re: [PATCH v4 bpf-next 1/4] bpftool: introduce "prog profile" command
Date: Wed, 4 Mar 2020 20:21:11 +0100	[thread overview]
Message-ID: <20200304192111.GB168640@krava> (raw)
In-Reply-To: <20200304180710.2677695-2-songliubraving@fb.com>

On Wed, Mar 04, 2020 at 10:07:07AM -0800, Song Liu wrote:
> With fentry/fexit programs, it is possible to profile BPF program with
> hardware counters. Introduce bpftool "prog profile", which measures key
> metrics of a BPF program.
> 
> bpftool prog profile command creates per-cpu perf events. Then it attaches
> fentry/fexit programs to the target BPF program. The fentry program saves
> perf event value to a map. The fexit program reads the perf event again,
> and calculates the difference, which is the instructions/cycles used by
> the target program.
> 
> Example input and output:
> 
>   ./bpftool prog profile id 337 duration 3 cycles instructions llc_misses
> 
>         4228 run_cnt
>      3403698 cycles                                              (84.08%)
>      3525294 instructions   #  1.04 insn per cycle               (84.05%)
>           13 llc_misses     #  3.69 LLC misses per million isns  (83.50%)

FYI I'm in the middle of moving perf's 'events parsing' interface to libperf,
which takes event name/s on input and returns list of perf_event_attr objects

  parse_events("cycles") -> ready to use 'struct perf_event_attr'

You can use any event that's listed in 'perf list' command, which includes
also all vendor (Intel/Arm/ppc..) events. It might be useful extension for
this command.

jirka


  reply	other threads:[~2020-03-04 19:21 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-04 18:07 [PATCH v4 bpf-next 0/4] bpftool: introduce prog profile Song Liu
2020-03-04 18:07 ` [PATCH v4 bpf-next 1/4] bpftool: introduce "prog profile" command Song Liu
2020-03-04 19:21   ` Jiri Olsa [this message]
2020-03-04 21:17     ` Song Liu
2020-03-04 20:38   ` Jiri Olsa
2020-03-05 20:03     ` Song Liu
2020-03-04 18:07 ` [PATCH v4 bpf-next 2/4] bpftool: Documentation for bpftool prog profile Song Liu
2020-03-04 18:07 ` [PATCH v4 bpf-next 3/4] bpftool: bash completion for "bpftool prog profile" Song Liu
2020-03-04 18:07 ` [PATCH v4 bpf-next 4/4] bpftool: fix typo in bash-completion Song Liu
2020-03-04 19:08 ` [PATCH v4 bpf-next 0/4] bpftool: introduce prog profile Jiri Olsa
2020-03-04 20:41   ` Jiri Olsa
2020-03-04 21:16     ` Song Liu
2020-03-04 21:29       ` Jiri Olsa
2020-03-04 21:39         ` Song Liu
2020-03-05 20:03           ` Song Liu
2020-03-06  8:51             ` Jiri Olsa
2020-03-09 18:04           ` Quentin Monnet
2020-03-09 18:24             ` Song Liu
2020-03-09 19:30               ` Jiri Olsa
2020-03-04 19:13 ` Quentin Monnet

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=20200304192111.GB168640@krava \
    --to=jolsa@redhat.com \
    --cc=arnaldo.melo@gmail.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=jolsa@kernel.org \
    --cc=kernel-team@fb.com \
    --cc=netdev@vger.kernel.org \
    --cc=quentin@isovalent.com \
    --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;
as well as URLs for NNTP newsgroup(s).