Hi David,

Just minor nits below..

On Mon, 18 Nov 2013 13:32:45 -0700, David Ahern wrote:
> Allows list of idle symbols to be leveraged by other commands,
> such as the upcoming timehist command.

[SNIP]
> +bool symbol__is_idle(struct symbol *sym)
> +{
> +     const char * const idle_symbols[] = {

Wouldn't it better making it static?  It seems to build a table
everytime otherwise.


> +             "cpu_idle",
> +             "intel_idle",
> +             "default_idle",
> +             "native_safe_halt",
> +             "enter_idle",
> +             "exit_idle",
> +             "mwait_idle",
> +             "mwait_idle_with_hints",
> +             "poll_idle",
> +             "ppc64_runlatch_off",
> +             "pseries_dedicated_idle_sleep",
> +             NULL
> +     };
> +
> +     int i;
> +
> +     if (!sym)
> +             return false;
> +
> +     for (i = 0; idle_symbols[i]; i++) {

Also we can use ARRAY_SIZE() here and let the last NULL go IMHO.

Thanks,
Namhyung


> +             if (!strcmp(idle_symbols[i], sym->name))
> +                     return true;
> +     }
> +
> +     return false;
> +}
> +
>  static int map__process_kallsym_symbol(void *arg, const char *name,
>                                      char type, u64 start)
>  {
> diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
> index 07de8fea2f48..ad13c5d50b91 100644
> --- a/tools/perf/util/symbol.h
> +++ b/tools/perf/util/symbol.h
> @@ -240,6 +240,7 @@ size_t symbol__fprintf(struct symbol *sym, FILE *fp);
>  bool symbol_type__is_a(char symbol_type, enum map_type map_type);
>  bool symbol__restricted_filename(const char *filename,
>                                const char *restricted_filename);
> +bool symbol__is_idle(struct symbol *sym);
>  
>  int dso__load_sym(struct dso *dso, struct map *map, struct symsrc *syms_ss,
>                 struct symsrc *runtime_ss, symbol_filter_t filter,
--
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