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

Commit 162f0bef authored by Frederic Weisbecker's avatar Frederic Weisbecker Committed by Arnaldo Carvalho de Melo
Browse files

perf tools: Add time argument on COMM setting



This way we can later delimit a lifecycle for the COMM and map a hist to
a precise COMM:timeslice couple.

PERF_RECORD_COMM and PERF_RECORD_FORK events that don't have
PERF_SAMPLE_TIME samples can only send 0 value as a timestamp and thus
should overwrite any previous COMM on a given thread because there is no
sensible way to keep track of all the comms lifecycles in a thread
without time informations.

Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
Tested-by: default avatarJiri Olsa <jolsa@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-6tyow99vgmmtt9qwr2u2lqd7@git.kernel.org


[ Made it cope with PERF_RECORD_MMAP2 ]
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent b9c5143a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -856,7 +856,7 @@ static void perf_top__mmap_read_idx(struct perf_top *top, int idx)
						   &sample, machine);
		} else if (event->header.type < PERF_RECORD_MAX) {
			hists__inc_nr_events(&evsel->hists, event->header.type);
			machine__process_event(machine, event);
			machine__process_event(machine, event, &sample);
		} else
			++session->stats.nr_unknown_events;
next_event:
+6 −6
Original line number Diff line number Diff line
@@ -1122,7 +1122,7 @@ static size_t trace__fprintf_entry_head(struct trace *trace, struct thread *thre
}

static int trace__process_event(struct trace *trace, struct machine *machine,
				union perf_event *event)
				union perf_event *event, struct perf_sample *sample)
{
	int ret = 0;

@@ -1130,9 +1130,9 @@ static int trace__process_event(struct trace *trace, struct machine *machine,
	case PERF_RECORD_LOST:
		color_fprintf(trace->output, PERF_COLOR_RED,
			      "LOST %" PRIu64 " events!\n", event->lost.lost);
		ret = machine__process_lost_event(machine, event);
		ret = machine__process_lost_event(machine, event, sample);
	default:
		ret = machine__process_event(machine, event);
		ret = machine__process_event(machine, event, sample);
		break;
	}

@@ -1141,11 +1141,11 @@ static int trace__process_event(struct trace *trace, struct machine *machine,

static int trace__tool_process(struct perf_tool *tool,
			       union perf_event *event,
			       struct perf_sample *sample __maybe_unused,
			       struct perf_sample *sample,
			       struct machine *machine)
{
	struct trace *trace = container_of(tool, struct trace, tool);
	return trace__process_event(trace, machine, event);
	return trace__process_event(trace, machine, event, sample);
}

static int trace__symbols_init(struct trace *trace, struct perf_evlist *evlist)
@@ -1751,7 +1751,7 @@ static int trace__run(struct trace *trace, int argc, const char **argv)
				trace->base_time = sample.time;

			if (type != PERF_RECORD_SAMPLE) {
				trace__process_event(trace, trace->host, event);
				trace__process_event(trace, trace->host, event, &sample);
				continue;
			}

+1 −1
Original line number Diff line number Diff line
@@ -276,7 +276,7 @@ static int process_event(struct machine *machine, struct perf_evlist *evlist,
		return process_sample_event(machine, evlist, event, state);

	if (event->header.type < PERF_RECORD_MAX)
		return machine__process_event(machine, event);
		return machine__process_event(machine, event, NULL);

	return 0;
}
+2 −2
Original line number Diff line number Diff line
@@ -93,7 +93,7 @@ static struct machine *setup_fake_machine(struct machines *machines)
		if (thread == NULL)
			goto out;

		thread__set_comm(thread, fake_threads[i].comm);
		thread__set_comm(thread, fake_threads[i].comm, 0);
	}

	for (i = 0; i < ARRAY_SIZE(fake_mmap_info); i++) {
@@ -110,7 +110,7 @@ static struct machine *setup_fake_machine(struct machines *machines)
		strcpy(fake_mmap_event.mmap.filename,
		       fake_mmap_info[i].filename);

		machine__process_mmap_event(machine, &fake_mmap_event);
		machine__process_mmap_event(machine, &fake_mmap_event, NULL);
	}

	for (i = 0; i < ARRAY_SIZE(fake_symbols); i++) {
+14 −14
Original line number Diff line number Diff line
@@ -512,18 +512,18 @@ size_t perf_event__fprintf_comm(union perf_event *event, FILE *fp)

int perf_event__process_comm(struct perf_tool *tool __maybe_unused,
			     union perf_event *event,
			     struct perf_sample *sample __maybe_unused,
			     struct perf_sample *sample,
			     struct machine *machine)
{
	return machine__process_comm_event(machine, event);
	return machine__process_comm_event(machine, event, sample);
}

int perf_event__process_lost(struct perf_tool *tool __maybe_unused,
			     union perf_event *event,
			     struct perf_sample *sample __maybe_unused,
			     struct perf_sample *sample,
			     struct machine *machine)
{
	return machine__process_lost_event(machine, event);
	return machine__process_lost_event(machine, event, sample);
}

size_t perf_event__fprintf_mmap(union perf_event *event, FILE *fp)
@@ -546,18 +546,18 @@ size_t perf_event__fprintf_mmap2(union perf_event *event, FILE *fp)

int perf_event__process_mmap(struct perf_tool *tool __maybe_unused,
			     union perf_event *event,
			     struct perf_sample *sample __maybe_unused,
			     struct perf_sample *sample,
			     struct machine *machine)
{
	return machine__process_mmap_event(machine, event);
	return machine__process_mmap_event(machine, event, sample);
}

int perf_event__process_mmap2(struct perf_tool *tool __maybe_unused,
			     union perf_event *event,
			     struct perf_sample *sample __maybe_unused,
			     struct perf_sample *sample,
			     struct machine *machine)
{
	return machine__process_mmap2_event(machine, event);
	return machine__process_mmap2_event(machine, event, sample);
}

size_t perf_event__fprintf_task(union perf_event *event, FILE *fp)
@@ -569,18 +569,18 @@ size_t perf_event__fprintf_task(union perf_event *event, FILE *fp)

int perf_event__process_fork(struct perf_tool *tool __maybe_unused,
			     union perf_event *event,
			     struct perf_sample *sample __maybe_unused,
			     struct perf_sample *sample,
			     struct machine *machine)
{
	return machine__process_fork_event(machine, event);
	return machine__process_fork_event(machine, event, sample);
}

int perf_event__process_exit(struct perf_tool *tool __maybe_unused,
			     union perf_event *event,
			     struct perf_sample *sample __maybe_unused,
			     struct perf_sample *sample,
			     struct machine *machine)
{
	return machine__process_exit_event(machine, event);
	return machine__process_exit_event(machine, event, sample);
}

size_t perf_event__fprintf(union perf_event *event, FILE *fp)
@@ -611,10 +611,10 @@ size_t perf_event__fprintf(union perf_event *event, FILE *fp)

int perf_event__process(struct perf_tool *tool __maybe_unused,
			union perf_event *event,
			struct perf_sample *sample __maybe_unused,
			struct perf_sample *sample,
			struct machine *machine)
{
	return machine__process_event(machine, event);
	return machine__process_event(machine, event, sample);
}

void thread__find_addr_map(struct thread *self,
Loading