diff options
| -rw-r--r-- | include/linux/syscalls.h | 6 | ||||
| -rw-r--r-- | tools/perf/builtin-report.c | 2 | ||||
| -rwxr-xr-x | tools/perf/util/PERF-VERSION-GEN | 17 | ||||
| -rw-r--r-- | tools/perf/util/callchain.c | 35 | ||||
| -rw-r--r-- | tools/perf/util/callchain.h | 5 |
5 files changed, 36 insertions, 29 deletions
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index 7f614ce274a9..13ebb5413a79 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h | |||
| @@ -124,7 +124,8 @@ extern struct trace_event_functions enter_syscall_print_funcs; | |||
| 124 | extern struct trace_event_functions exit_syscall_print_funcs; | 124 | extern struct trace_event_functions exit_syscall_print_funcs; |
| 125 | 125 | ||
| 126 | #define SYSCALL_TRACE_ENTER_EVENT(sname) \ | 126 | #define SYSCALL_TRACE_ENTER_EVENT(sname) \ |
| 127 | static struct syscall_metadata __syscall_meta_##sname; \ | 127 | static struct syscall_metadata \ |
| 128 | __attribute__((__aligned__(4))) __syscall_meta_##sname; \ | ||
| 128 | static struct ftrace_event_call \ | 129 | static struct ftrace_event_call \ |
| 129 | __attribute__((__aligned__(4))) event_enter_##sname; \ | 130 | __attribute__((__aligned__(4))) event_enter_##sname; \ |
| 130 | static struct ftrace_event_call __used \ | 131 | static struct ftrace_event_call __used \ |
| @@ -138,7 +139,8 @@ extern struct trace_event_functions exit_syscall_print_funcs; | |||
| 138 | } | 139 | } |
| 139 | 140 | ||
| 140 | #define SYSCALL_TRACE_EXIT_EVENT(sname) \ | 141 | #define SYSCALL_TRACE_EXIT_EVENT(sname) \ |
| 141 | static struct syscall_metadata __syscall_meta_##sname; \ | 142 | static struct syscall_metadata \ |
| 143 | __attribute__((__aligned__(4))) __syscall_meta_##sname; \ | ||
| 142 | static struct ftrace_event_call \ | 144 | static struct ftrace_event_call \ |
| 143 | __attribute__((__aligned__(4))) event_exit_##sname; \ | 145 | __attribute__((__aligned__(4))) event_exit_##sname; \ |
| 144 | static struct ftrace_event_call __used \ | 146 | static struct ftrace_event_call __used \ |
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 359205782964..fd7407c7205c 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 | |||
| 5 | fi | 5 | fi |
| 6 | 6 | ||
| 7 | GVF=${OUTPUT}PERF-VERSION-FILE | 7 | GVF=${OUTPUT}PERF-VERSION-FILE |
| 8 | DEF_VER=v0.0.2.PERF | ||
| 9 | 8 | ||
| 10 | LF=' | 9 | LF=' |
| 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 |
| 15 | if test -f version | 14 | if test -d ../../.git -o -f ../../.git && |
| 16 | then | ||
| 17 | VN=$(cat version) || VN="$DEF_VER" | ||
| 18 | elif 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 && | |||
| 27 | then | 23 | then |
| 28 | VN=$(echo "$VN" | sed -e 's/-/./g'); | 24 | VN=$(echo "$VN" | sed -e 's/-/./g'); |
| 29 | else | 25 | else |
| 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}" | ||
| 31 | fi | 32 | fi |
| 32 | 33 | ||
| 33 | VN=$(expr "$VN" : v*'\(.*\)') | 34 | VN=$(expr "$VN" : v*'\(.*\)') |
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c index 62b69ad4aa73..52c777e451ed 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 | ||
| 231 | static void | 231 | static void |
| 232 | add_child(struct callchain_node *parent, struct resolved_chain *chain, | 232 | add_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 | */ |
| 249 | static void | 249 | static void |
| 250 | split_add_child(struct callchain_node *parent, struct resolved_chain *chain, | 250 | split_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 | ||
| 285 | static int | 286 | static 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 | ||
| 289 | static void | 290 | static 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 | ||
| 306 | inc_children_hit: | 307 | inc_children_hit: |
| 307 | root->children_hit++; | 308 | root->children_hit += period; |
| 308 | } | 309 | } |
| 309 | 310 | ||
| 310 | static int | 311 | static 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 | ||
| 382 | int append_chain(struct callchain_node *root, struct ip_callchain *chain, | 383 | int 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); |
| 401 | end: | 402 | end: |
| 402 | free(filtered); | 403 | free(filtered); |
| 403 | 404 | ||
diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h index 1ca73e4a2723..f2e9ee164bd8 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 | ||
| 54 | static inline u64 cumul_hits(struct callchain_node *node) | 57 | static inline u64 cumul_hits(struct callchain_node *node) |
| @@ -58,7 +61,7 @@ static inline u64 cumul_hits(struct callchain_node *node) | |||
| 58 | 61 | ||
| 59 | int register_callchain_param(struct callchain_param *param); | 62 | int register_callchain_param(struct callchain_param *param); |
| 60 | int append_chain(struct callchain_node *root, struct ip_callchain *chain, | 63 | int append_chain(struct callchain_node *root, struct ip_callchain *chain, |
| 61 | struct map_symbol *syms); | 64 | struct map_symbol *syms, u64 period); |
| 62 | 65 | ||
| 63 | bool ip_callchain__valid(struct ip_callchain *chain, event_t *event); | 66 | bool ip_callchain__valid(struct ip_callchain *chain, event_t *event); |
| 64 | #endif /* __PERF_CALLCHAIN_H */ | 67 | #endif /* __PERF_CALLCHAIN_H */ |
