Re: [PATCH 4/5] perf diff: Fix output ordering to honor next column
From: Namhyung Kim
Date: Wed Jan 07 2015 - 02:45:10 EST
Hi Jiri,
On Sun, Jan 04, 2015 at 07:16:40PM +0100, Jiri Olsa wrote:
> On Sat, Dec 27, 2014 at 02:06:32PM +0900, Namhyung Kim wrote:
>
> SNIP
>
> > if (!pairs_left || !pairs_right)
> > return pairs_left ? -1 : 1;
> >
> > - p_left = get_pair_data(left, &data__files[sort_compute]);
> > - p_right = get_pair_data(right, &data__files[sort_compute]);
> > + p_left = get_pair_data(left, &data__files[sort_idx]);
> > + p_right = get_pair_data(right, &data__files[sort_idx]);
> >
> > if (!p_left && !p_right)
> > return 0;
> > @@ -555,8 +560,13 @@ hist_entry__cmp_nop(struct hist_entry *left __maybe_unused,
> > static int64_t
> > hist_entry__cmp_baseline(struct hist_entry *left, struct hist_entry *right)
> > {
> > - if (sort_compute)
> > - return 0;
> > + /*
> > + * This function will be called first for each entry to resort
> > + * output. Next compare-functions use this idx to find their
> > + * data and increase it for next data so we need to initialize
> > + * it everytime.
> > + */
> > + data_idx = 0;
>
> hum, could we omit the global 'data_idx' variable usage by passing
> 'struct perf_hpp_fmt' into color fmt callbacks? (like hist_entry__cmp_delta..)
>
> we could get the data_idx from 'struct diff_hpp_fmt'::idx
Right, I thought that too. But it requires adding '__maybe_unused
fmt' argument to all callbacks so I just decided to use a quick
solution. I'll convert to pass the fmt argument as it'll make
possible future changes easier.
Thanks,
Namhyung
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/