All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <andi@firstfloor.org>
To: acme@kernel.org
Cc: jolsa@kernel.org, linux-kernel@vger.kernel.org,
	Andi Kleen <ak@linux.intel.com>
Subject: [PATCH 2/2] perf report: Fix --ns time sort key output
Date: Fri, 23 Aug 2019 14:03:38 -0700	[thread overview]
Message-ID: <20190823210338.12360-2-andi@firstfloor.org> (raw)
In-Reply-To: <20190823210338.12360-1-andi@firstfloor.org>

From: Andi Kleen <ak@linux.intel.com>

If the user specified --ns, the column to print the sort time stamp
wasn't wide enough to actually print the full nanoseconds.

Widen the time key column width when --ns is specified.

Before:

% perf record -a sleep 1
% perf report --sort time,overhead,symbol --stdio --ns
...
     2.39%  187851.10000  [k] smp_call_function_single                                                                                -      -
     1.53%  187851.10000  [k] intel_idle                                                                                              -      -
     0.59%  187851.10000  [.] __wcscmp_ifunc                                                                                          -      -
     0.33%  187851.10000  [.] 0000000000000000                                                                                        -      -
     0.28%  187851.10000  [k] cpuidle_enter_state                                                                                     -      -

After:

% perf report --sort time,overhead,symbol --stdio --ns
...
     2.39%  187851.100000000  [k] smp_call_function_single                                                                                -      -
     1.53%  187851.100000000  [k] intel_idle                                                                                              -      -
     0.59%  187851.100000000  [.] __wcscmp_ifunc                                                                                          -      -
     0.33%  187851.100000000  [.] 0000000000000000                                                                                        -      -
     0.28%  187851.100000000  [k] cpuidle_enter_state                                                                                     -      -

Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
 tools/perf/util/hist.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 8efbf58dc3d0..33702675073c 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -193,7 +193,10 @@ void hists__calc_col_len(struct hists *hists, struct hist_entry *h)
 	hists__new_col_len(hists, HISTC_MEM_LVL, 21 + 3);
 	hists__new_col_len(hists, HISTC_LOCAL_WEIGHT, 12);
 	hists__new_col_len(hists, HISTC_GLOBAL_WEIGHT, 12);
-	hists__new_col_len(hists, HISTC_TIME, 12);
+	if (symbol_conf.nanosecs)
+		hists__new_col_len(hists, HISTC_TIME, 16);
+	else
+		hists__new_col_len(hists, HISTC_TIME, 12);
 
 	if (h->srcline) {
 		len = MAX(strlen(h->srcline), strlen(sort_srcline.se_header));
-- 
2.20.1


  reply	other threads:[~2019-08-23 21:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-23 21:03 [PATCH 1/2] perf report: Use timestamp__scnprintf_nsec for time sort key Andi Kleen
2019-08-23 21:03 ` Andi Kleen [this message]
2019-08-27  8:26   ` [tip: perf/core] perf report: Fix --ns time sort key output tip-bot2 for Andi Kleen
2019-08-25 14:31 ` [PATCH 1/2] perf report: Use timestamp__scnprintf_nsec for time sort key Arnaldo Carvalho de Melo
2019-08-27  8:26 ` [tip: perf/core] perf report: Use timestamp__scnprintf_nsec() " tip-bot2 for Andi Kleen

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=20190823210338.12360-2-andi@firstfloor.org \
    --to=andi@firstfloor.org \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.