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