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

Commit 81393214 authored by Ingo Molnar's avatar Ingo Molnar
Browse files

Merge tag 'perf-core-for-mingo' of...

Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux

 into perf/core

Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:

  * Add an option in 'perf script' to print the source line number, from Adrian Hunter

  * Add --header/--header-only options to 'script' and 'report', the default is not
    tho show the header info, but as this has been the default for some time,
    leave a single line explaining how to obtain that information, from Jiri Olsa.

  * Fix symoff printing in callchains in 'perf script', from Adrian Hunter.

  * Assorted mmap_pages handling fixes, from Adrian Hunter.

  * Fix summary percentage when processing files in 'perf trace', from David Ahern.

  * Handle old kernels where the "raw_syscalls" tracepoints were called plan "syscalls",
    in 'perf trace', from David Ahern.

  * Several man pages typo fixes from Dongsheng Yang.

  * Add '-v' option to 'perf kvm', from Dongsheng Yang.

  * Make perf kvm diff support --guestmount, from Dongsheng Yang.

  * Get rid of several die() calls in libtraceevent, from Namhyung Kim.

  * Use basename() in a more robust way, to avoid problems related to different
    system library implementations for that function, from Stephane Eranian.

  * Remove open coded management of short_name_allocated member, from Adrian Hunter

  * Several cleanups in the "dso" methods, constifying some parameters and
    renaming some fields to clarify its purpose. (Arnaldo Carvalho de Melo.)

  * Add per-feature check flags, fixing libunwind related build problems on some
    architectures, from Jean Pihet.

Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parents 78979079 1448fef4
Loading
Loading
Loading
Loading
+18 −10
Original line number Diff line number Diff line
@@ -2710,7 +2710,6 @@ process_func_handler(struct event_format *event, struct pevent_function_handler
	struct print_arg *farg;
	enum event_type type;
	char *token;
	const char *test;
	int i;

	arg->type = PRINT_FUNC;
@@ -2727,15 +2726,19 @@ process_func_handler(struct event_format *event, struct pevent_function_handler
		}

		type = process_arg(event, farg, &token);
		if (i < (func->nr_args - 1))
			test = ",";
		else
			test = ")";

		if (test_type_token(type, token, EVENT_DELIM, test)) {
			free_arg(farg);
			free_token(token);
			return EVENT_ERROR;
		if (i < (func->nr_args - 1)) {
			if (type != EVENT_DELIM || strcmp(token, ",") != 0) {
				warning("Error: function '%s()' expects %d arguments but event %s only uses %d",
					func->name, func->nr_args,
					event->name, i + 1);
				goto err;
			}
		} else {
			if (type != EVENT_DELIM || strcmp(token, ")") != 0) {
				warning("Error: function '%s()' only expects %d arguments but event %s has more",
					func->name, func->nr_args, event->name);
				goto err;
			}
		}

		*next_arg = farg;
@@ -2747,6 +2750,11 @@ process_func_handler(struct event_format *event, struct pevent_function_handler
	*tok = token;

	return type;

err:
	free_arg(farg);
	free_token(token);
	return EVENT_ERROR;
}

static enum event_type
+1 −1
Original line number Diff line number Diff line
@@ -860,7 +860,7 @@ int pevent_event_filtered(struct event_filter *filter,

void pevent_filter_reset(struct event_filter *filter);

void pevent_filter_clear_trivial(struct event_filter *filter,
int pevent_filter_clear_trivial(struct event_filter *filter,
				 enum filter_trivial_type type);

void pevent_filter_free(struct event_filter *filter);
+44 −13
Original line number Diff line number Diff line
@@ -182,7 +182,10 @@ struct event_filter *pevent_filter_alloc(struct pevent *pevent)
{
	struct event_filter *filter;

	filter = malloc_or_die(sizeof(*filter));
	filter = malloc(sizeof(*filter));
	if (filter == NULL)
		return NULL;

	memset(filter, 0, sizeof(*filter));
	filter->pevent = pevent;
	pevent_ref(pevent);
@@ -242,15 +245,19 @@ static void free_arg(struct filter_arg *arg)
	free(arg);
}

static void add_event(struct event_list **events,
static int add_event(struct event_list **events,
		      struct event_format *event)
{
	struct event_list *list;

	list = malloc_or_die(sizeof(*list));
	list = malloc(sizeof(*list));
	if (list == NULL)
		return -1;

	list->next = *events;
	*events = list;
	list->event = event;
	return 0;
}

static int event_match(struct event_format *event,
@@ -273,6 +280,7 @@ find_event(struct pevent *pevent, struct event_list **events,
	regex_t ereg;
	regex_t sreg;
	int match = 0;
	int fail = 0;
	char *reg;
	int ret;
	int i;
@@ -307,7 +315,10 @@ find_event(struct pevent *pevent, struct event_list **events,
		event = pevent->events[i];
		if (event_match(event, sys_name ? &sreg : NULL, &ereg)) {
			match = 1;
			add_event(events, event);
			if (add_event(events, event) < 0) {
				fail = 1;
				break;
			}
		}
	}

@@ -317,6 +328,8 @@ find_event(struct pevent *pevent, struct event_list **events,

	if (!match)
		return -1;
	if (fail)
		return -2;

	return 0;
}
@@ -349,8 +362,11 @@ create_arg_item(struct event_format *event, const char *token,
		arg->value.type =
			type == EVENT_DQUOTE ? FILTER_STRING : FILTER_CHAR;
		arg->value.str = strdup(token);
		if (!arg->value.str)
			die("malloc string");
		if (!arg->value.str) {
			free_arg(arg);
			show_error(error_str, "failed to allocate string filter arg");
			return NULL;
		}
		break;
	case EVENT_ITEM:
		/* if it is a number, then convert it */
@@ -1210,7 +1226,13 @@ int pevent_filter_add_filter_str(struct event_filter *filter,
		else
			len = strlen(filter_str);

		this_event = malloc_or_die(len + 1);
		this_event = malloc(len + 1);
		if (this_event == NULL) {
			show_error(error_str, "Memory allocation failure");
			/* This can only happen when events is NULL, but still */
			free_events(events);
			return -1;
		}
		memcpy(this_event, filter_str, len);
		this_event[len] = 0;

@@ -1482,8 +1504,10 @@ int pevent_update_trivial(struct event_filter *dest, struct event_filter *source
 * @type: remove only true, false, or both
 *
 * Removes filters that only contain a TRUE or FALES boolean arg.
 *
 * Returns 0 on success and -1 if there was a problem.
 */
void pevent_filter_clear_trivial(struct event_filter *filter,
int pevent_filter_clear_trivial(struct event_filter *filter,
				 enum filter_trivial_type type)
{
	struct filter_type *filter_type;
@@ -1492,13 +1516,15 @@ void pevent_filter_clear_trivial(struct event_filter *filter,
	int i;

	if (!filter->filters)
		return;
		return 0;

	/*
	 * Two steps, first get all ids with trivial filters.
	 *  then remove those ids.
	 */
	for (i = 0; i < filter->filters; i++) {
		int *new_ids;

		filter_type = &filter->event_filters[i];
		if (filter_type->filter->type != FILTER_ARG_BOOLEAN)
			continue;
@@ -1513,19 +1539,24 @@ void pevent_filter_clear_trivial(struct event_filter *filter,
			break;
		}

		ids = realloc(ids, sizeof(*ids) * (count + 1));
		if (!ids)
			die("Can't allocate ids");
		new_ids = realloc(ids, sizeof(*ids) * (count + 1));
		if (!new_ids) {
			free(ids);
			return -1;
		}

		ids = new_ids;
		ids[count++] = filter_type->event_id;
	}

	if (!count)
		return;
		return 0;

	for (i = 0; i < count; i++)
		pevent_filter_remove_event(filter, ids[i]);

	free(ids);
	return 0;
}

/**
+3 −3
Original line number Diff line number Diff line
@@ -12,9 +12,9 @@ SYNOPSIS

DESCRIPTION
-----------
This command runs runs perf-buildid-list --with-hits, and collects the files
with the buildids found so that analysis of perf.data contents can be possible
on another machine.
This command runs perf-buildid-list --with-hits, and collects the files with the
buildids found so that analysis of perf.data contents can be possible on another
machine.


SEE ALSO
+5 −2
Original line number Diff line number Diff line
@@ -10,9 +10,9 @@ SYNOPSIS
[verse]
'perf kvm' [--host] [--guest] [--guestmount=<path>
	[--guestkallsyms=<path> --guestmodules=<path> | --guestvmlinux=<path>]]
	{top|record|report|diff|buildid-list}
	{top|record|report|diff|buildid-list} [<options>]
'perf kvm' [--host] [--guest] [--guestkallsyms=<path> --guestmodules=<path>
	| --guestvmlinux=<path>] {top|record|report|diff|buildid-list|stat}
	| --guestvmlinux=<path>] {top|record|report|diff|buildid-list|stat} [<options>]
'perf kvm stat [record|report|live] [<options>]

DESCRIPTION
@@ -93,6 +93,9 @@ OPTIONS
	kernel module information. Users copy it out from guest os.
--guestvmlinux=<path>::
	Guest os kernel vmlinux.
-v::
--verbose::
	Be more verbose (show counter open errors, etc).

STAT REPORT OPTIONS
-------------------
Loading