mirror of https://lore.kernel.org/lkml/
 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 08/66] perf sort: Consolidate sort_entry__setup_elide()
Date: Thu, 30 May 2013 19:00:41 +0300	[thread overview]
Message-ID: <1369929699-8724-9-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>

The same code was duplicate to places, factor them out to common
sort__setup_elide().

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-11-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-diff.c   |  4 +---
 tools/perf/builtin-report.c | 20 +-------------------
 tools/perf/builtin-top.c    |  4 +---
 tools/perf/util/sort.c      | 45 +++++++++++++++++++++++++++++++++++++++++++--
 tools/perf/util/sort.h      |  3 +--
 5 files changed, 47 insertions(+), 29 deletions(-)

diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index 2d0462d..cabbea5 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -611,9 +611,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix __maybe_unused)
 
 	setup_pager();
 
-	sort_entry__setup_elide(&sort_dso, symbol_conf.dso_list, "dso", NULL);
-	sort_entry__setup_elide(&sort_comm, symbol_conf.comm_list, "comm", NULL);
-	sort_entry__setup_elide(&sort_sym, symbol_conf.sym_list, "symbol", NULL);
+	sort__setup_elide(NULL);
 
 	return __cmd_diff();
 }
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 669405c..d45bf9b 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -937,25 +937,7 @@ repeat:
 		report.symbol_filter_str = argv[0];
 	}
 
-	sort_entry__setup_elide(&sort_comm, symbol_conf.comm_list, "comm", stdout);
-
-	if (sort__mode == SORT_MODE__BRANCH) {
-		sort_entry__setup_elide(&sort_dso_from, symbol_conf.dso_from_list, "dso_from", stdout);
-		sort_entry__setup_elide(&sort_dso_to, symbol_conf.dso_to_list, "dso_to", stdout);
-		sort_entry__setup_elide(&sort_sym_from, symbol_conf.sym_from_list, "sym_from", stdout);
-		sort_entry__setup_elide(&sort_sym_to, symbol_conf.sym_to_list, "sym_to", stdout);
-	} else {
-		if (report.mem_mode) {
-			sort_entry__setup_elide(&sort_dso, symbol_conf.dso_list, "symbol_daddr", stdout);
-			sort_entry__setup_elide(&sort_dso, symbol_conf.dso_list, "dso_daddr", stdout);
-			sort_entry__setup_elide(&sort_dso, symbol_conf.dso_list, "mem", stdout);
-			sort_entry__setup_elide(&sort_dso, symbol_conf.dso_list, "local_weight", stdout);
-			sort_entry__setup_elide(&sort_dso, symbol_conf.dso_list, "tlb", stdout);
-			sort_entry__setup_elide(&sort_dso, symbol_conf.dso_list, "snoop", stdout);
-		}
-		sort_entry__setup_elide(&sort_dso, symbol_conf.dso_list, "dso", stdout);
-		sort_entry__setup_elide(&sort_sym, symbol_conf.sym_list, "symbol", stdout);
-	}
+	sort__setup_elide(stdout);
 
 	ret = __cmd_report(&report);
 	if (ret == K_SWITCH_INPUT_DATA) {
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 67bdb9f..2eb272d 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -1200,9 +1200,7 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
 	if (symbol__init() < 0)
 		return -1;
 
-	sort_entry__setup_elide(&sort_dso, symbol_conf.dso_list, "dso", stdout);
-	sort_entry__setup_elide(&sort_comm, symbol_conf.comm_list, "comm", stdout);
-	sort_entry__setup_elide(&sort_sym, symbol_conf.sym_list, "symbol", stdout);
+	sort__setup_elide(stdout);
 
 	/*
 	 * Avoid annotation data structures overhead when symbols aren't on the
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 1dbf169..701ab1d 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -1,5 +1,6 @@
 #include "sort.h"
 #include "hist.h"
+#include "symbol.h"
 
 regex_t		parent_regex;
 const char	default_parent_pattern[] = "^sys_|^do_page_fault";
@@ -1009,8 +1010,9 @@ int setup_sorting(void)
 	return ret;
 }
 
-void sort_entry__setup_elide(struct sort_entry *self, struct strlist *list,
-			     const char *list_name, FILE *fp)
+static void sort_entry__setup_elide(struct sort_entry *self,
+				    struct strlist *list,
+				    const char *list_name, FILE *fp)
 {
 	if (list && strlist__nr_entries(list) == 1) {
 		if (fp != NULL)
@@ -1019,3 +1021,42 @@ void sort_entry__setup_elide(struct sort_entry *self, struct strlist *list,
 		self->elide = true;
 	}
 }
+
+void sort__setup_elide(FILE *output)
+{
+	sort_entry__setup_elide(&sort_dso, symbol_conf.dso_list,
+				"dso", output);
+	sort_entry__setup_elide(&sort_comm, symbol_conf.comm_list,
+				"comm", output);
+	sort_entry__setup_elide(&sort_sym, symbol_conf.sym_list,
+				"symbol", output);
+
+	if (sort__mode == SORT_MODE__BRANCH) {
+		sort_entry__setup_elide(&sort_dso_from,
+					symbol_conf.dso_from_list,
+					"dso_from", output);
+		sort_entry__setup_elide(&sort_dso_to,
+					symbol_conf.dso_to_list,
+					"dso_to", output);
+		sort_entry__setup_elide(&sort_sym_from,
+					symbol_conf.sym_from_list,
+					"sym_from", output);
+		sort_entry__setup_elide(&sort_sym_to,
+					symbol_conf.sym_to_list,
+					"sym_to", output);
+	} else if (sort__mode == SORT_MODE__MEMORY) {
+		sort_entry__setup_elide(&sort_dso, symbol_conf.dso_list,
+					"symbol_daddr", output);
+		sort_entry__setup_elide(&sort_dso, symbol_conf.dso_list,
+					"dso_daddr", output);
+		sort_entry__setup_elide(&sort_dso, symbol_conf.dso_list,
+					"mem", output);
+		sort_entry__setup_elide(&sort_dso, symbol_conf.dso_list,
+					"local_weight", output);
+		sort_entry__setup_elide(&sort_dso, symbol_conf.dso_list,
+					"tlb", output);
+		sort_entry__setup_elide(&sort_dso, symbol_conf.dso_list,
+					"snoop", output);
+	}
+
+}
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index 0232d47..51f1b5a 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -181,7 +181,6 @@ extern struct list_head hist_entry__sort_list;
 
 int setup_sorting(void);
 extern int sort_dimension__add(const char *);
-void sort_entry__setup_elide(struct sort_entry *self, struct strlist *list,
-			     const char *list_name, FILE *fp);
+void sort__setup_elide(FILE *fp);
 
 #endif	/* __PERF_SORT_H */
-- 
1.8.1.4


  parent reply	other threads:[~2013-05-30 16:12 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 ` [PATCH 07/66] perf sort: Separate out memory-specific sort keys Arnaldo Carvalho de Melo
2013-05-30 16:00 ` Arnaldo Carvalho de Melo [this message]
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-9-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

all inboxes | Powered by JetHome®