diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-06-02 09:34:25 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-06-02 10:39:25 -0400 |
commit | 4593bba8679b925a056f84edac061676e7eda71c (patch) | |
tree | 54526e1beb9e242f197bfcc7793455a1edc1ff7c /Documentation/perf_counter/builtin-report.c | |
parent | 97124d5e2df5b9eaa5bb684bb1e8ebc7e29d0f5d (diff) |
perf report: Clean up the default output
- extra space between columns
- left-aligned the symbol column
- moved the no-symbols printout to -v
Acked-by: 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>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'Documentation/perf_counter/builtin-report.c')
-rw-r--r-- | Documentation/perf_counter/builtin-report.c | 55 |
1 files changed, 28 insertions, 27 deletions
diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c index 0558c1e1aa5b..19c1e056bb66 100644 --- a/Documentation/perf_counter/builtin-report.c +++ b/Documentation/perf_counter/builtin-report.c | |||
@@ -84,24 +84,25 @@ static struct dso *dsos__findnew(const char *name) | |||
84 | struct dso *dso = dsos__find(name); | 84 | struct dso *dso = dsos__find(name); |
85 | int nr; | 85 | int nr; |
86 | 86 | ||
87 | if (dso == NULL) { | 87 | if (dso) |
88 | dso = dso__new(name, 0); | 88 | return dso; |
89 | if (!dso) | 89 | |
90 | goto out_delete_dso; | 90 | dso = dso__new(name, 0); |
91 | 91 | if (!dso) | |
92 | nr = dso__load(dso, NULL); | 92 | goto out_delete_dso; |
93 | if (nr < 0) { | ||
94 | fprintf(stderr, "Failed to open: %s\n", name); | ||
95 | goto out_delete_dso; | ||
96 | } | ||
97 | if (!nr) { | ||
98 | fprintf(stderr, | ||
99 | "Failed to find debug symbols for: %s, maybe install a debug package?\n", | ||
100 | name); | ||
101 | } | ||
102 | 93 | ||
103 | dsos__add(dso); | 94 | nr = dso__load(dso, NULL); |
95 | if (nr < 0) { | ||
96 | fprintf(stderr, "Failed to open: %s\n", name); | ||
97 | goto out_delete_dso; | ||
104 | } | 98 | } |
99 | if (!nr && verbose) { | ||
100 | fprintf(stderr, | ||
101 | "No symbols found in: %s, maybe install a debug package?\n", | ||
102 | name); | ||
103 | } | ||
104 | |||
105 | dsos__add(dso); | ||
105 | 106 | ||
106 | return dso; | 107 | return dso; |
107 | 108 | ||
@@ -302,11 +303,11 @@ sort__thread_cmp(struct hist_entry *left, struct hist_entry *right) | |||
302 | static size_t | 303 | static size_t |
303 | sort__thread_print(FILE *fp, struct hist_entry *self) | 304 | sort__thread_print(FILE *fp, struct hist_entry *self) |
304 | { | 305 | { |
305 | return fprintf(fp, " %16s:%5d", self->thread->comm ?: "", self->thread->pid); | 306 | return fprintf(fp, " %16s:%5d", self->thread->comm ?: "", self->thread->pid); |
306 | } | 307 | } |
307 | 308 | ||
308 | static struct sort_entry sort_thread = { | 309 | static struct sort_entry sort_thread = { |
309 | .header = " Command: Pid ", | 310 | .header = " Command: Pid ", |
310 | .cmp = sort__thread_cmp, | 311 | .cmp = sort__thread_cmp, |
311 | .print = sort__thread_print, | 312 | .print = sort__thread_print, |
312 | }; | 313 | }; |
@@ -332,11 +333,11 @@ sort__comm_cmp(struct hist_entry *left, struct hist_entry *right) | |||
332 | static size_t | 333 | static size_t |
333 | sort__comm_print(FILE *fp, struct hist_entry *self) | 334 | sort__comm_print(FILE *fp, struct hist_entry *self) |
334 | { | 335 | { |
335 | return fprintf(fp, " %16s", self->thread->comm ?: "<unknown>"); | 336 | return fprintf(fp, " %16s", self->thread->comm ?: "<unknown>"); |
336 | } | 337 | } |
337 | 338 | ||
338 | static struct sort_entry sort_comm = { | 339 | static struct sort_entry sort_comm = { |
339 | .header = " Command", | 340 | .header = " Command", |
340 | .cmp = sort__comm_cmp, | 341 | .cmp = sort__comm_cmp, |
341 | .print = sort__comm_print, | 342 | .print = sort__comm_print, |
342 | }; | 343 | }; |
@@ -362,11 +363,11 @@ sort__dso_cmp(struct hist_entry *left, struct hist_entry *right) | |||
362 | static size_t | 363 | static size_t |
363 | sort__dso_print(FILE *fp, struct hist_entry *self) | 364 | sort__dso_print(FILE *fp, struct hist_entry *self) |
364 | { | 365 | { |
365 | return fprintf(fp, " %64s", self->dso ? self->dso->name : "<unknown>"); | 366 | return fprintf(fp, " %s", self->dso ? self->dso->name : "<unknown>"); |
366 | } | 367 | } |
367 | 368 | ||
368 | static struct sort_entry sort_dso = { | 369 | static struct sort_entry sort_dso = { |
369 | .header = " Shared Object", | 370 | .header = " Shared Object", |
370 | .cmp = sort__dso_cmp, | 371 | .cmp = sort__dso_cmp, |
371 | .print = sort__dso_print, | 372 | .print = sort__dso_print, |
372 | }; | 373 | }; |
@@ -391,9 +392,9 @@ sort__sym_print(FILE *fp, struct hist_entry *self) | |||
391 | size_t ret = 0; | 392 | size_t ret = 0; |
392 | 393 | ||
393 | if (verbose) | 394 | if (verbose) |
394 | ret += fprintf(fp, " %#018llx", (unsigned long long)self->ip); | 395 | ret += fprintf(fp, " %#018llx", (unsigned long long)self->ip); |
395 | 396 | ||
396 | ret += fprintf(fp, " %s: %s", | 397 | ret += fprintf(fp, " %s: %s", |
397 | self->dso ? self->dso->name : "<unknown>", | 398 | self->dso ? self->dso->name : "<unknown>", |
398 | self->sym ? self->sym->name : "<unknown>"); | 399 | self->sym ? self->sym->name : "<unknown>"); |
399 | 400 | ||
@@ -401,7 +402,7 @@ sort__sym_print(FILE *fp, struct hist_entry *self) | |||
401 | } | 402 | } |
402 | 403 | ||
403 | static struct sort_entry sort_sym = { | 404 | static struct sort_entry sort_sym = { |
404 | .header = "Shared Object: Symbol", | 405 | .header = " Shared Object: Symbol", |
405 | .cmp = sort__sym_cmp, | 406 | .cmp = sort__sym_cmp, |
406 | .print = sort__sym_print, | 407 | .print = sort__sym_print, |
407 | }; | 408 | }; |
@@ -595,8 +596,8 @@ static size_t output__fprintf(FILE *fp, uint64_t total_samples) | |||
595 | list_for_each_entry(se, &hist_entry__sort_list, list) { | 596 | list_for_each_entry(se, &hist_entry__sort_list, list) { |
596 | int i; | 597 | int i; |
597 | 598 | ||
598 | fprintf(fp, " "); | 599 | fprintf(fp, " "); |
599 | for (i = 0; i < strlen(se->header); i++) | 600 | for (i = 0; i < strlen(se->header)-1; i++) |
600 | fprintf(fp, "."); | 601 | fprintf(fp, "."); |
601 | } | 602 | } |
602 | fprintf(fp, "\n"); | 603 | fprintf(fp, "\n"); |