linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: Ian Rogers <irogers@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Namhyung Kim <namhyung@kernel.org>,
	linux-kernel@vger.kernel.org,
	Stephane Eranian <eranian@google.com>
Subject: Re: [PATCH] perf c2c: fix '-e list'
Date: Wed, 27 Nov 2019 09:18:44 +0100	[thread overview]
Message-ID: <20191127081844.GH32367@krava> (raw)
In-Reply-To: <20191127073442.174202-1-irogers@google.com>

On Tue, Nov 26, 2019 at 11:34:42PM -0800, Ian Rogers wrote:
> When the event is passed as list, the default events should be listed as
> per 'perf mem record -e list'. Previous behavior is:
> 
> $ perf c2c record -e list
> failed: event 'list' not found, use '-e list' to get list of available events
> 
>  Usage: perf c2c record [<options>] [<command>]
>     or: perf c2c record [<options>] -- <command> [<options>]
> 
>     -e, --event <event>   event selector. Use 'perf mem record -e list' to list available events

man c2c page do say you should use 'perf mem' not 'perf c2c'
could you please change the man page as well?

> 
> New behavior:
> 
> $ perf c2c record -e list
> ldlat-loads  : available
> ldlat-stores : available
> 
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
>  tools/perf/builtin-c2c.c | 20 ++++++++++++++++++--
>  1 file changed, 18 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c
> index e69f44941aad..dd69cd218e4c 100644
> --- a/tools/perf/builtin-c2c.c
> +++ b/tools/perf/builtin-c2c.c
> @@ -2872,10 +2872,26 @@ static int perf_c2c__report(int argc, const char **argv)
>  static int parse_record_events(const struct option *opt,
>  			       const char *str, int unset __maybe_unused)
>  {
> +	int j;
>  	bool *event_set = (bool *) opt->value;
>  
> -	*event_set = true;
> -	return perf_mem_events__parse(str);
> +	if (strcmp(str, "list")) {
> +		*event_set = true;
> +		if (!perf_mem_events__parse(str))
> +			return 0;
> +
> +		exit(-1);
> +	}
> +	for (j = 0; j < PERF_MEM_EVENTS__MAX; j++) {
> +		struct perf_mem_event *e = &perf_mem_events[j];
> +
> +		fprintf(stderr, "%-13s%-*s%s\n",
> +			e->tag,
> +			verbose > 0 ? 25 : 0,
> +			verbose > 0 ? perf_mem_events__name(j) : "",
> +			e->supported ? ": available" : "");
> +	}

there's same loop in builtin-mem.c, could you please put it
to function in mem-events.c?

thanks,
jirka


  reply	other threads:[~2019-11-27  8:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-27  7:34 [PATCH] perf c2c: fix '-e list' Ian Rogers
2019-11-27  8:18 ` Jiri Olsa [this message]
2019-11-27 18:33   ` Ian Rogers
2019-11-27 18:28 ` [PATCH v2] " Ian Rogers

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=20191127081844.GH32367@krava \
    --to=jolsa@redhat.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=eranian@google.com \
    --cc=irogers@google.com \
    --cc=linux-kernel@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;
as well as URLs for NNTP newsgroup(s).