linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: Jin Yao <yao.jin@linux.intel.com>
Cc: acme@kernel.org, jolsa@kernel.org, peterz@infradead.org,
	mingo@redhat.com, alexander.shishkin@linux.intel.com,
	Linux-kernel@vger.kernel.org, ak@linux.intel.com,
	kan.liang@intel.com, yao.jin@intel.com
Subject: Re: [PATCH v3 1/3] perf report: Change sort order by a specified event in group
Date: Mon, 16 Dec 2019 08:31:13 +0100	[thread overview]
Message-ID: <20191216073113.GB18240@krava> (raw)
In-Reply-To: <20191212123337.23600-1-yao.jin@linux.intel.com>

On Thu, Dec 12, 2019 at 08:33:35PM +0800, Jin Yao wrote:

SNIP

> 
> Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
> ---
>  tools/perf/Documentation/perf-report.txt |   4 +
>  tools/perf/builtin-report.c              |  10 +++
>  tools/perf/ui/hist.c                     | 108 +++++++++++++++++++----
>  tools/perf/util/symbol_conf.h            |   1 +
>  4 files changed, 108 insertions(+), 15 deletions(-)
> 
> diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt
> index 8dbe2119686a..9ade613ef020 100644
> --- a/tools/perf/Documentation/perf-report.txt
> +++ b/tools/perf/Documentation/perf-report.txt
> @@ -371,6 +371,10 @@ OPTIONS
>  	Show event group information together. It forces group output also
>  	if there are no groups defined in data file.
>  
> +--group-sort-idx::
> +	Sort the output by the event at the index n in group. If n is invalid,
> +	sort by the first event. WARNING: This should be used with --group.

--group in record or report?

you can also create groups with -e '{}', not just --group option

I wonder you could check early on 'evlist->nr_groups' and fail
if there's no group defined if the option is enabled

also what happens when we have more groups?

I think the option is easy to use as it is, just needs to be explained
consequences for more groups with different amount of events

SNIP

> +
> +static int __hpp__group_sort_idx(struct hist_entry *a, struct hist_entry *b,
> +				 hpp_field_fn get_field, int idx)
> +{
> +	struct evsel *evsel = hists_to_evsel(a->hists);
> +	u64 *fields_a, *fields_b;
> +	int cmp, nr_members, ret, i;
> +
> +	cmp = field_cmp(get_field(a), get_field(b));
> +	if (!perf_evsel__is_group_event(evsel))
> +		return cmp;
> +
> +	nr_members = evsel->core.nr_members;
> +	ret = pair_fields_alloc(a, b, get_field, nr_members,
> +				&fields_a, &fields_b);
> +	if (ret) {
> +		ret = cmp;
> +		goto out;
> +	}
> +
> +	if (idx >= 1 && idx < nr_members) {

do we need to continue here if idx is out of the limit?
I'm not sure but mybe in that case the comparison above
should be enough?

thanks,
jirka


  parent reply	other threads:[~2019-12-16  7:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-12 12:33 [PATCH v3 1/3] perf report: Change sort order by a specified event in group Jin Yao
2019-12-12 12:33 ` [PATCH v3 2/3] perf report: Support a new key to reload the browser Jin Yao
2019-12-12 12:33 ` [PATCH v3 3/3] perf report: support hotkey to let user select any event for sorting Jin Yao
2019-12-16  7:31 ` Jiri Olsa [this message]
2019-12-17  1:47   ` [PATCH v3 1/3] perf report: Change sort order by a specified event in group Jin, Yao
2019-12-17  9:06     ` Jiri Olsa
2019-12-18  2:29       ` Jin, Yao

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=20191216073113.GB18240@krava \
    --to=jolsa@redhat.com \
    --cc=Linux-kernel@vger.kernel.org \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@intel.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=yao.jin@intel.com \
    --cc=yao.jin@linux.intel.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;
as well as URLs for NNTP newsgroup(s).