Blame SOURCES/perf-archive

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