Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7e304557 authored by Jiri Olsa's avatar Jiri Olsa Committed by Arnaldo Carvalho de Melo
Browse files

perf annotate: Add samples into struct annotation_line



Add samples array into struct annotation_line to hold the annotation
data. The data is populated in the following patches.

Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20171011150158.11895-17-jolsa@kernel.org


Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent f8eb37bd
Loading
Loading
Loading
Loading
+8 −0
Original line number Original line Diff line number Diff line
@@ -911,7 +911,14 @@ static struct annotation_line *
annotation_line__new(struct annotate_args *args, size_t privsize)
annotation_line__new(struct annotate_args *args, size_t privsize)
{
{
	struct annotation_line *al;
	struct annotation_line *al;
	struct perf_evsel *evsel = args->evsel;
	size_t size = privsize + sizeof(*al);
	size_t size = privsize + sizeof(*al);
	int nr = 1;

	if (perf_evsel__is_group_event(evsel))
		nr = evsel->nr_members;

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


	al = zalloc(size);
	al = zalloc(size);
	if (al) {
	if (al) {
@@ -920,6 +927,7 @@ annotation_line__new(struct annotate_args *args, size_t privsize)
		al->offset     = args->offset;
		al->offset     = args->offset;
		al->line       = strdup(args->line);
		al->line       = strdup(args->line);
		al->line_nr    = args->line_nr;
		al->line_nr    = args->line_nr;
		al->samples_nr = nr;
	}
	}


	return al;
	return al;
+12 −5
Original line number Original line Diff line number Diff line
@@ -59,6 +59,16 @@ bool ins__is_fused(struct arch *arch, const char *ins1, const char *ins2);


struct annotation;
struct annotation;


struct sym_hist_entry {
	u64		nr_samples;
	u64		period;
};

struct annotation_data {
	double			 percent;
	struct sym_hist_entry	 he;
};

struct annotation_line {
struct annotation_line {
	struct list_head	 node;
	struct list_head	 node;
	struct rb_node		 rb_node;
	struct rb_node		 rb_node;
@@ -68,6 +78,8 @@ struct annotation_line {
	float			 ipc;
	float			 ipc;
	u64			 cycles;
	u64			 cycles;
	size_t			 privsize;
	size_t			 privsize;
	int			 samples_nr;
	struct annotation_data	 samples[0];
};
};


struct disasm_line {
struct disasm_line {
@@ -88,11 +100,6 @@ static inline bool disasm_line__has_offset(const struct disasm_line *dl)
	return dl->ops.target.offset_avail;
	return dl->ops.target.offset_avail;
}
}


struct sym_hist_entry {
	u64		nr_samples;
	u64		period;
};

void disasm_line__free(struct disasm_line *dl);
void disasm_line__free(struct disasm_line *dl);
struct annotation_line *
struct annotation_line *
annotation_line__next(struct annotation_line *pos, struct list_head *head);
annotation_line__next(struct annotation_line *pos, struct list_head *head);