diff options
| author | Namhyung Kim <namhyung.kim@lge.com> | 2013-03-05 00:53:27 -0500 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-03-15 12:06:06 -0400 |
| commit | c5a8368ca667d22a6e45396f23a5392d90396f39 (patch) | |
| tree | ea6cda250fde4dd3f448e212f49f9c5a8173c37f /tools/perf/util | |
| parent | 759ff497e0e6749437b6723f8d26de0b1833c199 (diff) | |
perf annotate: Factor out struct source_line_percent
The source_line_percent struct contains percentage value of the symbol
histogram. This is a preparation of event group view change.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1362462812-30885-8-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util')
| -rw-r--r-- | tools/perf/util/annotate.c | 14 | ||||
| -rw-r--r-- | tools/perf/util/annotate.h | 8 |
2 files changed, 13 insertions, 9 deletions
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index f080cc40f00b..ebf2596d7e2e 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c | |||
| @@ -616,7 +616,7 @@ static double disasm__calc_percent(struct annotation *notes, int evidx, | |||
| 616 | if (*path == NULL) | 616 | if (*path == NULL) |
| 617 | *path = src_line[offset].path; | 617 | *path = src_line[offset].path; |
| 618 | 618 | ||
| 619 | percent += src_line[offset++].percent; | 619 | percent += src_line[offset++].p[0].percent; |
| 620 | } | 620 | } |
| 621 | } else { | 621 | } else { |
| 622 | while (offset < end) | 622 | while (offset < end) |
| @@ -929,7 +929,7 @@ static void insert_source_line(struct rb_root *root, struct source_line *src_lin | |||
| 929 | 929 | ||
| 930 | ret = strcmp(iter->path, src_line->path); | 930 | ret = strcmp(iter->path, src_line->path); |
| 931 | if (ret == 0) { | 931 | if (ret == 0) { |
| 932 | iter->percent_sum += src_line->percent; | 932 | iter->p[0].percent_sum += src_line->p[0].percent; |
| 933 | return; | 933 | return; |
| 934 | } | 934 | } |
| 935 | 935 | ||
| @@ -939,7 +939,7 @@ static void insert_source_line(struct rb_root *root, struct source_line *src_lin | |||
| 939 | p = &(*p)->rb_right; | 939 | p = &(*p)->rb_right; |
| 940 | } | 940 | } |
| 941 | 941 | ||
| 942 | src_line->percent_sum = src_line->percent; | 942 | src_line->p[0].percent_sum = src_line->p[0].percent; |
| 943 | 943 | ||
| 944 | rb_link_node(&src_line->node, parent, p); | 944 | rb_link_node(&src_line->node, parent, p); |
| 945 | rb_insert_color(&src_line->node, root); | 945 | rb_insert_color(&src_line->node, root); |
| @@ -955,7 +955,7 @@ static void __resort_source_line(struct rb_root *root, struct source_line *src_l | |||
| 955 | parent = *p; | 955 | parent = *p; |
| 956 | iter = rb_entry(parent, struct source_line, node); | 956 | iter = rb_entry(parent, struct source_line, node); |
| 957 | 957 | ||
| 958 | if (src_line->percent_sum > iter->percent_sum) | 958 | if (src_line->p[0].percent_sum > iter->p[0].percent_sum) |
| 959 | p = &(*p)->rb_left; | 959 | p = &(*p)->rb_left; |
| 960 | else | 960 | else |
| 961 | p = &(*p)->rb_right; | 961 | p = &(*p)->rb_right; |
| @@ -1025,8 +1025,8 @@ static int symbol__get_source_line(struct symbol *sym, struct map *map, | |||
| 1025 | u64 offset; | 1025 | u64 offset; |
| 1026 | FILE *fp; | 1026 | FILE *fp; |
| 1027 | 1027 | ||
| 1028 | src_line[i].percent = 100.0 * h->addr[i] / h->sum; | 1028 | src_line[i].p[0].percent = 100.0 * h->addr[i] / h->sum; |
| 1029 | if (src_line[i].percent <= 0.5) | 1029 | if (src_line[i].p[0].percent <= 0.5) |
| 1030 | continue; | 1030 | continue; |
| 1031 | 1031 | ||
| 1032 | offset = start + i; | 1032 | offset = start + i; |
| @@ -1073,7 +1073,7 @@ static void print_summary(struct rb_root *root, const char *filename) | |||
| 1073 | char *path; | 1073 | char *path; |
| 1074 | 1074 | ||
| 1075 | src_line = rb_entry(node, struct source_line, node); | 1075 | src_line = rb_entry(node, struct source_line, node); |
| 1076 | percent = src_line->percent_sum; | 1076 | percent = src_line->p[0].percent_sum; |
| 1077 | color = get_percent_color(percent); | 1077 | color = get_percent_color(percent); |
| 1078 | path = src_line->path; | 1078 | path = src_line->path; |
| 1079 | 1079 | ||
diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h index 376395475663..bb2e3f998983 100644 --- a/tools/perf/util/annotate.h +++ b/tools/perf/util/annotate.h | |||
| @@ -74,11 +74,15 @@ struct sym_hist { | |||
| 74 | u64 addr[0]; | 74 | u64 addr[0]; |
| 75 | }; | 75 | }; |
| 76 | 76 | ||
| 77 | struct source_line { | 77 | struct source_line_percent { |
| 78 | struct rb_node node; | ||
| 79 | double percent; | 78 | double percent; |
| 80 | double percent_sum; | 79 | double percent_sum; |
| 80 | }; | ||
| 81 | |||
| 82 | struct source_line { | ||
| 83 | struct rb_node node; | ||
| 81 | char *path; | 84 | char *path; |
| 85 | struct source_line_percent p[1]; | ||
| 82 | }; | 86 | }; |
| 83 | 87 | ||
| 84 | /** struct annotated_source - symbols with hits have this attached as in sannotation | 88 | /** struct annotated_source - symbols with hits have this attached as in sannotation |
