Skip to content

bpftool: introduce prog profile

Song Liu bpf netdev 6 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest4 patches 2 repliesIn review
  2. v54 patches 1 replySuperseded
  3. v44 patches 15 repliesSuperseded
Earlier versions · 3
VersionPostedPatchesRepliesStatus
v33 patches3 repliesSuperseded
v22 patches12 repliesSuperseded
v1 RFC4 patches5 repliesSuperseded

Changes in v6 from the cover letter

1. Use new header bpf_tracing.h (Yonghong).

Patches in v6 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4bpftool: introduce "prog profile" commandtools/bpf/bpftool/Makefile tools/bpf/bpftool/prog.c tools/bpf/bpftool/skeleton/profiler.bpf.c +2 more+608 -11 reply
2/4bpftool: Documentation for bpftool prog profiletools/bpf/bpftool/Documentation/bpftool-prog.rst+19 -00 replies
3/4ybpftool: bash completion for "bpftool prog profile"tools/bpf/bpftool/bash-completion/bpftool+44 -10 replies
4/4bpftool: fix typo in bash-completiontools/bpf/bpftool/bash-completion/bpftool+1 -10 replies

Reviews trailers per patch

All 4 patches have a Reviewed-by or Acked-by.

PatchQuentin MonnetYonghong Song
1/4R-b A-b
2/4R-b
3/4R-b
4/4R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v6 thread

Cover letter [PATCH v6 bpf-next 0/4] bpftool: introduce prog profile

This set introduces bpftool prog profile command, which uses hardware counters to profile BPF programs.

This command attaches fentry/fexit programs to a target program. These two programs read hardware counters before and after the target program and calculate the difference.

Changes v5 => v6:
1. Use new header bpf_tracing.h (Yonghong).

Changes v4 => v5:
1. Adjust perf_event_attr for the events (Jiri).

Changes v3 => v4:
1. Simplify err handling in profile_open_perf_events() (Quentin);
2. Remove redundant p_err() (Quentin);
3. Replace tab with space in bash-completion; (Quentin);
4. Fix typo _bpftool_get_map_names => _bpftool_get_prog_names (Quentin).

Changes v2 => v3:
1. Change order of arguments (Quentin), as:
bpftool prog profile PROG [duration DURATION] METRICs
2. Add bash-completion for bpftool prog profile (Quentin);
3. Fix build of selftests (Yonghong);
4. Better handling of bpf_map_lookup_elem() returns (Yonghong);
5. Improve clean up logic of do_profile() (Yonghong);
6. Other smaller fixes/cleanups.

Changes RFC => v2:
1. Use new bpf_program__set_attach_target() API;
2. Update output format to be perf-stat like (Alexei);
3. Incorporate skeleton generation into Makefile;
4. Make DURATION optional and Allow Ctrl-C (Alexei);
5. Add calcated values "insn per cycle" and "LLC misses per million isns".

Song Liu (4):
bpftool: introduce "prog profile" command
bpftool: Documentation for bpftool prog profile
ybpftool: bash completion for "bpftool prog profile"
bpftool: fix typo in bash-completion

 .../bpftool/Documentation/bpftool-prog.rst    |  19 +
 tools/bpf/bpftool/Makefile                    |  18 +
 tools/bpf/bpftool/bash-completion/bpftool     |  47 +-
 tools/bpf/bpftool/prog.c                      | 424 +++++++++++++++++-
 tools/bpf/bpftool/skeleton/profiler.bpf.c     | 119 +++++
 tools/bpf/bpftool/skeleton/profiler.h         |  47 ++
 tools/scripts/Makefile.include                |   1 +
 7 files changed, 672 insertions(+), 3 deletions(-)
 create mode 100644 tools/bpf/bpftool/skeleton/profiler.bpf.c
 create mode 100644 tools/bpf/bpftool/skeleton/profiler.h

--
2.17.1