blob: 45fbe2f07b153429b79e8026be785942388b3101 [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)
12
13perf buildid-list -i $PERF_DATA --with-hits > $BUILDIDS
14if [ ! -s $BUILDIDS ] ; then
15 echo "perf archive: no build-ids found"
16 rm -f $BUILDIDS
17 exit 1
18fi
19
20MANIFEST=$(mktemp /tmp/perf-archive-manifest.XXXXXX)
21
22cut -d ' ' -f 1 $BUILDIDS | \
23while 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
28done
29
30tar cfj $PERF_DATA.tar.bz2 -C $DEBUGDIR -T $MANIFEST
31rm -f $MANIFEST $BUILDIDS
32exit 0