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

Commit 41a37e20 authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo
Browse files

perf tools: Make event__preprocess_sample parse the sample



Simplifying the tools that were using both in sequence and allowing
upcoming simplifications, such as Arun's patch to sort by cpus.

Cc: David S. Miller <davem@davemloft.net>
Cc: Frédéric 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 45d8e802
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -61,11 +61,9 @@ static int hists__add_entry(struct hists *self, struct addr_location *al)
static int process_sample_event(event_t *event, struct perf_session *session)
{
	struct addr_location al;
	struct sample_data data;

	dump_printf("(IP, %d): %d: %#Lx\n", event->header.misc,
		    event->ip.pid, event->ip.ip);

	if (event__preprocess_sample(event, session, &al, NULL) < 0) {
	if (event__preprocess_sample(event, session, &al, &data, NULL) < 0) {
		pr_warning("problem processing %d event, skipping it.\n",
			   event->header.type);
		return -1;
+1 −6
Original line number Diff line number Diff line
@@ -35,10 +35,7 @@ static int diff__process_sample_event(event_t *event, struct perf_session *sessi
	struct addr_location al;
	struct sample_data data = { .period = 1, };

	dump_printf("(IP, %d): %d: %#Lx\n", event->header.misc,
		    event->ip.pid, event->ip.ip);

	if (event__preprocess_sample(event, session, &al, NULL) < 0) {
	if (event__preprocess_sample(event, session, &al, &data, NULL) < 0) {
		pr_warning("problem processing %d event, skipping it.\n",
			   event->header.type);
		return -1;
@@ -47,8 +44,6 @@ static int diff__process_sample_event(event_t *event, struct perf_session *sessi
	if (al.filtered || al.sym == NULL)
		return 0;

	event__parse_sample(event, session->sample_type, &data);

	if (hists__add_entry(&session->hists, &al, data.period)) {
		pr_warning("problem incrementing symbol period, skipping event\n");
		return -1;
+1 −25
Original line number Diff line number Diff line
@@ -155,31 +155,7 @@ static int process_sample_event(event_t *event, struct perf_session *session)
	struct addr_location al;
	struct perf_event_attr *attr;

	event__parse_sample(event, session->sample_type, &data);

	dump_printf("(IP, %d): %d/%d: %#Lx period: %Ld cpu:%d\n",
		    event->header.misc, data.pid, data.tid, data.ip,
		    data.period, data.cpu);

	if (session->sample_type & PERF_SAMPLE_CALLCHAIN) {
		unsigned int i;

		dump_printf("... chain: nr:%Lu\n", data.callchain->nr);

		if (!ip_callchain__valid(data.callchain, event)) {
			pr_debug("call-chain problem with event, "
				 "skipping it.\n");
			return 0;
		}

		if (dump_trace) {
			for (i = 0; i < data.callchain->nr; i++)
				dump_printf("..... %2d: %016Lx\n",
					    i, data.callchain->ips[i]);
		}
	}

	if (event__preprocess_sample(event, session, &al, NULL) < 0) {
	if (event__preprocess_sample(event, session, &al, &data, NULL) < 0) {
		fprintf(stderr, "problem processing %d event, skipping it.\n",
			event->header.type);
		return -1;
+3 −1
Original line number Diff line number Diff line
@@ -983,6 +983,7 @@ static void event__process_sample(const event_t *self,
	u64 ip = self->ip.ip;
	struct sym_entry *syme;
	struct addr_location al;
	struct sample_data data;
	struct machine *machine;
	u8 origin = self->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;

@@ -1025,7 +1026,8 @@ static void event__process_sample(const event_t *self,
	if (self->header.misc & PERF_RECORD_MISC_EXACT_IP)
		exact_samples++;

	if (event__preprocess_sample(self, session, &al, symbol_filter) < 0 ||
	if (event__preprocess_sample(self, session, &al, &data,
				     symbol_filter) < 0 ||
	    al.filtered)
		return;

+1 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@
#include "util.h"
#include "callchain.h"

bool ip_callchain__valid(struct ip_callchain *chain, event_t *event)
bool ip_callchain__valid(struct ip_callchain *chain, const event_t *event)
{
	unsigned int chain_size = event->header.size;
	chain_size -= (unsigned long)&event->ip.__more_data - (unsigned long)event;
Loading