dingjian / rpms / kernel-rt

Forked from rpms/kernel-rt 4 years ago
Clone

Blame SOURCES/perf-archive

ab7326
#!/bin/bash
ab7326
# perf archive
ab7326
# Arnaldo Carvalho de Melo <acme@redhat.com>
ab7326
ab7326
PERF_DATA=perf.data
ab7326
if [ $# -ne 0 ] ; then
ab7326
	PERF_DATA=$1
ab7326
fi
ab7326
ab7326
DEBUGDIR=~/.debug/
ab7326
BUILDIDS=$(mktemp /tmp/perf-archive-buildids.XXXXXX)
ab7326
NOBUILDID=0000000000000000000000000000000000000000
ab7326
ab7326
perf buildid-list -i $PERF_DATA --with-hits | grep -v "^$NOBUILDID " > $BUILDIDS
ab7326
if [ ! -s $BUILDIDS ] ; then
ab7326
	echo "perf archive: no build-ids found"
ab7326
	rm -f $BUILDIDS
ab7326
	exit 1
ab7326
fi
ab7326
ab7326
MANIFEST=$(mktemp /tmp/perf-archive-manifest.XXXXXX)
ab7326
ab7326
cut -d ' ' -f 1 $BUILDIDS | \
ab7326
while read build_id ; do
ab7326
	linkname=$DEBUGDIR.build-id/${build_id:0:2}/${build_id:2}
ab7326
	filename=$(readlink -f $linkname)
ab7326
	echo ${linkname#$DEBUGDIR} >> $MANIFEST
ab7326
	echo ${filename#$DEBUGDIR} >> $MANIFEST
ab7326
done
ab7326
ab7326
tar cfj $PERF_DATA.tar.bz2 -C $DEBUGDIR -T $MANIFEST
ab7326
rm -f $MANIFEST $BUILDIDS
ab7326
exit 0