linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@infradead.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: linux-kernel@vger.kernel.org, Namhyung Kim <namhyung.kim@lge.com>,
	Namhyung Kim <namhyung@kernel.org>,
	Andi Kleen <andi@firstfloor.org>, David Ahern <dsahern@gmail.com>,
	Ingo Molnar <mingo@kernel.org>, Jiri Olsa <jolsa@redhat.com>,
	Paul Mackerras <paulus@samba.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Stephane Eranian <eranian@google.com>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 07/66] perf sort: Separate out memory-specific sort keys
Date: Thu, 30 May 2013 19:00:40 +0300	[thread overview]
Message-ID: <1369929699-8724-8-git-send-email-acme@infradead.org> (raw)
In-Reply-To: <1369929699-8724-1-git-send-email-acme@infradead.org>

From: Namhyung Kim <namhyung.kim@lge.com>

Since they're used only for perf mem, separate out them to a different
dimension so that normal user cannot access them by any chance.

For global/local weights, I'm not entirely sure to place them into the
memory dimension.  But it's the only user at this time.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1364991979-3008-3-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-report.c |  2 ++
 tools/perf/util/sort.c      | 39 +++++++++++++++++++++++++++++++--------
 tools/perf/util/sort.h      | 19 +++++++++++--------
 3 files changed, 44 insertions(+), 16 deletions(-)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index c877982..669405c 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -871,6 +871,8 @@ repeat:
 			fprintf(stderr, "branch and mem mode incompatible\n");
 			goto error;
 		}
+		sort__mode = SORT_MODE__MEMORY;
+
 		/*
 		 * if no sort_order is provided, then specify
 		 * branch-mode specific order
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index a997955..1dbf169 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -871,14 +871,6 @@ static struct sort_dimension common_sort_dimensions[] = {
 	DIM(SORT_PARENT, "parent", sort_parent),
 	DIM(SORT_CPU, "cpu", sort_cpu),
 	DIM(SORT_SRCLINE, "srcline", sort_srcline),
-	DIM(SORT_LOCAL_WEIGHT, "local_weight", sort_local_weight),
-	DIM(SORT_GLOBAL_WEIGHT, "weight", sort_global_weight),
-	DIM(SORT_MEM_DADDR_SYMBOL, "symbol_daddr", sort_mem_daddr_sym),
-	DIM(SORT_MEM_DADDR_DSO, "dso_daddr", sort_mem_daddr_dso),
-	DIM(SORT_MEM_LOCKED, "locked", sort_mem_locked),
-	DIM(SORT_MEM_TLB, "tlb", sort_mem_tlb),
-	DIM(SORT_MEM_LVL, "mem", sort_mem_lvl),
-	DIM(SORT_MEM_SNOOP, "snoop", sort_mem_snoop),
 };
 
 #undef DIM
@@ -895,6 +887,21 @@ static struct sort_dimension bstack_sort_dimensions[] = {
 
 #undef DIM
 
+#define DIM(d, n, func) [d - __SORT_MEMORY_MODE] = { .name = n, .entry = &(func) }
+
+static struct sort_dimension memory_sort_dimensions[] = {
+	DIM(SORT_LOCAL_WEIGHT, "local_weight", sort_local_weight),
+	DIM(SORT_GLOBAL_WEIGHT, "weight", sort_global_weight),
+	DIM(SORT_MEM_DADDR_SYMBOL, "symbol_daddr", sort_mem_daddr_sym),
+	DIM(SORT_MEM_DADDR_DSO, "dso_daddr", sort_mem_daddr_dso),
+	DIM(SORT_MEM_LOCKED, "locked", sort_mem_locked),
+	DIM(SORT_MEM_TLB, "tlb", sort_mem_tlb),
+	DIM(SORT_MEM_LVL, "mem", sort_mem_lvl),
+	DIM(SORT_MEM_SNOOP, "snoop", sort_mem_snoop),
+};
+
+#undef DIM
+
 static void __sort_dimension__add(struct sort_dimension *sd, enum sort_type idx)
 {
 	if (sd->taken)
@@ -957,6 +964,22 @@ int sort_dimension__add(const char *tok)
 		return 0;
 	}
 
+	for (i = 0; i < ARRAY_SIZE(memory_sort_dimensions); i++) {
+		struct sort_dimension *sd = &memory_sort_dimensions[i];
+
+		if (strncasecmp(tok, sd->name, strlen(tok)))
+			continue;
+
+		if (sort__mode != SORT_MODE__MEMORY)
+			return -EINVAL;
+
+		if (sd->entry == &sort_mem_daddr_sym)
+			sort__has_sym = 1;
+
+		__sort_dimension__add(sd, i + __SORT_MEMORY_MODE);
+		return 0;
+	}
+
 	return -ESRCH;
 }
 
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index 39ff4b8..0232d47 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -138,14 +138,6 @@ enum sort_type {
 	SORT_PARENT,
 	SORT_CPU,
 	SORT_SRCLINE,
-	SORT_LOCAL_WEIGHT,
-	SORT_GLOBAL_WEIGHT,
-	SORT_MEM_DADDR_SYMBOL,
-	SORT_MEM_DADDR_DSO,
-	SORT_MEM_LOCKED,
-	SORT_MEM_TLB,
-	SORT_MEM_LVL,
-	SORT_MEM_SNOOP,
 
 	/* branch stack specific sort keys */
 	__SORT_BRANCH_STACK,
@@ -154,6 +146,17 @@ enum sort_type {
 	SORT_SYM_FROM,
 	SORT_SYM_TO,
 	SORT_MISPREDICT,
+
+	/* memory mode specific sort keys */
+	__SORT_MEMORY_MODE,
+	SORT_LOCAL_WEIGHT = __SORT_MEMORY_MODE,
+	SORT_GLOBAL_WEIGHT,
+	SORT_MEM_DADDR_SYMBOL,
+	SORT_MEM_DADDR_DSO,
+	SORT_MEM_LOCKED,
+	SORT_MEM_TLB,
+	SORT_MEM_LVL,
+	SORT_MEM_SNOOP,
 };
 
 /*
-- 
1.8.1.4


  parent reply	other threads:[~2013-05-30 16:11 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-30 16:00 [GIT PULL 00/66] perf/core improvements and fixes Arnaldo Carvalho de Melo
2013-05-30 16:00 ` [PATCH 01/66] perf tools: Fix bug in isupper() and islower() Arnaldo Carvalho de Melo
2013-05-30 16:00 ` [PATCH 02/66] perf hists: Fix an invalid memory free on he->branch_info Arnaldo Carvalho de Melo
2013-05-30 16:00 ` [PATCH 03/66] perf hists: Free unused mem info of a matched hist entry Arnaldo Carvalho de Melo
2013-05-30 16:00 ` [PATCH 04/66] perf report: Fix alignment of symbol column when -v is given Arnaldo Carvalho de Melo
2013-05-30 16:00 ` [PATCH 05/66] perf sort: Introduce sort__mode variable Arnaldo Carvalho de Melo
2013-05-30 16:00 ` [PATCH 06/66] perf sort: Factor out common code in sort_dimension__add() Arnaldo Carvalho de Melo
2013-05-30 16:00 ` Arnaldo Carvalho de Melo [this message]
2013-05-30 16:00 ` [PATCH 08/66] perf sort: Consolidate sort_entry__setup_elide() Arnaldo Carvalho de Melo
2013-05-30 16:00 ` [PATCH 09/66] perf archive: Fix typo on Documentation Arnaldo Carvalho de Melo
2013-05-30 16:00 ` [PATCH 10/66] perf sort: Reorder HISTC_SRCLINE index Arnaldo Carvalho de Melo
2013-05-30 16:00 ` [PATCH 11/66] perf sort: Cleanup sort__has_sym setting Arnaldo Carvalho de Melo
2013-05-30 16:00 ` [PATCH 12/66] perf top: Use sort__has_sym Arnaldo Carvalho de Melo
2013-05-30 16:00 ` [PATCH 13/66] perf hists browser: " Arnaldo Carvalho de Melo
2013-05-30 16:00 ` [PATCH 14/66] perf tools: Fix tab vs spaces issue in Makefile ifdef/endif Arnaldo Carvalho de Melo
2013-05-30 16:00 ` [PATCH 15/66] perf tests: Fix compile errors in bp_signal files Arnaldo Carvalho de Melo
2013-05-30 16:00 ` [PATCH 16/66] perf tools: Handle JITed code in shared memory Arnaldo Carvalho de Melo
2013-05-30 16:00 ` [PATCH 17/66] perf record: handle death by SIGTERM Arnaldo Carvalho de Melo
2013-05-30 16:00 ` [PATCH 18/66] perf top: Fix -E option behavior Arnaldo Carvalho de Melo
2013-05-30 16:00 ` [PATCH 19/66] perf top: Fix percent output when no samples collected Arnaldo Carvalho de Melo
2013-05-30 16:00 ` [PATCH 20/66] perf top: Get rid of *_threaded() functions Arnaldo Carvalho de Melo
2013-05-30 16:00 ` [PATCH 21/66] perf hists: Move locking to its call-sites Arnaldo Carvalho de Melo
2013-05-30 16:00 ` [PATCH 22/66] perf report: Don't bother locking when adding hist entries Arnaldo Carvalho de Melo
2013-05-30 16:00 ` [PATCH 23/66] perf report: Add --percent-limit option Arnaldo Carvalho de Melo
2013-05-30 16:00 ` [PATCH 24/66] perf top: " Arnaldo Carvalho de Melo
2013-05-30 16:00 ` [PATCH 25/66] perf report: Add report.percent-limit config variable Arnaldo Carvalho de Melo
2013-05-30 16:00 ` [PATCH 26/66] perf diff: Use internal rb tree for hists__precompute Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 27/66] perf hists: Rename hist_entry__add_pair arguments Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 28/66] perf test: Fix typo Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 29/66] perf evsel: Fix printing of perf_event_paranoid message Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 30/66] perf kvm: Handle realloc failures Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 31/66] perf stats: Fix divide by 0 in variance Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 32/66] perf tools: Save parent pid in thread struct Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 33/66] perf tools: Add automated make test suite Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 34/66] perf tools: Move arch check into config/Makefile Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 35/66] perf tools: Move programs " Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 36/66] perf tools: Move compiler and linker flags " Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 37/66] perf tools: Move libelf check config " Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 38/66] perf tools: Move libdw " Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 39/66] perf tools: Move libunwind " Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 40/66] perf tools: Move libaudit " Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 41/66] perf tools: Move slang " Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 42/66] perf tools: Move gtk2 " Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 43/66] perf tools: Move libperl " Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 44/66] perf tools: Move libpython " Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 45/66] perf tools: Move libbfd " Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 46/66] perf tools: Move stdlib " Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 47/66] perf tools: Move libnuma " Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 48/66] perf tools: Move paths " Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 49/66] perf tools: Final touches for CHK config move Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 50/66] perf tests: Fix attr test for record -d option Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 51/66] perf tests: Fix exclude_guest|exclude_host checking for attr tests Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 52/66] perf tools: Remove frozen from perf_header struct Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 53/66] perf tools: Remove cwdlen from struct perf_session Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 54/66] tools lib lk: Respect CROSS_COMPILE Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 55/66] perf: Power7: Make CPI stack events available in sysfs Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 56/66] perf: Power7 Update testing ABI to list CPI-stack events Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 57/66] perf: Expand definition of sysfs format attribute Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 58/66] perf evlist: Reset SIGTERM handler in workload child process Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 59/66] perf tools: Merge all *CFLAGS* make variable into CFLAGS Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 60/66] perf tools: Merge all *LDFLAGS* make variable into LDFLAGS Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 61/66] perf tools: Switch to full path C include directories Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 62/66] perf tools: Add NO_BIONIC variable to confiure bionic setup Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 63/66] perf tools: Replace tabs with spaces for all non-commands statements Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 64/66] perf tools: Replace multiple line assignment with multiple statements Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 65/66] perf tools: Remove '?=' Makefile STRIP assignment Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 66/66] perf tools: Add missing liblk.a dependency for python/perf.so Arnaldo Carvalho de Melo
2013-05-31 11:04 ` [GIT PULL 00/66] perf/core improvements and fixes Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1369929699-8724-8-git-send-email-acme@infradead.org \
    --to=acme@infradead.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=andi@firstfloor.org \
    --cc=dsahern@gmail.com \
    --cc=eranian@google.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@kernel.org \
    --cc=namhyung.kim@lge.com \
    --cc=namhyung@kernel.org \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).