diff options
Diffstat (limited to 'tools/perf/util')
45 files changed, 1959 insertions, 2899 deletions
diff --git a/tools/perf/util/PERF-VERSION-GEN b/tools/perf/util/PERF-VERSION-GEN index 95264f304179..6aa34e5afdcf 100755 --- a/tools/perf/util/PERF-VERSION-GEN +++ b/tools/perf/util/PERF-VERSION-GEN | |||
| @@ -9,18 +9,14 @@ GVF=${OUTPUT}PERF-VERSION-FILE | |||
| 9 | LF=' | 9 | LF=' |
| 10 | ' | 10 | ' |
| 11 | 11 | ||
| 12 | # | ||
| 12 | # First check if there is a .git to get the version from git describe | 13 | # First check if there is a .git to get the version from git describe |
| 13 | # otherwise try to get the version from the kernel makefile | 14 | # otherwise try to get the version from the kernel Makefile |
| 15 | # | ||
| 14 | if test -d ../../.git -o -f ../../.git && | 16 | if test -d ../../.git -o -f ../../.git && |
| 15 | VN=$(git describe --match 'v[0-9].[0-9]*' --abbrev=4 HEAD 2>/dev/null) && | 17 | VN=$(git tag 2>/dev/null | tail -1 | grep -E "v[0-9].[0-9]*") |
| 16 | case "$VN" in | ||
| 17 | *$LF*) (exit 1) ;; | ||
| 18 | v[0-9]*) | ||
| 19 | git update-index -q --refresh | ||
| 20 | test -z "$(git diff-index --name-only HEAD --)" || | ||
| 21 | VN="$VN-dirty" ;; | ||
| 22 | esac | ||
| 23 | then | 18 | then |
| 19 | VN=$(echo $VN"-g"$(git log -1 --abbrev=4 --pretty=format:"%h" HEAD)) | ||
| 24 | VN=$(echo "$VN" | sed -e 's/-/./g'); | 20 | VN=$(echo "$VN" | sed -e 's/-/./g'); |
| 25 | else | 21 | else |
| 26 | VN=$(MAKEFLAGS= make -sC ../.. kernelversion) | 22 | VN=$(MAKEFLAGS= make -sC ../.. kernelversion) |
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index f0a910371377..07aaeea60000 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | #include "debug.h" | 15 | #include "debug.h" |
| 16 | #include "annotate.h" | 16 | #include "annotate.h" |
| 17 | #include <pthread.h> | 17 | #include <pthread.h> |
| 18 | #include <linux/bitops.h> | ||
| 18 | 19 | ||
| 19 | const char *disassembler_style; | 20 | const char *disassembler_style; |
| 20 | const char *objdump_path; | 21 | const char *objdump_path; |
| @@ -170,15 +171,15 @@ static int lock__parse(struct ins_operands *ops) | |||
| 170 | if (disasm_line__parse(ops->raw, &name, &ops->locked.ops->raw) < 0) | 171 | if (disasm_line__parse(ops->raw, &name, &ops->locked.ops->raw) < 0) |
| 171 | goto out_free_ops; | 172 | goto out_free_ops; |
| 172 | 173 | ||
| 173 | ops->locked.ins = ins__find(name); | 174 | ops->locked.ins = ins__find(name); |
| 174 | if (ops->locked.ins == NULL) | 175 | if (ops->locked.ins == NULL) |
| 175 | goto out_free_ops; | 176 | goto out_free_ops; |
| 176 | 177 | ||
| 177 | if (!ops->locked.ins->ops) | 178 | if (!ops->locked.ins->ops) |
| 178 | return 0; | 179 | return 0; |
| 179 | 180 | ||
| 180 | if (ops->locked.ins->ops->parse) | 181 | if (ops->locked.ins->ops->parse) |
| 181 | ops->locked.ins->ops->parse(ops->locked.ops); | 182 | ops->locked.ins->ops->parse(ops->locked.ops); |
| 182 | 183 | ||
| 183 | return 0; | 184 | return 0; |
| 184 | 185 | ||
| @@ -400,6 +401,8 @@ static struct ins instructions[] = { | |||
| 400 | { .name = "testb", .ops = &mov_ops, }, | 401 | { .name = "testb", .ops = &mov_ops, }, |
| 401 | { .name = "testl", .ops = &mov_ops, }, | 402 | { .name = "testl", .ops = &mov_ops, }, |
| 402 | { .name = "xadd", .ops = &mov_ops, }, | 403 | { .name = "xadd", .ops = &mov_ops, }, |
| 404 | { .name = "xbeginl", .ops = &jump_ops, }, | ||
| 405 | { .name = "xbeginq", .ops = &jump_ops, }, | ||
| 403 | }; | 406 | }; |
| 404 | 407 | ||
| 405 | static int ins__cmp(const void *name, const void *insp) | 408 | static int ins__cmp(const void *name, const void *insp) |
| @@ -855,21 +858,68 @@ static void insert_source_line(struct rb_root *root, struct source_line *src_lin | |||
| 855 | struct source_line *iter; | 858 | struct source_line *iter; |
| 856 | struct rb_node **p = &root->rb_node; | 859 | struct rb_node **p = &root->rb_node; |
| 857 | struct rb_node *parent = NULL; | 860 | struct rb_node *parent = NULL; |
| 861 | int ret; | ||
| 858 | 862 | ||
| 859 | while (*p != NULL) { | 863 | while (*p != NULL) { |
| 860 | parent = *p; | 864 | parent = *p; |
| 861 | iter = rb_entry(parent, struct source_line, node); | 865 | iter = rb_entry(parent, struct source_line, node); |
| 862 | 866 | ||
| 863 | if (src_line->percent > iter->percent) | 867 | ret = strcmp(iter->path, src_line->path); |
| 868 | if (ret == 0) { | ||
| 869 | iter->percent_sum += src_line->percent; | ||
| 870 | return; | ||
| 871 | } | ||
| 872 | |||
| 873 | if (ret < 0) | ||
| 864 | p = &(*p)->rb_left; | 874 | p = &(*p)->rb_left; |
| 865 | else | 875 | else |
| 866 | p = &(*p)->rb_right; | 876 | p = &(*p)->rb_right; |
| 867 | } | 877 | } |
| 868 | 878 | ||
| 879 | src_line->percent_sum = src_line->percent; | ||
| 880 | |||
| 869 | rb_link_node(&src_line->node, parent, p); | 881 | rb_link_node(&src_line->node, parent, p); |
| 870 | rb_insert_color(&src_line->node, root); | 882 | rb_insert_color(&src_line->node, root); |
| 871 | } | 883 | } |
| 872 | 884 | ||
| 885 | static void __resort_source_line(struct rb_root *root, struct source_line *src_line) | ||
| 886 | { | ||
| 887 | struct source_line *iter; | ||
| 888 | struct rb_node **p = &root->rb_node; | ||
| 889 | struct rb_node *parent = NULL; | ||
| 890 | |||
| 891 | while (*p != NULL) { | ||
| 892 | parent = *p; | ||
| 893 | iter = rb_entry(parent, struct source_line, node); | ||
| 894 | |||
| 895 | if (src_line->percent_sum > iter->percent_sum) | ||
| 896 | p = &(*p)->rb_left; | ||
| 897 | else | ||
| 898 | p = &(*p)->rb_right; | ||
