All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/1] perf tools: Avoid auto-complete failure if sysfs events are missing
@ 2025-07-29 11:03 Jan Polensky
  0 siblings, 0 replies; only message in thread
From: Jan Polensky @ 2025-07-29 11:03 UTC (permalink / raw)
  To: adrian.hunter, irogers, namhyung, Thomas Richter; +Cc: linux-perf-users

Using current auto-complete script result in the following error
on systems where /sys/bus/event_source/devices/cpu/events is absent:

    [root@localhost perf]# perf top -e
    ls: cannot access '/sys/bus/event_source/devices/cpu/events': No such file or directory

Fix this by skipping lookup if the directory does not exist.

Replaces: aIRnJDMRNO8olMdD@google.com
Signed-off-by: Jan Polensky <japo@linux.ibm.com>
---
Changes since v1 (Thanks Namhyung):
- Changed commit tittle.
- Removed arch specific handling and test for sysfs events.

 tools/perf/perf-completion.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/perf/perf-completion.sh b/tools/perf/perf-completion.sh
index 69cba3c170d5..1a91b9399f94 100644
--- a/tools/perf/perf-completion.sh
+++ b/tools/perf/perf-completion.sh
@@ -168,11 +168,11 @@ __perf_main ()
 		local cur1=${COMP_WORDS[COMP_CWORD]}
 		local raw_evts
 		local arr s tmp result cpu_evts
+		local sysfs_events=/sys/bus/event_source/devices/cpu/events

 		raw_evts=$($cmd list --raw-dump hw sw cache tracepoint pmu sdt)
-		# aarch64 doesn't have /sys/bus/event_source/devices/cpu/events
-		if [[ `uname -m` != aarch64 ]]; then
-			cpu_evts=$(ls /sys/bus/event_source/devices/cpu/events)
+		if [[ -d "$sysfs_events" ]]; then
+			cpu_evts=$(ls "$sysfs_events")
 		fi

 		if [[ "$cur1" == */* && ${cur1#*/} =~ ^[A-Z] ]]; then
--
2.48.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2025-07-29 11:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-29 11:03 [PATCH v2 1/1] perf tools: Avoid auto-complete failure if sysfs events are missing Jan Polensky

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.