aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/arch/sparc/Makefile4
-rw-r--r--tools/perf/arch/sparc/util/dwarf-regs.c43
-rw-r--r--tools/perf/builtin-report.c2
-rwxr-xr-xtools/perf/util/PERF-VERSION-GEN17
-rw-r--r--tools/perf/util/callchain.c35
-rw-r--r--tools/perf/util/callchain.h5
6 files changed, 79 insertions, 27 deletions
diff --git a/tools/perf/arch/sparc/Makefile b/tools/perf/arch/sparc/Makefile
new file mode 100644
index 000000000000..15130b50dfe3
--- /dev/null
+++ b/tools/perf/arch/sparc/Makefile
@@ -0,0 +1,4 @@
1ifndef NO_DWARF
2PERF_HAVE_DWARF_REGS := 1
3LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
4endif
diff --git a/tools/perf/arch/sparc/util/dwarf-regs.c b/tools/perf/arch/sparc/util/dwarf-regs.c
new file mode 100644
index 000000000000..0ab88483720c
--- /dev/null
+++ b/tools/perf/arch/sparc/util/dwarf-regs.c
@@ -0,0 +1,43 @@
1/*
2 * Mapping of DWARF debug register numbers into register names.
3 *
4 * Copyright (C) 2010 David S. Miller <davem@davemloft.net>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#include <libio.h>
13#include <dwarf-regs.h>
14
15#define SPARC_MAX_REGS 96
16
17const char *sparc_regs_table[SPARC_MAX_REGS] = {
18 "%g0", "%g1", "%g2", "%g3", "%g4", "%g5", "%g6", "%g7",
19 "%o0", "%o1", "%o2", "%o3", "%o4", "%o5", "%sp", "%o7",
20 "%l0", "%l1", "%l2", "%l3", "%l4", "%l5", "%l6", "%l7",
21 "%i0", "%i1", "%i2", "%i3", "%i4", "%i5", "%fp", "%i7",
22 "%f0", "%f1", "%f2", "%f3", "%f4", "%f5", "%f6", "%f7",
23 "%f8", "%f9", "%f10", "%f11", "%f12", "%f13", "%f14", "%f15",
24 "%f16", "%f17", "%f18", "%f19", "%f20", "%f21", "%f22", "%f23",
25 "%f24", "%f25", "%f26", "%f27", "%f28", "%f29", "%f30", "%f31",
26 "%f32", "%f33", "%f34", "%f35", "%f36", "%f37", "%f38", "%f39",
27 "%f40", "%f41", "%f42", "%f43", "%f44", "%f45", "%f46", "%f47",
28 "%f48", "%f49", "%f50", "%f51", "%f52", "%f53", "%f54", "%f55",
29 "%f56", "%f57", "%f58", "%f59", "%f60", "%f61", "%f62", "%f63",
30};
31
32/**
33 * get_arch_regstr() - lookup register name from it's DWARF register number
34 * @n: the DWARF register number
35 *
36 * get_arch_regstr() returns the name of the register in struct
37 * regdwarfnum_table from it's DWARF register number. If the register is not
38 * found in the table, this returns NULL;
39 */
40const char *get_arch_regstr(unsigned int n)
41{
42 return (n <= SPARC_MAX_REGS) ? sparc_regs_table[n] : NULL;
43}
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 371a3c995806..ce42bbaa252d 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -107,7 +107,7 @@ static int perf_session__add_hist_entry(struct perf_session *self,
107 goto out_free_syms; 107 goto out_free_syms;
108 err = 0; 108 err = 0;
109 if (symbol_conf.use_callchain) { 109 if (symbol_conf.use_callchain) {
110 err = append_chain(he->callchain, data->callchain, syms); 110 err = append_chain(he->callchain, data->callchain, syms, data->period);
111 if (err) 111 if (err)
112 goto out_free_syms; 112 goto out_free_syms;
113 } 113 }
diff --git a/tools/perf/util/PERF-VERSION-GEN b/tools/perf/util/PERF-VERSION-GEN
index 49ece7921914..97d76562a1a0 100755
--- a/tools/perf/util/PERF-VERSION-GEN
+++ b/tools/perf/util/PERF-VERSION-GEN
@@ -5,17 +5,13 @@ if [ $# -eq 1 ] ; then
5fi 5fi
6 6
7GVF=${OUTPUT}PERF-VERSION-FILE 7GVF=${OUTPUT}PERF-VERSION-FILE
8DEF_VER=v0.0.2.PERF
9 8
10LF=' 9LF='
11' 10'
12 11
13# First see if there is a version file (included in release tarballs), 12# First check if there is a .git to get the version from git describe
14# then try git-describe, then default. 13# otherwise try to get the version from the kernel makefile
15if test -f version 14if test -d ../../.git -o -f ../../.git &&
16then
17 VN=$(cat version) || VN="$DEF_VER"
18elif test -d .git -o -f .git &&
19 VN=$(git describe --abbrev=4 HEAD 2>/dev/null) && 15 VN=$(git describe --abbrev=4 HEAD 2>/dev/null) &&
20 case "$VN" in 16 case "$VN" in
21 *$LF*) (exit 1) ;; 17 *$LF*) (exit 1) ;;
@@ -27,7 +23,12 @@ elif test -d .git -o -f .git &&
27then 23then
28 VN=$(echo "$VN" | sed -e 's/-/./g'); 24 VN=$(echo "$VN" | sed -e 's/-/./g');
29else 25else
30 VN="$DEF_VER" 26 eval `grep '^VERSION\s*=' ../../Makefile|tr -d ' '`
27 eval `grep '^PATCHLEVEL\s*=' ../../Makefile|tr -d ' '`
28 eval `grep '^SUBLEVEL\s*=' ../../Makefile|tr -d ' '`
29 eval `grep '^EXTRAVERSION\s*=' ../../Makefile|tr -d ' '`
30
31 VN="${VERSION}.${PATCHLEVEL}.${SUBLEVEL}${EXTRAVERSION}"
31fi 32fi
32 33
33VN=$(expr "$VN" : v*'\(.*\)') 34VN=$(expr "$VN" : v*'\(.*\)')
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
index e63c997d6c1b..f231f43424d2 100644
--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -230,7 +230,7 @@ fill_node(struct callchain_node *node, struct resolved_chain *chain, int start)
230 230
231static void 231static void
232add_child(struct callchain_node *parent, struct resolved_chain *chain, 232add_child(struct callchain_node *parent, struct resolved_chain *chain,
233 int start) 233 int start, u64 period)
234{ 234{
235 struct callchain_node *new; 235 struct callchain_node *new;
236 236
@@ -238,7 +238,7 @@ add_child(struct callchain_node *parent, struct resolved_chain *chain,
238 fill_node(new, chain, start); 238 fill_node(new, chain, start);
239 239
240 new->children_hit = 0; 240 new->children_hit = 0;
241 new->hit = 1; 241 new->hit = period;
242} 242}
243 243
244/* 244/*
@@ -248,7 +248,8 @@ add_child(struct callchain_node *parent, struct resolved_chain *chain,
248 */ 248 */
249static void 249static void
250split_add_child(struct callchain_node *parent, struct resolved_chain *chain, 250split_add_child(struct callchain_node *parent, struct resolved_chain *chain,
251 struct callchain_list *to_split, int idx_parents, int idx_local) 251 struct callchain_list *to_split, int idx_parents, int idx_local,
252 u64 period)
252{ 253{
253 struct callchain_node *new; 254 struct callchain_node *new;
254 struct list_head *old_tail; 255 struct list_head *old_tail;
@@ -275,41 +276,41 @@ split_add_child(struct callchain_node *parent, struct resolved_chain *chain,
275 /* create a new child for the new branch if any */ 276 /* create a new child for the new branch if any */
276 if (idx_total < chain->nr) { 277 if (idx_total < chain->nr) {
277 parent->hit = 0; 278 parent->hit = 0;
278 add_child(parent, chain, idx_total); 279 add_child(parent, chain, idx_total, period);
279 parent->children_hit++; 280 parent->children_hit += period;
280 } else { 281 } else {
281 parent->hit = 1; 282 parent->hit = period;
282 } 283 }
283} 284}
284 285
285static int 286static int
286__append_chain(struct callchain_node *root, struct resolved_chain *chain, 287__append_chain(struct callchain_node *root, struct resolved_chain *chain,
287 unsigned int start); 288 unsigned int start, u64 period);
288 289
289static void 290static void
290__append_chain_children(struct callchain_node *root, 291__append_chain_children(struct callchain_node *root,
291 struct resolved_chain *chain, 292 struct resolved_chain *chain,
292 unsigned int start) 293 unsigned int start, u64 period)
293{ 294{
294 struct callchain_node *rnode; 295 struct callchain_node *rnode;
295 296
296 /* lookup in childrens */ 297 /* lookup in childrens */
297 chain_for_each_child(rnode, root) { 298 chain_for_each_child(rnode, root) {
298 unsigned int ret = __append_chain(rnode, chain, start); 299 unsigned int ret = __append_chain(rnode, chain, start, period);
299 300
300 if (!ret) 301 if (!ret)
301 goto inc_children_hit; 302 goto inc_children_hit;
302 } 303 }
303 /* nothing in children, add to the current node */ 304 /* nothing in children, add to the current node */
304 add_child(root, chain, start); 305 add_child(root, chain, start, period);
305 306
306inc_children_hit: 307inc_children_hit:
307 root->children_hit++; 308 root->children_hit += period;
308} 309}
309 310
310static int 311static int
311__append_chain(struct callchain_node *root, struct resolved_chain *chain, 312__append_chain(struct callchain_node *root, struct resolved_chain *chain,
312 unsigned int start) 313 unsigned int start, u64 period)
313{ 314{
314 struct callchain_list *cnode; 315 struct callchain_list *cnode;
315 unsigned int i = start; 316 unsigned int i = start;
@@ -345,18 +346,18 @@ __append_chain(struct callchain_node *root, struct resolved_chain *chain,
345 346
346 /* we match only a part of the node. Split it and add the new chain */ 347 /* we match only a part of the node. Split it and add the new chain */
347 if (i - start < root->val_nr) { 348 if (i - start < root->val_nr) {
348 split_add_child(root, chain, cnode, start, i - start); 349 split_add_child(root, chain, cnode, start, i - start, period);
349 return 0; 350 return 0;
350 } 351 }
351 352
352 /* we match 100% of the path, increment the hit */ 353 /* we match 100% of the path, increment the hit */
353 if (i - start == root->val_nr && i == chain->nr) { 354 if (i - start == root->val_nr && i == chain->nr) {
354 root->hit++; 355 root->hit += period;
355 return 0; 356 return 0;
356 } 357 }
357 358
358 /* We match the node and still have a part remaining */ 359 /* We match the node and still have a part remaining */
359 __append_chain_children(root, chain, i); 360 __append_chain_children(root, chain, i, period);
360 361
361 return 0; 362 return 0;
362} 363}
@@ -380,7 +381,7 @@ static void filter_context(struct ip_callchain *old, struct resolved_chain *new,
380 381
381 382
382int append_chain(struct callchain_node *root, struct ip_callchain *chain, 383int append_chain(struct callchain_node *root, struct ip_callchain *chain,
383 struct map_symbol *syms) 384 struct map_symbol *syms, u64 period)
384{ 385{
385 struct resolved_chain *filtered; 386 struct resolved_chain *filtered;
386 387
@@ -397,7 +398,7 @@ int append_chain(struct callchain_node *root, struct ip_callchain *chain,
397 if (!filtered->nr) 398 if (!filtered->nr)
398 goto end; 399 goto end;
399 400
400 __append_chain_children(root, filtered, 0); 401 __append_chain_children(root, filtered, 0, period);
401end: 402end:
402 free(filtered); 403 free(filtered);
403 404
diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h
index 809850fb75fb..624a96c636fd 100644
--- a/tools/perf/util/callchain.h
+++ b/tools/perf/util/callchain.h
@@ -49,6 +49,9 @@ static inline void callchain_init(struct callchain_node *node)
49 INIT_LIST_HEAD(&node->brothers); 49 INIT_LIST_HEAD(&node->brothers);
50 INIT_LIST_HEAD(&node->children); 50 INIT_LIST_HEAD(&node->children);
51 INIT_LIST_HEAD(&node->val); 51 INIT_LIST_HEAD(&node->val);
52
53 node->parent = NULL;
54 node->hit = 0;
52} 55}
53 56
54static inline u64 cumul_hits(struct callchain_node *node) 57static inline u64 cumul_hits(struct callchain_node *node)
@@ -58,7 +61,7 @@ static inline u64 cumul_hits(struct callchain_node *node)
58 61
59int register_callchain_param(struct callchain_param *param); 62int register_callchain_param(struct callchain_param *param);
60int append_chain(struct callchain_node *root, struct ip_callchain *chain, 63int append_chain(struct callchain_node *root, struct ip_callchain *chain,
61 struct map_symbol *syms); 64 struct map_symbol *syms, u64 period);
62 65
63bool ip_callchain__valid(struct ip_callchain *chain, const event_t *event); 66bool ip_callchain__valid(struct ip_callchain *chain, const event_t *event);
64#endif /* __PERF_CALLCHAIN_H */ 67#endif /* __PERF_CALLCHAIN_H */