Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Aaron Lewis <aaronlewis@google.com>
To: peterz@infradead.org, mingo@redhat.com, acme@kernel.org,
	 namhyung@kernel.org, mark.rutland@arm.com,
	alexander.shishkin@linux.intel.com,  jolsa@kernel.org,
	irogers@google.com, adrian.hunter@intel.com,
	 james.clark@linaro.org, seanjc@google.com, dmatlack@google.com
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
	bpf@vger.kernel.org,  Aaron Lewis <aaronlewis@google.com>
Subject: [PATCH 0/1] Introduce an instrumented profiler using BpfTrace
Date: Tue, 30 Jun 2026 14:11:51 +0000	[thread overview]
Message-ID: <20260630141152.3757722-1-aaronlewis@google.com> (raw)

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

-- 
2.55.0.rc0.799.gd6f94ed593-goog


             reply	other threads:[~2026-06-30 14:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-30 14:11 Aaron Lewis [this message]
2026-06-30 14:11 ` [PATCH 1/1] tools/bpftrace: Add a simple instrumented kernel profiler Aaron Lewis
2026-06-30 14:23   ` sashiko-bot
2026-06-30 20:56 ` [PATCH 0/1] Introduce an instrumented profiler using BpfTrace Alexei Starovoitov

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=20260630141152.3757722-1-aaronlewis@google.com \
    --to=aaronlewis@google.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=bpf@vger.kernel.org \
    --cc=dmatlack@google.com \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=jolsa@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=seanjc@google.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