~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/perf/perf-archive.sh

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /tools/perf/perf-archive.sh (Version linux-6.12-rc7) and /tools/perf/perf-archive.sh (Version linux-4.9.337)


  1 #!/bin/bash                                         1 #!/bin/bash
  2 # SPDX-License-Identifier: GPL-2.0             << 
  3 # perf archive                                      2 # perf archive
  4 # Arnaldo Carvalho de Melo <acme@redhat.com>         3 # Arnaldo Carvalho de Melo <acme@redhat.com>
  5                                                     4 
  6 PERF_DATA=perf.data                                 5 PERF_DATA=perf.data
  7 PERF_SYMBOLS=perf.symbols                      !!   6 if [ $# -ne 0 ] ; then
  8 PERF_ALL=perf.all                              !!   7         PERF_DATA=$1
  9 ALL=0                                          << 
 10 UNPACK=0                                       << 
 11                                                << 
 12 while [ $# -gt 0 ] ; do                        << 
 13         if [ $1 == "--all" ]; then             << 
 14                 ALL=1                          << 
 15                 shift                          << 
 16         elif [ $1 == "--unpack" ]; then        << 
 17                 UNPACK=1                       << 
 18                 shift                          << 
 19         else                                   << 
 20                 PERF_DATA=$1                   << 
 21                 UNPACK_TAR=$1                  << 
 22                 shift                          << 
 23         fi                                     << 
 24 done                                           << 
 25                                                << 
 26 if [ $UNPACK -eq 1 ]; then                     << 
 27         if [ ! -z "$UNPACK_TAR" ]; then        << 
 28                 if [ ! -e "$UNPACK_TAR" ]; the << 
 29                         echo "Provided file $U << 
 30                         exit 1                 << 
 31                 fi                             << 
 32                 TARGET="$UNPACK_TAR"           << 
 33         else                                   << 
 34                 TARGET=`find . -regex "\./perf << 
 35                 TARGET_NUM=`echo -n "$TARGET"  << 
 36                                                << 
 37                 if [ -z "$TARGET" ] || [ $TARG << 
 38                         echo -e "Error: $TARGE << 
 39                         echo "Provide the requ << 
 40                         exit 1                 << 
 41                 else                           << 
 42                         echo "Found target fil << 
 43                 fi                             << 
 44         fi                                     << 
 45                                                << 
 46         if [[ "$TARGET" =~ (\./)?$PERF_ALL.*.t << 
 47                 TAR_CONTENTS=`tar tvf "$TARGET << 
 48                 VALID_TAR=`echo "$TAR_CONTENTS << 
 49                 if [ $VALID_TAR -ne 1 ]; then  << 
 50                         echo "Error: $TARGET f << 
 51                         exit 1                 << 
 52                 fi                             << 
 53                                                << 
 54                 INTERSECT=`comm -12 <(ls) <(ec << 
 55                 if [ ! -z "$INTERSECT" ]; then << 
 56                         echo "File(s) ${INTERS << 
 57                         while true; do         << 
 58                                 read -p 'Do yo << 
 59                                 case $yn in    << 
 60                                         [Yy]*  << 
 61                                         [Nn]*  << 
 62                                         * ) ec << 
 63                                 esac           << 
 64                         done                   << 
 65                 fi                             << 
 66                                                << 
 67                 # unzip the perf.data file in  << 
 68                 tar xvf $TARGET && tar xvf $PE << 
 69                                                << 
 70         else                                   << 
 71                 tar xvf $TARGET -C ~/.debug    << 
 72         fi                                     << 
 73         exit 0                                 << 
 74 fi                                                  8 fi
 75                                                     9 
 76 #                                                  10 #
 77 # PERF_BUILDID_DIR environment variable set by     11 # PERF_BUILDID_DIR environment variable set by perf
 78 # path to buildid directory, default to $HOME/     12 # path to buildid directory, default to $HOME/.debug
 79 #                                                  13 #
 80 if [ -z $PERF_BUILDID_DIR ]; then                  14 if [ -z $PERF_BUILDID_DIR ]; then
 81         PERF_BUILDID_DIR=~/.debug/                 15         PERF_BUILDID_DIR=~/.debug/
 82 else                                               16 else
 83         # append / to make substitutions work      17         # append / to make substitutions work
 84         PERF_BUILDID_DIR=$PERF_BUILDID_DIR/        18         PERF_BUILDID_DIR=$PERF_BUILDID_DIR/
 85 fi                                                 19 fi
 86                                                    20 
 87 BUILDIDS=$(mktemp /tmp/perf-archive-buildids.X     21 BUILDIDS=$(mktemp /tmp/perf-archive-buildids.XXXXXX)
                                                   >>  22 NOBUILDID=0000000000000000000000000000000000000000
 88                                                    23 
 89 perf buildid-list -i $PERF_DATA --with-hits |  !!  24 perf buildid-list -i $PERF_DATA --with-hits | grep -v "^$NOBUILDID " > $BUILDIDS
 90 if [ ! -s $BUILDIDS ] ; then                       25 if [ ! -s $BUILDIDS ] ; then
 91         echo "perf archive: no build-ids found     26         echo "perf archive: no build-ids found"
 92         rm $BUILDIDS || true                       27         rm $BUILDIDS || true
 93         exit 1                                     28         exit 1
 94 fi                                                 29 fi
 95                                                    30 
 96 MANIFEST=$(mktemp /tmp/perf-archive-manifest.X     31 MANIFEST=$(mktemp /tmp/perf-archive-manifest.XXXXXX)
 97 PERF_BUILDID_LINKDIR=$(readlink -f $PERF_BUILD     32 PERF_BUILDID_LINKDIR=$(readlink -f $PERF_BUILDID_DIR)/
 98                                                    33 
 99 cut -d ' ' -f 1 $BUILDIDS | \                      34 cut -d ' ' -f 1 $BUILDIDS | \
100 while read build_id ; do                           35 while read build_id ; do
101         linkname=$PERF_BUILDID_DIR.build-id/${     36         linkname=$PERF_BUILDID_DIR.build-id/${build_id:0:2}/${build_id:2}
102         filename=$(readlink -f $linkname)          37         filename=$(readlink -f $linkname)
103         echo ${linkname#$PERF_BUILDID_DIR} >>      38         echo ${linkname#$PERF_BUILDID_DIR} >> $MANIFEST
104         echo ${filename#$PERF_BUILDID_LINKDIR}     39         echo ${filename#$PERF_BUILDID_LINKDIR} >> $MANIFEST
105 done                                               40 done
106                                                    41 
107 if [ $ALL -eq 1 ]; then                        !!  42 tar cjf $PERF_DATA.tar.bz2 -C $PERF_BUILDID_DIR -T $MANIFEST
108         HOSTNAME=$(hostname)                   !!  43 rm $MANIFEST $BUILDIDS || true
109         DATE=$(date '+%Y%m%d-%H%M%S')          << 
110         tar cjf $PERF_SYMBOLS.tar.bz2 -C $PERF << 
111         tar cjf $PERF_ALL-$HOSTNAME-$DATE.tar. << 
112         rm $PERF_SYMBOLS.tar.bz2 $MANIFEST $BU << 
113 else                                           << 
114         tar cjf $PERF_DATA.tar.bz2 -C $PERF_BU << 
115         rm $MANIFEST $BUILDIDS || true         << 
116 fi                                             << 
117                                                << 
118 echo -e "Now please run:\n"                        44 echo -e "Now please run:\n"
119 echo -e "$ perf archive --unpack\n"            !!  45 echo -e "$ tar xvf $PERF_DATA.tar.bz2 -C ~/.debug\n"
120 echo "or unpack the tar manually wherever you  !!  46 echo "wherever you need to run 'perf report' on."
121 exit 0                                             47 exit 0
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php