lkml.org 
[lkml]   [2012]   [Nov]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRe: [PATCH 01/14] perf tool: Introduce perf_hpp__list for period related columns
Date
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);


\
 
 \ /
  Last update: 2012-11-29 09:21    [W:0.156 / U:2.960 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site