aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-01-22 10:38:37 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-01-22 10:38:37 -0500
commitfcc9d2e5a6c89d22b8b773a64fb4ad21ac318446 (patch)
treea57612d1888735a2ec7972891b68c1ac5ec8faea /tools
parent8dea78da5cee153b8af9c07a2745f6c55057fe12 (diff)
Added missing tegra files.HEADmaster
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/builtin-test.c919
-rw-r--r--tools/perf/util/include/linux/module.h6
-rw-r--r--tools/perf/util/ui/browser.c356
-rw-r--r--tools/perf/util/ui/browser.h52
-rw-r--r--tools/perf/util/ui/browsers/annotate.c302
-rw-r--r--tools/perf/util/ui/browsers/hists.c1138
-rw-r--r--tools/perf/util/ui/browsers/map.c156
-rw-r--r--tools/perf/util/ui/browsers/map.h6
-rw-r--r--tools/perf/util/ui/browsers/top.c212
-rw-r--r--tools/perf/util/ui/helpline.c72
-rw-r--r--tools/perf/util/ui/helpline.h11
-rw-r--r--tools/perf/util/ui/libslang.h27
-rw-r--r--tools/perf/util/ui/progress.c60
-rw-r--r--tools/perf/util/ui/progress.h11
-rw-r--r--tools/perf/util/ui/setup.c46
-rw-r--r--tools/perf/util/ui/ui.h8
-rw-r--r--tools/perf/util/ui/util.c130
-rw-r--r--tools/perf/util/ui/util.h10
-rw-r--r--tools/slub/slabinfo.c1385
19 files changed, 4907 insertions, 0 deletions
diff --git a/tools/perf/builtin-test.c b/tools/perf/builtin-test.c
new file mode 100644
index 00000000000..efe696f936e
--- /dev/null
+++ b/tools/perf/builtin-test.c
@@ -0,0 +1,919 @@
1/*
2 * builtin-test.c
3 *
4 * Builtin regression testing command: ever growing number of sanity tests
5 */
6#include "builtin.h"
7
8#include "util/cache.h"
9#include "util/debug.h"
10#include "util/evlist.h"
11#include "util/parse-options.h"
12#include "util/parse-events.h"
13#include "util/symbol.h"
14#include "util/thread_map.h"
15#include "../../include/linux/hw_breakpoint.h"
16
17static long page_size;
18
19static int vmlinux_matches_kallsyms_filter(struct map *map __used, struct symbol *sym)
20{
21 bool *visited = symbol__priv(sym);
22 *visited = true;
23 return 0;
24}
25
26static int test__vmlinux_matches_kallsyms(void)
27{
28 int err = -1;
29 struct rb_node *nd;
30 struct symbol *sym;
31 struct map *kallsyms_map, *vmlinux_map;
32 struct machine kallsyms, vmlinux;
33 enum map_type type = MAP__FUNCTION;
34 struct ref_reloc_sym ref_reloc_sym = { .name = "_stext", };
35
36 /*
37 * Step 1:
38 *
39 * Init the machines that will hold kernel, modules obtained from
40 * both vmlinux + .ko files and from /proc/kallsyms split by modules.
41 */
42 machine__init(&kallsyms, "", HOST_KERNEL_ID);
43 machine__init(&vmlinux, "", HOST_KERNEL_ID);
44
45 /*
46 * Step 2:
47 *
48 * Create the kernel maps for kallsyms and the DSO where we will then
49 * load /proc/kallsyms. Also create the modules maps from /proc/modules
50 * and find the .ko files that match them in /lib/modules/`uname -r`/.
51 */
52 if (machine__create_kernel_maps(&kallsyms) < 0) {
53 pr_debug("machine__create_kernel_maps ");
54 return -1;
55 }
56
57 /*
58 * Step 3:
59 *
60 * Load and split /proc/kallsyms into multiple maps, one per module.
61 */
62 if (machine__load_kallsyms(&kallsyms, "/proc/kallsyms", type, NULL) <= 0) {
63 pr_debug("dso__load_kallsyms ");
64 goto out;
65 }
66
67 /*
68 * Step 4:
69 *
70 * kallsyms will be internally on demand sorted by name so that we can
71 * find the reference relocation * symbol, i.e. the symbol we will use
72 * to see if the running kernel was relocated by checking if it has the
73 * same value in the vmlinux file we load.
74 */
75 kallsyms_map = machine__kernel_map(&kallsyms, type);
76
77 sym = map__find_symbol_by_name(kallsyms_map, ref_reloc_sym.name, NULL);
78 if (sym == NULL) {
79 pr_debug("dso__find_symbol_by_name ");
80 goto out;
81 }
82
83 ref_reloc_sym.addr = sym->start;
84
85 /*
86 * Step 5:
87 *
88 * Now repeat step 2, this time for the vmlinux file we'll auto-locate.
89 */
90 if (machine__create_kernel_maps(&vmlinux) < 0) {
91 pr_debug("machine__create_kernel_maps ");
92 goto out;
93 }
94
95 vmlinux_map = machine__kernel_map(&vmlinux, type);
96 map__kmap(vmlinux_map)->ref_reloc_sym = &ref_reloc_sym;
97
98 /*
99 * Step 6:
100 *
101 * Locate a vmlinux file in the vmlinux path that has a buildid that
102 * matches the one of the running kernel.
103 *
104 * While doing that look if we find the ref reloc symbol, if we find it
105 * we'll have its ref_reloc_symbol.unrelocated_addr and then
106 * maps__reloc_vmlinux will notice and set proper ->[un]map_ip routines
107 * to fixup the symbols.
108 */
109 if (machine__load_vmlinux_path(&vmlinux, type,
110 vmlinux_matches_kallsyms_filter) <= 0) {
111 pr_debug("machine__load_vmlinux_path ");
112 goto out;
113 }
114
115 err = 0;
116 /*
117 * Step 7:
118 *
119 * Now look at the symbols in the vmlinux DSO and check if we find all of them
120 * in the kallsyms dso. For the ones that are in both, check its names and
121 * end addresses too.
122 */
123 for (nd = rb_first(&vmlinux_map->dso->symbols[type]); nd; nd = rb_next(nd)) {
124 struct symbol *pair, *first_pair;
125 bool backwards = true;
126
127 sym = rb_entry(nd, struct symbol, rb_node);
128
129 if (sym->start == sym->end)
130 continue;
131
132 first_pair = machine__find_kernel_symbol(&kallsyms, type, sym->start, NULL, NULL);
133 pair = first_pair;
134
135 if (pair && pair->start == sym->start) {
136next_pair:
137 if (strcmp(sym->name, pair->name) == 0) {
138 /*
139 * kallsyms don't have the symbol end, so we
140 * set that by using the next symbol start - 1,
141 * in some cases we get this up to a page
142 * wrong, trace_kmalloc when I was developing
143 * this code was one such example, 2106 bytes
144 * off the real size. More than that and we
145 * _really_ have a problem.
146 */
147 s64 skew = sym->end - pair->end;
148 if (llabs(skew) < page_size)
149 continue;
150
151 pr_debug("%#" PRIx64 ": diff end addr for %s v: %#" PRIx64 " k: %#" PRIx64 "\n",
152 sym->start, sym->name, sym->end, pair->end);
153 } else {
154 struct rb_node *nnd;
155detour:
156 nnd = backwards ? rb_prev(&pair->rb_node) :
157 rb_next(&pair->rb_node);
158 if (nnd) {
159 struct symbol *next = rb_entry(nnd, struct symbol, rb_node);
160
161 if (next->start == sym->start) {
162 pair = next;
163 goto next_pair;
164 }
165 }
166
167 if (backwards) {
168 backwards = false;
169 pair = first_pair;
170 goto detour;
171 }
172
173 pr_debug("%#" PRIx64 ": diff name v: %s k: %s\n",
174 sym->start, sym->name, pair->name);
175 }
176 } else
177 pr_debug("%#" PRIx64 ": %s not on kallsyms\n", sym->start, sym->name);
178
179 err = -1;
180 }
181
182 if (!verbose)
183 goto out;
184
185 pr_info("Maps only in vmlinux:\n");
186
187 for (nd = rb_first(&vmlinux.kmaps.maps[type]); nd; nd = rb_next(nd)) {
188