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

Commit 8115d60c authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo
Browse files

perf tools: Kill event_t typedef, use 'union perf_event' instead



And move the event_t methods to the perf_event__ too.

No code changes, just namespace consistency.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 8d50e5b4
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -58,12 +58,13 @@ static int hists__add_entry(struct hists *self, struct addr_location *al)
	return hist_entry__inc_addr_samples(he, al->addr);
}

static int process_sample_event(event_t *event, struct perf_sample *sample,
static int process_sample_event(union perf_event *event,
				struct perf_sample *sample,
				struct perf_session *session)
{
	struct addr_location al;

	if (event__preprocess_sample(event, session, &al, sample, NULL) < 0) {
	if (perf_event__preprocess_sample(event, session, &al, sample, NULL) < 0) {
		pr_warning("problem processing %d event, skipping it.\n",
			   event->header.type);
		return -1;
@@ -372,9 +373,9 @@ find_next:

static struct perf_event_ops event_ops = {
	.sample	= process_sample_event,
	.mmap	= event__process_mmap,
	.comm	= event__process_comm,
	.fork	= event__process_task,
	.mmap	= perf_event__process_mmap,
	.comm	= perf_event__process_comm,
	.fork	= perf_event__process_task,
	.ordered_samples = true,
	.ordering_requires_timestamps = true,
};
+7 −7
Original line number Diff line number Diff line
@@ -30,13 +30,13 @@ static int hists__add_entry(struct hists *self,
	return -ENOMEM;
}

static int diff__process_sample_event(event_t *event,
static int diff__process_sample_event(union perf_event *event,
				      struct perf_sample *sample,
				      struct perf_session *session)
{
	struct addr_location al;

	if (event__preprocess_sample(event, session, &al, sample, NULL) < 0) {
	if (perf_event__preprocess_sample(event, session, &al, sample, NULL) < 0) {
		pr_warning("problem processing %d event, skipping it.\n",
			   event->header.type);
		return -1;
@@ -56,11 +56,11 @@ static int diff__process_sample_event(event_t *event,

static struct perf_event_ops event_ops = {
	.sample	= diff__process_sample_event,
	.mmap	= event__process_mmap,
	.comm	= event__process_comm,
	.exit	= event__process_task,
	.fork	= event__process_task,
	.lost	= event__process_lost,
	.mmap	= perf_event__process_mmap,
	.comm	= perf_event__process_comm,
	.exit	= perf_event__process_task,
	.fork	= perf_event__process_task,
	.lost	= perf_event__process_lost,
	.ordered_samples = true,
	.ordering_requires_timestamps = true,
};
+43 −39
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@
static char		const *input_name = "-";
static bool		inject_build_ids;

static int event__repipe_synth(event_t *event,
static int perf_event__repipe_synth(union perf_event *event,
				    struct perf_session *session __used)
{
	uint32_t size;
@@ -36,41 +36,44 @@ static int event__repipe_synth(event_t *event,
	return 0;
}

static int event__repipe(event_t *event, struct perf_sample *sample __used,
static int perf_event__repipe(union perf_event *event,
			      struct perf_sample *sample __used,
			      struct perf_session *session)
{
	return event__repipe_synth(event, session);
	return perf_event__repipe_synth(event, session);
}

static int event__repipe_mmap(event_t *self, struct perf_sample *sample,
static int perf_event__repipe_mmap(union perf_event *event,
				   struct perf_sample *sample,
				   struct perf_session *session)
{
	int err;

	err = event__process_mmap(self, sample, session);
	event__repipe(self, sample, session);
	err = perf_event__process_mmap(event, sample, session);
	perf_event__repipe(event, sample, session);

	return err;
}

static int event__repipe_task(event_t *self, struct perf_sample *sample,
static int perf_event__repipe_task(union perf_event *event,
				   struct perf_sample *sample,
				   struct perf_session *session)
{
	int err;

	err = event__process_task(self, sample, session);
	event__repipe(self, sample, session);
	err = perf_event__process_task(event, sample, session);
	perf_event__repipe(event, sample, session);

	return err;
}

static int event__repipe_tracing_data(event_t *self,
static int perf_event__repipe_tracing_data(union perf_event *event,
					   struct perf_session *session)
{
	int err;

	event__repipe_synth(self, session);
	err = event__process_tracing_data(self, session);
	perf_event__repipe_synth(event, session);
	err = perf_event__process_tracing_data(event, session);

	return err;
}
@@ -109,7 +112,7 @@ static int dso__inject_build_id(struct dso *self, struct perf_session *session)
	if (self->kernel)
		misc = PERF_RECORD_MISC_KERNEL;

	err = event__synthesize_build_id(self, misc, event__repipe,
	err = perf_event__synthesize_build_id(self, misc, perf_event__repipe,
					      machine, session);
	if (err) {
		pr_err("Can't synthesize build_id event for %s\n", self->long_name);
@@ -119,7 +122,8 @@ static int dso__inject_build_id(struct dso *self, struct perf_session *session)
	return 0;
}

static int event__inject_buildid(event_t *event, struct perf_sample *sample,
static int perf_event__inject_buildid(union perf_event *event,
				      struct perf_sample *sample,
				      struct perf_session *session)
{
	struct addr_location al;
@@ -155,24 +159,24 @@ static int event__inject_buildid(event_t *event, struct perf_sample *sample,
	}

repipe:
	event__repipe(event, sample, session);
	perf_event__repipe(event, sample, session);
	return 0;
}

struct perf_event_ops inject_ops = {
	.sample		= event__repipe,
	.mmap		= event__repipe,
	.comm		= event__repipe,
	.fork		= event__repipe,
	.exit		= event__repipe,
	.lost		= event__repipe,
	.read		= event__repipe,
	.throttle	= event__repipe,
	.unthrottle	= event__repipe,
	.attr		= event__repipe_synth,
	.event_type 	= event__repipe_synth,
	.tracing_data 	= event__repipe_synth,
	.build_id 	= event__repipe_synth,
	.sample		= perf_event__repipe,
	.mmap		= perf_event__repipe,
	.comm		= perf_event__repipe,
	.fork		= perf_event__repipe,
	.exit		= perf_event__repipe,
	.lost		= perf_event__repipe,
	.read		= perf_event__repipe,
	.throttle	= perf_event__repipe,
	.unthrottle	= perf_event__repipe,
	.attr		= perf_event__repipe_synth,
	.event_type 	= perf_event__repipe_synth,
	.tracing_data 	= perf_event__repipe_synth,
	.build_id 	= perf_event__repipe_synth,
};

extern volatile int session_done;
@@ -190,10 +194,10 @@ static int __cmd_inject(void)
	signal(SIGINT, sig_handler);

	if (inject_build_ids) {
		inject_ops.sample	= event__inject_buildid;
		inject_ops.mmap		= event__repipe_mmap;
		inject_ops.fork		= event__repipe_task;
		inject_ops.tracing_data	= event__repipe_tracing_data;
		inject_ops.sample	= perf_event__inject_buildid;
		inject_ops.mmap		= perf_event__repipe_mmap;
		inject_ops.fork		= perf_event__repipe_task;
		inject_ops.tracing_data	= perf_event__repipe_tracing_data;
	}

	session = perf_session__new(input_name, O_RDONLY, false, true, &inject_ops);
+5 −5
Original line number Diff line number Diff line
@@ -275,8 +275,7 @@ static void process_free_event(void *data,
	s_alloc->alloc_cpu = -1;
}

static void
process_raw_event(event_t *raw_event __used, void *data,
static void process_raw_event(union perf_event *raw_event __used, void *data,
			      int cpu, u64 timestamp, struct thread *thread)
{
	struct event *event;
@@ -304,7 +303,8 @@ process_raw_event(event_t *raw_event __used, void *data,
	}
}

static int process_sample_event(event_t *event, struct perf_sample *sample,
static int process_sample_event(union perf_event *event,
				struct perf_sample *sample,
				struct perf_session *session)
{
	struct thread *thread = perf_session__findnew(session, event->ip.pid);
@@ -325,7 +325,7 @@ static int process_sample_event(event_t *event, struct perf_sample *sample,

static struct perf_event_ops event_ops = {
	.sample			= process_sample_event,
	.comm			= event__process_comm,
	.comm			= perf_event__process_comm,
	.ordered_samples	= true,
};

+3 −3
Original line number Diff line number Diff line
@@ -834,14 +834,14 @@ static void dump_info(void)
		die("Unknown type of information\n");
}

static int process_sample_event(event_t *self, struct perf_sample *sample,
static int process_sample_event(union perf_event *event, struct perf_sample *sample,
				struct perf_session *s)
{
	struct thread *thread = perf_session__findnew(s, sample->tid);

	if (thread == NULL) {
		pr_debug("problem processing %d event, skipping it.\n",
			self->header.type);
			event->header.type);
		return -1;
	}

@@ -852,7 +852,7 @@ static int process_sample_event(event_t *self, struct perf_sample *sample,

static struct perf_event_ops eops = {
	.sample			= process_sample_event,
	.comm			= event__process_comm,
	.comm			= perf_event__process_comm,
	.ordered_samples	= true,
};

Loading