Skip to content

Commit ffd1240

Browse files
Yicong Yangacmel
authored andcommitted
perf tools: Fix auto-complete on aarch64
On aarch64 CPU related events are not under event_source/devices/cpu/events, they're under event_source/devices/armv8_pmuv3_0/events on my machine. Using current auto-complete script will generate below error: [root@localhost bin]# perf stat -e ls: cannot access '/sys/bus/event_source/devices/cpu/events': No such file or directory Fix this by not testing /sys/bus/event_source/devices/cpu/events on aarch64 machine. Fixes: 74cd581 ("perf tool: Improve bash command line auto-complete for multiple events with comma") Reviewed-by: James Clark <[email protected]> Signed-off-by: Yicong Yang <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jin Yao <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 1bece13 commit ffd1240

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

tools/perf/perf-completion.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,12 @@ __perf_main ()
165165

166166
local cur1=${COMP_WORDS[COMP_CWORD]}
167167
local raw_evts=$($cmd list --raw-dump)
168-
local arr s tmp result
168+
local arr s tmp result cpu_evts
169+
170+
# aarch64 doesn't have /sys/bus/event_source/devices/cpu/events
171+
if [[ `uname -m` != aarch64 ]]; then
172+
cpu_evts=$(ls /sys/bus/event_source/devices/cpu/events)
173+
fi
169174

170175
if [[ "$cur1" == */* && ${cur1#*/} =~ ^[A-Z] ]]; then
171176
OLD_IFS="$IFS"
@@ -183,9 +188,9 @@ __perf_main ()
183188
fi
184189
done
185190

186-
evts=${result}" "$(ls /sys/bus/event_source/devices/cpu/events)
191+
evts=${result}" "${cpu_evts}
187192
else
188-
evts=${raw_evts}" "$(ls /sys/bus/event_source/devices/cpu/events)
193+
evts=${raw_evts}" "${cpu_evts}
189194
fi
190195

191196
if [[ "$cur1" == , ]]; then

0 commit comments

Comments
 (0)