linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Namhyung Kim <namhyung.kim@lge.com>
Subject: [PATCH 3/5] perf hists: Use perf_hpp__format->width to calculate the column widths
Date: Mon,  3 Sep 2012 11:53:08 +0900	[thread overview]
Message-ID: <1346640790-17197-4-git-send-email-namhyung@kernel.org> (raw)
In-Reply-To: <1346640790-17197-1-git-send-email-namhyung@kernel.org>

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

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/ui/hist.c   | 27 +++++++++++++++++++++++++++
 tools/perf/util/hist.c | 33 ---------------------------------
 2 files changed, 27 insertions(+), 33 deletions(-)

diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index 802a8659c15a..16dc486d02be 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -337,3 +337,30 @@ int hist_entry__sort_snprintf(struct hist_entry *he, char *s, size_t size,
 
 	return ret;
 }
+
+/*
+ * See hists__fprintf to match the column widths
+ */
+unsigned int hists__sort_list_width(struct hists *hists)
+{
+	struct sort_entry *se;
+	int i, ret = 0;
+
+	for (i = 0; i < PERF_HPP__MAX_INDEX; i++) {
+		if (!perf_hpp__format[i].cond)
+			continue;
+		if (i)
+			ret += 2;
+
+		ret += perf_hpp__format[i].width(NULL);
+	}
+
+	list_for_each_entry(se, &hist_entry__sort_list, list)
+		if (!se->elide)
+			ret += 2 + hists__col_len(hists, se->se_width_idx);
+
+	if (verbose) /* Addr + origin */
+		ret += 3 + BITS_PER_LONG / 4;
+
+	return ret;
+}
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index b1817f15bb87..0ba65ad07cd1 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -563,39 +563,6 @@ void hists__output_resort_threaded(struct hists *hists)
 	return __hists__output_resort(hists, true);
 }
 
-/*
- * See hists__fprintf to match the column widths
- */
-unsigned int hists__sort_list_width(struct hists *hists)
-{
-	struct sort_entry *se;
-	int ret = 9; /* total % */
-
-	if (symbol_conf.show_cpu_utilization) {
-		ret += 7; /* count_sys % */
-		ret += 6; /* count_us % */
-		if (perf_guest) {
-			ret += 13; /* count_guest_sys % */
-			ret += 12; /* count_guest_us % */
-		}
-	}
-
-	if (symbol_conf.show_nr_samples)
-		ret += 11;
-
-	if (symbol_conf.show_total_period)
-		ret += 13;
-
-	list_for_each_entry(se, &hist_entry__sort_list, list)
-		if (!se->elide)
-			ret += 2 + hists__col_len(hists, se->se_width_idx);
-
-	if (verbose) /* Addr + origin */
-		ret += 3 + BITS_PER_LONG / 4;
-
-	return ret;
-}
-
 static void hists__remove_entry_filter(struct hists *hists, struct hist_entry *h,
 				       enum hist_filter filter)
 {
-- 
1.7.11.4


  parent reply	other threads:[~2012-09-03  3:00 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-03  2:53 [PATCHSET RESEND 0/5] perf tools: Cleanup hist printing code (v4) Namhyung Kim
2012-09-03  2:53 ` [PATCH 1/5] perf hists: Introduce perf_hpp for hist period printing Namhyung Kim
2012-09-09  8:54   ` [tip:perf/core] " tip-bot for Namhyung Kim
2012-09-12 17:26     ` Robert Richter
2012-09-12 18:48       ` Arnaldo Carvalho de Melo
2012-09-13  2:43         ` Namhyung Kim
2012-09-13  3:51           ` Arnaldo Carvalho de Melo
2012-09-13  4:14           ` [PATCH] perf record: Add missing perf_hpp__init for pipe-mode Namhyung Kim
2012-09-13  4:21             ` Namhyung Kim
2012-09-13  9:48             ` Robert Richter
2012-09-19 15:25             ` [tip:perf/core] perf report: " tip-bot for Namhyung Kim
2012-09-03  2:53 ` [PATCH 2/5] perf hists: Handle field separator properly Namhyung Kim
2012-09-09  8:55   ` [tip:perf/core] " tip-bot for Namhyung Kim
2012-09-03  2:53 ` Namhyung Kim [this message]
2012-09-09  8:56   ` [tip:perf/core] perf hists: Use perf_hpp__format-> width to calculate the column widths tip-bot for Namhyung Kim
2012-09-03  2:53 ` [PATCH 4/5] perf ui/browser: Use perf_hpp__format functions Namhyung Kim
2012-09-08  0:32   ` Arnaldo Carvalho de Melo
2012-09-08 14:05     ` Namhyung Kim
2012-09-12  6:25       ` Namhyung Kim
2012-09-09  8:57   ` [tip:perf/core] perf hists browser: " tip-bot for Namhyung Kim
2012-09-03  2:53 ` [PATCH 5/5] perf gtk/browser: " Namhyung Kim
2012-09-09  8:58   ` [tip:perf/core] " tip-bot for Namhyung Kim
2012-09-08  0:48 ` [PATCHSET RESEND 0/5] perf tools: Cleanup hist printing code (v4) Arnaldo Carvalho de Melo
2012-09-08 14:00   ` Namhyung Kim
2012-09-08 15:08     ` Arnaldo Carvalho de Melo
  -- strict thread matches above, loose matches on Subject: below --
2012-08-22  5:48 [PATCH " Namhyung Kim
2012-08-22  5:48 ` [PATCH 3/5] perf hists: Use perf_hpp__format->width to calculate the column widths Namhyung Kim

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=1346640790-17197-4-git-send-email-namhyung@kernel.org \
    --to=namhyung@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@ghostprotocols.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung.kim@lge.com \
    --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).