Merge branch 'core-rcu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[deliverable/linux.git] / tools / perf / perf-archive.sh
CommitLineData
2c585174
ACM
1#!/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
45de34bb
SE
10#
11# PERF_BUILDID_DIR environment variable set by perf
12# path to buildid directory, default to $HOME/.debug
13#
14if [ -z $PERF_BUILDID_DIR ]; then
15 PERF_BUILDID_DIR=~/.debug/
16else
17 # append / to make substitutions work
18 PERF_BUILDID_DIR=$PERF_BUILDID_DIR/
19fi
20
2c585174 21BUILDIDS=$(mktemp /tmp/perf-archive-buildids.XXXXXX)
66301254 22NOBUILDID=0000000000000000000000000000000000000000
2c585174 23
66301254 24perf buildid-list -i $PERF_DATA --with-hits | grep -v "^$NOBUILDID " > $BUILDIDS
2c585174
ACM
25if [ ! -s $BUILDIDS ] ; then
26 echo "perf archive: no build-ids found"
73eb422c 27 rm $BUILDIDS || true
2c585174
ACM
28 exit 1
29fi
30
31MANIFEST=$(mktemp /tmp/perf-archive-manifest.XXXXXX)
e3b61933 32PERF_BUILDID_LINKDIR=$(readlink -f $PERF_BUILDID_DIR)/
2c585174
ACM
33
34cut -d ' ' -f 1 $BUILDIDS | \
35while read build_id ; do
45de34bb 36 linkname=$PERF_BUILDID_DIR.build-id/${build_id:0:2}/${build_id:2}
2c585174 37 filename=$(readlink -f $linkname)
45de34bb 38 echo ${linkname#$PERF_BUILDID_DIR} >> $MANIFEST
e3b61933 39 echo ${filename#$PERF_BUILDID_LINKDIR} >> $MANIFEST
2c585174
ACM
40done
41
87ff50a3 42tar cjf $PERF_DATA.tar.bz2 -C $PERF_BUILDID_DIR -T $MANIFEST
73eb422c 43rm $MANIFEST $BUILDIDS || true
88978e56
ACM
44echo -e "Now please run:\n"
45echo -e "$ tar xvf $PERF_DATA.tar.bz2 -C ~/.debug\n"
46echo "wherever you need to run 'perf report' on."
2c585174 47exit 0
This page took 0.271665 seconds and 5 git commands to generate.