From: tip-bot for Namhyung Kim <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: acme@redhat.com, linux-kernel@vger.kernel.org, paulus@samba.org,
hpa@zytor.com, mingo@kernel.org, a.p.zijlstra@chello.nl,
namhyung.kim@lge.com, namhyung@kernel.org, jolsa@redhat.com,
tglx@linutronix.de
Subject: [tip:perf/core] perf tools: Left-align output contents
Date: Tue, 12 Aug 2014 22:17:59 -0700 [thread overview]
Message-ID: <tip-8246de88e95ddef7508f5601d7af85c3ab9e476b@git.kernel.org> (raw)
In-Reply-To: <1406785662-5534-2-git-send-email-namhyung@kernel.org>
Commit-ID: 8246de88e95ddef7508f5601d7af85c3ab9e476b
Gitweb: http://git.kernel.org/tip/8246de88e95ddef7508f5601d7af85c3ab9e476b
Author: Namhyung Kim <namhyung@kernel.org>
AuthorDate: Thu, 31 Jul 2014 14:47:35 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 12 Aug 2014 12:03:04 -0300
perf tools: Left-align output contents
Now perf left-aligns column headers but the contents does not. It
should have same alignment. This requires a change in pid sort key - it
consists of two part (pid and comm). As length of comm can be vary it'd
be better to change the order of them.
Thanks to Jiri Olsa for pointing this out.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1406785662-5534-2-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/sort.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 14e5a03..eda9ee8 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -70,12 +70,12 @@ static int hist_entry__thread_snprintf(struct hist_entry *he, char *bf,
size_t size, unsigned int width)
{
const char *comm = thread__comm_str(he->thread);
- return repsep_snprintf(bf, size, "%*s:%5d", width - 6,
- comm ?: "", he->thread->tid);
+ return repsep_snprintf(bf, size, "%5d:%-*s", he->thread->tid,
+ width - 6, comm ?: "");
}
struct sort_entry sort_thread = {
- .se_header = "Command: Pid",
+ .se_header = " Pid:Command",
.se_cmp = sort__thread_cmp,
.se_snprintf = hist_entry__thread_snprintf,
.se_width_idx = HISTC_THREAD,
@@ -106,7 +106,7 @@ sort__comm_sort(struct hist_entry *left, struct hist_entry *right)
static int hist_entry__comm_snprintf(struct hist_entry *he, char *bf,
size_t size, unsigned int width)
{
- return repsep_snprintf(bf, size, "%*s", width, comm__str(he->comm));
+ return repsep_snprintf(bf, size, "%-*s", width, comm__str(he->comm));
}
struct sort_entry sort_comm = {
@@ -305,7 +305,7 @@ static int hist_entry__srcline_snprintf(struct hist_entry *he, char *bf,
size_t size,
unsigned int width __maybe_unused)
{
- return repsep_snprintf(bf, size, "%s", he->srcline);
+ return repsep_snprintf(bf, size, "%-s", he->srcline);
}
struct sort_entry sort_srcline = {
next prev parent reply other threads:[~2014-08-13 5:18 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-31 5:47 [PATCHSET 0/8] perf tools: Honor column width setting (v3) Namhyung Kim
2014-07-31 5:47 ` [PATCH 1/8] perf tools: Left-align output contents Namhyung Kim
2014-08-13 5:17 ` tip-bot for Namhyung Kim [this message]
2014-07-31 5:47 ` [PATCH 2/8] perf tools: Make __hpp__fmt() receive an additional len argument Namhyung Kim
2014-08-02 13:30 ` Arnaldo Carvalho de Melo
2014-08-11 8:05 ` Namhyung Kim
2014-08-11 13:17 ` Arnaldo Carvalho de Melo
2014-08-12 7:13 ` Namhyung Kim
2014-08-13 5:18 ` [tip:perf/core] " tip-bot for Namhyung Kim
2014-07-31 5:47 ` [PATCH 3/8] perf tools: Save column length in perf_hpp_fmt Namhyung Kim
2014-08-13 5:18 ` [tip:perf/core] " tip-bot for Namhyung Kim
2014-07-31 5:47 ` [PATCH 4/8] perf report: Honor column width setting Namhyung Kim
2014-08-13 5:18 ` [tip:perf/core] " tip-bot for Namhyung Kim
2014-07-31 5:47 ` [PATCH 5/8] perf top: Add -w option for setting column width Namhyung Kim
2014-08-13 5:18 ` [tip:perf/core] " tip-bot for Namhyung Kim
2014-07-31 5:47 ` [PATCH 6/8] perf tools: Add name field into perf_hpp_fmt Namhyung Kim
2014-08-13 5:19 ` [tip:perf/core] " tip-bot for Namhyung Kim
2014-07-31 5:47 ` [PATCH 7/8] perf tools: Fix column alignment when headers aren't shown on TUI Namhyung Kim
2014-08-13 5:19 ` [tip:perf/core] " tip-bot for Namhyung Kim
2014-07-31 5:47 ` [PATCH 8/8] perf symbol: Don't demangle parameters and such by default Namhyung Kim
2014-08-02 13:35 ` Arnaldo Carvalho de Melo
2014-08-11 8:17 ` Namhyung Kim
2014-08-11 13:32 ` Arnaldo Carvalho de Melo
2014-08-12 7:17 ` Namhyung Kim
2014-08-14 8:49 ` [tip:perf/core] perf symbols: Don' t " tip-bot for 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=tip-8246de88e95ddef7508f5601d7af85c3ab9e476b@git.kernel.org \
--to=tipbot@zytor.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=hpa@zytor.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung.kim@lge.com \
--cc=namhyung@kernel.org \
--cc=paulus@samba.org \
--cc=tglx@linutronix.de \
/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
Powered by JetHome