Skip to content

Introduce an instrumented profiler using BpfTrace

Aaron Lewis bpf kvm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest1 patch 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/1tools/bpftrace: Add a simple instrumented kernel profilertools/bpftrace/instrumented_profiler/aggregate_bpf_results.py tools/bpftrace/instrumented_profiler/samples/kvm_trace.bt tools/bpftrace/instrumented_profiler/samples/vfio_trace.bt+830 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/1] Introduce an instrumented profiler using BpfTrace

I am proposing this patch as a simple way of turning BpfTrace into an instrumented profiler. This approach has come in handy for me more than once, so I felt like it could be useful for others as well.

I am not entirely sure where something like this should live in the kernel tree, so I took a chance and put it in "tools/bpftrace/instrumented_profiler". I am not attached to this location, so please feel free to recommend a better place for it to live if this doesn't seem appropriate.

I have included two samples as examples of how a trace can be set up (kvm_trace.bt and vfio_trace.bt). The included Python script then runs over the output of these traces to generate the final profiler results. Example output can be seen in the patch itself.

Aaron Lewis (1):
tools/bpftrace: Add a simple instrumented kernel profiler

 .../aggregate_bpf_results.py                  | 318 ++++++++++++++++++
 .../samples/kvm_trace.bt                      | 197 +++++++++++
 .../samples/vfio_trace.bt                     | 315 +++++++++++++++++
 3 files changed, 830 insertions(+)
 create mode 100644 tools/bpftrace/instrumented_profiler/aggregate_bpf_results.py
 create mode 100644 tools/bpftrace/instrumented_profiler/samples/kvm_trace.bt
 create mode 100644 tools/bpftrace/instrumented_profiler/samples/vfio_trace.bt
Signature · 1 line
2.55.0.rc0.799.gd6f94ed593-goog