aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2014-07-31 01:47:35 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2014-08-12 11:03:04 -0400
commit8246de88e95ddef7508f5601d7af85c3ab9e476b (patch)
treef19f6201f27a1bab0239d62183e8339316999666 /tools/perf/util
parent56c7d79e49776084b852e451bda5f59dc3bcf894 (diff)
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>
Diffstat (limited to 'tools/perf/util')
-rw-r--r--tools/perf/util/sort.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 14e5a039bc45..eda9ee836cee 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,
70 size_t size, unsigned int width) 70 size_t size, unsigned int width)
71{ 71{
72 const char *comm = thread__comm_str(he->thread); 72 const char *comm = thread__comm_str(he->thread);
73 return repsep_snprintf(bf, size, "%*s:%5d", width - 6, 73 return repsep_snprintf(bf, size, "%5d:%-*s", he->thread->tid,
74 comm ?: "", he->thread->tid); 74 width - 6, comm ?: "");
75} 75}
76 76
77struct sort_entry sort_thread = { 77struct sort_entry sort_thread = {
78 .se_header = "Command: Pid", 78 .se_header = " Pid:Command",
79 .se_cmp = sort__thread_cmp, 79 .se_cmp = sort__thread_cmp,
80 .se_snprintf = hist_entry__thread_snprintf, 80 .se_snprintf = hist_entry__thread_snprintf,
81 .se_width_idx = HISTC_THREAD, 81 .se_width_idx = HISTC_THREAD,
@@ -106,7 +106,7 @@ sort__comm_sort(struct hist_entry *left, struct hist_entry *right)
106static int hist_entry__comm_snprintf(struct hist_entry *he, char *bf, 106static int hist_entry__comm_snprintf(struct hist_entry *he, char *bf,
107 size_t size, unsigned int width) 107 size_t size, unsigned int width)
108{ 108{
109 return repsep_snprintf(bf, size, "%*s", width, comm__str(he->comm)); 109 return repsep_snprintf(bf, size, "%-*s", width, comm__str(he->comm));
110} 110}
111 111
112struct sort_entry sort_comm = { 112struct sort_entry sort_comm = {
@@ -305,7 +305,7 @@ static int hist_entry__srcline_snprintf(struct hist_entry *he, char *bf,
305 size_t size, 305 size_t size,
306 unsigned int width __maybe_unused) 306 unsigned int width __maybe_unused)
307{ 307{
308 return repsep_snprintf(bf, size, "%s", he->srcline); 308 return repsep_snprintf(bf, size, "%-s", he->srcline);
309} 309}
310 310
311struct sort_entry sort_srcline = { 311struct sort_entry sort_srcline = {