blob: 910468e6e01cfbcbfffb1619904e307253d8d6b7 [file] [log] [blame]
Arnaldo Carvalho de Melo2c585172010-01-15 13:17:52 -02001#!/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)
Arnaldo Carvalho de Melo66301252010-03-02 15:25:38 -030012NOBUILDID=0000000000000000000000000000000000000000
Arnaldo Carvalho de Melo2c585172010-01-15 13:17:52 -020013
Arnaldo Carvalho de Melo66301252010-03-02 15:25:38 -030014perf buildid-list -i $PERF_DATA --with-hits | grep -v "^$NOBUILDID " > $BUILDIDS
Arnaldo Carvalho de Melo2c585172010-01-15 13:17:52 -020015if [ ! -s $BUILDIDS ] ; then
16 echo "perf archive: no build-ids found"
17 rm -f $BUILDIDS
18 exit 1
19fi
20
21MANIFEST=$(mktemp /tmp/perf-archive-manifest.XXXXXX)
22
23cut -d ' ' -f 1 $BUILDIDS | \
24while read build_id ; do
25 linkname=$DEBUGDIR.build-id/${build_id:0:2}/${build_id:2}
26 filename=$(readlink -f $linkname)
27 echo ${linkname#$DEBUGDIR} >> $MANIFEST
28 echo ${filename#$DEBUGDIR} >> $MANIFEST
29done
30
31tar cfj $PERF_DATA.tar.bz2 -C $DEBUGDIR -T $MANIFEST
32rm -f $MANIFEST $BUILDIDS
33exit 0