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

Commit 7ebaa283 authored by Ingo Molnar's avatar Ingo Molnar
Browse files

Merge branch 'perf' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux-2.6 into perf/core

parents 1ff3d7d7 3e1bbdc3
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -416,6 +416,7 @@ LIB_H += util/thread.h
LIB_H += util/trace-event.h
LIB_H += util/probe-finder.h
LIB_H += util/probe-event.h
LIB_H += util/pstack.h
LIB_H += util/cpumap.h

LIB_OBJS += $(OUTPUT)util/abspath.o
@@ -451,6 +452,7 @@ LIB_OBJS += $(OUTPUT)util/callchain.o
LIB_OBJS += $(OUTPUT)util/values.o
LIB_OBJS += $(OUTPUT)util/debug.o
LIB_OBJS += $(OUTPUT)util/map.o
LIB_OBJS += $(OUTPUT)util/pstack.o
LIB_OBJS += $(OUTPUT)util/session.o
LIB_OBJS += $(OUTPUT)util/thread.o
LIB_OBJS += $(OUTPUT)util/trace-event-parse.o
+1 −1
Original line number Diff line number Diff line
@@ -365,7 +365,7 @@ static int __cmd_annotate(void)
		goto out_delete;

	if (dump_trace) {
		event__print_totals();
		perf_session__fprintf_nr_events(session, stdout);
		goto out_delete;
	}

+4 −4
Original line number Diff line number Diff line
@@ -23,9 +23,9 @@ static bool force;
static bool show_displacement;

static int hists__add_entry(struct hists *self,
			    struct addr_location *al, u64 count)
			    struct addr_location *al, u64 period)
{
	if (__hists__add_entry(self, al, NULL, count) != NULL)
	if (__hists__add_entry(self, al, NULL, period) != NULL)
		return 0;
	return -ENOMEM;
}
@@ -50,11 +50,11 @@ static int diff__process_sample_event(event_t *event, struct perf_session *sessi
	event__parse_sample(event, session->sample_type, &data);

	if (hists__add_entry(&session->hists, &al, data.period)) {
		pr_warning("problem incrementing symbol count, skipping event\n");
		pr_warning("problem incrementing symbol period, skipping event\n");
		return -1;
	}

	session->hists.stats.total += data.period;
	session->hists.stats.total_period += data.period;
	return 0;
}

+31 −13
Original line number Diff line number Diff line
@@ -138,8 +138,14 @@ static int add_event_total(struct perf_session *session,
	if (!hists)
		return -ENOMEM;

	hists->stats.total += data->period;
	session->hists.stats.total += data->period;
	hists->stats.total_period += data->period;
	/*
	 * FIXME: add_event_total should be moved from here to
	 * perf_session__process_event so that the proper hist is passed to
	 * the event_op methods.
	 */
	hists__inc_nr_events(hists, PERF_RECORD_SAMPLE);
	session->hists.stats.total_period += data->period;
	return 0;
}

@@ -182,14 +188,14 @@ static int process_sample_event(event_t *event, struct perf_session *session)
		return 0;

	if (perf_session__add_hist_entry(session, &al, &data)) {
		pr_debug("problem incrementing symbol count, skipping event\n");
		pr_debug("problem incrementing symbol period, skipping event\n");
		return -1;
	}

	attr = perf_header__find_attr(data.id, &session->header);

	if (add_event_total(session, &data, attr)) {
		pr_debug("problem adding event count\n");
		pr_debug("problem adding event period\n");
		return -1;
	}

@@ -263,11 +269,25 @@ static struct perf_event_ops event_ops = {

extern volatile int session_done;

static void sig_handler(int sig __attribute__((__unused__)))
static void sig_handler(int sig __used)
{
	session_done = 1;
}

static size_t hists__fprintf_nr_sample_events(struct hists *self,
					      const char *evname, FILE *fp)
{
	size_t ret;
	char unit;
	unsigned long nr_events = self->stats.nr_events[PERF_RECORD_SAMPLE];

	nr_events = convert_unit(nr_events, &unit);
	ret = fprintf(fp, "# Events: %lu%c", nr_events, unit);
	if (evname != NULL)
		ret += fprintf(fp, " %s", evname);
	return ret + fprintf(fp, "\n#\n");
}

static int __cmd_report(void)
{
	int ret = -EINVAL;
@@ -293,7 +313,7 @@ static int __cmd_report(void)
		goto out_delete;

	if (dump_trace) {
		event__print_totals();
		perf_session__fprintf_nr_events(session, stdout);
		goto out_delete;
	}

@@ -313,14 +333,12 @@ static int __cmd_report(void)
		if (use_browser)
			hists__browse(hists, help, input_name);
		else {
			if (rb_first(&session->hists.entries) ==
			const char *evname = NULL;
			if (rb_first(&session->hists.entries) !=
			    rb_last(&session->hists.entries))
				fprintf(stdout, "# Samples: %Ld\n#\n",
					hists->stats.total);
			else
				fprintf(stdout, "# Samples: %Ld %s\n#\n",
					hists->stats.total,
					__event_name(hists->type, hists->config));
				evname = __event_name(hists->type, hists->config);

			hists__fprintf_nr_sample_events(hists, evname, stdout);

			hists__fprintf(hists, NULL, false, stdout);
			fprintf(stdout, "\n\n");
+6 −11
Original line number Diff line number Diff line
@@ -1641,19 +1641,10 @@ static int process_sample_event(event_t *event, struct perf_session *session)
	return 0;
}

static int process_lost_event(event_t *event __used,
			      struct perf_session *session __used)
{
	nr_lost_chunks++;
	nr_lost_events += event->lost.lost;

	return 0;
}

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

@@ -1664,8 +1655,12 @@ static int read_events(void)
	if (session == NULL)
		return -ENOMEM;

	if (perf_session__has_traces(session, "record -R"))
	if (perf_session__has_traces(session, "record -R")) {
		err = perf_session__process_events(session, &event_ops);
		nr_events      = session->hists.stats.nr_events[0];
		nr_lost_events = session->hists.stats.total_lost;
		nr_lost_chunks = session->hists.stats.nr_events[PERF_RECORD_LOST];
	}

	perf_session__delete(session);
	return err;
Loading