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

Commit cc8b88b1 authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo Committed by Ingo Molnar
Browse files

perf report: Add --comms parameter



So that we can filter by comm. Symbols in other comms won't be
accounted for.

Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1246399282-20934-3-git-send-email-acme@redhat.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 25903407
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -24,6 +24,10 @@ OPTIONS
--dsos=::
--dsos=::
	Only consider symbols in these dsos. CSV that understands
	Only consider symbols in these dsos. CSV that understands
	file://filename entries.
	file://filename entries.
-C::
--comms=::
	Only consider symbols in these comms. CSV that understands
	file://filename entries.


SEE ALSO
SEE ALSO
--------
--------
+23 −10
Original line number Original line Diff line number Diff line
@@ -33,8 +33,8 @@ static char *vmlinux = NULL;


static char		default_sort_order[] = "comm,dso";
static char		default_sort_order[] = "comm,dso";
static char		*sort_order = default_sort_order;
static char		*sort_order = default_sort_order;
static char		*dso_list_str;
static char		*dso_list_str, *comm_list_str;
static struct strlist	*dso_list;
static struct strlist	*dso_list, *comm_list;


static int		input;
static int		input;
static int		show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV;
static int		show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV;
@@ -1253,6 +1253,9 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head)
		return -1;
		return -1;
	}
	}


	if (comm_list && !strlist__has_entry(comm_list, thread->comm))
		return 0;

	if (event->header.misc & PERF_EVENT_MISC_KERNEL) {
	if (event->header.misc & PERF_EVENT_MISC_KERNEL) {
		show = SHOW_KERNEL;
		show = SHOW_KERNEL;
		level = 'k';
		level = 'k';
@@ -1667,6 +1670,8 @@ static const struct option options[] = {
	OPT_BOOLEAN('c', "callchain", &callchain, "Display callchains"),
	OPT_BOOLEAN('c', "callchain", &callchain, "Display callchains"),
	OPT_STRING('d', "dsos", &dso_list_str, "dso[,dso...]",
	OPT_STRING('d', "dsos", &dso_list_str, "dso[,dso...]",
		   "only consider symbols in these dsos"),
		   "only consider symbols in these dsos"),
	OPT_STRING('C', "comms", &comm_list_str, "comm[,comm...]",
		   "only consider symbols in these comms"),
	OPT_END()
	OPT_END()
};
};


@@ -1685,6 +1690,19 @@ static void setup_sorting(void)
	free(str);
	free(str);
}
}


static void setup_list(struct strlist **list, const char *list_str,
		       const char *list_name)
{
	if (list_str) {
		*list = strlist__new(true, list_str);
		if (!*list) {
			fprintf(stderr, "problems parsing %s list\n",
				list_name);
			exit(129);
		}
	}
}

int cmd_report(int argc, const char **argv, const char *prefix)
int cmd_report(int argc, const char **argv, const char *prefix)
{
{
	symbol__init();
	symbol__init();
@@ -1706,13 +1724,8 @@ int cmd_report(int argc, const char **argv, const char *prefix)
	if (argc)
	if (argc)
		usage_with_options(report_usage, options);
		usage_with_options(report_usage, options);


	if (dso_list_str) {
	setup_list(&dso_list, dso_list_str, "dso");
		dso_list = strlist__new(true, dso_list_str);
	setup_list(&comm_list, comm_list_str, "comm");
		if (!dso_list) {
			fprintf(stderr, "problems parsing dso list\n");
			exit(129);
		}
	}


	setup_pager();
	setup_pager();