[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100712155531.GC23776@linux.vnet.ibm.com>
Date: Mon, 12 Jul 2010 21:25:31 +0530
From: Srikar Dronamraju <srikar@...ux.vnet.ibm.com>
To: Arnaldo Carvalho de Melo <acme@...radead.org>
Cc: Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...e.hu>,
Steven Rostedt <rostedt@...dmis.org>,
Randy Dunlap <rdunlap@...otime.net>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Christoph Hellwig <hch@...radead.org>,
Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>,
Oleg Nesterov <oleg@...hat.com>,
Mark Wielaard <mjw@...hat.com>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
LKML <linux-kernel@...r.kernel.org>,
Naren A Devaiah <naren.devaiah@...ibm.com>,
Jim Keniston <jkenisto@...ux.vnet.ibm.com>,
Frederic Weisbecker <fweisbec@...il.com>,
"Frank Ch. Eigler" <fche@...hat.com>,
Ananth N Mavinakayanahalli <ananth@...ibm.com>,
Andrew Morton <akpm@...ux-foundation.org>,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
Subject: Re: [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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists