Re: [PATCH 01/10] perf tools: Move TUI-specific fields into unnamed union

From: Arnaldo Carvalho de Melo
Date: Wed Apr 22 2015 - 07:57:31 EST


Em Wed, Apr 22, 2015 at 04:18:12PM +0900, Namhyung Kim escreveu:
> +++ b/tools/perf/util/sort.h
> @@ -93,18 +93,24 @@ struct hist_entry {
> u8 cpumode;
> - struct hist_entry_diff diff;
> -
> - /* XXX These two should move to some tree widget lib */
> - u16 row_offset;
> - u16 nr_rows;
> + union {
> + /*
> + * Since perf diff only supports the stdio output, TUI
> + * fields are only accessed from perf report (or perf
> + * top). So make it an union to reduce memory usage.
> + */
> + struct hist_entry_diff diff;
> + struct /* for TUI */ {
> + u16 row_offset;
> + u16 nr_rows;
> + };
> + };

Thanks, this way we don't have to touch the diff code, reducing this
patch size.

At some later date, we can shorten the accesses to diff.<fields>, if
struct hist_entry_diff isn't passed as a parameter, etc. But this
certainly is something for later, if at all.

Applying.

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