Commit 8246de88 authored by Namhyung Kim's avatar Namhyung Kim Committed by Arnaldo Carvalho de Melo

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: default avatarNamhyung 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.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 56c7d79e
...@@ -70,12 +70,12 @@ static int hist_entry__thread_snprintf(struct hist_entry *he, char *bf, ...@@ -70,12 +70,12 @@ static int hist_entry__thread_snprintf(struct hist_entry *he, char *bf,
size_t size, unsigned int width) size_t size, unsigned int width)
{ {
const char *comm = thread__comm_str(he->thread); const char *comm = thread__comm_str(he->thread);
return repsep_snprintf(bf, size, "%*s:%5d", width - 6, return repsep_snprintf(bf, size, "%5d:%-*s", he->thread->tid,
comm ?: "", he->thread->tid); width - 6, comm ?: "");
} }
struct sort_entry sort_thread = { struct sort_entry sort_thread = {
.se_header = "Command: Pid", .se_header = " Pid:Command",
.se_cmp = sort__thread_cmp, .se_cmp = sort__thread_cmp,
.se_snprintf = hist_entry__thread_snprintf, .se_snprintf = hist_entry__thread_snprintf,
.se_width_idx = HISTC_THREAD, .se_width_idx = HISTC_THREAD,
...@@ -106,7 +106,7 @@ sort__comm_sort(struct hist_entry *left, struct hist_entry *right) ...@@ -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, static int hist_entry__comm_snprintf(struct hist_entry *he, char *bf,
size_t size, unsigned int width) 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 = { struct sort_entry sort_comm = {
...@@ -305,7 +305,7 @@ static int hist_entry__srcline_snprintf(struct hist_entry *he, char *bf, ...@@ -305,7 +305,7 @@ static int hist_entry__srcline_snprintf(struct hist_entry *he, char *bf,
size_t size, size_t size,
unsigned int width __maybe_unused) 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 = { struct sort_entry sort_srcline = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment