Re: [PATCH 4/5] perf diff: Fix output ordering to honor next column

From: Jiri Olsa
Date: Sun Jan 04 2015 - 13:17:00 EST


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

jirka
--
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/