diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-04-27 20:22:44 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-04-27 20:22:44 -0400 |
commit | cbf6968098f89d3216d074f06544b5032b344da4 (patch) | |
tree | 842750b609ec0ad6f246be03fc39f7614c98316f /tools/perf | |
parent | d28c62232e50eab202bcd3f19b5c7a25b8b900b6 (diff) |
perf machines: Make the machines class adopt the dsos__fprintf methods
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>
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/builtin-annotate.c | 2 | ||||
-rw-r--r-- | tools/perf/builtin-buildid-list.c | 2 | ||||
-rw-r--r-- | tools/perf/builtin-report.c | 2 | ||||
-rw-r--r-- | tools/perf/builtin-top.c | 2 | ||||
-rw-r--r-- | tools/perf/util/session.h | 13 | ||||
-rw-r--r-- | tools/perf/util/symbol.c | 22 | ||||
-rw-r--r-- | tools/perf/util/symbol.h | 5 |
7 files changed, 33 insertions, 15 deletions
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c index 986b2efcef2e..b57dbcf62af3 100644 --- a/tools/perf/builtin-annotate.c +++ b/tools/perf/builtin-annotate.c | |||
@@ -571,7 +571,7 @@ static int __cmd_annotate(void) | |||
571 | perf_session__fprintf(session, stdout); | 571 | perf_session__fprintf(session, stdout); |
572 | 572 | ||
573 | if (verbose > 2) | 573 | if (verbose > 2) |
574 | dsos__fprintf(&session->machines, stdout); | 574 | perf_session__fprintf_dsos(session, stdout); |
575 | 575 | ||
576 | perf_session__collapse_resort(&session->hists); | 576 | perf_session__collapse_resort(&session->hists); |
577 | perf_session__output_resort(&session->hists, session->event_total[0]); | 577 | perf_session__output_resort(&session->hists, session->event_total[0]); |
diff --git a/tools/perf/builtin-buildid-list.c b/tools/perf/builtin-buildid-list.c index b4a265ae3b98..7dc3b2e7a5e4 100644 --- a/tools/perf/builtin-buildid-list.c +++ b/tools/perf/builtin-buildid-list.c | |||
@@ -46,7 +46,7 @@ static int __cmd_buildid_list(void) | |||
46 | if (with_hits) | 46 | if (with_hits) |
47 | perf_session__process_events(session, &build_id__mark_dso_hit_ops); | 47 | perf_session__process_events(session, &build_id__mark_dso_hit_ops); |
48 | 48 | ||
49 | dsos__fprintf_buildid(&session->machines, stdout, with_hits); | 49 | perf_session__fprintf_dsos_buildid(session, stdout, with_hits); |
50 | 50 | ||
51 | perf_session__delete(session); | 51 | perf_session__delete(session); |
52 | return err; | 52 | return err; |
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 49cc367d8c30..f1b46eb7ef9a 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -313,7 +313,7 @@ static int __cmd_report(void) | |||
313 | perf_session__fprintf(session, stdout); | 313 | perf_session__fprintf(session, stdout); |
314 | 314 | ||
315 | if (verbose > 2) | 315 | if (verbose > 2) |
316 | dsos__fprintf(&session->machines, stdout); | 316 | perf_session__fprintf_dsos(session, stdout); |
317 | 317 | ||
318 | next = rb_first(&session->stats_by_id); | 318 | next = rb_first(&session->stats_by_id); |
319 | while (next) { | 319 | while (next) { |
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index c390f340b03d..d95281f588d2 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -854,7 +854,7 @@ static void handle_keypress(struct perf_session *session, int c) | |||
854 | case 'Q': | 854 | case 'Q': |
855 | printf("exiting.\n"); | 855 | printf("exiting.\n"); |
856 | if (dump_symtab) | 856 | if (dump_symtab) |
857 | dsos__fprintf(&session->machines, stderr); | 857 | perf_session__fprintf_dsos(session, stderr); |
858 | exit(0); | 858 | exit(0); |
859 | case 's': | 859 | case 's': |
860 | prompt_symbol(&sym_filter_entry, "Enter details symbol"); | 860 | prompt_symbol(&sym_filter_entry, "Enter details symbol"); |
diff --git a/tools/perf/util/session.h b/tools/perf/util/session.h index 71252723a17d..61ca92e58ad4 100644 --- a/tools/perf/util/session.h +++ b/tools/perf/util/session.h | |||
@@ -127,4 +127,17 @@ void perf_session__process_machines(struct perf_session *self, | |||
127 | { | 127 | { |
128 | return machines__process(&self->machines, process, self); | 128 | return machines__process(&self->machines, process, self); |
129 | } | 129 | } |
130 | |||
131 | static inline | ||
132 | size_t perf_session__fprintf_dsos(struct perf_session *self, FILE *fp) | ||
133 | { | ||
134 | return machines__fprintf_dsos(&self->machines, fp); | ||
135 | } | ||
136 | |||
137 | static inline | ||
138 | size_t perf_session__fprintf_dsos_buildid(struct perf_session *self, FILE *fp, | ||
139 | bool with_hits) | ||
140 | { | ||
141 | return machines__fprintf_dsos_buildid(&self->machines, fp, with_hits); | ||
142 | } | ||
130 | #endif /* __PERF_SESSION_H */ | 143 | #endif /* __PERF_SESSION_H */ |
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 12359c37240c..caa890f8e2c0 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c | |||
@@ -1889,26 +1889,32 @@ struct dso *__dsos__findnew(struct list_head *head, const char *name) | |||
1889 | return dso; | 1889 | return dso; |
1890 | } | 1890 | } |
1891 | 1891 | ||
1892 | static void __dsos__fprintf(struct list_head *head, FILE *fp) | 1892 | static size_t __dsos__fprintf(struct list_head *head, FILE *fp) |
1893 | { | 1893 | { |
1894 | struct dso *pos; | 1894 | struct dso *pos; |
1895 | size_t ret = 0; | ||
1895 | 1896 | ||
1896 | list_for_each_entry(pos, head, node) { | 1897 | list_for_each_entry(pos, head, node) { |
1897 | int i; | 1898 | int i; |
1898 | for (i = 0; i < MAP__NR_TYPES; ++i) | 1899 | for (i = 0; i < MAP__NR_TYPES; ++i) |
1899 | dso__fprintf(pos, i, fp); | 1900 | ret += dso__fprintf(pos, i, fp); |
1900 | } | 1901 | } |
1902 | |||
1903 | return ret; | ||
1901 | } | 1904 | } |
1902 | 1905 | ||
1903 | void dsos__fprintf(struct rb_root *machines, FILE *fp) | 1906 | size_t machines__fprintf_dsos(struct rb_root *self, FILE *fp) |
1904 | { | 1907 | { |
1905 | struct rb_node *nd; | 1908 | struct rb_node *nd; |
1909 | size_t ret = 0; | ||
1906 | 1910 | ||
1907 | for (nd = rb_first(machines); nd; nd = rb_next(nd)) { | 1911 | for (nd = rb_first(self); nd; nd = rb_next(nd)) { |
1908 | struct machine *pos = rb_entry(nd, struct machine, rb_node); | 1912 | struct machine *pos = rb_entry(nd, struct machine, rb_node); |
1909 | __dsos__fprintf(&pos->kernel_dsos, fp); | 1913 | ret += __dsos__fprintf(&pos->kernel_dsos, fp); |
1910 | __dsos__fprintf(&pos->user_dsos, fp); | 1914 | ret += __dsos__fprintf(&pos->user_dsos, fp); |
1911 | } | 1915 | } |
1916 | |||
1917 | return ret; | ||
1912 | } | 1918 | } |
1913 | 1919 | ||
1914 | static size_t __dsos__fprintf_buildid(struct list_head *head, FILE *fp, | 1920 | 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, | |||
1926 | return ret; | 1932 | return ret; |
1927 | } | 1933 | } |
1928 | 1934 | ||
1929 | size_t dsos__fprintf_buildid(struct rb_root *machines, FILE *fp, bool with_hits) | 1935 | size_t machines__fprintf_dsos_buildid(struct rb_root *self, FILE *fp, bool with_hits) |
1930 | { | 1936 | { |
1931 | struct rb_node *nd; | 1937 | struct rb_node *nd; |
1932 | size_t ret = 0; | 1938 | size_t ret = 0; |
1933 | 1939 | ||
1934 | for (nd = rb_first(machines); nd; nd = rb_next(nd)) { | 1940 | for (nd = rb_first(self); nd; nd = rb_next(nd)) { |
1935 | struct machine *pos = rb_entry(nd, struct machine, rb_node); | 1941 | struct machine *pos = rb_entry(nd, struct machine, rb_node); |
1936 | ret += __dsos__fprintf_buildid(&pos->kernel_dsos, fp, with_hits); | 1942 | ret += __dsos__fprintf_buildid(&pos->kernel_dsos, fp, with_hits); |
1937 | ret += __dsos__fprintf_buildid(&pos->user_dsos, fp, with_hits); | 1943 | ret += __dsos__fprintf_buildid(&pos->user_dsos, fp, with_hits); |
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h index 37b717b861c4..2cec6a10716a 100644 --- a/tools/perf/util/symbol.h +++ b/tools/perf/util/symbol.h | |||
@@ -162,9 +162,8 @@ int dso__load_vmlinux_path(struct dso *self, struct map *map, | |||
162 | symbol_filter_t filter); | 162 | symbol_filter_t filter); |
163 | int dso__load_kallsyms(struct dso *self, const char *filename, struct map *map, | 163 | int dso__load_kallsyms(struct dso *self, const char *filename, struct map *map, |
164 | symbol_filter_t filter); | 164 | symbol_filter_t filter); |
165 | void dsos__fprintf(struct rb_root *kerninfo_root, FILE *fp); | 165 | size_t machines__fprintf_dsos(struct rb_root *self, FILE *fp); |
166 | size_t dsos__fprintf_buildid(struct rb_root *kerninfo_root, | 166 | size_t machines__fprintf_dsos_buildid(struct rb_root *self, FILE *fp, bool with_hits); |
167 | FILE *fp, bool with_hits); | ||
168 | 167 | ||
169 | size_t dso__fprintf_buildid(struct dso *self, FILE *fp); | 168 | size_t dso__fprintf_buildid(struct dso *self, FILE *fp); |
170 | size_t dso__fprintf(struct dso *self, enum map_type type, FILE *fp); | 169 | size_t dso__fprintf(struct dso *self, enum map_type type, FILE *fp); |