|
@@ -29,11 +29,6 @@ struct browser_disasm_line {
|
|
u32 idx;
|
|
u32 idx;
|
|
int idx_asm;
|
|
int idx_asm;
|
|
int jump_sources;
|
|
int jump_sources;
|
|
- /*
|
|
|
|
- * actual length of this array is saved on the nr_events field
|
|
|
|
- * of the struct annotate_browser
|
|
|
|
- */
|
|
|
|
- struct disasm_line_samples samples[1];
|
|
|
|
};
|
|
};
|
|
|
|
|
|
static struct annotate_browser_opt {
|
|
static struct annotate_browser_opt {
|
|
@@ -76,9 +71,7 @@ struct annotate_browser {
|
|
|
|
|
|
static inline struct browser_disasm_line *disasm_line__browser(struct disasm_line *dl)
|
|
static inline struct browser_disasm_line *disasm_line__browser(struct disasm_line *dl)
|
|
{
|
|
{
|
|
- struct annotation_line *al = &dl->al;
|
|
|
|
-
|
|
|
|
- return (void *) al - al->privsize;
|
|
|
|
|
|
+ return (void *) dl - sizeof(struct browser_disasm_line);
|
|
}
|
|
}
|
|
|
|
|
|
static bool disasm_line__filter(struct ui_browser *browser __maybe_unused,
|
|
static bool disasm_line__filter(struct ui_browser *browser __maybe_unused,
|
|
@@ -139,8 +132,8 @@ static void annotate_browser__write(struct ui_browser *browser, void *entry, int
|
|
bool show_title = false;
|
|
bool show_title = false;
|
|
|
|
|
|
for (i = 0; i < ab->nr_events; i++) {
|
|
for (i = 0; i < ab->nr_events; i++) {
|
|
- if (bdl->samples[i].percent > percent_max)
|
|
|
|
- percent_max = bdl->samples[i].percent;
|
|
|
|
|
|
+ if (dl->al.samples[i].percent > percent_max)
|
|
|
|
+ percent_max = dl->al.samples[i].percent;
|
|
}
|
|
}
|
|
|
|
|
|
if ((row == 0) && (dl->al.offset == -1 || percent_max == 0.0)) {
|
|
if ((row == 0) && (dl->al.offset == -1 || percent_max == 0.0)) {
|
|
@@ -154,17 +147,17 @@ static void annotate_browser__write(struct ui_browser *browser, void *entry, int
|
|
if (dl->al.offset != -1 && percent_max != 0.0) {
|
|
if (dl->al.offset != -1 && percent_max != 0.0) {
|
|
for (i = 0; i < ab->nr_events; i++) {
|
|
for (i = 0; i < ab->nr_events; i++) {
|
|
ui_browser__set_percent_color(browser,
|
|
ui_browser__set_percent_color(browser,
|
|
- bdl->samples[i].percent,
|
|
|
|
|
|
+ dl->al.samples[i].percent,
|
|
current_entry);
|
|
current_entry);
|
|
if (annotate_browser__opts.show_total_period) {
|
|
if (annotate_browser__opts.show_total_period) {
|
|
ui_browser__printf(browser, "%11" PRIu64 " ",
|
|
ui_browser__printf(browser, "%11" PRIu64 " ",
|
|
- bdl->samples[i].he.period);
|
|
|
|
|
|
+ dl->al.samples[i].he.period);
|
|
} else if (annotate_browser__opts.show_nr_samples) {
|
|
} else if (annotate_browser__opts.show_nr_samples) {
|
|
ui_browser__printf(browser, "%6" PRIu64 " ",
|
|
ui_browser__printf(browser, "%6" PRIu64 " ",
|
|
- bdl->samples[i].he.nr_samples);
|
|
|
|
|
|
+ dl->al.samples[i].he.nr_samples);
|
|
} else {
|
|
} else {
|
|
ui_browser__printf(browser, "%6.2f ",
|
|
ui_browser__printf(browser, "%6.2f ",
|
|
- bdl->samples[i].percent);
|
|
|
|
|
|
+ dl->al.samples[i].percent);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
@@ -363,11 +356,9 @@ static unsigned int annotate_browser__refresh(struct ui_browser *browser)
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
-static int disasm__cmp(struct disasm_line *da,
|
|
|
|
- struct disasm_line *db, int nr_pcnt)
|
|
|
|
|
|
+static int disasm__cmp(struct annotation_line *a,
|
|
|
|
+ struct annotation_line *b, int nr_pcnt)
|
|
{
|
|
{
|
|
- struct browser_disasm_line *a = disasm_line__browser(da);
|
|
|
|
- struct browser_disasm_line *b = disasm_line__browser(db);
|
|
|
|
int i;
|
|
int i;
|
|
|
|
|
|
for (i = 0; i < nr_pcnt; i++) {
|
|
for (i = 0; i < nr_pcnt; i++) {
|
|
@@ -378,24 +369,24 @@ static int disasm__cmp(struct disasm_line *da,
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
-static void disasm_rb_tree__insert(struct rb_root *root, struct disasm_line *dl,
|
|
|
|
|
|
+static void disasm_rb_tree__insert(struct rb_root *root, struct annotation_line *al,
|
|
int nr_events)
|
|
int nr_events)
|
|
{
|
|
{
|
|
struct rb_node **p = &root->rb_node;
|
|
struct rb_node **p = &root->rb_node;
|
|
struct rb_node *parent = NULL;
|
|
struct rb_node *parent = NULL;
|
|
- struct disasm_line *l;
|
|
|
|
|
|
+ struct annotation_line *l;
|
|
|
|
|
|
while (*p != NULL) {
|
|
while (*p != NULL) {
|
|
parent = *p;
|
|
parent = *p;
|
|
- l = rb_entry(parent, struct disasm_line, al.rb_node);
|
|
|
|
|
|
+ l = rb_entry(parent, struct annotation_line, rb_node);
|
|
|
|
|
|
- if (disasm__cmp(dl, l, nr_events))
|
|
|
|
|
|
+ if (disasm__cmp(al, l, nr_events))
|
|
p = &(*p)->rb_left;
|
|
p = &(*p)->rb_left;
|
|
else
|
|
else
|
|
p = &(*p)->rb_right;
|
|
p = &(*p)->rb_right;
|
|
}
|
|
}
|
|
- rb_link_node(&dl->al.rb_node, parent, p);
|
|
|
|
- rb_insert_color(&dl->al.rb_node, root);
|
|
|
|
|
|
+ rb_link_node(&al->rb_node, parent, p);
|
|
|
|
+ rb_insert_color(&al->rb_node, root);
|
|
}
|
|
}
|
|
|
|
|
|
static void annotate_browser__set_top(struct annotate_browser *browser,
|
|
static void annotate_browser__set_top(struct annotate_browser *browser,
|
|
@@ -453,7 +444,6 @@ static void annotate_browser__calc_percent(struct annotate_browser *browser,
|
|
symbol__calc_percent(sym, evsel);
|
|
symbol__calc_percent(sym, evsel);
|
|
|
|
|
|
list_for_each_entry(pos, ¬es->src->source, al.node) {
|
|
list_for_each_entry(pos, ¬es->src->source, al.node) {
|
|
- struct browser_disasm_line *bpos = disasm_line__browser(pos);
|
|
|
|
double max_percent = 0.0;
|
|
double max_percent = 0.0;
|
|
int i;
|
|
int i;
|
|
|
|
|
|
@@ -465,18 +455,15 @@ static void annotate_browser__calc_percent(struct annotate_browser *browser,
|
|
for (i = 0; i < browser->nr_events; i++) {
|
|
for (i = 0; i < browser->nr_events; i++) {
|
|
struct annotation_data *sample = &pos->al.samples[i];
|
|
struct annotation_data *sample = &pos->al.samples[i];
|
|
|
|
|
|
- bpos->samples[i].percent = sample->percent;
|
|
|
|
- bpos->samples[i].he = sample->he;
|
|
|
|
-
|
|
|
|
- if (max_percent < bpos->samples[i].percent)
|
|
|
|
- max_percent = bpos->samples[i].percent;
|
|
|
|
|
|
+ if (max_percent < sample->percent)
|
|
|
|
+ max_percent = sample->percent;
|
|
}
|
|
}
|
|
|
|
|
|
if (max_percent < 0.01 && pos->al.ipc == 0) {
|
|
if (max_percent < 0.01 && pos->al.ipc == 0) {
|
|
RB_CLEAR_NODE(&pos->al.rb_node);
|
|
RB_CLEAR_NODE(&pos->al.rb_node);
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
- disasm_rb_tree__insert(&browser->entries, pos,
|
|
|
|
|
|
+ disasm_rb_tree__insert(&browser->entries, &pos->al,
|
|
browser->nr_events);
|
|
browser->nr_events);
|
|
}
|
|
}
|
|
pthread_mutex_unlock(¬es->lock);
|
|
pthread_mutex_unlock(¬es->lock);
|
|
@@ -1096,7 +1083,6 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map,
|
|
};
|
|
};
|
|
int ret = -1, err;
|
|
int ret = -1, err;
|
|
int nr_pcnt = 1;
|
|
int nr_pcnt = 1;
|
|
- size_t sizeof_bdl = sizeof(struct browser_disasm_line);
|
|
|
|
|
|
|
|
if (sym == NULL)
|
|
if (sym == NULL)
|
|
return -1;
|
|
return -1;
|
|
@@ -1112,14 +1098,11 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map,
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
|
|
|
|
- if (perf_evsel__is_group_event(evsel)) {
|
|
|
|
|
|
+ if (perf_evsel__is_group_event(evsel))
|
|
nr_pcnt = evsel->nr_members;
|
|
nr_pcnt = evsel->nr_members;
|
|
- sizeof_bdl += sizeof(struct disasm_line_samples) *
|
|
|
|
- (nr_pcnt - 1);
|
|
|
|
- }
|
|
|
|
|
|
|
|
err = symbol__annotate(sym, map, evsel,
|
|
err = symbol__annotate(sym, map, evsel,
|
|
- sizeof_bdl, &browser.arch,
|
|
|
|
|
|
+ sizeof(struct browser_disasm_line), &browser.arch,
|
|
perf_evsel__env_cpuid(evsel));
|
|
perf_evsel__env_cpuid(evsel));
|
|
if (err) {
|
|
if (err) {
|
|
char msg[BUFSIZ];
|
|
char msg[BUFSIZ];
|