aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/perf-archive.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/perf-archive.sh')
-rw-r--r--tools/perf/perf-archive.sh32
1 files changed, 32 insertions, 0 deletions
diff --git a/tools/perf/perf-archive.sh b/tools/perf/perf-archive.sh
new file mode 100644
index 000000000000..45fbe2f07b15
--- /dev/null
+++ b/tools/perf/perf-archive.sh
@@ -0,0 +1,32 @@
1#!/bin/bash
2# perf archive
3# Arnaldo Carvalho de Melo <acme@redhat.com>
4
5PERF_DATA=perf.data
6if [ $# -ne 0 ] ; then
7 PERF_DATA=$1
8fi
9
10DEBUGDIR=~/.debug/
11BUILDIDS=$(mktemp /tmp/perf-archive-buildids.XXXXXX)
12
13perf buildid-list -i $PERF_DATA --with-hits > $BUILDIDS
14if [ ! -s $BUILDIDS ] ; then
15 echo "perf archive: no build-ids found"
16 rm -f $BUILDIDS
17 exit 1
18fi
19
20MANIFEST=$(mktemp /tmp/perf-archive-manifest.XXXXXX)
21
22cut -d ' ' -f 1 $BUILDIDS | \
23while read build_id ; do
24 linkname=$DEBUGDIR.build-id/${build_id:0:2}/${build_id:2}
25 filename=$(readlink -f $linkname)
26 echo ${linkname#$DEBUGDIR} >> $MANIFEST
27 echo ${filename#$DEBUGDIR} >> $MANIFEST
28done
29
30tar cfj $PERF_DATA.tar.bz2 -C $DEBUGDIR -T $MANIFEST
31rm -f $MANIFEST $BUILDIDS
32exit 0