diff options
author | Jiri Olsa <jolsa@kernel.org> | 2018-08-04 09:05:05 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2018-08-08 14:55:46 -0400 |
commit | c2f938ba5aa61ba60e9217848e666c783cbcce1c (patch) | |
tree | 3174c8496023083eea3e8a3f03658b5344171d85 /tools/perf/util/annotate.c | |
parent | 0683d13c1afbf5cca147b6f578d1463be132b11b (diff) |
perf annotate: Rename struct annotation_line::samples* to data*
The name 'samples*' is little confusing because we have nested 'struct
sym_hist_entry' under annotation_line struct, which holds 'nr_samples'
as well.
Also the holding struct name is 'annotation_data' so the 'data' name
fits better.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/20180804130521.11408-5-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/annotate.c')
-rw-r--r-- | tools/perf/util/annotate.c | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index 0d40cee13f6b..e4cb8963db1a 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c | |||
@@ -1108,7 +1108,7 @@ annotation_line__new(struct annotate_args *args, size_t privsize) | |||
1108 | if (perf_evsel__is_group_event(evsel)) | 1108 | if (perf_evsel__is_group_event(evsel)) |
1109 | nr = evsel->nr_members; | 1109 | nr = evsel->nr_members; |
1110 | 1110 | ||
1111 | size += sizeof(al->samples[0]) * nr; | 1111 | size += sizeof(al->data[0]) * nr; |
1112 | 1112 | ||
1113 | al = zalloc(size); | 1113 | al = zalloc(size); |
1114 | if (al) { | 1114 | if (al) { |
@@ -1117,7 +1117,7 @@ annotation_line__new(struct annotate_args *args, size_t privsize) | |||
1117 | al->offset = args->offset; | 1117 | al->offset = args->offset; |
1118 | al->line = strdup(args->line); | 1118 | al->line = strdup(args->line); |
1119 | al->line_nr = args->line_nr; | 1119 | al->line_nr = args->line_nr; |
1120 | al->samples_nr = nr; | 1120 | al->data_nr = nr; |
1121 | } | 1121 | } |
1122 | 1122 | ||
1123 | return al; | 1123 | return al; |
@@ -1309,15 +1309,15 @@ annotation_line__print(struct annotation_line *al, struct symbol *sym, u64 start | |||
1309 | const char *color; | 1309 | const char *color; |
1310 | struct annotation *notes = symbol__annotation(sym); | 1310 | struct annotation *notes = symbol__annotation(sym); |
1311 | 1311 | ||
1312 | for (i = 0; i < al->samples_nr; i++) { | 1312 | for (i = 0; i < al->data_nr; i++) { |
1313 | struct annotation_data *sample = &al->samples[i]; | 1313 | struct annotation_data *sample = &al->data[i]; |
1314 | 1314 | ||
1315 | if (sample->percent > max_percent) | 1315 | if (sample->percent > max_percent) |
1316 | max_percent = sample->percent; | 1316 | max_percent = sample->percent; |
1317 | } | 1317 | } |
1318 | 1318 | ||
1319 | if (al->samples_nr > nr_percent) | 1319 | if (al->data_nr > nr_percent) |
1320 | nr_percent = al->samples_nr; | 1320 | nr_percent = al->data_nr; |
1321 | 1321 | ||
1322 | if (max_percent < min_pcnt) | 1322 | if (max_percent < min_pcnt) |
1323 | return -1; | 1323 | return -1; |
@@ -1351,7 +1351,7 @@ annotation_line__print(struct annotation_line *al, struct symbol *sym, u64 start | |||
1351 | } | 1351 | } |
1352 | 1352 | ||
1353 | for (i = 0; i < nr_percent; i++) { | 1353 | for (i = 0; i < nr_percent; i++) { |
1354 | struct annotation_data *sample = &al->samples[i]; | 1354 | struct annotation_data *sample = &al->data[i]; |
1355 | 1355 | ||
1356 | color = get_percent_color(sample->percent); | 1356 | color = get_percent_color(sample->percent); |
1357 | 1357 | ||
@@ -1788,12 +1788,12 @@ static void annotation__calc_percent(struct annotation *notes, | |||
1788 | next = annotation_line__next(al, ¬es->src->source); | 1788 | next = annotation_line__next(al, ¬es->src->source); |
1789 | end = next ? next->offset : len; | 1789 | end = next ? next->offset : len; |
1790 | 1790 | ||
1791 | for (i = 0; i < al->samples_nr; i++) { | 1791 | for (i = 0; i < al->data_nr; i++) { |
1792 | struct annotation_data *sample; | 1792 | struct annotation_data *sample; |
1793 | struct sym_hist *hist; | 1793 | struct sym_hist *hist; |
1794 | 1794 | ||
1795 | hist = annotation__histogram(notes, evsel->idx + i); | 1795 | hist = annotation__histogram(notes, evsel->idx + i); |
1796 | sample = &al->samples[i]; | 1796 | sample = &al->data[i]; |
1797 | 1797 | ||
1798 | calc_percent(hist, sample, al->offset, end); | 1798 | calc_percent(hist, sample, al->offset, end); |
1799 | } | 1799 | } |
@@ -1859,8 +1859,8 @@ static void insert_source_line(struct rb_root *root, struct annotation_line *al) | |||
1859 | 1859 | ||
1860 | ret = strcmp(iter->path, al->path); | 1860 | ret = strcmp(iter->path, al->path); |
1861 | if (ret == 0) { | 1861 | if (ret == 0) { |
1862 | for (i = 0; i < al->samples_nr; i++) | 1862 | for (i = 0; i < al->data_nr; i++) |
1863 | iter->samples[i].percent_sum += al->samples[i].percent; | 1863 | iter->data[i].percent_sum += al->data[i].percent; |
1864 | return; | 1864 | return; |
1865 | } | 1865 | } |
1866 | 1866 | ||
@@ -1870,8 +1870,8 @@ static void insert_source_line(struct rb_root *root, struct annotation_line *al) | |||
1870 | p = &(*p)->rb_right; | 1870 | p = &(*p)->rb_right; |
1871 | } | 1871 | } |
1872 | 1872 | ||
1873 | for (i = 0; i < al->samples_nr; i++) | 1873 | for (i = 0; i < al->data_nr; i++) |
1874 | al->samples[i].percent_sum = al->samples[i].percent; | 1874 | al->data[i].percent_sum = al->data[i].percent; |
1875 | 1875 | ||
1876 | rb_link_node(&al->rb_node, parent, p); | 1876 | rb_link_node(&al->rb_node, parent, p); |
1877 | rb_insert_color(&al->rb_node, root); | 1877 | rb_insert_color(&al->rb_node, root); |
@@ -1881,10 +1881,10 @@ static int cmp_source_line(struct annotation_line *a, struct annotation_line *b) | |||
1881 | { | 1881 | { |
1882 | int i; | 1882 | int i; |
1883 | 1883 | ||
1884 | for (i = 0; i < a->samples_nr; i++) { | 1884 | for (i = 0; i < a->data_nr; i++) { |
1885 | if (a->samples[i].percent_sum == b->samples[i].percent_sum) | 1885 | if (a->data[i].percent_sum == b->data[i].percent_sum) |
1886 | continue; | 1886 | continue; |
1887 | return a->samples[i].percent_sum > b->samples[i].percent_sum; | 1887 | return a->data[i].percent_sum > b->data[i].percent_sum; |
1888 | } | 1888 | } |
1889 | 1889 | ||
1890 | return 0; | 1890 | return 0; |
@@ -1949,8 +1949,8 @@ static void print_summary(struct rb_root *root, const char *filename) | |||
1949 | int i; | 1949 | int i; |
1950 | 1950 | ||
1951 | al = rb_entry(node, struct annotation_line, rb_node); | 1951 | al = rb_entry(node, struct annotation_line, rb_node); |
1952 | for (i = 0; i < al->samples_nr; i++) { | 1952 | for (i = 0; i < al->data_nr; i++) { |
1953 | percent = al->samples[i].percent_sum; | 1953 | percent = al->data[i].percent_sum; |
1954 | color = get_percent_color(percent); | 1954 | color = get_percent_color(percent); |
1955 | color_fprintf(stdout, color, " %7.2f", percent); | 1955 | color_fprintf(stdout, color, " %7.2f", percent); |
1956 | 1956 | ||
@@ -2355,10 +2355,10 @@ static void annotation__calc_lines(struct annotation *notes, struct map *map, | |||
2355 | double percent_max = 0.0; | 2355 | double percent_max = 0.0; |
2356 | int i; | 2356 | int i; |
2357 | 2357 | ||
2358 | for (i = 0; i < al->samples_nr; i++) { | 2358 | for (i = 0; i < al->data_nr; i++) { |
2359 | struct annotation_data *sample; | 2359 | struct annotation_data *sample; |
2360 | 2360 | ||
2361 | sample = &al->samples[i]; | 2361 | sample = &al->data[i]; |
2362 | 2362 | ||
2363 | if (sample->percent > percent_max) | 2363 | if (sample->percent > percent_max) |
2364 | percent_max = sample->percent; | 2364 | percent_max = sample->percent; |
@@ -2448,8 +2448,8 @@ static double annotation_line__max_percent(struct annotation_line *al, | |||
2448 | int i; | 2448 | int i; |
2449 | 2449 | ||
2450 | for (i = 0; i < notes->nr_events; i++) { | 2450 | for (i = 0; i < notes->nr_events; i++) { |
2451 | if (al->samples[i].percent > percent_max) | 2451 | if (al->data[i].percent > percent_max) |
2452 | percent_max = al->samples[i].percent; | 2452 | percent_max = al->data[i].percent; |
2453 | } | 2453 | } |
2454 | 2454 | ||
2455 | return percent_max; | 2455 | return percent_max; |
@@ -2515,15 +2515,15 @@ static void __annotation_line__write(struct annotation_line *al, struct annotati | |||
2515 | int i; | 2515 | int i; |
2516 | 2516 | ||
2517 | for (i = 0; i < notes->nr_events; i++) { | 2517 | for (i = 0; i < notes->nr_events; i++) { |
2518 | obj__set_percent_color(obj, al->samples[i].percent, current_entry); | 2518 | obj__set_percent_color(obj, al->data[i].percent, current_entry); |
2519 | if (notes->options->show_total_period) { | 2519 | if (notes->options->show_total_period) { |
2520 | obj__printf(obj, "%11" PRIu64 " ", al->samples[i].he.period); | 2520 | obj__printf(obj, "%11" PRIu64 " ", al->data[i].he.period); |
2521 | } else if (notes->options->show_nr_samples) { | 2521 | } else if (notes->options->show_nr_samples) { |
2522 | obj__printf(obj, "%6" PRIu64 " ", | 2522 | obj__printf(obj, "%6" PRIu64 " ", |
2523 | al->samples[i].he.nr_samples); | 2523 | al->data[i].he.nr_samples); |
2524 | } else { | 2524 | } else { |
2525 | obj__printf(obj, "%6.2f ", | 2525 | obj__printf(obj, "%6.2f ", |
2526 | al->samples[i].percent); | 2526 | al->data[i].percent); |
2527 | } | 2527 | } |
2528 | } | 2528 | } |
2529 | } else { | 2529 | } else { |