mirror of https://github.com/torvalds/linux.git
tools/perf: Add --exclude-buildids option to perf archive command
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>
Link: https://lore.kernel.org/r/20250625161509.2599646-1-tianyou.li@intel.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
This commit is contained in:
parent
e201757f7a
commit
9d8511daf1
|
|
@ -16,6 +16,13 @@ while [ $# -gt 0 ] ; do
|
||||||
elif [ $1 == "--unpack" ]; then
|
elif [ $1 == "--unpack" ]; then
|
||||||
UNPACK=1
|
UNPACK=1
|
||||||
shift
|
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
|
else
|
||||||
PERF_DATA=$1
|
PERF_DATA=$1
|
||||||
UNPACK_TAR=$1
|
UNPACK_TAR=$1
|
||||||
|
|
@ -86,12 +93,30 @@ fi
|
||||||
|
|
||||||
BUILDIDS=$(mktemp /tmp/perf-archive-buildids.XXXXXX)
|
BUILDIDS=$(mktemp /tmp/perf-archive-buildids.XXXXXX)
|
||||||
|
|
||||||
|
#
|
||||||
|
# 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
|
perf buildid-list -i $PERF_DATA --with-hits | grep -v "^ " > $BUILDIDS
|
||||||
if [ ! -s $BUILDIDS ] ; then
|
if [ ! -s "$BUILDIDS" ] ; then
|
||||||
echo "perf archive: no build-ids found"
|
echo "perf archive: no build-ids found"
|
||||||
rm $BUILDIDS || true
|
rm $BUILDIDS || true
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
MANIFEST=$(mktemp /tmp/perf-archive-manifest.XXXXXX)
|
MANIFEST=$(mktemp /tmp/perf-archive-manifest.XXXXXX)
|
||||||
PERF_BUILDID_LINKDIR=$(readlink -f $PERF_BUILDID_DIR)/
|
PERF_BUILDID_LINKDIR=$(readlink -f $PERF_BUILDID_DIR)/
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue