From: Andi Kleen <ak@linux.intel.com>
To: namhyung@kernel.org
Cc: acme@kernel.org, linux-perf-users@vger.kernel.org,
Andi Kleen <ak@linux.intel.com>
Subject: [PATCH v2 2/4] perf tools top: Add --weight option
Date: Thu, 13 Aug 2026 14:10:08 -0700 [thread overview]
Message-ID: <20260813211109.240689-3-ak@linux.intel.com> (raw)
In-Reply-To: <20260813211109.240689-1-ak@linux.intel.com>
Add a -W/--weight option to perf top to collect weights too. Useful with
follow on patches.
Assisted-by: omp:GPT-5.6-Luna
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
tools/perf/Documentation/perf-top.txt | 6 ++++++
tools/perf/builtin-top.c | 2 ++
2 files changed, 8 insertions(+)
diff --git a/tools/perf/Documentation/perf-top.txt b/tools/perf/Documentation/perf-top.txt
index af3e4230c72f..2da2a16bbf26 100644
--- a/tools/perf/Documentation/perf-top.txt
+++ b/tools/perf/Documentation/perf-top.txt
@@ -25,6 +25,12 @@ OPTIONS
--count=<count>::
Event period to sample.
+-W::
+--weight::
+Enable weighted sampling. One or more additional weights can be recorded per sample
+and can be displayed with the weight, weight2, weight3 and local_weight sort keys.
+Possible uses for weights are memory or instruction retirement latencies.
+
-C <cpu-list>::
--cpu=<cpu>::
Monitor only on the list of CPUs provided. Multiple CPUs can be provided as a
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 570410599f1b..2888ac3b7b92 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -1493,6 +1493,8 @@ int cmd_top(int argc, const char **argv)
OPT_CALLBACK(0, "filter", &top.evlist, "filter",
"event filter", parse_filter),
OPT_U64('c', "count", &opts->user_interval, "event period to sample"),
+ OPT_BOOLEAN('W', "weight", &opts->sample_weight,
+ "sample by weight (on special events only)"),
OPT_STRING('p', "pid", &target->pid, "pid",
"profile events on existing process id"),
OPT_STRING('t', "tid", &target->tid, "tid",
--
2.55.0
next prev parent reply other threads:[~2026-08-13 21:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-13 21:10 Updated patchkit to show weights in annotation Andi Kleen
2026-08-13 21:10 ` [PATCH v2 1/4] perf tools record: Modernize -W man page Andi Kleen
2026-08-13 21:10 ` Andi Kleen [this message]
2026-08-13 21:10 ` [PATCH v2 3/4] perf tools: Add support for displaying weights in annotate Andi Kleen
2026-08-13 21:10 ` [PATCH v2 4/4] perf tools: Add test for weight annotation Andi Kleen
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=20260813211109.240689-3-ak@linux.intel.com \
--to=ak@linux.intel.com \
--cc=acme@kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=namhyung@kernel.org \
/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