Blame view

kernel/linux-imx6_3.14.28/tools/perf/perf-archive.sh 1.27 KB
6b13f685e   김민수   BSP 최초 추가
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
  #!/bin/bash
  # perf archive
  # Arnaldo Carvalho de Melo <acme@redhat.com>
  
  PERF_DATA=perf.data
  if [ $# -ne 0 ] ; then
  	PERF_DATA=$1
  fi
  
  #
  # PERF_BUILDID_DIR environment variable set by perf
  # path to buildid directory, default to $HOME/.debug
  #
  if [ -z $PERF_BUILDID_DIR ]; then
  	PERF_BUILDID_DIR=~/.debug/
  else
          # append / to make substitutions work
          PERF_BUILDID_DIR=$PERF_BUILDID_DIR/
  fi
  
  BUILDIDS=$(mktemp /tmp/perf-archive-buildids.XXXXXX)
  NOBUILDID=0000000000000000000000000000000000000000
  
  perf buildid-list -i $PERF_DATA --with-hits | grep -v "^$NOBUILDID " > $BUILDIDS
  if [ ! -s $BUILDIDS ] ; then
  	echo "perf archive: no build-ids found"
  	rm $BUILDIDS || true
  	exit 1
  fi
  
  MANIFEST=$(mktemp /tmp/perf-archive-manifest.XXXXXX)
  PERF_BUILDID_LINKDIR=$(readlink -f $PERF_BUILDID_DIR)/
  
  cut -d ' ' -f 1 $BUILDIDS | \
  while read build_id ; do
  	linkname=$PERF_BUILDID_DIR.build-id/${build_id:0:2}/${build_id:2}
  	filename=$(readlink -f $linkname)
  	echo ${linkname#$PERF_BUILDID_DIR} >> $MANIFEST
  	echo ${filename#$PERF_BUILDID_LINKDIR} >> $MANIFEST
  done
  
  tar cjf $PERF_DATA.tar.bz2 -C $PERF_BUILDID_DIR -T $MANIFEST
  rm $MANIFEST $BUILDIDS || true
  echo -e "Now please run:
  "
  echo -e "$ tar xvf $PERF_DATA.tar.bz2 -C ~/.debug
  "
  echo "wherever you need to run 'perf report' on."
  exit 0