Skip to content

Commit c2f938b

Browse files
olsajiriacmel
authored andcommitted
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>
1 parent 0683d13 commit c2f938b

3 files changed

Lines changed: 33 additions & 33 deletions

File tree

‎tools/perf/ui/browsers/annotate.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -227,10 +227,10 @@ static int disasm__cmp(struct annotation_line *a, struct annotation_line *b)
227227
{
228228
int i;
229229

230-
for (i = 0; i < a->samples_nr; i++) {
231-
if (a->samples[i].percent == b->samples[i].percent)
230+
for (i = 0; i < a->data_nr; i++) {
231+
if (a->data[i].percent == b->data[i].percent)
232232
continue;
233-
return a->samples[i].percent < b->samples[i].percent;
233+
return a->data[i].percent < b->data[i].percent;
234234
}
235235
return 0;
236236
}
@@ -314,8 +314,8 @@ static void annotate_browser__calc_percent(struct annotate_browser *browser,
314314
continue;
315315
}
316316

317-
for (i = 0; i < pos->al.samples_nr; i++) {
318-
struct annotation_data *sample = &pos->al.samples[i];
317+
for (i = 0; i < pos->al.data_nr; i++) {
318+
struct annotation_data *sample = &pos->al.data[i];
319319

320320
if (max_percent < sample->percent)
321321
max_percent = sample->percent;

‎tools/perf/util/annotate.c‎

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,7 +1108,7 @@ annotation_line__new(struct annotate_args *args, size_t privsize)
11081108
if (perf_evsel__is_group_event(evsel))
11091109
nr = evsel->nr_members;
11101110

1111-
size += sizeof(al->samples[0]) * nr;
1111+
size += sizeof(al->data[0]) * nr;
11121112

11131113
al = zalloc(size);
11141114
if (al) {
@@ -1117,7 +1117,7 @@ annotation_line__new(struct annotate_args *args, size_t privsize)
11171117
al->offset = args->offset;
11181118
al->line = strdup(args->line);
11191119
al->line_nr = args->line_nr;
1120-
al->samples_nr = nr;
1120+
al->data_nr = nr;
11211121
}
11221122

11231123
return al;
@@ -1309,15 +1309,15 @@ annotation_line__print(struct annotation_line *al, struct symbol *sym, u64 start
13091309
const char *color;
13101310
struct annotation *notes = symbol__annotation(sym);
13111311

1312-
for (i = 0; i < al->samples_nr; i++) {
1313-
struct annotation_data *sample = &al->samples[i];
1312+
for (i = 0; i < al->data_nr; i++) {
1313+
struct annotation_data *sample = &al->data[i];
13141314

13151315
if (sample->percent > max_percent)
13161316
max_percent = sample->percent;
13171317
}
13181318

1319-
if (al->samples_nr > nr_percent)
1320-
nr_percent = al->samples_nr;
1319+
if (al->data_nr > nr_percent)
1320+
nr_percent = al->data_nr;
13211321

13221322
if (max_percent < min_pcnt)
13231323
return -1;
@@ -1351,7 +1351,7 @@ annotation_line__print(struct annotation_line *al, struct symbol *sym, u64 start
13511351
}
13521352

13531353
for (i = 0; i < nr_percent; i++) {
1354-
struct annotation_data *sample = &al->samples[i];
1354+
struct annotation_data *sample = &al->data[i];
13551355

13561356
color = get_percent_color(sample->percent);
13571357

@@ -1788,12 +1788,12 @@ static void annotation__calc_percent(struct annotation *notes,
17881788
next = annotation_line__next(al, &notes->src->source);
17891789
end = next ? next->offset : len;
17901790

1791-
for (i = 0; i < al->samples_nr; i++) {
1791+
for (i = 0; i < al->data_nr; i++) {
17921792
struct annotation_data *sample;
17931793
struct sym_hist *hist;
17941794

17951795
hist = annotation__histogram(notes, evsel->idx + i);
1796-
sample = &al->samples[i];
1796+
sample = &al->data[i];
17971797

17981798
calc_percent(hist, sample, al->offset, end);
17991799
}
@@ -1859,8 +1859,8 @@ static void insert_source_line(struct rb_root *root, struct annotation_line *al)
18591859

18601860
ret = strcmp(iter->path, al->path);
18611861
if (ret == 0) {
1862-
for (i = 0; i < al->samples_nr; i++)
1863-
iter->samples[i].percent_sum += al->samples[i].percent;
1862+
for (i = 0; i < al->data_nr; i++)
1863+
iter->data[i].percent_sum += al->data[i].percent;
18641864
return;
18651865
}
18661866

@@ -1870,8 +1870,8 @@ static void insert_source_line(struct rb_root *root, struct annotation_line *al)
18701870
p = &(*p)->rb_right;
18711871
}
18721872

1873-
for (i = 0; i < al->samples_nr; i++)
1874-
al->samples[i].percent_sum = al->samples[i].percent;
1873+
for (i = 0; i < al->data_nr; i++)
1874+
al->data[i].percent_sum = al->data[i].percent;
18751875

18761876
rb_link_node(&al->rb_node, parent, p);
18771877
rb_insert_color(&al->rb_node, root);
@@ -1881,10 +1881,10 @@ static int cmp_source_line(struct annotation_line *a, struct annotation_line *b)
18811881
{
18821882
int i;
18831883

1884-
for (i = 0; i < a->samples_nr; i++) {
1885-
if (a->samples[i].percent_sum == b->samples[i].percent_sum)
1884+
for (i = 0; i < a->data_nr; i++) {
1885+
if (a->data[i].percent_sum == b->data[i].percent_sum)
18861886
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;
18881888
}
18891889

18901890
return 0;
@@ -1949,8 +1949,8 @@ static void print_summary(struct rb_root *root, const char *filename)
19491949
int i;
19501950

19511951
al = rb_entry(node, struct annotation_line, rb_node);
1952-
for (i = 0; i < al->samples_nr; i++) {
1953-
percent = al->samples[i].percent_sum;
1952+
for (i = 0; i < al->data_nr; i++) {
1953+
percent = al->data[i].percent_sum;
19541954
color = get_percent_color(percent);
19551955
color_fprintf(stdout, color, " %7.2f", percent);
19561956

@@ -2355,10 +2355,10 @@ static void annotation__calc_lines(struct annotation *notes, struct map *map,
23552355
double percent_max = 0.0;
23562356
int i;
23572357

2358-
for (i = 0; i < al->samples_nr; i++) {
2358+
for (i = 0; i < al->data_nr; i++) {
23592359
struct annotation_data *sample;
23602360

2361-
sample = &al->samples[i];
2361+
sample = &al->data[i];
23622362

23632363
if (sample->percent > percent_max)
23642364
percent_max = sample->percent;
@@ -2448,8 +2448,8 @@ static double annotation_line__max_percent(struct annotation_line *al,
24482448
int i;
24492449

24502450
for (i = 0; i < notes->nr_events; i++) {
2451-
if (al->samples[i].percent > percent_max)
2452-
percent_max = al->samples[i].percent;
2451+
if (al->data[i].percent > percent_max)
2452+
percent_max = al->data[i].percent;
24532453
}
24542454

24552455
return percent_max;
@@ -2515,15 +2515,15 @@ static void __annotation_line__write(struct annotation_line *al, struct annotati
25152515
int i;
25162516

25172517
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);
25192519
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);
25212521
} else if (notes->options->show_nr_samples) {
25222522
obj__printf(obj, "%6" PRIu64 " ",
2523-
al->samples[i].he.nr_samples);
2523+
al->data[i].he.nr_samples);
25242524
} else {
25252525
obj__printf(obj, "%6.2f ",
2526-
al->samples[i].percent);
2526+
al->data[i].percent);
25272527
}
25282528
}
25292529
} else {

‎tools/perf/util/annotate.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ struct annotation_line {
122122
char *path;
123123
u32 idx;
124124
int idx_asm;
125-
int samples_nr;
126-
struct annotation_data samples[0];
125+
int data_nr;
126+
struct annotation_data data[0];
127127
};
128128

129129
struct disasm_line {

0 commit comments

Comments
 (0)