diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-06-19 15:36:12 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-06-19 15:39:21 -0400 |
commit | 276af92f107fc35ede78c7cdea323aaec364002c (patch) | |
tree | 397dcfba0747377fb26f7e9c4ef3c6a72f7740b2 | |
parent | 0c4a5bcea4609948375173cdea8d73783110a75e (diff) |
perf annotate: Rename source_line_percent to source_line_samples
To better reflect the purpose of this struct, that is to hold
info about samples, its total number and is percentage.
Cc: Martin Liska <mliska@suse.cz>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/n/tip-6bf8gwcl975uurl0ttpvtk69@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/util/annotate.c | 26 | ||||
-rw-r--r-- | tools/perf/util/annotate.h | 6 |
2 files changed, 16 insertions, 16 deletions
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index 12914b66d347..03b7bc70eb66 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c | |||
@@ -662,7 +662,7 @@ double disasm__calc_percent(struct annotation *notes, int evidx, s64 offset, | |||
662 | 662 | ||
663 | if (src_line) { | 663 | if (src_line) { |
664 | size_t sizeof_src_line = sizeof(*src_line) + | 664 | size_t sizeof_src_line = sizeof(*src_line) + |
665 | sizeof(src_line->p) * (src_line->nr_pcnt - 1); | 665 | sizeof(src_line->samples) * (src_line->nr_pcnt - 1); |
666 | 666 | ||
667 | while (offset < end) { | 667 | while (offset < end) { |
668 | src_line = (void *)notes->src->lines + | 668 | src_line = (void *)notes->src->lines + |
@@ -671,8 +671,8 @@ double disasm__calc_percent(struct annotation *notes, int evidx, s64 offset, | |||
671 | if (*path == NULL) | 671 | if (*path == NULL) |
672 | *path = src_line->path; | 672 | *path = src_line->path; |
673 | 673 | ||
674 | percent += src_line->p[evidx].percent; | 674 | percent += src_line->samples[evidx].percent; |
675 | *nr_samples += src_line->p[evidx].samples; | 675 | *nr_samples += src_line->samples[evidx].nr; |
676 | offset++; | 676 | offset++; |
677 | } | 677 | } |
678 | } else { | 678 | } else { |
@@ -1121,7 +1121,7 @@ static void insert_source_line(struct rb_root *root, struct source_line *src_lin | |||
1121 | ret = strcmp(iter->path, src_line->path); | 1121 | ret = strcmp(iter->path, src_line->path); |
1122 | if (ret == 0) { | 1122 | if (ret == 0) { |
1123 | for (i = 0; i < src_line->nr_pcnt; i++) | 1123 | for (i = 0; i < src_line->nr_pcnt; i++) |
1124 | iter->p[i].percent_sum += src_line->p[i].percent; | 1124 | iter->samples[i].percent_sum += src_line->samples[i].percent; |
1125 | return; | 1125 | return; |
1126 | } | 1126 | } |
1127 | 1127 | ||
@@ -1132,7 +1132,7 @@ static void insert_source_line(struct rb_root *root, struct source_line *src_lin | |||
1132 | } | 1132 | } |
1133 | 1133 | ||
1134 | for (i = 0; i < src_line->nr_pcnt; i++) | 1134 | for (i = 0; i < src_line->nr_pcnt; i++) |
1135 | src_line->p[i].percent_sum = src_line->p[i].percent; | 1135 | src_line->samples[i].percent_sum = src_line->samples[i].percent; |
1136 | 1136 | ||
1137 | rb_link_node(&src_line->node, parent, p); | 1137 | rb_link_node(&src_line->node, parent, p); |
1138 | rb_insert_color(&src_line->node, root); | 1138 | rb_insert_color(&src_line->node, root); |
@@ -1143,9 +1143,9 @@ static int cmp_source_line(struct source_line *a, struct source_line *b) | |||
1143 | int i; | 1143 | int i; |
1144 | 1144 | ||
1145 | for (i = 0; i < a->nr_pcnt; i++) { | 1145 | for (i = 0; i < a->nr_pcnt; i++) { |
1146 | if (a->p[i].percent_sum == b->p[i].percent_sum) | 1146 | if (a->samples[i].percent_sum == b->samples[i].percent_sum) |
1147 | continue; | 1147 | continue; |
1148 | return a->p[i].percent_sum > b->p[i].percent_sum; | 1148 | return a->samples[i].percent_sum > b->samples[i].percent_sum; |
1149 | } | 1149 | } |
1150 | 1150 | ||
1151 | return 0; | 1151 | return 0; |
@@ -1197,7 +1197,7 @@ static void symbol__free_source_line(struct symbol *sym, int len) | |||
1197 | int i; | 1197 | int i; |
1198 | 1198 | ||
1199 | sizeof_src_line = sizeof(*src_line) + | 1199 | sizeof_src_line = sizeof(*src_line) + |
1200 | (sizeof(src_line->p) * (src_line->nr_pcnt - 1)); | 1200 | (sizeof(src_line->samples) * (src_line->nr_pcnt - 1)); |
1201 | 1201 | ||
1202 | for (i = 0; i < len; i++) { | 1202 | for (i = 0; i < len; i++) { |
1203 | free_srcline(src_line->path); | 1203 | free_srcline(src_line->path); |
@@ -1229,7 +1229,7 @@ static int symbol__get_source_line(struct symbol *sym, struct map *map, | |||
1229 | h_sum += h->sum; | 1229 | h_sum += h->sum; |
1230 | } | 1230 | } |
1231 | nr_pcnt = evsel->nr_members; | 1231 | nr_pcnt = evsel->nr_members; |
1232 | sizeof_src_line += (nr_pcnt - 1) * sizeof(src_line->p); | 1232 | sizeof_src_line += (nr_pcnt - 1) * sizeof(src_line->samples); |
1233 | } | 1233 | } |
1234 | 1234 | ||
1235 | if (!h_sum) | 1235 | if (!h_sum) |
@@ -1249,10 +1249,10 @@ static int symbol__get_source_line(struct symbol *sym, struct map *map, | |||
1249 | 1249 | ||
1250 | for (k = 0; k < nr_pcnt; k++) { | 1250 | for (k = 0; k < nr_pcnt; k++) { |
1251 | h = annotation__histogram(notes, evidx + k); | 1251 | h = annotation__histogram(notes, evidx + k); |
1252 | src_line->p[k].percent = 100.0 * h->addr[i] / h->sum; | 1252 | src_line->samples[k].percent = 100.0 * h->addr[i] / h->sum; |
1253 | 1253 | ||
1254 | if (src_line->p[k].percent > percent_max) | 1254 | if (src_line->samples[k].percent > percent_max) |
1255 | percent_max = src_line->p[k].percent; | 1255 | percent_max = src_line->samples[k].percent; |
1256 | } | 1256 | } |
1257 | 1257 | ||
1258 | if (percent_max <= 0.5) | 1258 | if (percent_max <= 0.5) |
@@ -1292,7 +1292,7 @@ static void print_summary(struct rb_root *root, const char *filename) | |||
1292 | 1292 | ||
1293 | src_line = rb_entry(node, struct source_line, node); | 1293 | src_line = rb_entry(node, struct source_line, node); |
1294 | for (i = 0; i < src_line->nr_pcnt; i++) { | 1294 | for (i = 0; i < src_line->nr_pcnt; i++) { |
1295 | percent = src_line->p[i].percent_sum; | 1295 | percent = src_line->samples[i].percent_sum; |
1296 | color = get_percent_color(percent); | 1296 | color = get_percent_color(percent); |
1297 | color_fprintf(stdout, color, " %7.2f", percent); | 1297 | color_fprintf(stdout, color, " %7.2f", percent); |
1298 | 1298 | ||
diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h index c8c18cadcd17..7e78e6c27078 100644 --- a/tools/perf/util/annotate.h +++ b/tools/perf/util/annotate.h | |||
@@ -79,17 +79,17 @@ struct sym_hist { | |||
79 | u64 addr[0]; | 79 | u64 addr[0]; |
80 | }; | 80 | }; |
81 | 81 | ||
82 | struct source_line_percent { | 82 | struct source_line_samples { |
83 | double percent; | 83 | double percent; |
84 | double percent_sum; | 84 | double percent_sum; |
85 | double samples; | 85 | double nr; |
86 | }; | 86 | }; |
87 | 87 | ||
88 | struct source_line { | 88 | struct source_line { |
89 | struct rb_node node; | 89 | struct rb_node node; |
90 | char *path; | 90 | char *path; |
91 | int nr_pcnt; | 91 | int nr_pcnt; |
92 | struct source_line_percent p[1]; | 92 | struct source_line_samples samples[1]; |
93 | }; | 93 | }; |
94 | 94 | ||
95 | /** struct annotated_source - symbols with hits have this attached as in sannotation | 95 | /** struct annotated_source - symbols with hits have this attached as in sannotation |