From: Aaron Tomlin <atomlin@atomlin.com>
To: namhyung@kernel.org
Cc: arnaldo.melo@gmail.com, peterz@infradead.org, mingo@redhat.com,
acme@kernel.org, mark.rutland@arm.com,
alexander.shishkin@linux.intel.com, jolsa@kernel.org,
irogers@google.com, adrian.hunter@intel.com,
kan.liang@linux.intel.com, linux-perf-users@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 1/1] perf probe: Extend the quiet option
Date: Sun, 23 Mar 2025 18:39:17 +0000 [thread overview]
Message-ID: <20250323183917.230567-2-atomlin@atomlin.com> (raw)
In-Reply-To: <Z5PP3vPpYOccGWIv@google.com>
To provide a consistent and complete quiet mode, this patch expands the
scope of the [-q|--quiet] option to suppress all informational messages,
including those indicating successful event creation, in addition to the
currently suppressed warnings and messages. For example:
❯ sudo ./perf probe --quiet --add proc_sys_open
❯ echo $?
0
Signed-off-by: Aaron Tomlin <atomlin@atomlin.com>
---
tools/perf/builtin-probe.c | 16 +++++++++++-----
tools/perf/util/probe-event.h | 1 +
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
index 69800e4d9530..aee756aad19d 100644
--- a/tools/perf/builtin-probe.c
+++ b/tools/perf/builtin-probe.c
@@ -391,7 +391,7 @@ static int perf_add_probe_events(struct perf_probe_event *pevs, int npevs)
}
/* Note that it is possible to skip all events because of blacklist */
- if (event) {
+ if (event && !probe_conf.quiet) {
#ifndef HAVE_LIBTRACEEVENT
pr_info("\nperf is not linked with libtraceevent, to use the new probe you can use tracefs:\n\n");
pr_info("\tcd /sys/kernel/tracing/\n");
@@ -467,8 +467,11 @@ static int perf_del_probe_events(struct strfilter *filter)
ret = probe_file__get_events(kfd, filter, klist);
if (ret == 0) {
- strlist__for_each_entry(ent, klist)
+ strlist__for_each_entry(ent, klist) {
+ if (probe_conf.quiet)
+ continue;
pr_info("Removed event: %s\n", ent->s);
+ }
ret = probe_file__del_strlist(kfd, klist);
if (ret < 0)
@@ -478,8 +481,11 @@ static int perf_del_probe_events(struct strfilter *filter)
ret2 = probe_file__get_events(ufd, filter, ulist);
if (ret2 == 0) {
- strlist__for_each_entry(ent, ulist)
+ strlist__for_each_entry(ent, ulist) {
+ if (probe_conf.quiet)
+ continue;
pr_info("Removed event: %s\n", ent->s);
+ }
ret2 = probe_file__del_strlist(ufd, ulist);
if (ret2 < 0)
@@ -531,7 +537,7 @@ __cmd_probe(int argc, const char **argv)
struct option options[] = {
OPT_INCR('v', "verbose", &verbose,
"be more verbose (show parsed arguments, etc)"),
- OPT_BOOLEAN('q', "quiet", &quiet,
+ OPT_BOOLEAN('q', "quiet", &probe_conf.quiet,
"be quiet (do not show any warnings or messages)"),
OPT_CALLBACK_DEFAULT('l', "list", NULL, "[GROUP:]EVENT",
"list up probe events",
@@ -631,7 +637,7 @@ __cmd_probe(int argc, const char **argv)
argc = parse_options(argc, argv, options, probe_usage,
PARSE_OPT_STOP_AT_NON_OPTION);
- if (quiet) {
+ if (probe_conf.quiet) {
if (verbose != 0) {
pr_err(" Error: -v and -q are exclusive.\n");
return -EINVAL;
diff --git a/tools/perf/util/probe-event.h b/tools/perf/util/probe-event.h
index 71905ede0207..55771113791f 100644
--- a/tools/perf/util/probe-event.h
+++ b/tools/perf/util/probe-event.h
@@ -10,6 +10,7 @@ struct nsinfo;
/* Probe related configurations */
struct probe_conf {
+ bool quiet;
bool show_ext_vars;
bool show_location_range;
bool force_add;
--
2.47.1
next prev parent reply other threads:[~2025-03-23 18:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-14 19:34 [PATCH] perf probe: Introduce --no-advice option when a new event is created Aaron Tomlin
2025-01-24 0:25 ` Namhyung Kim
2025-01-24 10:54 ` Aaron Tomlin
2025-01-24 17:37 ` Namhyung Kim
2025-01-25 12:22 ` Aaron Tomlin
2025-03-23 18:39 ` [PATCH 0/1] perf probe: Extend the quiet option Aaron Tomlin
2025-03-23 18:39 ` Aaron Tomlin [this message]
[not found] ` <CA+JHD92anFo9rNOZ8NVyY4j23ukyWO-LRroHfUTnuOLnL-05-g@mail.gmail.com>
2025-01-25 12:31 ` [PATCH] perf probe: Introduce --no-advice option when a new event is created Aaron Tomlin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250323183917.230567-2-atomlin@atomlin.com \
--to=atomlin@atomlin.com \
--cc=Z5PP3vPpYOccGWIv@google.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=arnaldo.melo@gmail.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox