Commit 71dd8945 authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Ingo Molnar

perf report: Add consistent spacing rules

Make the sort header and the print function have the same column width.
Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <new-submission>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 05ca061e
...@@ -344,11 +344,11 @@ sort__thread_cmp(struct hist_entry *left, struct hist_entry *right) ...@@ -344,11 +344,11 @@ sort__thread_cmp(struct hist_entry *left, struct hist_entry *right)
static size_t static size_t
sort__thread_print(FILE *fp, struct hist_entry *self) sort__thread_print(FILE *fp, struct hist_entry *self)
{ {
return fprintf(fp, " %16s:%5d", self->thread->comm ?: "", self->thread->pid); return fprintf(fp, "%16s:%5d", self->thread->comm ?: "", self->thread->pid);
} }
static struct sort_entry sort_thread = { static struct sort_entry sort_thread = {
.header = " Command: Pid ", .header = " Command: Pid",
.cmp = sort__thread_cmp, .cmp = sort__thread_cmp,
.print = sort__thread_print, .print = sort__thread_print,
}; };
...@@ -382,7 +382,7 @@ sort__comm_collapse(struct hist_entry *left, struct hist_entry *right) ...@@ -382,7 +382,7 @@ sort__comm_collapse(struct hist_entry *left, struct hist_entry *right)
static size_t static size_t
sort__comm_print(FILE *fp, struct hist_entry *self) sort__comm_print(FILE *fp, struct hist_entry *self)
{ {
return fprintf(fp, " %16s", self->thread->comm); return fprintf(fp, "%16s", self->thread->comm);
} }
static struct sort_entry sort_comm = { static struct sort_entry sort_comm = {
...@@ -416,13 +416,13 @@ static size_t ...@@ -416,13 +416,13 @@ static size_t
sort__dso_print(FILE *fp, struct hist_entry *self) sort__dso_print(FILE *fp, struct hist_entry *self)
{ {
if (self->dso) if (self->dso)
return fprintf(fp, " %-25s", self->dso->name); return fprintf(fp, "%-25s", self->dso->name);
return fprintf(fp, " %016llx ", (__u64)self->ip); return fprintf(fp, "%016llx ", (__u64)self->ip);
} }
static struct sort_entry sort_dso = { static struct sort_entry sort_dso = {
.header = " Shared Object ", .header = "Shared Object ",
.cmp = sort__dso_cmp, .cmp = sort__dso_cmp,
.print = sort__dso_print, .print = sort__dso_print,
}; };
...@@ -449,18 +449,18 @@ sort__sym_print(FILE *fp, struct hist_entry *self) ...@@ -449,18 +449,18 @@ sort__sym_print(FILE *fp, struct hist_entry *self)
size_t ret = 0; size_t ret = 0;
if (verbose) if (verbose)
ret += fprintf(fp, " %#018llx", (__u64)self->ip); ret += fprintf(fp, "%#018llx ", (__u64)self->ip);
if (self->sym) if (self->sym)
ret += fprintf(fp, " %s", self->sym->name); ret += fprintf(fp, "%s", self->sym->name);
else else
ret += fprintf(fp, " %#016llx", (__u64)self->ip); ret += fprintf(fp, "%#016llx", (__u64)self->ip);
return ret; return ret;
} }
static struct sort_entry sort_sym = { static struct sort_entry sort_sym = {
.header = " Symbol", .header = "Symbol",
.cmp = sort__sym_cmp, .cmp = sort__sym_cmp,
.print = sort__sym_print, .print = sort__sym_print,
}; };
...@@ -553,8 +553,10 @@ hist_entry__fprintf(FILE *fp, struct hist_entry *self, uint64_t total_samples) ...@@ -553,8 +553,10 @@ hist_entry__fprintf(FILE *fp, struct hist_entry *self, uint64_t total_samples)
} else } else
ret = fprintf(fp, "%12d ", self->count); ret = fprintf(fp, "%12d ", self->count);
list_for_each_entry(se, &hist_entry__sort_list, list) list_for_each_entry(se, &hist_entry__sort_list, list) {
fprintf(fp, " ");
ret += se->print(fp, self); ret += se->print(fp, self);
}
ret += fprintf(fp, "\n"); ret += fprintf(fp, "\n");
...@@ -721,6 +723,7 @@ static size_t output__fprintf(FILE *fp, uint64_t total_samples) ...@@ -721,6 +723,7 @@ static size_t output__fprintf(FILE *fp, uint64_t total_samples)
struct rb_node *nd; struct rb_node *nd;
size_t ret = 0; size_t ret = 0;
fprintf(fp, "\n");
fprintf(fp, "#\n"); fprintf(fp, "#\n");
fprintf(fp, "# (%Ld profiler events)\n", (__u64)total_samples); fprintf(fp, "# (%Ld profiler events)\n", (__u64)total_samples);
fprintf(fp, "#\n"); fprintf(fp, "#\n");
...@@ -735,7 +738,7 @@ static size_t output__fprintf(FILE *fp, uint64_t total_samples) ...@@ -735,7 +738,7 @@ static size_t output__fprintf(FILE *fp, uint64_t total_samples)
int i; int i;
fprintf(fp, " "); fprintf(fp, " ");
for (i = 0; i < strlen(se->header)-1; i++) for (i = 0; i < strlen(se->header); i++)
fprintf(fp, "."); fprintf(fp, ".");
} }
fprintf(fp, "\n"); fprintf(fp, "\n");
...@@ -749,9 +752,10 @@ static size_t output__fprintf(FILE *fp, uint64_t total_samples) ...@@ -749,9 +752,10 @@ static size_t output__fprintf(FILE *fp, uint64_t total_samples)
if (!strcmp(sort_order, default_sort_order)) { if (!strcmp(sort_order, default_sort_order)) {
fprintf(fp, "#\n"); fprintf(fp, "#\n");
fprintf(fp, "# ( For more details, try: perf report --sort comm,dso,symbol )\n"); fprintf(fp, "# (For more details, try: perf report --sort comm,dso,symbol)\n");
fprintf(fp, "#\n"); fprintf(fp, "#\n");
} }
fprintf(fp, "\n");
return ret; return ret;
} }
......
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