perf annotate: Introduce annotation_line__max_percent()

Out of the annotate_browser__write() routine, to be used in the --stdio2
mode.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: https://lkml.kernel.org/n/tip-0he0wyy4haswqi1qb35x37do@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Arnaldo Carvalho de Melo
2018-03-15 17:04:53 -03:00
parent ecda45bd6c
commit 2f025ea0ba
3 changed files with 18 additions and 6 deletions

View File

@@ -2184,6 +2184,20 @@ bool ui__has_annotation(void)
return use_browser == 1 && perf_hpp_list.sym;
}
double annotation_line__max_percent(struct annotation_line *al, struct annotation *notes)
{
double percent_max = 0.0;
int i;
for (i = 0; i < notes->nr_events; i++) {
if (al->samples[i].percent > percent_max)
percent_max = al->samples[i].percent;
}
return percent_max;
}
int symbol__annotate2(struct symbol *sym, struct map *map, struct perf_evsel *evsel,
struct annotation_options *options, struct arch **parch)
{