* [PATCH V2] tools/perf: Add --exclude-buildids option to perf archive command
[not found] <aFrzSpvzzWeHdyJ5 () google ! com>
@ 2025-06-25 16:14 ` Tianyou Li
2025-06-27 18:53 ` Namhyung Kim
0 siblings, 1 reply; 3+ messages in thread
From: Tianyou Li @ 2025-06-25 16:14 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim
Cc: Mark Rutland, Alexander Shishkin, Jiri Olsa, Ian Rogers,
Adrian Hunter, Kan Liang, tianyou.li, wangyang.guo,
linux-perf-users, linux-kernel
When make a perf archive, it may contains the binaries that user did not want to ship with,
add --exclude-buildids option to specify a file which contains the buildids need to be
excluded. The file can be generated from command:
perf buildid-list -i perf.data --with-hits | grep -v "^ " > exclude-buildids.txt
Then remove the lines from the exclude-buildids.txt for buildids should be included.
Signed-off-by: Tianyou Li <tianyou.li@intel.com>
Reviewed-by: Wangyang Guo <wangyang.guo@intel.com>
---
tools/perf/perf-archive.sh | 35 ++++++++++++++++++++++++++++++-----
1 file changed, 30 insertions(+), 5 deletions(-)
diff --git a/tools/perf/perf-archive.sh b/tools/perf/perf-archive.sh
index 6ed7e52ab881..7977e9b0a5ea 100755
--- a/tools/perf/perf-archive.sh
+++ b/tools/perf/perf-archive.sh
@@ -16,6 +16,13 @@ while [ $# -gt 0 ] ; do
elif [ $1 == "--unpack" ]; then
UNPACK=1
shift
+ elif [ $1 == "--exclude-buildids" ]; then
+ EXCLUDE_BUILDIDS="$2"
+ if [ ! -e "$EXCLUDE_BUILDIDS" ]; then
+ echo "Provided exclude-buildids file $EXCLUDE_BUILDIDS does not exist"
+ exit 1
+ fi
+ shift 2
else
PERF_DATA=$1
UNPACK_TAR=$1
@@ -86,11 +93,29 @@ fi
BUILDIDS=$(mktemp /tmp/perf-archive-buildids.XXXXXX)
-perf buildid-list -i $PERF_DATA --with-hits | grep -v "^ " > $BUILDIDS
-if [ ! -s $BUILDIDS ] ; then
- echo "perf archive: no build-ids found"
- rm $BUILDIDS || true
- exit 1
+#
+# EXCLUDE_BUILDIDS is an optional file that contains build-ids to be excluded from the
+# archive. It is a list of build-ids, one per line, without any leading or trailing spaces.
+# If the file is empty, all build-ids will be included in the archive. To create a exclude-
+# buildids file, you can use the following command:
+# perf buildid-list -i perf.data --with-hits | grep -v "^ " > exclude_buildids.txt
+# You can edit the file to remove the lines that you want to keep in the archive, then:
+# perf archive --exclude-buildids exclude_buildids.txt
+#
+if [ -s "$EXCLUDE_BUILDIDS" ]; then
+ perf buildid-list -i $PERF_DATA --with-hits | grep -v "^ " | grep -Fv -f $EXCLUDE_BUILDIDS > $BUILDIDS
+ if [ ! -s "$BUILDIDS" ] ; then
+ echo "perf archive: no build-ids found after applying exclude-buildids file"
+ rm $BUILDIDS || true
+ exit 1
+ fi
+else
+ perf buildid-list -i $PERF_DATA --with-hits | grep -v "^ " > $BUILDIDS
+ if [ ! -s "$BUILDIDS" ] ; then
+ echo "perf archive: no build-ids found"
+ rm $BUILDIDS || true
+ exit 1
+ fi
fi
MANIFEST=$(mktemp /tmp/perf-archive-manifest.XXXXXX)
--
2.47.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH V2] tools/perf: Add --exclude-buildids option to perf archive command
2025-06-25 16:14 ` [PATCH V2] tools/perf: Add --exclude-buildids option to perf archive command Tianyou Li
@ 2025-06-27 18:53 ` Namhyung Kim
2025-06-30 1:36 ` Li, Tianyou
0 siblings, 1 reply; 3+ messages in thread
From: Namhyung Kim @ 2025-06-27 18:53 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo, Tianyou Li
Cc: Mark Rutland, Alexander Shishkin, Jiri Olsa, Ian Rogers,
Adrian Hunter, Kan Liang, wangyang.guo, linux-perf-users,
linux-kernel
On Thu, 26 Jun 2025 00:14:01 +0800, Tianyou Li wrote:
> When make a perf archive, it may contains the binaries that user did not want to ship with,
> add --exclude-buildids option to specify a file which contains the buildids need to be
> excluded. The file can be generated from command:
>
> perf buildid-list -i perf.data --with-hits | grep -v "^ " > exclude-buildids.txt
>
> Then remove the lines from the exclude-buildids.txt for buildids should be included.
>
> [...]
Applied to perf-tools-next, thanks!
Best regards,
Namhyung
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH V2] tools/perf: Add --exclude-buildids option to perf archive command
2025-06-27 18:53 ` Namhyung Kim
@ 2025-06-30 1:36 ` Li, Tianyou
0 siblings, 0 replies; 3+ messages in thread
From: Li, Tianyou @ 2025-06-30 1:36 UTC (permalink / raw)
To: Namhyung Kim, Peter Zijlstra, Ingo Molnar,
Arnaldo Carvalho de Melo
Cc: Mark Rutland, Alexander Shishkin, Jiri Olsa, Ian Rogers,
Hunter, Adrian, Kan Liang, Guo, Wangyang,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Thanks Namhyung, very appreciated for your review.
Regards,
Tianyou
-----Original Message-----
From: Namhyung Kim <namhyung@kernel.org>
Sent: Saturday, June 28, 2025 2:53 AM
To: Peter Zijlstra <peterz@infradead.org>; Ingo Molnar <mingo@redhat.com>; Arnaldo Carvalho de Melo <acme@kernel.org>; Li, Tianyou <tianyou.li@intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>; Alexander Shishkin <alexander.shishkin@linux.intel.com>; Jiri Olsa <jolsa@kernel.org>; Ian Rogers <irogers@google.com>; Hunter, Adrian <adrian.hunter@intel.com>; Kan Liang <kan.liang@linux.intel.com>; Guo, Wangyang <wangyang.guo@intel.com>; linux-perf-users@vger.kernel.org; linux-kernel@vger.kernel.org
Subject: Re: [PATCH V2] tools/perf: Add --exclude-buildids option to perf archive command
On Thu, 26 Jun 2025 00:14:01 +0800, Tianyou Li wrote:
> When make a perf archive, it may contains the binaries that user did
> not want to ship with, add --exclude-buildids option to specify a file
> which contains the buildids need to be excluded. The file can be generated from command:
>
> perf buildid-list -i perf.data --with-hits | grep -v "^ " >
> exclude-buildids.txt
>
> Then remove the lines from the exclude-buildids.txt for buildids should be included.
>
> [...]
Applied to perf-tools-next, thanks!
Best regards,
Namhyung
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-06-30 1:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <aFrzSpvzzWeHdyJ5 () google ! com>
2025-06-25 16:14 ` [PATCH V2] tools/perf: Add --exclude-buildids option to perf archive command Tianyou Li
2025-06-27 18:53 ` Namhyung Kim
2025-06-30 1:36 ` Li, Tianyou
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).