diff options
Diffstat (limited to 'tools/perf/perf-archive.sh')
-rw-r--r-- | tools/perf/perf-archive.sh | 32 |
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 | |||
5 | PERF_DATA=perf.data | ||
6 | if [ $# -ne 0 ] ; then | ||
7 | PERF_DATA=$1 | ||
8 | fi | ||
9 | |||
10 | DEBUGDIR=~/.debug/ | ||
11 | BUILDIDS=$(mktemp /tmp/perf-archive-buildids.XXXXXX) | ||
12 | |||
13 | perf buildid-list -i $PERF_DATA --with-hits > $BUILDIDS | ||
14 | if [ ! -s $BUILDIDS ] ; then | ||
15 | echo "perf archive: no build-ids found" | ||
16 | rm -f $BUILDIDS | ||
17 | exit 1 | ||
18 | fi | ||
19 | |||
20 | MANIFEST=$(mktemp /tmp/perf-archive-manifest.XXXXXX) | ||
21 | |||
22 | cut -d ' ' -f 1 $BUILDIDS | \ | ||
23 | while 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 | ||
28 | done | ||
29 | |||
30 | tar cfj $PERF_DATA.tar.bz2 -C $DEBUGDIR -T $MANIFEST | ||
31 | rm -f $MANIFEST $BUILDIDS | ||
32 | exit 0 | ||