lkml.org 
[lkml]   [2019]   [Dec]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 1/3] perf report: Change sort order by a specified event in group
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

\
 
 \ /
  Last update: 2019-12-16 08:32    [W:0.068 / U:0.288 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site