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

Commit fd8ea212 authored by Frederic Weisbecker's avatar Frederic Weisbecker
Browse files

perf tools: Allow sort dimensions to be registered more than once



So that the parent sort dimension can be registered twice: once
if we add it as an explicit sort dimension (-s parent) and twice
if we request a parent filter (-p foo).

We'll have only one parent sort dimension in the end but this
allows to override the default parent filter with we gave in "-p"
option. The goal of this is to prepare to allow the use of
"-s parent" and "-p foo" at the same time, ie: sort by filtered
parent.

Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Stephane Eranian <eranian@google.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Sam Liao <phyomh@gmail.com>
parent e84d2122
Loading
Loading
Loading
Loading
+6 −6
Original line number Original line Diff line number Diff line
@@ -260,15 +260,9 @@ int sort_dimension__add(const char *tok)
	for (i = 0; i < ARRAY_SIZE(sort_dimensions); i++) {
	for (i = 0; i < ARRAY_SIZE(sort_dimensions); i++) {
		struct sort_dimension *sd = &sort_dimensions[i];
		struct sort_dimension *sd = &sort_dimensions[i];


		if (sd->taken)
			continue;

		if (strncasecmp(tok, sd->name, strlen(tok)))
		if (strncasecmp(tok, sd->name, strlen(tok)))
			continue;
			continue;


		if (sd->entry->se_collapse)
			sort__need_collapse = 1;

		if (sd->entry == &sort_parent) {
		if (sd->entry == &sort_parent) {
			int ret = regcomp(&parent_regex, parent_pattern, REG_EXTENDED);
			int ret = regcomp(&parent_regex, parent_pattern, REG_EXTENDED);
			if (ret) {
			if (ret) {
@@ -281,6 +275,12 @@ int sort_dimension__add(const char *tok)
			sort__has_parent = 1;
			sort__has_parent = 1;
		}
		}


		if (sd->taken)
			return 0;

		if (sd->entry->se_collapse)
			sort__need_collapse = 1;

		if (list_empty(&hist_entry__sort_list)) {
		if (list_empty(&hist_entry__sort_list)) {
			if (!strcmp(sd->name, "pid"))
			if (!strcmp(sd->name, "pid"))
				sort__first_dimension = SORT_PID;
				sort__first_dimension = SORT_PID;