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

Commit 3ac1bbcf authored by Ingo Molnar's avatar Ingo Molnar
Browse files

Merge branch 'perf/core' of...

Merge branch 'perf/core' of git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing

 into perf/urgent

Conflicts:
	tools/perf/builtin-top.c

Semantic conflict:
	util/include/linux/list.h        # fix prefetch.h removal fallout

Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parents a2d063ac 5538beca
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -474,6 +474,7 @@ static int test__basic_mmap(void)
	unsigned int nr_events[nsyscalls],
		     expected_nr_events[nsyscalls], i, j;
	struct perf_evsel *evsels[nsyscalls], *evsel;
	int sample_size = perf_sample_size(attr.sample_type);

	for (i = 0; i < nsyscalls; ++i) {
		char name[64];
@@ -558,7 +559,13 @@ static int test__basic_mmap(void)
			goto out_munmap;
		}

		perf_event__parse_sample(event, attr.sample_type, false, &sample);
		err = perf_event__parse_sample(event, attr.sample_type, sample_size,
					       false, &sample);
		if (err) {
			pr_err("Can't parse sample, err = %d\n", err);
			goto out_munmap;
		}

		evsel = perf_evlist__id2evsel(evlist, sample.id);
		if (evsel == NULL) {
			pr_debug("event with id %" PRIu64
+6 −1
Original line number Diff line number Diff line
@@ -805,9 +805,14 @@ static void perf_session__mmap_read_idx(struct perf_session *self, int idx)
{
	struct perf_sample sample;
	union perf_event *event;
	int ret;

	while ((event = perf_evlist__mmap_read(top.evlist, idx)) != NULL) {
		perf_session__parse_sample(self, event, &sample);
		ret = perf_session__parse_sample(self, event, &sample);
		if (ret) {
			pr_err("Can't parse sample, err = %d\n", ret);
			continue;
		}

		if (event->header.type == PERF_RECORD_SAMPLE)
			perf_event__process_sample(event, &sample, self);
+16 −0
Original line number Diff line number Diff line
@@ -35,6 +35,22 @@ const char *perf_event__name(unsigned int id)
	return perf_event__names[id];
}

int perf_sample_size(u64 sample_type)
{
	u64 mask = sample_type & PERF_SAMPLE_MASK;
	int size = 0;
	int i;

	for (i = 0; i < 64; i++) {
		if ((mask << i) & 1)
			size++;
	}

	size *= sizeof(u64);

	return size;
}

static struct perf_sample synth_sample = {
	.pid	   = -1,
	.tid	   = -1,
+11 −1
Original line number Diff line number Diff line
@@ -56,6 +56,13 @@ struct read_event {
	u64 id;
};


#define PERF_SAMPLE_MASK				\
	(PERF_SAMPLE_IP | PERF_SAMPLE_TID |		\
	 PERF_SAMPLE_TIME | PERF_SAMPLE_ADDR |		\
	PERF_SAMPLE_ID | PERF_SAMPLE_STREAM_ID |	\
	 PERF_SAMPLE_CPU | PERF_SAMPLE_PERIOD)

struct sample_event {
	struct perf_event_header        header;
	u64 array[];
@@ -75,6 +82,8 @@ struct perf_sample {
	struct ip_callchain *callchain;
};

int perf_sample_size(u64 sample_type);

#define BUILD_ID_SIZE 20

struct build_id_event {
@@ -178,6 +187,7 @@ int perf_event__preprocess_sample(const union perf_event *self,
const char *perf_event__name(unsigned int id);

int perf_event__parse_sample(const union perf_event *event, u64 type,
			     bool sample_id_all, struct perf_sample *sample);
			     int sample_size, bool sample_id_all,
			     struct perf_sample *sample);

#endif /* __PERF_RECORD_H */
+31 −0
Original line number Diff line number Diff line
@@ -459,3 +459,34 @@ int perf_evlist__set_filters(struct perf_evlist *evlist)

	return 0;
}

u64 perf_evlist__sample_type(struct perf_evlist *evlist)
{
	struct perf_evsel *pos;
	u64 type = 0;

	list_for_each_entry(pos, &evlist->entries, node) {
		if (!type)
			type = pos->attr.sample_type;
		else if (type != pos->attr.sample_type)
			die("non matching sample_type");
	}

	return type;
}

bool perf_evlist__sample_id_all(const struct perf_evlist *evlist)
{
	bool value = false, first = true;
	struct perf_evsel *pos;

	list_for_each_entry(pos, &evlist->entries, node) {
		if (first) {
			value = pos->attr.sample_id_all;
			first = false;
		} else if (value != pos->attr.sample_id_all)
			die("non matching sample_id_all");
	}

	return value;
}
Loading