Hi Jiri,

On Wed, 28 Nov 2012 14:52:36 +0100, Jiri Olsa wrote:
> Adding perf_hpp__list list to register and contain all period
> related columns the command is interested in.
>
> This way we get rid of static array holding all possible
> columns and enable commands to register their own columns.

But it seems you didn't get rid of the array? :)

>
> It'll be handy for diff command in future to process and display
> data for multiple files.
[snip]
> diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
> index 8b091a5..a935a60 100644
> --- a/tools/perf/util/hist.h
> +++ b/tools/perf/util/hist.h
> @@ -126,13 +126,19 @@ struct perf_hpp {
>  };
>  
>  struct perf_hpp_fmt {
> -     bool cond;
>       int (*header)(struct perf_hpp *hpp);
>       int (*width)(struct perf_hpp *hpp);
>       int (*color)(struct perf_hpp *hpp, struct hist_entry *he);
>       int (*entry)(struct perf_hpp *hpp, struct hist_entry *he);
> +
> +     struct list_head list;
>  };
>  
> +extern struct list_head perf_hpp__list;
> +
> +#define perf_hpp__for_each_format(format) \
> +     list_for_each_entry(format, &perf_hpp__list, list)
> +
>  extern struct perf_hpp_fmt perf_hpp__format[];

Instead of using new perf_hpp__list, how about this?

#define perf_hpp__for_each_format(fmt) \
        for (fmt = &perf_hpp__format[0]; fmt < 
&perf_hpp__format[PERF_HPP__MAX_INDEX]; fmt++) \
                if (fmt->cond)

Thanks,
Namhyung

>  
>  enum {
> @@ -155,7 +161,8 @@ enum {
>  };
>  
>  void perf_hpp__init(void);
> -void perf_hpp__column_enable(unsigned col, bool enable);
> +void perf_hpp__column_register(struct perf_hpp_fmt *format);
> +void perf_hpp__column_enable(unsigned col);
>  int hist_entry__period_snprintf(struct perf_hpp *hpp, struct hist_entry *he,
>                               bool color);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to