perf annotate: Switch struct annotation_data::percent to array

So we can hold multiple percent values for annotation line.

The first member of this array is current local hits percent value
(PERCENT_HITS_LOCAL index), so no functional change is expected.

Adding annotation_data__percent function to return requested percent
value from struct annotation_data.

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-9-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Jiri Olsa
2018-08-04 15:05:09 +02:00
committed by Arnaldo Carvalho de Melo
parent 2bcf73069b
commit 6d9f0c2d5e
3 changed files with 56 additions and 23 deletions

View File

@@ -101,8 +101,13 @@ struct sym_hist_entry {
u64 period;
};
enum {
PERCENT_HITS_LOCAL,
PERCENT_MAX,
};
struct annotation_data {
double percent;
double percent[PERCENT_MAX];
double percent_sum;
struct sym_hist_entry he;
};
@@ -134,6 +139,12 @@ struct disasm_line {
struct annotation_line al;
};
static inline double annotation_data__percent(struct annotation_data *data,
unsigned int which)
{
return which < PERCENT_MAX ? data->percent[which] : -1;
}
static inline struct disasm_line *disasm_line(struct annotation_line *al)
{
return al ? container_of(al, struct disasm_line, al) : NULL;