~ubuntu-branches/ubuntu/saucy/linux-n900/saucy

« back to all changes in this revision

Viewing changes to tools/perf/perf-archive.sh

  • Committer: Bazaar Package Importer
  • Author(s): Mathieu Poirier
  • Date: 2011-02-18 09:43:31 UTC
  • Revision ID: james.westby@ubuntu.com-20110218094331-eyubsja4f9k0yhmq
Tags: 2.6.35-1.1
Initial release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
NOBUILDID=0000000000000000000000000000000000000000
 
13
 
 
14
perf buildid-list -i $PERF_DATA --with-hits | grep -v "^$NOBUILDID " > $BUILDIDS
 
15
if [ ! -s $BUILDIDS ] ; then
 
16
        echo "perf archive: no build-ids found"
 
17
        rm -f $BUILDIDS
 
18
        exit 1
 
19
fi
 
20
 
 
21
MANIFEST=$(mktemp /tmp/perf-archive-manifest.XXXXXX)
 
22
 
 
23
cut -d ' ' -f 1 $BUILDIDS | \
 
24
while 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
 
29
done
 
30
 
 
31
tar cfj $PERF_DATA.tar.bz2 -C $DEBUGDIR -T $MANIFEST
 
32
rm -f $MANIFEST $BUILDIDS
 
33
echo -e "Now please run:\n"
 
34
echo -e "$ tar xvf $PERF_DATA.tar.bz2 -C ~/.debug\n"
 
35
echo "wherever you need to run 'perf report' on."
 
36
exit 0