perf machines: Make the machines class adopt the dsos__fprintf methods
authorArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 28 Apr 2010 00:22:44 +0000 (21:22 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 28 Apr 2010 00:22:44 +0000 (21:22 -0300)
Now those methods don't operate on a global list of dsos, but on lists
of machines, so make this clear by renaming the functions.

Cc: Avi Kivity <avi@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Zhang, Yanmin <yanmin_zhang@linux.intel.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-annotate.c
tools/perf/builtin-buildid-list.c
tools/perf/builtin-report.c
tools/perf/builtin-top.c
tools/perf/util/session.h
tools/perf/util/symbol.c
tools/perf/util/symbol.h

index 986b2efcef2eebb9168bfdf0147594db01d03147..b57dbcf62af3b203655dc5de0d07eb63fb38cd76 100644 (file)
@@ -571,7 +571,7 @@ static int __cmd_annotate(void)
                perf_session__fprintf(session, stdout);
 
        if (verbose > 2)
-               dsos__fprintf(&session->machines, stdout);
+               perf_session__fprintf_dsos(session, stdout);
 
        perf_session__collapse_resort(&session->hists);
        perf_session__output_resort(&session->hists, session->event_total[0]);
index b4a265ae3b9821fa4d18f726c01a2b22a5e2174d..7dc3b2e7a5e4a939b4a1f964c858927fe19ce41a 100644 (file)
@@ -46,7 +46,7 @@ static int __cmd_buildid_list(void)
        if (with_hits)
                perf_session__process_events(session, &build_id__mark_dso_hit_ops);
 
-       dsos__fprintf_buildid(&session->machines, stdout, with_hits);
+       perf_session__fprintf_dsos_buildid(session, stdout, with_hits);
 
        perf_session__delete(session);
        return err;
index 49cc367d8c30e43f4f5afa2ee149f6332b302415..f1b46eb7ef9afb4bbe8c1cc0cf4d4ed8c1e0520f 100644 (file)
@@ -313,7 +313,7 @@ static int __cmd_report(void)
                perf_session__fprintf(session, stdout);
 
        if (verbose > 2)
-               dsos__fprintf(&session->machines, stdout);
+               perf_session__fprintf_dsos(session, stdout);
 
        next = rb_first(&session->stats_by_id);
        while (next) {
index c390f340b03d26224afb836fffd09fd2edbc974e..d95281f588d2798f469355a81ebbeb9b3fbd5a60 100644 (file)
@@ -854,7 +854,7 @@ static void handle_keypress(struct perf_session *session, int c)
                case 'Q':
                        printf("exiting.\n");
                        if (dump_symtab)
-                               dsos__fprintf(&session->machines, stderr);
+                               perf_session__fprintf_dsos(session, stderr);
                        exit(0);
                case 's':
                        prompt_symbol(&sym_filter_entry, "Enter details symbol");
index 71252723a17d7aeb1ae9ea445880a4d17ce0922b..61ca92e58ad4d6cf1ba44c9f3022ea7b53fcbb2e 100644 (file)
@@ -127,4 +127,17 @@ void perf_session__process_machines(struct perf_session *self,
 {
        return machines__process(&self->machines, process, self);
 }
+
+static inline
+size_t perf_session__fprintf_dsos(struct perf_session *self, FILE *fp)
+{
+       return machines__fprintf_dsos(&self->machines, fp);
+}
+
+static inline
+size_t perf_session__fprintf_dsos_buildid(struct perf_session *self, FILE *fp,
+                                         bool with_hits)
+{
+       return machines__fprintf_dsos_buildid(&self->machines, fp, with_hits);
+}
 #endif /* __PERF_SESSION_H */
index 12359c37240ce6f5f36915b9add6d0e1c71721af..caa890f8e2c0b2db7d362ebe50059ed2724ed7e2 100644 (file)
@@ -1889,26 +1889,32 @@ struct dso *__dsos__findnew(struct list_head *head, const char *name)
        return dso;
 }
 
-static void __dsos__fprintf(struct list_head *head, FILE *fp)
+static size_t __dsos__fprintf(struct list_head *head, FILE *fp)
 {
        struct dso *pos;
+       size_t ret = 0;
 
        list_for_each_entry(pos, head, node) {
                int i;
                for (i = 0; i < MAP__NR_TYPES; ++i)
-                       dso__fprintf(pos, i, fp);
+                       ret += dso__fprintf(pos, i, fp);
        }
+
+       return ret;
 }
 
-void dsos__fprintf(struct rb_root *machines, FILE *fp)
+size_t machines__fprintf_dsos(struct rb_root *self, FILE *fp)
 {
        struct rb_node *nd;
+       size_t ret = 0;
 
-       for (nd = rb_first(machines); nd; nd = rb_next(nd)) {
+       for (nd = rb_first(self); nd; nd = rb_next(nd)) {
                struct machine *pos = rb_entry(nd, struct machine, rb_node);
-               __dsos__fprintf(&pos->kernel_dsos, fp);
-               __dsos__fprintf(&pos->user_dsos, fp);
+               ret += __dsos__fprintf(&pos->kernel_dsos, fp);
+               ret += __dsos__fprintf(&pos->user_dsos, fp);
        }
+
+       return ret;
 }
 
 static size_t __dsos__fprintf_buildid(struct list_head *head, FILE *fp,
@@ -1926,12 +1932,12 @@ static size_t __dsos__fprintf_buildid(struct list_head *head, FILE *fp,
        return ret;
 }
 
-size_t dsos__fprintf_buildid(struct rb_root *machines, FILE *fp, bool with_hits)
+size_t machines__fprintf_dsos_buildid(struct rb_root *self, FILE *fp, bool with_hits)
 {
        struct rb_node *nd;
        size_t ret = 0;
 
-       for (nd = rb_first(machines); nd; nd = rb_next(nd)) {
+       for (nd = rb_first(self); nd; nd = rb_next(nd)) {
                struct machine *pos = rb_entry(nd, struct machine, rb_node);
                ret += __dsos__fprintf_buildid(&pos->kernel_dsos, fp, with_hits);
                ret += __dsos__fprintf_buildid(&pos->user_dsos, fp, with_hits);
index 37b717b861c4bb816fd2e5db07fed189749d52e5..2cec6a10716ab8d4d627fed3acd95d45d39cdf5d 100644 (file)
@@ -162,9 +162,8 @@ int dso__load_vmlinux_path(struct dso *self, struct map *map,
                           symbol_filter_t filter);
 int dso__load_kallsyms(struct dso *self, const char *filename, struct map *map,
                       symbol_filter_t filter);
-void dsos__fprintf(struct rb_root *kerninfo_root, FILE *fp);
-size_t dsos__fprintf_buildid(struct rb_root *kerninfo_root,
-               FILE *fp, bool with_hits);
+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(struct dso *self, enum map_type type, FILE *fp);