3 # Arnaldo Carvalho de Melo <acme@redhat.com>
11 # PERF_BUILDID_DIR environment variable set by perf
12 # path to buildid directory, default to $HOME/.debug
14 if [ -z $PERF_BUILDID_DIR ]; then
15 PERF_BUILDID_DIR
=~
/.debug
/
17 # append / to make substitutions work
18 PERF_BUILDID_DIR
=$PERF_BUILDID_DIR/
21 BUILDIDS
=$
(mktemp
/tmp
/perf-archive-buildids.XXXXXX
)
22 NOBUILDID
=0000000000000000000000000000000000000000
24 perf buildid-list
-i $PERF_DATA --with-hits |
grep -v "^$NOBUILDID " > $BUILDIDS
25 if [ ! -s $BUILDIDS ] ; then
26 echo "perf archive: no build-ids found"
31 MANIFEST
=$
(mktemp
/tmp
/perf-archive-manifest.XXXXXX
)
32 PERF_BUILDID_LINKDIR
=$
(readlink
-f $PERF_BUILDID_DIR)/
34 cut
-d ' ' -f 1 $BUILDIDS | \
35 while read build_id
; do
36 linkname
=$PERF_BUILDID_DIR.build-id
/${build_id:0:2}/${build_id:2}
37 filename
=$
(readlink
-f $linkname)
38 echo ${linkname#$PERF_BUILDID_DIR} >> $MANIFEST
39 echo ${filename#$PERF_BUILDID_LINKDIR} >> $MANIFEST
42 tar cfj
$PERF_DATA.
tar.bz2
-C $PERF_BUILDID_DIR -T $MANIFEST
43 rm -f $MANIFEST $BUILDIDS
44 echo -e "Now please run:\n"
45 echo -e "$ tar xvf $PERF_DATA.tar.bz2 -C ~/.debug\n"
46 echo "wherever you need to run 'perf report' on."