public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Hemant Kumar <hemant@linux.vnet.ibm.com>
To: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: srikar@linux.vnet.ibm.com, Peter Zijlstra <peterz@infradead.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	namhyung@kernel.org, Ingo Molnar <mingo@kernel.org>
Subject: Re: (ltc-kernel 10243) [PATCH perf/core 2/2] perf-probe: Add --quiet option to suppress output result message
Date: Tue, 28 Oct 2014 11:57:18 +0530	[thread overview]
Message-ID: <544F3746.5030507@linux.vnet.ibm.com> (raw)
In-Reply-To: <544E3CF2.80901@hitachi.com>

Hi Masami,

On 10/27/2014 06:09 PM, Masami Hiramatsu wrote:
> Hi Hermant,
>
> This patch is actually what you need for suppressing the result
> messages when adding/removing probe events from sdt event tracing.
> You just need to set "verbose=-1" around adding/removing probes.

Thank you for working on this. :)

> Thank you,
>
> (2014/10/28 5:31), Masami Hiramatsu wrote:
>> Add --quiet(-q) option to suppress output result message
>> for --add, and --del options (Note that --lines/funcs/vars are
>> not affected). This option is useful if you run the perf
>> probe inside your scripts.
>>
>> Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
>> ---
>>   tools/perf/builtin-probe.c    |   11 +++++++++++
>>   tools/perf/util/probe-event.c |   18 +++++++++---------
>>   2 files changed, 20 insertions(+), 9 deletions(-)
>>
>> diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
>> index 2d3577d..921bb69 100644
>> --- a/tools/perf/builtin-probe.c
>> +++ b/tools/perf/builtin-probe.c
>> @@ -55,6 +55,7 @@ static struct {
>>   	bool show_funcs;
>>   	bool mod_events;
>>   	bool uprobes;
>> +	bool quiet;
>>   	int nevents;
>>   	struct perf_probe_event events[MAX_PROBES];
>>   	struct strlist *dellist;
>> @@ -315,6 +316,8 @@ __cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused)
>>   	struct option options[] = {
>>   	OPT_INCR('v', "verbose", &verbose,
>>   		    "be more verbose (show parsed arguments, etc)"),
>> +	OPT_BOOLEAN('q', "quiet", &params.quiet,
>> +		    "be quiet (do not show any mesages)"),
>>   	OPT_BOOLEAN('l', "list", &params.list_events,
>>   		    "list up current probe events"),
>>   	OPT_CALLBACK('d', "del", NULL, "[GROUP:]EVENT", "delete a probe event.",
>> @@ -404,6 +407,14 @@ __cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused)
>>   		}
>>   	}
>>   
>> +	if (params.quiet) {
>> +		if (verbose != 0) {
>> +			pr_err("  Error: -v and -q are exclusive.\n");
>> +			return -EINVAL;
>> +		}
>> +		verbose = -1;
>> +	}
>> +
>>   	if (params.max_probe_points == 0)
>>   		params.max_probe_points = MAX_PROBES;
>>   
>> diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
>> index c150ca4..28eb141 100644
>> --- a/tools/perf/util/probe-event.c
>> +++ b/tools/perf/util/probe-event.c
>> @@ -1910,21 +1910,21 @@ static int show_perf_probe_event(struct perf_probe_event *pev,
>>   	if (ret < 0)
>>   		return ret;
>>   
>> -	printf("  %-20s (on %s", buf, place);
>> +	pr_info("  %-20s (on %s", buf, place);
>>   	if (module)
>> -		printf(" in %s", module);
>> +		pr_info(" in %s", module);
>>   
>>   	if (pev->nargs > 0) {
>> -		printf(" with");
>> +		pr_info(" with");
>>   		for (i = 0; i < pev->nargs; i++) {
>>   			ret = synthesize_perf_probe_arg(&pev->args[i],
>>   							buf, 128);
>>   			if (ret < 0)
>>   				break;
>> -			printf(" %s", buf);
>> +			pr_info(" %s", buf);
>>   		}
>>   	}
>> -	printf(")\n");
>> +	pr_info(")\n");
>>   	free(place);
>>   	return ret;
>>   }
>> @@ -2124,7 +2124,7 @@ static int __add_probe_trace_events(struct perf_probe_event *pev,
>>   	}
>>   
>>   	ret = 0;
>> -	printf("Added new event%s\n", (ntevs > 1) ? "s:" : ":");
>> +	pr_info("Added new event%s\n", (ntevs > 1) ? "s:" : ":");
>>   	for (i = 0; i < ntevs; i++) {
>>   		tev = &tevs[i];
>>   		if (pev->event)
>> @@ -2179,8 +2179,8 @@ static int __add_probe_trace_events(struct perf_probe_event *pev,
>>   
>>   	if (ret >= 0) {
>>   		/* Show how to use the event. */
>> -		printf("\nYou can now use it in all perf tools, such as:\n\n");
>> -		printf("\tperf record -e %s:%s -aR sleep 1\n\n", tev->group,
>> +		pr_info("\nYou can now use it in all perf tools, such as:\n\n");
>> +		pr_info("\tperf record -e %s:%s -aR sleep 1\n\n", tev->group,
>>   			 tev->event);
>>   	}
>>   
>> @@ -2444,7 +2444,7 @@ static int __del_trace_probe_event(int fd, struct str_node *ent)
>>   		goto error;
>>   	}
>>   
>> -	printf("Removed event: %s\n", ent->s);
>> +	pr_info("Removed event: %s\n", ent->s);
>>   	return 0;
>>   error:
>>   	pr_warning("Failed to delete event: %s\n",
>>
>>
>>
>

-- 
Thanks,
Hemant Kumar


  reply	other threads:[~2014-10-28  6:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-27 20:31 [PATCH perf/core 1/2] [BUGFIX] perf-probe: a trivial typo fix for --demangle Masami Hiramatsu
2014-10-27 20:31 ` [PATCH perf/core 2/2] perf-probe: Add --quiet option to suppress output result message Masami Hiramatsu
2014-10-27 12:39   ` (ltc-kernel 10243) " Masami Hiramatsu
2014-10-28  6:27     ` Hemant Kumar [this message]
2014-10-30  6:47   ` [tip:perf/core] perf probe: " tip-bot for Masami Hiramatsu
2014-10-30  6:41 ` [tip:perf/core] perf probe: Trivial typo fix for --demangle tip-bot for Masami Hiramatsu

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=544F3746.5030507@linux.vnet.ibm.com \
    --to=hemant@linux.vnet.ibm.com \
    --cc=acme@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=srikar@linux.vnet.ibm.com \
    /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