aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util')
-rwxr-xr-xtools/perf/util/PERF-VERSION-GEN14
-rw-r--r--tools/perf/util/annotate.c72
-rw-r--r--tools/perf/util/annotate.h10
-rw-r--r--tools/perf/util/build-id.c27
-rw-r--r--tools/perf/util/build-id.h11
-rw-r--r--tools/perf/util/cache.h39
-rw-r--r--tools/perf/util/debug.h1
-rw-r--r--tools/perf/util/dso-test-data.c153
-rw-r--r--tools/perf/util/dso.c595
-rw-r--r--tools/perf/util/dso.h148
-rw-r--r--tools/perf/util/event.c302
-rw-r--r--tools/perf/util/event.h9
-rw-r--r--tools/perf/util/evlist.c13
-rw-r--r--tools/perf/util/evsel.c52
-rw-r--r--tools/perf/util/evsel.h8
-rw-r--r--tools/perf/util/header.c11
-rw-r--r--tools/perf/util/header.h1
-rw-r--r--tools/perf/util/hist.c99
-rw-r--r--tools/perf/util/hist.h49
-rw-r--r--tools/perf/util/machine.c464
-rw-r--r--tools/perf/util/machine.h148
-rw-r--r--tools/perf/util/map.c182
-rw-r--r--tools/perf/util/map.h93
-rw-r--r--tools/perf/util/parse-events-test.c1048
-rw-r--r--tools/perf/util/parse-events.c54
-rw-r--r--tools/perf/util/parse-events.h3
-rw-r--r--tools/perf/util/parse-events.l4
-rw-r--r--tools/perf/util/parse-events.y18
-rw-r--r--tools/perf/util/pmu.c192
-rw-r--r--tools/perf/util/pmu.h4
-rw-r--r--tools/perf/util/pstack.c46
-rw-r--r--tools/perf/util/python.c2
-rw-r--r--tools/perf/util/rblist.c4
-rw-r--r--tools/perf/util/scripting-engines/trace-event-python.c1
-rw-r--r--tools/perf/util/session.c5
-rw-r--r--tools/perf/util/session.h5
-rw-r--r--tools/perf/util/sort.h45
-rw-r--r--tools/perf/util/string.c18
-rw-r--r--tools/perf/util/symbol.c658
-rw-r--r--tools/perf/util/symbol.h162
-rw-r--r--tools/perf/util/thread.c41
-rw-r--r--tools/perf/util/thread.h2
-rw-r--r--tools/perf/util/trace-event-read.c2
-rw-r--r--tools/perf/util/util.c35
-rw-r--r--tools/perf/util/util.h8
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
9LF=' 9LF='
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#
14if test -d ../../.git -o -f ../../.git && 16if 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
23then 18then
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');
25else 21else
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
19const char *disassembler_style; 20const char *disassembler_style;
20const char *objdump_path; 21const 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
405static int ins__cmp(const void *name, const void *insp) 408static 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
885static 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;