mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
To: acme@redhat.com
Cc: jolsa@redhat.com, linux-kernel@vger.kernel.org,
	Ravi Bangoria <ravi.bangoria@linux.ibm.com>
Subject: Re: [PATCH 1/2] libsubcmd: Fix OPT_CALLBACK_SET()
Date: Fri, 17 Jul 2020 09:10:45 +0530	[thread overview]
Message-ID: <3b15af42-bfb2-07dd-8bb2-df9cd6b32a34@linux.ibm.com> (raw)
In-Reply-To: <20200619133412.50705-1-ravi.bangoria@linux.ibm.com>

Hi Arnaldo,

Can you please consider this trivial fix.

Ravi

On 6/19/20 7:04 PM, Ravi Bangoria wrote:
> Any option macro with _SET suffix should set opt->set variable which
> is not happening for OPT_CALLBACK_SET(). This is causing issues with
> perf record --switch-output-event. Fix that.
> 
> Before:
>    # ./perf record --overwrite -e sched:*switch,syscalls:sys_enter_mmap \
>             --switch-output-event syscalls:sys_enter_mmap
>    ^C[ perf record: Woken up 1 times to write data ]
>    [ perf record: Captured and wrote 0.297 MB perf.data (657 samples) ]
> 
> After:
> 
>    $ ./perf record --overwrite -e sched:*switch,syscalls:sys_enter_mmap \
>            --switch-output-event syscalls:sys_enter_mmap
>    [ perf record: dump data: Woken up 1 times ]
>    [ perf record: Dump perf.data.2020061918144542 ]
>    [ perf record: dump data: Woken up 1 times ]
>    [ perf record: Dump perf.data.2020061918144608 ]
>    [ perf record: dump data: Woken up 1 times ]
>    [ perf record: Dump perf.data.2020061918144660 ]
>    ^C[ perf record: dump data: Woken up 1 times ]
>    [ perf record: Dump perf.data.2020061918144784 ]
>    [ perf record: Woken up 0 times to write data ]
>    [ perf record: Dump perf.data.2020061918144803 ]
>    [ perf record: Captured and wrote 0.419 MB perf.data.<timestamp> ]
> 
> Fixes: 636eb4d001b1 ("libsubcmd: Introduce OPT_CALLBACK_SET()")
> Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
> ---
>   tools/lib/subcmd/parse-options.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/tools/lib/subcmd/parse-options.c b/tools/lib/subcmd/parse-options.c
> index dbb9efbf718a..39ebf6192016 100644
> --- a/tools/lib/subcmd/parse-options.c
> +++ b/tools/lib/subcmd/parse-options.c
> @@ -237,6 +237,9 @@ static int get_value(struct parse_opt_ctx_t *p,
>   		return err;
>   
>   	case OPTION_CALLBACK:
> +		if (opt->set)
> +			*(bool *)opt->set = true;
> +
>   		if (unset)
>   			return (*opt->callback)(opt, NULL, 1) ? (-1) : 0;
>   		if (opt->flags & PARSE_OPT_NOARG)
> 

  parent reply	other threads:[~2020-07-17  3:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-19 13:34 Ravi Bangoria
2020-06-19 13:34 ` [PATCH 2/2] perf record: Fix --switch-output=time documentation Ravi Bangoria
2020-07-17  3:40 ` Ravi Bangoria [this message]
2020-07-17 12:34   ` [PATCH 1/2] libsubcmd: Fix OPT_CALLBACK_SET() Arnaldo Carvalho de Melo

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=3b15af42-bfb2-07dd-8bb2-df9cd6b32a34@linux.ibm.com \
    --to=ravi.bangoria@linux.ibm.com \
    --cc=acme@redhat.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.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

Powered by JetHome