mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-06 22:42:10 +00:00
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>
This commit is contained in:
parent
759ff497e0
commit
c5a8368ca6
3 changed files with 14 additions and 10 deletions
|
@ -257,7 +257,7 @@ static double disasm_line__calc_percent(struct disasm_line *dl, struct symbol *s
|
||||||
while (offset < (s64)len &&
|
while (offset < (s64)len &&
|
||||||
(next == NULL || offset < next->offset)) {
|
(next == NULL || offset < next->offset)) {
|
||||||
if (src_line) {
|
if (src_line) {
|
||||||
percent += src_line[offset].percent;
|
percent += src_line[offset].p[0].percent;
|
||||||
} else
|
} else
|
||||||
hits += h->addr[offset];
|
hits += h->addr[offset];
|
||||||
|
|
||||||
|
|
|
@ -616,7 +616,7 @@ static double disasm__calc_percent(struct annotation *notes, int evidx,
|
||||||
if (*path == NULL)
|
if (*path == NULL)
|
||||||
*path = src_line[offset].path;
|
*path = src_line[offset].path;
|
||||||
|
|
||||||
percent += src_line[offset++].percent;
|
percent += src_line[offset++].p[0].percent;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
while (offset < end)
|
while (offset < end)
|
||||||
|
@ -929,7 +929,7 @@ static void insert_source_line(struct rb_root *root, struct source_line *src_lin
|
||||||
|
|
||||||
ret = strcmp(iter->path, src_line->path);
|
ret = strcmp(iter->path, src_line->path);
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
iter->percent_sum += src_line->percent;
|
iter->p[0].percent_sum += src_line->p[0].percent;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -939,7 +939,7 @@ static void insert_source_line(struct rb_root *root, struct source_line *src_lin
|
||||||
p = &(*p)->rb_right;
|
p = &(*p)->rb_right;
|
||||||
}
|
}
|
||||||
|
|
||||||
src_line->percent_sum = src_line->percent;
|
src_line->p[0].percent_sum = src_line->p[0].percent;
|
||||||
|
|
||||||
rb_link_node(&src_line->node, parent, p);
|
rb_link_node(&src_line->node, parent, p);
|
||||||
rb_insert_color(&src_line->node, root);
|
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
|
||||||
parent = *p;
|
parent = *p;
|
||||||
iter = rb_entry(parent, struct source_line, node);
|
iter = rb_entry(parent, struct source_line, node);
|
||||||
|
|
||||||
if (src_line->percent_sum > iter->percent_sum)
|
if (src_line->p[0].percent_sum > iter->p[0].percent_sum)
|
||||||
p = &(*p)->rb_left;
|
p = &(*p)->rb_left;
|
||||||
else
|
else
|
||||||
p = &(*p)->rb_right;
|
p = &(*p)->rb_right;
|
||||||
|
@ -1025,8 +1025,8 @@ static int symbol__get_source_line(struct symbol *sym, struct map *map,
|
||||||
u64 offset;
|
u64 offset;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
src_line[i].percent = 100.0 * h->addr[i] / h->sum;
|
src_line[i].p[0].percent = 100.0 * h->addr[i] / h->sum;
|
||||||
if (src_line[i].percent <= 0.5)
|
if (src_line[i].p[0].percent <= 0.5)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
offset = start + i;
|
offset = start + i;
|
||||||
|
@ -1073,7 +1073,7 @@ static void print_summary(struct rb_root *root, const char *filename)
|
||||||
char *path;
|
char *path;
|
||||||
|
|
||||||
src_line = rb_entry(node, struct source_line, node);
|
src_line = rb_entry(node, struct source_line, node);
|
||||||
percent = src_line->percent_sum;
|
percent = src_line->p[0].percent_sum;
|
||||||
color = get_percent_color(percent);
|
color = get_percent_color(percent);
|
||||||
path = src_line->path;
|
path = src_line->path;
|
||||||
|
|
||||||
|
|
|
@ -74,11 +74,15 @@ struct sym_hist {
|
||||||
u64 addr[0];
|
u64 addr[0];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct source_line {
|
struct source_line_percent {
|
||||||
struct rb_node node;
|
|
||||||
double percent;
|
double percent;
|
||||||
double percent_sum;
|
double percent_sum;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct source_line {
|
||||||
|
struct rb_node node;
|
||||||
char *path;
|
char *path;
|
||||||
|
struct source_line_percent p[1];
|
||||||
};
|
};
|
||||||
|
|
||||||
/** struct annotated_source - symbols with hits have this attached as in sannotation
|
/** struct annotated_source - symbols with hits have this attached as in sannotation
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue