* [PATCH 0/2] Small changes for perf tools
@ 2024-07-30 6:22 Tiezhu Yang
2024-07-30 6:23 ` [PATCH 1/2] perf tools: Fix wrong message when running "make JOBS=1" Tiezhu Yang
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Tiezhu Yang @ 2024-07-30 6:22 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim
Cc: linux-perf-users, linux-kernel
Tiezhu Yang (2):
perf tools: Fix wrong message when running "make JOBS=1"
perf list: Give clues if failed to open tracing events directory
tools/lib/api/fs/tracing_path.c | 2 +-
tools/perf/Makefile | 8 +++++++-
tools/perf/util/print-events.c | 3 ++-
3 files changed, 10 insertions(+), 3 deletions(-)
--
2.42.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] perf tools: Fix wrong message when running "make JOBS=1"
2024-07-30 6:22 [PATCH 0/2] Small changes for perf tools Tiezhu Yang
@ 2024-07-30 6:23 ` Tiezhu Yang
2024-07-30 6:23 ` [PATCH 2/2] perf list: Give clues if failed to open tracing events directory Tiezhu Yang
2024-07-30 19:40 ` [PATCH 0/2] Small changes for perf tools Arnaldo Carvalho de Melo
2 siblings, 0 replies; 4+ messages in thread
From: Tiezhu Yang @ 2024-07-30 6:23 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim
Cc: linux-perf-users, linux-kernel
There is only one job when running "make JOBS=1", it should
print "sequential build" rather than "parallel build".
Before:
$ cd tools/perf && make JOBS=1
BUILD: Doing 'make -j1' parallel build
After:
$ cd tools/perf && make JOBS=1
BUILD: Doing 'make -j1' sequential build
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
tools/perf/Makefile | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 75f3f6e0a231..816d5d84816b 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -51,8 +51,14 @@ else
override DEBUG = 0
endif
+ifeq ($(JOBS),1)
+ BUILD_TYPE := sequential
+else
+ BUILD_TYPE := parallel
+endif
+
define print_msg
- @printf ' BUILD: Doing '\''make \033[33m-j'$(JOBS)'\033[m'\'' parallel build\n'
+ @printf ' BUILD: Doing '\''make \033[33m-j'$(JOBS)'\033[m'\'' $(BUILD_TYPE) build\n'
endef
define make
--
2.42.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] perf list: Give clues if failed to open tracing events directory
2024-07-30 6:22 [PATCH 0/2] Small changes for perf tools Tiezhu Yang
2024-07-30 6:23 ` [PATCH 1/2] perf tools: Fix wrong message when running "make JOBS=1" Tiezhu Yang
@ 2024-07-30 6:23 ` Tiezhu Yang
2024-07-30 19:40 ` [PATCH 0/2] Small changes for perf tools Arnaldo Carvalho de Melo
2 siblings, 0 replies; 4+ messages in thread
From: Tiezhu Yang @ 2024-07-30 6:23 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim
Cc: linux-perf-users, linux-kernel
When executing the command "perf list", I met "Error: failed to open
tracing events directory" twice, the first reason is that there is no
"/sys/kernel/tracing/events" directory due to it does not enable the
kernel tracing infrastructure with CONFIG_FTRACE, the second reason
is that there is no root privileges.
Add the error string to tell the users what happened and what should
to do, and also call put_tracing_file() to free events_path a little
later to avoid messy code in the error message.
At the same time, just remove the redundant "/" of the file path in
the function get_tracing_file(), otherwise it shows something like
"/sys/kernel/tracing//events".
Before:
$ ./perf list
Error: failed to open tracing events directory
After:
(1) Without CONFIG_FTRACE
$ ./perf list
Error: failed to open tracing events directory
/sys/kernel/tracing/events: No such file or directory
(2) With CONFIG_FTRACE but no root privileges
$ ./perf list
Error: failed to open tracing events directory
/sys/kernel/tracing/events: Permission denied
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
tools/lib/api/fs/tracing_path.c | 2 +-
tools/perf/util/print-events.c | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/tools/lib/api/fs/tracing_path.c b/tools/lib/api/fs/tracing_path.c
index 30745f35d0d2..834fd64c7130 100644
--- a/tools/lib/api/fs/tracing_path.c
+++ b/tools/lib/api/fs/tracing_path.c
@@ -69,7 +69,7 @@ char *get_tracing_file(const char *name)
{
char *file;
- if (asprintf(&file, "%s/%s", tracing_path_mount(), name) < 0)
+ if (asprintf(&file, "%s%s", tracing_path_mount(), name) < 0)
return NULL;
return file;
diff --git a/tools/perf/util/print-events.c b/tools/perf/util/print-events.c
index 3f38c27f0157..81e0135cddf0 100644
--- a/tools/perf/util/print-events.c
+++ b/tools/perf/util/print-events.c
@@ -68,11 +68,12 @@ void print_tracepoint_events(const struct print_callbacks *print_cb __maybe_unus
struct dirent **sys_namelist = NULL;
int sys_items;
- put_tracing_file(events_path);
if (events_fd < 0) {
pr_err("Error: failed to open tracing events directory\n");
+ pr_err("%s: %s\n", events_path, strerror(errno));
return;
}
+ put_tracing_file(events_path);
sys_items = tracing_events__scandir_alphasort(&sys_namelist);
--
2.42.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2] Small changes for perf tools
2024-07-30 6:22 [PATCH 0/2] Small changes for perf tools Tiezhu Yang
2024-07-30 6:23 ` [PATCH 1/2] perf tools: Fix wrong message when running "make JOBS=1" Tiezhu Yang
2024-07-30 6:23 ` [PATCH 2/2] perf list: Give clues if failed to open tracing events directory Tiezhu Yang
@ 2024-07-30 19:40 ` Arnaldo Carvalho de Melo
2 siblings, 0 replies; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2024-07-30 19:40 UTC (permalink / raw)
To: Tiezhu Yang
Cc: Peter Zijlstra, Ingo Molnar, Namhyung Kim, linux-perf-users,
linux-kernel
On Tue, Jul 30, 2024 at 02:22:59PM +0800, Tiezhu Yang wrote:
> Tiezhu Yang (2):
> perf tools: Fix wrong message when running "make JOBS=1"
> perf list: Give clues if failed to open tracing events directory
Thanks, tested and applied.
- Arnaldo
> tools/lib/api/fs/tracing_path.c | 2 +-
> tools/perf/Makefile | 8 +++++++-
> tools/perf/util/print-events.c | 3 ++-
> 3 files changed, 10 insertions(+), 3 deletions(-)
>
> --
> 2.42.0
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-07-30 19:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-30 6:22 [PATCH 0/2] Small changes for perf tools Tiezhu Yang
2024-07-30 6:23 ` [PATCH 1/2] perf tools: Fix wrong message when running "make JOBS=1" Tiezhu Yang
2024-07-30 6:23 ` [PATCH 2/2] perf list: Give clues if failed to open tracing events directory Tiezhu Yang
2024-07-30 19:40 ` [PATCH 0/2] Small changes for perf tools Arnaldo Carvalho de Melo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).