diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-01-27 18:05:51 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-01-29 03:20:58 -0500 |
commit | fd1d908c543fbdfae82839d24b0872c542fceedc (patch) | |
tree | a5ce23cd57ba88f4230b571736d1638dde11aa09 /tools/perf/util/symbol.c | |
parent | a19afe46412452fef89cc623873a8931b3685944 (diff) |
perf symbols: Split helpers used when creating kernel dso object
To make it clear and allow for direct usage by, for instance,
regression test suites.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1264633557-17597-3-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/util/symbol.c')
-rw-r--r-- | tools/perf/util/symbol.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 26ec603083e0..f9049d12ead6 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c | |||
@@ -1762,24 +1762,38 @@ size_t dsos__fprintf_buildid(FILE *fp, bool with_hits) | |||
1762 | __dsos__fprintf_buildid(&dsos__user, fp, with_hits)); | 1762 | __dsos__fprintf_buildid(&dsos__user, fp, with_hits)); |
1763 | } | 1763 | } |
1764 | 1764 | ||
1765 | struct dso *dso__new_kernel(const char *name) | ||
1766 | { | ||
1767 | struct dso *self = dso__new(name ?: "[kernel.kallsyms]"); | ||
1768 | |||
1769 | if (self != NULL) { | ||
1770 | self->short_name = "[kernel]"; | ||
1771 | self->kernel = 1; | ||
1772 | } | ||
1773 | |||
1774 | return self; | ||
1775 | } | ||
1776 | |||
1777 | void dso__read_running_kernel_build_id(struct dso *self) | ||
1778 | { | ||
1779 | if (sysfs__read_build_id("/sys/kernel/notes", self->build_id, | ||
1780 | sizeof(self->build_id)) == 0) | ||
1781 | self->has_build_id = true; | ||
1782 | } | ||
1783 | |||
1765 | static struct dso *dsos__create_kernel(const char *vmlinux) | 1784 | static struct dso *dsos__create_kernel(const char *vmlinux) |
1766 | { | 1785 | { |
1767 | struct dso *kernel = dso__new(vmlinux ?: "[kernel.kallsyms]"); | 1786 | struct dso *kernel = dso__new_kernel(vmlinux); |
1768 | 1787 | ||
1769 | if (kernel == NULL) | 1788 | if (kernel == NULL) |
1770 | return NULL; | 1789 | return NULL; |
1771 | 1790 | ||
1772 | kernel->short_name = "[kernel]"; | ||
1773 | kernel->kernel = 1; | ||
1774 | |||
1775 | vdso = dso__new("[vdso]"); | 1791 | vdso = dso__new("[vdso]"); |
1776 | if (vdso == NULL) | 1792 | if (vdso == NULL) |
1777 | goto out_delete_kernel_dso; | 1793 | goto out_delete_kernel_dso; |
1778 | dso__set_loaded(vdso, MAP__FUNCTION); | 1794 | dso__set_loaded(vdso, MAP__FUNCTION); |
1779 | 1795 | ||
1780 | if (sysfs__read_build_id("/sys/kernel/notes", kernel->build_id, | 1796 | dso__read_running_kernel_build_id(kernel); |
1781 | sizeof(kernel->build_id)) == 0) | ||
1782 | kernel->has_build_id = true; | ||
1783 | 1797 | ||
1784 | dsos__add(&dsos__kernel, kernel); | 1798 | dsos__add(&dsos__kernel, kernel); |
1785 | dsos__add(&dsos__user, vdso); | 1799 | dsos__add(&dsos__user, vdso); |