Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf tools: Use "grep -E" instead of "egrep"

The latest version of grep claims the egrep is now obsolete so the build
now contains warnings that look like:

egrep: warning: egrep is obsolescent; using grep -E

fix this up by moving the related file to use "grep -E" instead.

sed -i "s/egrep/grep -E/g" `grep egrep -rwl tools/perf`

Here are the steps to install the latest grep:

wget http://ftp.gnu.org/gnu/grep/grep-3.8.tar.gz
tar xf grep-3.8.tar.gz
cd grep-3.8 && ./configure && make
sudo make install
export PATH=/usr/local/bin:$PATH

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Acked-by: Ian Rogers <irogers@google.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lore.kernel.org/lkml/1668762999-9297-1-git-send-email-yangtiezhu@loongson.cn
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Tiezhu Yang and committed by
Arnaldo Carvalho de Melo
818448e9 c587e77e

+89 -89
+1 -1
tools/perf/Makefile
··· 25 25 # (To override it, run 'make JOBS=1' and similar.) 26 26 # 27 27 ifeq ($(JOBS),) 28 - JOBS := $(shell (getconf _NPROCESSORS_ONLN || egrep -c '^processor|^CPU[0-9]' /proc/cpuinfo) 2>/dev/null) 28 + JOBS := $(shell (getconf _NPROCESSORS_ONLN || grep -E -c '^processor|^CPU[0-9]' /proc/cpuinfo) 2>/dev/null) 29 29 ifeq ($(JOBS),0) 30 30 JOBS := 1 31 31 endif
+1 -1
tools/perf/builtin-trace.c
··· 1727 1727 len >= 2 && strcmp(field->name + len - 2, "fd") == 0) { 1728 1728 /* 1729 1729 * /sys/kernel/tracing/events/syscalls/sys_enter* 1730 - * egrep 'field:.*fd;' .../format|sed -r 's/.*field:([a-z ]+) [a-z_]*fd.+/\1/g'|sort|uniq -c 1730 + * grep -E 'field:.*fd;' .../format|sed -r 's/.*field:([a-z ]+) [a-z_]*fd.+/\1/g'|sort|uniq -c 1731 1731 * 65 int 1732 1732 * 23 unsigned int 1733 1733 * 7 unsigned long
+1 -1
tools/perf/tests/make
··· 29 29 PARALLEL_OPT= 30 30 ifeq ($(SET_PARALLEL),1) 31 31 ifeq ($(JOBS),) 32 - cores := $(shell (getconf _NPROCESSORS_ONLN || egrep -c '^processor|^CPU[0-9]' /proc/cpuinfo) 2>/dev/null) 32 + cores := $(shell (getconf _NPROCESSORS_ONLN || grep -E -c '^processor|^CPU[0-9]' /proc/cpuinfo) 2>/dev/null) 33 33 ifeq ($(cores),0) 34 34 cores := 1 35 35 endif
+2 -2
tools/perf/tests/shell/lib/probe_vfs_getname.sh
··· 12 12 add_probe_vfs_getname() { 13 13 local verbose=$1 14 14 if [ $had_vfs_getname -eq 1 ] ; then 15 - line=$(perf probe -L getname_flags 2>&1 | egrep 'result.*=.*filename;' | sed -r 's/[[:space:]]+([[:digit:]]+)[[:space:]]+result->uptr.*/\1/') 15 + line=$(perf probe -L getname_flags 2>&1 | grep -E 'result.*=.*filename;' | sed -r 's/[[:space:]]+([[:digit:]]+)[[:space:]]+result->uptr.*/\1/') 16 16 perf probe -q "vfs_getname=getname_flags:${line} pathname=result->name:string" || \ 17 17 perf probe $verbose "vfs_getname=getname_flags:${line} pathname=filename:ustring" 18 18 fi 19 19 } 20 20 21 21 skip_if_no_debuginfo() { 22 - add_probe_vfs_getname -v 2>&1 | egrep -q "^(Failed to find the path for the kernel|Debuginfo-analysis is not supported)|(file has no debug information)" && return 2 22 + add_probe_vfs_getname -v 2>&1 | grep -E -q "^(Failed to find the path for the kernel|Debuginfo-analysis is not supported)|(file has no debug information)" && return 2 23 23 return 1 24 24 }
+1 -1
tools/perf/tests/shell/record+probe_libc_inet_pton.sh
··· 64 64 while read line <&3 && read -r pattern <&4; do 65 65 [ -z "$pattern" ] && break 66 66 echo $line 67 - echo "$line" | egrep -q "$pattern" 67 + echo "$line" | grep -E -q "$pattern" 68 68 if [ $? -ne 0 ] ; then 69 69 printf "FAIL: expected backtrace entry \"%s\" got \"%s\"\n" "$pattern" "$line" 70 70 return 1
+1 -1
tools/perf/tests/shell/record+script_probe_vfs_getname.sh
··· 23 23 perf_script_filenames() { 24 24 echo "Looking at perf.data file for vfs_getname records for the file we touched:" 25 25 perf script -i ${perfdata} | \ 26 - egrep " +touch +[0-9]+ +\[[0-9]+\] +[0-9]+\.[0-9]+: +probe:vfs_getname[_0-9]*: +\([[:xdigit:]]+\) +pathname=\"${file}\"" 26 + grep -E " +touch +[0-9]+ +\[[0-9]+\] +[0-9]+\.[0-9]+: +probe:vfs_getname[_0-9]*: +\([[:xdigit:]]+\) +pathname=\"${file}\"" 27 27 } 28 28 29 29 add_probe_vfs_getname || skip_if_no_debuginfo
+1 -1
tools/perf/tests/shell/record_offcpu.sh
··· 51 51 err=1 52 52 return 53 53 fi 54 - if ! perf report -i ${perfdata} -q --percent-limit=90 | egrep -q sleep 54 + if ! perf report -i ${perfdata} -q --percent-limit=90 | grep -E -q sleep 55 55 then 56 56 echo "Basic off-cpu test [Failed missing output]" 57 57 err=1
+5 -5
tools/perf/tests/shell/stat.sh
··· 7 7 err=0 8 8 test_default_stat() { 9 9 echo "Basic stat command test" 10 - if ! perf stat true 2>&1 | egrep -q "Performance counter stats for 'true':" 10 + if ! perf stat true 2>&1 | grep -E -q "Performance counter stats for 'true':" 11 11 then 12 12 echo "Basic stat command test [Failed]" 13 13 err=1 ··· 19 19 test_stat_record_report() { 20 20 echo "stat record and report test" 21 21 if ! perf stat record -o - true | perf stat report -i - 2>&1 | \ 22 - egrep -q "Performance counter stats for 'pipe':" 22 + grep -E -q "Performance counter stats for 'pipe':" 23 23 then 24 24 echo "stat record and report test [Failed]" 25 25 err=1 ··· 55 55 echo "Topdown event group test [Skipped event parsing failed]" 56 56 return 57 57 fi 58 - if perf stat -e '{slots,topdown-retiring}' true 2>&1 | egrep -q "<not supported>" 58 + if perf stat -e '{slots,topdown-retiring}' true 2>&1 | grep -E -q "<not supported>" 59 59 then 60 60 echo "Topdown event group test [Failed events not supported]" 61 61 err=1 62 62 return 63 63 fi 64 - if perf stat -e '{topdown-retiring,slots}' true 2>&1 | egrep -q "<not supported>" 64 + if perf stat -e '{topdown-retiring,slots}' true 2>&1 | grep -E -q "<not supported>" 65 65 then 66 66 echo "Topdown event group test [Failed slots not reordered first]" 67 67 err=1 ··· 82 82 return 83 83 fi 84 84 group_needs_break="{slots,topdown-bad-spec,topdown-be-bound,topdown-fe-bound,topdown-retiring,branch-instructions,branch-misses,bus-cycles,cache-misses,cache-references,cpu-cycles,instructions,mem-loads,mem-stores,ref-cycles,cache-misses,cache-references}:W" 85 - if perf stat --no-merge -e "$group_needs_break" true 2>&1 | egrep -q "<not supported>" 85 + if perf stat --no-merge -e "$group_needs_break" true 2>&1 | grep -E -q "<not supported>" 86 86 then 87 87 echo "Topdown weak groups test [Failed events not supported]" 88 88 err=1
+4 -4
tools/perf/tests/shell/test_arm_coresight.sh
··· 49 49 # touch 6512 1 branches:u: ffffb22082e0 strcmp+0xa0 (/lib/aarch64-linux-gnu/ld-2.27.so) 50 50 # touch 6512 1 branches:u: ffffb2208320 strcmp+0xe0 (/lib/aarch64-linux-gnu/ld-2.27.so) 51 51 perf script -F,-time -i ${perfdata} 2>&1 | \ 52 - egrep " +$1 +[0-9]+ .* +branches:(.*:)? +" > /dev/null 2>&1 52 + grep -E " +$1 +[0-9]+ .* +branches:(.*:)? +" > /dev/null 2>&1 53 53 } 54 54 55 55 perf_report_branch_samples() { ··· 60 60 # 7.71% 7.71% touch libc-2.27.so [.] getenv 61 61 # 2.59% 2.59% touch ld-2.27.so [.] strcmp 62 62 perf report --stdio -i ${perfdata} 2>&1 | \ 63 - egrep " +[0-9]+\.[0-9]+% +[0-9]+\.[0-9]+% +$1 " > /dev/null 2>&1 63 + grep -E " +[0-9]+\.[0-9]+% +[0-9]+\.[0-9]+% +$1 " > /dev/null 2>&1 64 64 } 65 65 66 66 perf_report_instruction_samples() { ··· 71 71 # 5.80% touch libc-2.27.so [.] getenv 72 72 # 4.35% touch ld-2.27.so [.] _dl_fixup 73 73 perf report --itrace=i20i --stdio -i ${perfdata} 2>&1 | \ 74 - egrep " +[0-9]+\.[0-9]+% +$1" > /dev/null 2>&1 74 + grep -E " +[0-9]+\.[0-9]+% +$1" > /dev/null 2>&1 75 75 } 76 76 77 77 arm_cs_report() { ··· 87 87 # If the node of "enable_sink" is existed under the device path, this 88 88 # means the device is a sink device. Need to exclude 'tpiu' since it 89 89 # cannot support perf PMU. 90 - echo "$1" | egrep -q -v "tpiu" 90 + echo "$1" | grep -E -q -v "tpiu" 91 91 92 92 if [ $? -eq 0 -a -e "$1/enable_sink" ]; then 93 93
+3 -3
tools/perf/tests/shell/test_arm_spe.sh
··· 9 9 # German Gomez <german.gomez@arm.com>, 2021 10 10 11 11 skip_if_no_arm_spe_event() { 12 - perf list | egrep -q 'arm_spe_[0-9]+//' && return 0 12 + perf list | grep -E -q 'arm_spe_[0-9]+//' && return 0 13 13 14 14 # arm_spe event doesn't exist 15 15 return 2 ··· 51 51 # dd 3048 [002] 1 tlb-access: ffffaa64999c __GI___libc_write+0x3c (/lib/aarch64-linux-gnu/libc-2.27.so) 52 52 # dd 3048 [002] 1 memory: ffffaa64999c __GI___libc_write+0x3c (/lib/aarch64-linux-gnu/libc-2.27.so) 53 53 perf script -F,-time -i ${perfdata} 2>&1 | \ 54 - egrep " +$1 +[0-9]+ .* +${events}:(.*:)? +" > /dev/null 2>&1 54 + grep -E " +$1 +[0-9]+ .* +${events}:(.*:)? +" > /dev/null 2>&1 55 55 } 56 56 57 57 perf_report_samples() { ··· 62 62 # 7.71% 7.71% dd libc-2.27.so [.] getenv 63 63 # 2.59% 2.59% dd ld-2.27.so [.] strcmp 64 64 perf report --stdio -i ${perfdata} 2>&1 | \ 65 - egrep " +[0-9]+\.[0-9]+% +[0-9]+\.[0-9]+% +$1 " > /dev/null 2>&1 65 + grep -E " +[0-9]+\.[0-9]+% +[0-9]+\.[0-9]+% +$1 " > /dev/null 2>&1 66 66 } 67 67 68 68 arm_spe_snapshot_test() {
+1 -1
tools/perf/tests/shell/test_arm_spe_fork.sh
··· 5 5 # German Gomez <german.gomez@arm.com>, 2022 6 6 7 7 skip_if_no_arm_spe_event() { 8 - perf list | egrep -q 'arm_spe_[0-9]+//' && return 0 8 + perf list | grep -E -q 'arm_spe_[0-9]+//' && return 0 9 9 return 2 10 10 } 11 11
+9 -9
tools/perf/tests/shell/test_brstack.sh
··· 30 30 # brstack_foo+0x14/brstack_bar+0x40/P/-/-/0/CALL 31 31 32 32 set -x 33 - egrep -m1 "^brstack_bench\+[^ ]*/brstack_foo\+[^ ]*/IND_CALL$" $TMPDIR/perf.script 34 - egrep -m1 "^brstack_foo\+[^ ]*/brstack_bar\+[^ ]*/CALL$" $TMPDIR/perf.script 35 - egrep -m1 "^brstack_bench\+[^ ]*/brstack_foo\+[^ ]*/CALL$" $TMPDIR/perf.script 36 - egrep -m1 "^brstack_bench\+[^ ]*/brstack_bar\+[^ ]*/CALL$" $TMPDIR/perf.script 37 - egrep -m1 "^brstack_bar\+[^ ]*/brstack_foo\+[^ ]*/RET$" $TMPDIR/perf.script 38 - egrep -m1 "^brstack_foo\+[^ ]*/brstack_bench\+[^ ]*/RET$" $TMPDIR/perf.script 39 - egrep -m1 "^brstack_bench\+[^ ]*/brstack_bench\+[^ ]*/COND$" $TMPDIR/perf.script 40 - egrep -m1 "^brstack\+[^ ]*/brstack\+[^ ]*/UNCOND$" $TMPDIR/perf.script 33 + grep -E -m1 "^brstack_bench\+[^ ]*/brstack_foo\+[^ ]*/IND_CALL$" $TMPDIR/perf.script 34 + grep -E -m1 "^brstack_foo\+[^ ]*/brstack_bar\+[^ ]*/CALL$" $TMPDIR/perf.script 35 + grep -E -m1 "^brstack_bench\+[^ ]*/brstack_foo\+[^ ]*/CALL$" $TMPDIR/perf.script 36 + grep -E -m1 "^brstack_bench\+[^ ]*/brstack_bar\+[^ ]*/CALL$" $TMPDIR/perf.script 37 + grep -E -m1 "^brstack_bar\+[^ ]*/brstack_foo\+[^ ]*/RET$" $TMPDIR/perf.script 38 + grep -E -m1 "^brstack_foo\+[^ ]*/brstack_bench\+[^ ]*/RET$" $TMPDIR/perf.script 39 + grep -E -m1 "^brstack_bench\+[^ ]*/brstack_bench\+[^ ]*/COND$" $TMPDIR/perf.script 40 + grep -E -m1 "^brstack\+[^ ]*/brstack\+[^ ]*/UNCOND$" $TMPDIR/perf.script 41 41 set +x 42 42 43 43 # some branch types are still not being tested: ··· 57 57 58 58 # fail if we find any branch type that doesn't match any of the expected ones 59 59 # also consider UNKNOWN branch types (-) 60 - if egrep -vm1 "^[^ ]*/($expect|-|( *))$" $TMPDIR/perf.script; then 60 + if grep -E -vm1 "^[^ ]*/($expect|-|( *))$" $TMPDIR/perf.script; then 61 61 return 1 62 62 fi 63 63 }
+2 -2
tools/perf/tests/shell/test_data_symbol.sh
··· 5 5 # Leo Yan <leo.yan@linaro.org>, 2022 6 6 7 7 skip_if_no_mem_event() { 8 - perf mem record -e list 2>&1 | egrep -q 'available' && return 0 8 + perf mem record -e list 2>&1 | grep -E -q 'available' && return 0 9 9 return 2 10 10 } 11 11 ··· 48 48 # perf mem/c2c internally uses IBS PMU on AMD CPU which doesn't support 49 49 # user/kernel filtering and per-process monitoring, spin program on 50 50 # specific CPU and test in per-CPU mode. 51 - is_amd=$(egrep -c 'vendor_id.*AuthenticAMD' /proc/cpuinfo) 51 + is_amd=$(grep -E -c 'vendor_id.*AuthenticAMD' /proc/cpuinfo) 52 52 if (($is_amd >= 1)); then 53 53 perf mem record -o ${PERF_DATA} -C 0 -- taskset -c 0 $TEST_PROGRAM & 54 54 else
+1 -1
tools/perf/tests/shell/test_java_symbol.sh
··· 65 65 # 8.18% jshell jitted-50116-29.so [.] Interpreter 66 66 # 0.75% Thread-1 jitted-83602-1670.so [.] jdk.internal.jimage.BasicImageReader.getString(int) 67 67 perf report --stdio -i ${PERF_INJ_DATA} 2>&1 | \ 68 - egrep " +[0-9]+\.[0-9]+% .* (Interpreter|jdk\.internal).*" > /dev/null 2>&1 68 + grep -E " +[0-9]+\.[0-9]+% .* (Interpreter|jdk\.internal).*" > /dev/null 2>&1 69 69 70 70 if [ $? -ne 0 ]; then 71 71 echo "Fail to find java symbols"
+2 -2
tools/perf/tests/shell/trace+probe_vfs_getname.sh
··· 18 18 . $(dirname $0)/lib/probe_vfs_getname.sh 19 19 20 20 trace_open_vfs_getname() { 21 - evts=$(echo $(perf list syscalls:sys_enter_open* 2>/dev/null | egrep 'open(at)? ' | sed -r 's/.*sys_enter_([a-z]+) +\[.*$/\1/') | sed 's/ /,/') 21 + evts=$(echo $(perf list syscalls:sys_enter_open* 2>/dev/null | grep -E 'open(at)? ' | sed -r 's/.*sys_enter_([a-z]+) +\[.*$/\1/') | sed 's/ /,/') 22 22 perf trace -e $evts touch $file 2>&1 | \ 23 - egrep " +[0-9]+\.[0-9]+ +\( +[0-9]+\.[0-9]+ ms\): +touch\/[0-9]+ open(at)?\((dfd: +CWD, +)?filename: +${file}, +flags: CREAT\|NOCTTY\|NONBLOCK\|WRONLY, +mode: +IRUGO\|IWUGO\) += +[0-9]+$" 23 + grep -E " +[0-9]+\.[0-9]+ +\( +[0-9]+\.[0-9]+ ms\): +touch\/[0-9]+ open(at)?\((dfd: +CWD, +)?filename: +${file}, +flags: CREAT\|NOCTTY\|NONBLOCK\|WRONLY, +mode: +IRUGO\|IWUGO\) += +[0-9]+$" 24 24 } 25 25 26 26
+1 -1
tools/perf/trace/beauty/fadvise.sh
··· 6 6 printf "static const char *fadvise_advices[] = {\n" 7 7 regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+POSIX_FADV_(\w+)[[:space:]]+([[:digit:]]+)[[:space:]]+.*' 8 8 9 - egrep $regex ${header_dir}/fadvise.h | \ 9 + grep -E $regex ${header_dir}/fadvise.h | \ 10 10 sed -r "s/$regex/\2 \1/g" | \ 11 11 sort | xargs printf "\t[%s] = \"%s\",\n" | \ 12 12 grep -v "[6].*DONTNEED" | grep -v "[7].*NOREUSE"
+1 -1
tools/perf/trace/beauty/fsmount.sh
··· 16 16 17 17 printf "static const char *fsmount_attr_flags[] = {\n" 18 18 regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+MOUNT_ATTR_([[:alnum:]][[:alnum:]_]+)[[:space:]]+(0x[[:xdigit:]]+)[[:space:]]*.*' 19 - egrep $regex ${linux_mount} | grep -v MOUNT_ATTR_RELATIME | \ 19 + grep -E $regex ${linux_mount} | grep -v MOUNT_ATTR_RELATIME | \ 20 20 sed -r "s/$regex/\2 \1/g" | \ 21 21 xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n" 22 22 printf "};\n"
+1 -1
tools/perf/trace/beauty/fspick.sh
··· 11 11 12 12 printf "static const char *fspick_flags[] = {\n" 13 13 regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+FSPICK_([[:alnum:]_]+)[[:space:]]+(0x[[:xdigit:]]+)[[:space:]]*.*' 14 - egrep $regex ${linux_mount} | \ 14 + grep -E $regex ${linux_mount} | \ 15 15 sed -r "s/$regex/\2 \1/g" | \ 16 16 xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n" 17 17 printf "};\n"
+1 -1
tools/perf/trace/beauty/kcmp_type.sh
··· 5 5 6 6 printf "static const char *kcmp_types[] = {\n" 7 7 regex='^[[:space:]]+(KCMP_(\w+)),' 8 - egrep $regex ${header_dir}/kcmp.h | grep -v KCMP_TYPES, | \ 8 + grep -E $regex ${header_dir}/kcmp.h | grep -v KCMP_TYPES, | \ 9 9 sed -r "s/$regex/\1 \2/g" | \ 10 10 xargs printf "\t[%s]\t= \"%s\",\n" 11 11 printf "};\n"
+2 -2
tools/perf/trace/beauty/kvm_ioctl.sh
··· 5 5 6 6 printf "static const char *kvm_ioctl_cmds[] = {\n" 7 7 regex='^#[[:space:]]*define[[:space:]]+KVM_(\w+)[[:space:]]+_IO[RW]*\([[:space:]]*KVMIO[[:space:]]*,[[:space:]]*(0x[[:xdigit:]]+).*' 8 - egrep $regex ${header_dir}/kvm.h | \ 8 + grep -E $regex ${header_dir}/kvm.h | \ 9 9 sed -r "s/$regex/\2 \1/g" | \ 10 - egrep -v " ((ARM|PPC|S390)_|[GS]ET_(DEBUGREGS|PIT2|XSAVE|TSC_KHZ)|CREATE_SPAPR_TCE_64)" | \ 10 + grep -E -v " ((ARM|PPC|S390)_|[GS]ET_(DEBUGREGS|PIT2|XSAVE|TSC_KHZ)|CREATE_SPAPR_TCE_64)" | \ 11 11 sort | xargs printf "\t[%s] = \"%s\",\n" 12 12 printf "};\n"
+1 -1
tools/perf/trace/beauty/madvise_behavior.sh
··· 5 5 6 6 printf "static const char *madvise_advices[] = {\n" 7 7 regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+MADV_([[:alnum:]_]+)[[:space:]]+([[:digit:]]+)[[:space:]]*.*' 8 - egrep $regex ${header_dir}/mman-common.h | \ 8 + grep -E $regex ${header_dir}/mman-common.h | \ 9 9 sed -r "s/$regex/\2 \1/g" | \ 10 10 sort -n | xargs printf "\t[%s] = \"%s\",\n" 11 11 printf "};\n"
+11 -11
tools/perf/trace/beauty/mmap_flags.sh
··· 15 15 linux_mman=${linux_header_dir}/mman.h 16 16 arch_mman=${arch_header_dir}/mman.h 17 17 18 - # those in egrep -vw are flags, we want just the bits 18 + # those in grep -E -vw are flags, we want just the bits 19 19 20 20 printf "static const char *mmap_flags[] = {\n" 21 21 regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+MAP_([[:alnum:]_]+)[[:space:]]+(0x[[:xdigit:]]+)[[:space:]]*.*' 22 - egrep -q $regex ${arch_mman} && \ 23 - (egrep $regex ${arch_mman} | \ 22 + grep -E -q $regex ${arch_mman} && \ 23 + (grep -E $regex ${arch_mman} | \ 24 24 sed -r "s/$regex/\2 \1 \1 \1 \2/g" | \ 25 25 xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n#ifndef MAP_%s\n#define MAP_%s %s\n#endif\n") 26 - egrep -q $regex ${linux_mman} && \ 27 - (egrep $regex ${linux_mman} | \ 28 - egrep -vw 'MAP_(UNINITIALIZED|TYPE|SHARED_VALIDATE)' | \ 26 + grep -E -q $regex ${linux_mman} && \ 27 + (grep -E $regex ${linux_mman} | \ 28 + grep -E -vw 'MAP_(UNINITIALIZED|TYPE|SHARED_VALIDATE)' | \ 29 29 sed -r "s/$regex/\2 \1 \1 \1 \2/g" | \ 30 30 xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n#ifndef MAP_%s\n#define MAP_%s %s\n#endif\n") 31 - ([ ! -f ${arch_mman} ] || egrep -q '#[[:space:]]*include[[:space:]]+.*uapi/asm-generic/mman.*' ${arch_mman}) && 32 - (egrep $regex ${header_dir}/mman-common.h | \ 33 - egrep -vw 'MAP_(UNINITIALIZED|TYPE|SHARED_VALIDATE)' | \ 31 + ([ ! -f ${arch_mman} ] || grep -E -q '#[[:space:]]*include[[:space:]]+.*uapi/asm-generic/mman.*' ${arch_mman}) && 32 + (grep -E $regex ${header_dir}/mman-common.h | \ 33 + grep -E -vw 'MAP_(UNINITIALIZED|TYPE|SHARED_VALIDATE)' | \ 34 34 sed -r "s/$regex/\2 \1 \1 \1 \2/g" | \ 35 35 xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n#ifndef MAP_%s\n#define MAP_%s %s\n#endif\n") 36 - ([ ! -f ${arch_mman} ] || egrep -q '#[[:space:]]*include[[:space:]]+.*uapi/asm-generic/mman.h>.*' ${arch_mman}) && 37 - (egrep $regex ${header_dir}/mman.h | \ 36 + ([ ! -f ${arch_mman} ] || grep -E -q '#[[:space:]]*include[[:space:]]+.*uapi/asm-generic/mman.h>.*' ${arch_mman}) && 37 + (grep -E $regex ${header_dir}/mman.h | \ 38 38 sed -r "s/$regex/\2 \1 \1 \1 \2/g" | \ 39 39 xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n#ifndef MAP_%s\n#define MAP_%s %s\n#endif\n") 40 40 printf "};\n"
+6 -6
tools/perf/trace/beauty/mmap_prot.sh
··· 17 17 18 18 printf "static const char *mmap_prot[] = {\n" 19 19 regex=`printf '^[[:space:]]*#[[:space:]]*define[[:space:]]+%s_([[:alnum:]_]+)[[:space:]]+(0x[[:xdigit:]]+)[[:space:]]*.*' ${prefix}` 20 - ([ ! -f ${arch_mman} ] || egrep -q '#[[:space:]]*include[[:space:]]+.*uapi/asm-generic/mman.*' ${arch_mman}) && 21 - (egrep $regex ${common_mman} | \ 22 - egrep -vw PROT_NONE | \ 20 + ([ ! -f ${arch_mman} ] || grep -E -q '#[[:space:]]*include[[:space:]]+.*uapi/asm-generic/mman.*' ${arch_mman}) && 21 + (grep -E $regex ${common_mman} | \ 22 + grep -E -vw PROT_NONE | \ 23 23 sed -r "s/$regex/\2 \1 \1 \1 \2/g" | \ 24 24 xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n#ifndef ${prefix}_%s\n#define ${prefix}_%s %s\n#endif\n") 25 - [ -f ${arch_mman} ] && egrep -q $regex ${arch_mman} && 26 - (egrep $regex ${arch_mman} | \ 27 - egrep -vw PROT_NONE | \ 25 + [ -f ${arch_mman} ] && grep -E -q $regex ${arch_mman} && 26 + (grep -E $regex ${arch_mman} | \ 27 + grep -E -vw PROT_NONE | \ 28 28 sed -r "s/$regex/\2 \1 \1 \1 \2/g" | \ 29 29 xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n#ifndef ${prefix}_%s\n#define ${prefix}_%s %s\n#endif\n") 30 30 printf "};\n"
+2 -2
tools/perf/trace/beauty/mount_flags.sh
··· 5 5 6 6 printf "static const char *mount_flags[] = {\n" 7 7 regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+MS_([[:alnum:]_]+)[[:space:]]+([[:digit:]]+)[[:space:]]*.*' 8 - egrep $regex ${header_dir}/mount.h | egrep -v '(MSK|VERBOSE|MGC_VAL)\>' | \ 8 + grep -E $regex ${header_dir}/mount.h | grep -E -v '(MSK|VERBOSE|MGC_VAL)\>' | \ 9 9 sed -r "s/$regex/\2 \2 \1/g" | sort -n | \ 10 10 xargs printf "\t[%s ? (ilog2(%s) + 1) : 0] = \"%s\",\n" 11 11 regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+MS_([[:alnum:]_]+)[[:space:]]+\(1<<([[:digit:]]+)\)[[:space:]]*.*' 12 - egrep $regex ${header_dir}/mount.h | \ 12 + grep -E $regex ${header_dir}/mount.h | \ 13 13 sed -r "s/$regex/\2 \1/g" | \ 14 14 xargs printf "\t[%s + 1] = \"%s\",\n" 15 15 printf "};\n"
+1 -1
tools/perf/trace/beauty/move_mount_flags.sh
··· 11 11 12 12 printf "static const char *move_mount_flags[] = {\n" 13 13 regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+MOVE_MOUNT_([^_]+_[[:alnum:]_]+)[[:space:]]+(0x[[:xdigit:]]+)[[:space:]]*.*' 14 - egrep $regex ${linux_mount} | \ 14 + grep -E $regex ${linux_mount} | \ 15 15 sed -r "s/$regex/\2 \1/g" | \ 16 16 xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n" 17 17 printf "};\n"
+2 -2
tools/perf/trace/beauty/mremap_flags.sh
··· 11 11 12 12 printf "static const char *mremap_flags[] = {\n" 13 13 regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+MREMAP_([[:alnum:]_]+)[[:space:]]+((0x)?[[:xdigit:]]+)[[:space:]]*.*' 14 - egrep -q $regex ${linux_mman} && \ 15 - (egrep $regex ${linux_mman} | \ 14 + grep -E -q $regex ${linux_mman} && \ 15 + (grep -E $regex ${linux_mman} | \ 16 16 sed -r "s/$regex/\2 \1 \1 \1 \2/g" | \ 17 17 xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n#ifndef MREMAP_%s\n#define MREMAP_%s %s\n#endif\n") 18 18 printf "};\n"
+1 -1
tools/perf/trace/beauty/perf_ioctl.sh
··· 5 5 6 6 printf "static const char *perf_ioctl_cmds[] = {\n" 7 7 regex='^#[[:space:]]*define[[:space:]]+PERF_EVENT_IOC_(\w+)[[:space:]]+_IO[RW]*[[:space:]]*\([[:space:]]*.\$.[[:space:]]*,[[:space:]]*([[:digit:]]+).*' 8 - egrep $regex ${header_dir}/perf_event.h | \ 8 + grep -E $regex ${header_dir}/perf_event.h | \ 9 9 sed -r "s/$regex/\2 \1/g" | \ 10 10 sort | xargs printf "\t[%s] = \"%s\",\n" 11 11 printf "};\n"
+1 -1
tools/perf/trace/beauty/pkey_alloc_access_rights.sh
··· 5 5 6 6 printf "static const char *pkey_alloc_access_rights[] = {\n" 7 7 regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+PKEY_([[:alnum:]_]+)[[:space:]]+(0x[[:xdigit:]]+)[[:space:]]*' 8 - egrep $regex ${header_dir}/mman-common.h | \ 8 + grep -E $regex ${header_dir}/mman-common.h | \ 9 9 sed -r "s/$regex/\2 \2 \1/g" | \ 10 10 sort | xargs printf "\t[%s ? (ilog2(%s) + 1) : 0] = \"%s\",\n" 11 11 printf "};\n"
+2 -2
tools/perf/trace/beauty/prctl_option.sh
··· 5 5 6 6 printf "static const char *prctl_options[] = {\n" 7 7 regex='^#define[[:space:]]{1}PR_(\w+)[[:space:]]*([[:xdigit:]]+)([[:space:]]*\/.*)?$' 8 - egrep $regex ${header_dir}/prctl.h | grep -v PR_SET_PTRACER | \ 8 + grep -E $regex ${header_dir}/prctl.h | grep -v PR_SET_PTRACER | \ 9 9 sed -r "s/$regex/\2 \1/g" | \ 10 10 sort -n | xargs printf "\t[%s] = \"%s\",\n" 11 11 printf "};\n" 12 12 13 13 printf "static const char *prctl_set_mm_options[] = {\n" 14 14 regex='^#[[:space:]]+define[[:space:]]+PR_SET_MM_(\w+)[[:space:]]*([[:digit:]]+).*' 15 - egrep $regex ${header_dir}/prctl.h | \ 15 + grep -E $regex ${header_dir}/prctl.h | \ 16 16 sed -r "s/$regex/\2 \1/g" | \ 17 17 sort -n | xargs printf "\t[%s] = \"%s\",\n" 18 18 printf "};\n"
+2 -2
tools/perf/trace/beauty/rename_flags.sh
··· 8 8 9 9 printf "static const char *rename_flags[] = {\n" 10 10 regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+RENAME_([[:alnum:]_]+)[[:space:]]+\(1[[:space:]]*<<[[:space:]]*([[:xdigit:]]+)[[:space:]]*\)[[:space:]]*.*' 11 - egrep -q $regex ${fs_header} && \ 12 - (egrep $regex ${fs_header} | \ 11 + grep -E -q $regex ${fs_header} && \ 12 + (grep -E $regex ${fs_header} | \ 13 13 sed -r "s/$regex/\2 \1/g" | \ 14 14 xargs printf "\t[%d + 1] = \"%s\",\n") 15 15 printf "};\n"
+2 -2
tools/perf/trace/beauty/sockaddr.sh
··· 17 17 # #define AF_LOCAL 1 /* POSIX name for AF_UNIX */ 18 18 regex='^#define[[:space:]]+AF_(\w+)[[:space:]]+([[:digit:]]+).*' 19 19 20 - egrep $regex ${header_dir}/socket.h | \ 20 + grep -E $regex ${header_dir}/socket.h | \ 21 21 sed -r "s/$regex/\2 \1/g" | \ 22 22 xargs printf "\t[%s] = \"%s\",\n" | \ 23 - egrep -v "\"(UNIX|MAX)\"" 23 + grep -E -v "\"(UNIX|MAX)\"" 24 24 printf "};\n"
+2 -2
tools/perf/trace/beauty/socket.sh
··· 12 12 printf "static const char *socket_ipproto[] = {\n" 13 13 ipproto_regex='^[[:space:]]+IPPROTO_(\w+)[[:space:]]+=[[:space:]]+([[:digit:]]+),.*' 14 14 15 - egrep $ipproto_regex ${uapi_header_dir}/in.h | \ 15 + grep -E $ipproto_regex ${uapi_header_dir}/in.h | \ 16 16 sed -r "s/$ipproto_regex/\2 \1/g" | \ 17 17 sort -n | xargs printf "\t[%s] = \"%s\",\n" 18 18 printf "};\n\n" ··· 20 20 printf "static const char *socket_level[] = {\n" 21 21 socket_level_regex='^#define[[:space:]]+SOL_(\w+)[[:space:]]+([[:digit:]]+)([[:space:]]+\/.*)?' 22 22 23 - egrep $socket_level_regex ${beauty_header_dir}/socket.h | \ 23 + grep -E $socket_level_regex ${beauty_header_dir}/socket.h | \ 24 24 sed -r "s/$socket_level_regex/\2 \1/g" | \ 25 25 sort -n | xargs printf "\t[%s] = \"%s\",\n" 26 26 printf "};\n\n"
+1 -1
tools/perf/trace/beauty/sync_file_range.sh
··· 11 11 12 12 printf "static const char *sync_file_range_flags[] = {\n" 13 13 regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+SYNC_FILE_RANGE_([[:alnum:]_]+)[[:space:]]+([[:xdigit:]]+)[[:space:]]*.*' 14 - egrep $regex ${linux_fs} | \ 14 + grep -E $regex ${linux_fs} | \ 15 15 sed -r "s/$regex/\2 \1/g" | \ 16 16 xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n" 17 17 printf "};\n"
+2 -2
tools/perf/trace/beauty/tracepoints/x86_irq_vectors.sh
··· 15 15 # the time of writing of this script was: IRQ_MOVE_CLEANUP_VECTOR. 16 16 17 17 first_external_regex='^#define[[:space:]]+FIRST_EXTERNAL_VECTOR[[:space:]]+(0x[[:xdigit:]]+)$' 18 - first_external_vector=$(egrep ${first_external_regex} ${x86_irq_vectors} | sed -r "s/${first_external_regex}/\1/g") 18 + first_external_vector=$(grep -E ${first_external_regex} ${x86_irq_vectors} | sed -r "s/${first_external_regex}/\1/g") 19 19 20 20 printf "static const char *x86_irq_vectors[] = {\n" 21 21 regex='^#define[[:space:]]+([[:alnum:]_]+)_VECTOR[[:space:]]+(0x[[:xdigit:]]+)$' 22 22 sed -r "s/FIRST_EXTERNAL_VECTOR/${first_external_vector}/g" ${x86_irq_vectors} | \ 23 - egrep ${regex} | \ 23 + grep -E ${regex} | \ 24 24 sed -r "s/${regex}/\2 \1/g" | sort -n | \ 25 25 xargs printf "\t[%s] = \"%s\",\n" 26 26 printf "};\n\n"
+6 -6
tools/perf/trace/beauty/tracepoints/x86_msr.sh
··· 15 15 16 16 printf "static const char *x86_MSRs[] = {\n" 17 17 regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+MSR_([[:alnum:]][[:alnum:]_]+)[[:space:]]+(0x00000[[:xdigit:]]+)[[:space:]]*.*' 18 - egrep $regex ${x86_msr_index} | egrep -v 'MSR_(ATOM|P[46]|IA32_(TSC_DEADLINE|UCODE_REV)|IDT_FCR4)' | \ 18 + grep -E $regex ${x86_msr_index} | grep -E -v 'MSR_(ATOM|P[46]|IA32_(TSC_DEADLINE|UCODE_REV)|IDT_FCR4)' | \ 19 19 sed -r "s/$regex/\2 \1/g" | sort -n | \ 20 20 xargs printf "\t[%s] = \"%s\",\n" 21 21 printf "};\n\n" ··· 23 23 # Remove MSR_K6_WHCR, clashes with MSR_LSTAR 24 24 regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+MSR_([[:alnum:]][[:alnum:]_]+)[[:space:]]+(0xc0000[[:xdigit:]]+)[[:space:]]*.*' 25 25 printf "#define x86_64_specific_MSRs_offset " 26 - egrep $regex ${x86_msr_index} | sed -r "s/$regex/\2/g" | sort -n | head -1 26 + grep -E $regex ${x86_msr_index} | sed -r "s/$regex/\2/g" | sort -n | head -1 27 27 printf "static const char *x86_64_specific_MSRs[] = {\n" 28 - egrep $regex ${x86_msr_index} | \ 29 - sed -r "s/$regex/\2 \1/g" | egrep -vw 'K6_WHCR' | sort -n | \ 28 + grep -E $regex ${x86_msr_index} | \ 29 + sed -r "s/$regex/\2 \1/g" | grep -E -vw 'K6_WHCR' | sort -n | \ 30 30 xargs printf "\t[%s - x86_64_specific_MSRs_offset] = \"%s\",\n" 31 31 printf "};\n\n" 32 32 33 33 regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+MSR_([[:alnum:]][[:alnum:]_]+)[[:space:]]+(0xc0010[[:xdigit:]]+)[[:space:]]*.*' 34 34 printf "#define x86_AMD_V_KVM_MSRs_offset " 35 - egrep $regex ${x86_msr_index} | sed -r "s/$regex/\2/g" | sort -n | head -1 35 + grep -E $regex ${x86_msr_index} | sed -r "s/$regex/\2/g" | sort -n | head -1 36 36 printf "static const char *x86_AMD_V_KVM_MSRs[] = {\n" 37 - egrep $regex ${x86_msr_index} | \ 37 + grep -E $regex ${x86_msr_index} | \ 38 38 sed -r "s/$regex/\2 \1/g" | sort -n | \ 39 39 xargs printf "\t[%s - x86_AMD_V_KVM_MSRs_offset] = \"%s\",\n" 40 40 printf "};\n"
+2 -2
tools/perf/trace/beauty/usbdevfs_ioctl.sh
··· 8 8 9 9 printf "static const char *usbdevfs_ioctl_cmds[] = {\n" 10 10 regex="^#[[:space:]]*define[[:space:]]+USBDEVFS_(\w+)(\(\w+\))?[[:space:]]+_IO[CWR]{0,2}\([[:space:]]*(_IOC_\w+,[[:space:]]*)?'U'[[:space:]]*,[[:space:]]*([[:digit:]]+).*" 11 - egrep "$regex" ${header_dir}/usbdevice_fs.h | egrep -v 'USBDEVFS_\w+32[[:space:]]' | \ 11 + grep -E "$regex" ${header_dir}/usbdevice_fs.h | grep -E -v 'USBDEVFS_\w+32[[:space:]]' | \ 12 12 sed -r "s/$regex/\4 \1/g" | \ 13 13 sort | xargs printf "\t[%s] = \"%s\",\n" 14 14 printf "};\n\n" 15 15 printf "#if 0\n" 16 16 printf "static const char *usbdevfs_ioctl_32_cmds[] = {\n" 17 17 regex="^#[[:space:]]*define[[:space:]]+USBDEVFS_(\w+)[[:space:]]+_IO[WR]{0,2}\([[:space:]]*'U'[[:space:]]*,[[:space:]]*([[:digit:]]+).*" 18 - egrep $regex ${header_dir}/usbdevice_fs.h | egrep 'USBDEVFS_\w+32[[:space:]]' | \ 18 + grep -E $regex ${header_dir}/usbdevice_fs.h | grep -E 'USBDEVFS_\w+32[[:space:]]' | \ 19 19 sed -r "s/$regex/\2 \1/g" | \ 20 20 sort | xargs printf "\t[%s] = \"%s\",\n" 21 21 printf "};\n"
+2 -2
tools/perf/trace/beauty/vhost_virtio_ioctl.sh
··· 5 5 6 6 printf "static const char *vhost_virtio_ioctl_cmds[] = {\n" 7 7 regex='^#[[:space:]]*define[[:space:]]+VHOST_(\w+)[[:space:]]+_IOW?\([[:space:]]*VHOST_VIRTIO[[:space:]]*,[[:space:]]*(0x[[:xdigit:]]+).*' 8 - egrep $regex ${header_dir}/vhost.h | \ 8 + grep -E $regex ${header_dir}/vhost.h | \ 9 9 sed -r "s/$regex/\2 \1/g" | \ 10 10 sort | xargs printf "\t[%s] = \"%s\",\n" 11 11 printf "};\n" 12 12 13 13 printf "static const char *vhost_virtio_ioctl_read_cmds[] = {\n" 14 14 regex='^#[[:space:]]*define[[:space:]]+VHOST_(\w+)[[:space:]]+_IOW?R\([[:space:]]*VHOST_VIRTIO[[:space:]]*,[[:space:]]*(0x[[:xdigit:]]+).*' 15 - egrep $regex ${header_dir}/vhost.h | \ 15 + grep -E $regex ${header_dir}/vhost.h | \ 16 16 sed -r "s/$regex/\2 \1/g" | \ 17 17 sort | xargs printf "\t[%s] = \"%s\",\n" 18 18 printf "};\n"
+2 -2
tools/perf/trace/beauty/x86_arch_prctl.sh
··· 15 15 printf "static const char *x86_arch_prctl_codes_%d[] = {\n" $idx 16 16 regex=`printf '^[[:space:]]*#[[:space:]]*define[[:space:]]+ARCH_([[:alnum:]_]+)[[:space:]]+(%s[[:xdigit:]]+).*' ${prefix}` 17 17 fmt="\t[%#x - ${first_entry}]= \"%s\",\n" 18 - egrep -q $regex ${prctl_arch_header} && \ 19 - (egrep $regex ${prctl_arch_header} | \ 18 + grep -E -q $regex ${prctl_arch_header} && \ 19 + (grep -E $regex ${prctl_arch_header} | \ 20 20 sed -r "s/$regex/\2 \1/g" | \ 21 21 xargs printf "$fmt") 22 22 printf "};\n\n"