lkml.org 
[lkml]   [2010]   [Jul]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCHv9 2.6.35-rc4-tip 12/13] [RFC] perf: Show Potential probe points.
> 
> What if strlist__new() fails?
>

Okay will add a check.

>

> Humm, here I think perhaps we should try to do as the kernel and
> introduce some form of:
>
> map_groups__for_each_map(self, pos)
>
> Like we have for list_for_each_entry, strlist__for_each, for_each_lang,
> for_each_script, etc.
>
> Matter of coding style, following the culture of the kernel is a goal
> for these tools, to encourage kernel hackers to contribute to these
> tools.

Okay.

>
>
> Also here please follow the style of the other routines that print
> entries, i.e.:
>
> size_t dso__fprintf_symbols(self, type, fp)
>
> like this:
>
> diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
> index 971d0a0..85fe580 100644
> --- a/tools/perf/util/symbol.c
> +++ b/tools/perf/util/symbol.c
> @@ -370,9 +370,21 @@ size_t dso__fprintf_buildid(struct dso *self, FILE *fp)
> return fprintf(fp, "%s", sbuild_id);
> }
>
> -size_t dso__fprintf(struct dso *self, enum map_type type, FILE *fp)
> +size_t dso__fprintf_symbols(struct dso *self, enum map_type type, FILE *fp)
> {
> + size_t ret = 0;
> struct rb_node *nd;
> +
> + for (nd = rb_first(&self->symbols[type]); nd; nd = rb_next(nd)) {
> + struct symbol *pos = rb_entry(nd, struct symbol, rb_node);
> + ret += symbol__fprintf(pos, fp);
> + }
> +
> + return ret;
> +}
> +
> +size_t dso__fprintf(struct dso *self, enum map_type type, FILE *fp)
> +{
> size_t ret = fprintf(fp, "dso: %s (", self->short_name);
>
> if (self->short_name != self->long_name)
> @@ -381,12 +393,8 @@ size_t dso__fprintf(struct dso *self, enum map_type type, FILE *fp)
> self->loaded ? "" : "NOT ");
> ret += dso__fprintf_buildid(self, fp);
> ret += fprintf(fp, ")\n");
> - for (nd = rb_first(&self->symbols[type]); nd; nd = rb_next(nd)) {
> - struct symbol *pos = rb_entry(nd, struct symbol, rb_node);
> - ret += symbol__fprintf(pos, fp);
> - }
>
> - return ret;
> + return ret + dso__fprintf_symbols(self, type, fp);
> }
>
> int kallsyms__parse(const char *filename, void *arg,
> diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
> index 261a3e3..714d286 100644
> --- a/tools/perf/util/symbol.h
> +++ b/tools/perf/util/symbol.h
> @@ -177,6 +177,7 @@ size_t machines__fprintf_dsos(struct rb_root *self, FILE *fp);
> size_t machines__fprintf_dsos_buildid(struct rb_root *self, FILE *fp, bool with_hits);
>
> size_t dso__fprintf_buildid(struct dso *self, FILE *fp);
> +size_t dso__fprintf_symbols(struct dso *self, enum map_type type, FILE *fp);
> size_t dso__fprintf(struct dso *self, enum map_type type, FILE *fp);
>
> enum dso_origin {
>
> ------------------------------------
>
> This way we reduce the resulting code size while following the existing
> style.

Okay.


\
 
 \ /
  Last update: 2010-07-12 18:07    [W:0.065 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site