Arnaldo Carvalho de Melo | 2c58517 | 2010-01-15 13:17:52 -0200 | [diff] [blame] | 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 |