Skip to content

Commit 818448e

Browse files
seehearfeelacmel
authored andcommitted
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 <[email protected]> Acked-by: Ian Rogers <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lore.kernel.org/lkml/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent c587e77 commit 818448e

38 files changed

+89
-89
lines changed

tools/perf/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ unexport MAKEFLAGS
2525
# (To override it, run 'make JOBS=1' and similar.)
2626
#
2727
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)
2929
ifeq ($(JOBS),0)
3030
JOBS := 1
3131
endif

tools/perf/builtin-trace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1727,7 +1727,7 @@ syscall_arg_fmt__init_array(struct syscall_arg_fmt *arg, struct tep_format_field
17271727
len >= 2 && strcmp(field->name + len - 2, "fd") == 0) {
17281728
/*
17291729
* /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
17311731
* 65 int
17321732
* 23 unsigned int
17331733
* 7 unsigned long

tools/perf/tests/make

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ endif
2929
PARALLEL_OPT=
3030
ifeq ($(SET_PARALLEL),1)
3131
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)
3333
ifeq ($(cores),0)
3434
cores := 1
3535
endif

tools/perf/tests/shell/lib/probe_vfs_getname.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ cleanup_probe_vfs_getname() {
1212
add_probe_vfs_getname() {
1313
local verbose=$1
1414
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/')
1616
perf probe -q "vfs_getname=getname_flags:${line} pathname=result->name:string" || \
1717
perf probe $verbose "vfs_getname=getname_flags:${line} pathname=filename:ustring"
1818
fi
1919
}
2020

2121
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
2323
return 1
2424
}

tools/perf/tests/shell/record+probe_libc_inet_pton.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ trace_libc_inet_pton_backtrace() {
6464
while read line <&3 && read -r pattern <&4; do
6565
[ -z "$pattern" ] && break
6666
echo $line
67-
echo "$line" | egrep -q "$pattern"
67+
echo "$line" | grep -E -q "$pattern"
6868
if [ $? -ne 0 ] ; then
6969
printf "FAIL: expected backtrace entry \"%s\" got \"%s\"\n" "$pattern" "$line"
7070
return 1

tools/perf/tests/shell/record+script_probe_vfs_getname.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ record_open_file() {
2323
perf_script_filenames() {
2424
echo "Looking at perf.data file for vfs_getname records for the file we touched:"
2525
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}\""
2727
}
2828

2929
add_probe_vfs_getname || skip_if_no_debuginfo

tools/perf/tests/shell/record_offcpu.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ test_offcpu_basic() {
5151
err=1
5252
return
5353
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
5555
then
5656
echo "Basic off-cpu test [Failed missing output]"
5757
err=1

tools/perf/tests/shell/stat.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ set -e
77
err=0
88
test_default_stat() {
99
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':"
1111
then
1212
echo "Basic stat command test [Failed]"
1313
err=1
@@ -19,7 +19,7 @@ test_default_stat() {
1919
test_stat_record_report() {
2020
echo "stat record and report test"
2121
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':"
2323
then
2424
echo "stat record and report test [Failed]"
2525
err=1
@@ -55,13 +55,13 @@ test_topdown_groups() {
5555
echo "Topdown event group test [Skipped event parsing failed]"
5656
return
5757
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>"
5959
then
6060
echo "Topdown event group test [Failed events not supported]"
6161
err=1
6262
return
6363
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>"
6565
then
6666
echo "Topdown event group test [Failed slots not reordered first]"
6767
err=1
@@ -82,7 +82,7 @@ test_topdown_weak_groups() {
8282
return
8383
fi
8484
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>"
8686
then
8787
echo "Topdown weak groups test [Failed events not supported]"
8888
err=1

tools/perf/tests/shell/test_arm_coresight.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ perf_script_branch_samples() {
4949
# touch 6512 1 branches:u: ffffb22082e0 strcmp+0xa0 (/lib/aarch64-linux-gnu/ld-2.27.so)
5050
# touch 6512 1 branches:u: ffffb2208320 strcmp+0xe0 (/lib/aarch64-linux-gnu/ld-2.27.so)
5151
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
5353
}
5454

5555
perf_report_branch_samples() {
@@ -60,7 +60,7 @@ perf_report_branch_samples() {
6060
# 7.71% 7.71% touch libc-2.27.so [.] getenv
6161
# 2.59% 2.59% touch ld-2.27.so [.] strcmp
6262
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
6464
}
6565

6666
perf_report_instruction_samples() {
@@ -71,7 +71,7 @@ perf_report_instruction_samples() {
7171
# 5.80% touch libc-2.27.so [.] getenv
7272
# 4.35% touch ld-2.27.so [.] _dl_fixup
7373
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
7575
}
7676

7777
arm_cs_report() {
@@ -87,7 +87,7 @@ is_device_sink() {
8787
# If the node of "enable_sink" is existed under the device path, this
8888
# means the device is a sink device. Need to exclude 'tpiu' since it
8989
# cannot support perf PMU.
90-
echo "$1" | egrep -q -v "tpiu"
90+
echo "$1" | grep -E -q -v "tpiu"
9191

9292
if [ $? -eq 0 -a -e "$1/enable_sink" ]; then
9393

tools/perf/tests/shell/test_arm_spe.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# German Gomez <[email protected]>, 2021
1010

1111
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
1313

1414
# arm_spe event doesn't exist
1515
return 2
@@ -51,7 +51,7 @@ perf_script_samples() {
5151
# dd 3048 [002] 1 tlb-access: ffffaa64999c __GI___libc_write+0x3c (/lib/aarch64-linux-gnu/libc-2.27.so)
5252
# dd 3048 [002] 1 memory: ffffaa64999c __GI___libc_write+0x3c (/lib/aarch64-linux-gnu/libc-2.27.so)
5353
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
5555
}
5656

5757
perf_report_samples() {
@@ -62,7 +62,7 @@ perf_report_samples() {
6262
# 7.71% 7.71% dd libc-2.27.so [.] getenv
6363
# 2.59% 2.59% dd ld-2.27.so [.] strcmp
6464
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
6666
}
6767

6868
arm_spe_snapshot_test() {

0 commit comments

Comments
 (0)