diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2009-06-04 09:16:56 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-06-04 09:04:41 -0400 |
commit | 71dd8945d8d827ab101cd287f9480ef22fc7c1b6 (patch) | |
tree | 625347b5c15845770edc4ba9409b973b4f646c76 | |
parent | 05ca061eb9704ad9b0739f88046276792b75f2c1 (diff) |
perf report: Add consistent spacing rules
Make the sort header and the print function have the same column width.
Signed-off-by: Peter 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: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | Documentation/perf_counter/builtin-report.c | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c index be392e0f77c6..e930b4e02335 100644 --- a/Documentation/perf_counter/builtin-report.c +++ b/Documentation/perf_counter/builtin-report.c | |||
@@ -344,11 +344,11 @@ sort__thread_cmp(struct hist_entry *left, struct hist_entry *right) | |||
344 | static size_t | 344 | static size_t |
345 | sort__thread_print(FILE *fp, struct hist_entry *self) | 345 | sort__thread_print(FILE *fp, struct hist_entry *self) |
346 | { | 346 | { |
347 | return fprintf(fp, " %16s:%5d", self->thread->comm ?: "", self->thread->pid); | 347 | return fprintf(fp, "%16s:%5d", self->thread->comm ?: "", self->thread->pid); |
348 | } | 348 | } |
349 | 349 | ||
350 | static struct sort_entry sort_thread = { | 350 | static struct sort_entry sort_thread = { |
351 | .header = " Command: Pid ", | 351 | .header = " Command: Pid", |
352 | .cmp = sort__thread_cmp, | 352 | .cmp = sort__thread_cmp, |
353 | .print = sort__thread_print, | 353 | .print = sort__thread_print, |
354 | }; | 354 | }; |
@@ -382,11 +382,11 @@ sort__comm_collapse(struct hist_entry *left, struct hist_entry *right) | |||
382 | static size_t | 382 | static size_t |
383 | sort__comm_print(FILE *fp, struct hist_entry *self) | 383 | sort__comm_print(FILE *fp, struct hist_entry *self) |
384 | { | 384 | { |
385 | return fprintf(fp, " %16s", self->thread->comm); | 385 | return fprintf(fp, "%16s", self->thread->comm); |
386 | } | 386 | } |
387 | 387 | ||
388 | static struct sort_entry sort_comm = { | 388 | static struct sort_entry sort_comm = { |
389 | .header = " Command", | 389 | .header = " Command", |
390 | .cmp = sort__comm_cmp, | 390 | .cmp = sort__comm_cmp, |
391 | .collapse = sort__comm_collapse, | 391 | .collapse = sort__comm_collapse, |
392 | .print = sort__comm_print, | 392 | .print = sort__comm_print, |
@@ -416,13 +416,13 @@ static size_t | |||
416 | sort__dso_print(FILE *fp, struct hist_entry *self) | 416 | sort__dso_print(FILE *fp, struct hist_entry *self) |
417 | { | 417 | { |
418 | if (self->dso) | 418 | if (self->dso) |
419 | return fprintf(fp, " %-25s", self->dso->name); | 419 | return fprintf(fp, "%-25s", self->dso->name); |
420 | 420 | ||
421 | return fprintf(fp, " %016llx ", (__u64)self->ip); | 421 | return fprintf(fp, "%016llx ", (__u64)self->ip); |
422 | } | 422 | } |
423 | 423 | ||
424 | static struct sort_entry sort_dso = { | 424 | static struct sort_entry sort_dso = { |
425 | .header = " Shared Object ", | 425 | .header = "Shared Object ", |
426 | .cmp = sort__dso_cmp, | 426 | .cmp = sort__dso_cmp, |
427 | .print = sort__dso_print, | 427 | .print = sort__dso_print, |
428 | }; | 428 | }; |
@@ -449,18 +449,18 @@ sort__sym_print(FILE *fp, struct hist_entry *self) | |||
449 | size_t ret = 0; | 449 | size_t ret = 0; |
450 | 450 | ||
451 | if (verbose) | 451 | if (verbose) |
452 | ret += fprintf(fp, " %#018llx", (__u64)self->ip); | 452 | ret += fprintf(fp, "%#018llx ", (__u64)self->ip); |
453 | 453 | ||
454 | if (self->sym) | 454 | if (self->sym) |
455 | ret += fprintf(fp, " %s", self->sym->name); | 455 | ret += fprintf(fp, "%s", self->sym->name); |
456 | else | 456 | else |
457 | ret += fprintf(fp, " %#016llx", (__u64)self->ip); | 457 | ret += fprintf(fp, "%#016llx", (__u64)self->ip); |
458 | 458 | ||
459 | return ret; | 459 | return ret; |
460 | } | 460 | } |
461 | 461 | ||
462 | static struct sort_entry sort_sym = { | 462 | static struct sort_entry sort_sym = { |
463 | .header = " Symbol", | 463 | .header = "Symbol", |
464 | .cmp = sort__sym_cmp, | 464 | .cmp = sort__sym_cmp, |
465 | .print = sort__sym_print, | 465 | .print = sort__sym_print, |
466 | }; | 466 | }; |
@@ -553,8 +553,10 @@ hist_entry__fprintf(FILE *fp, struct hist_entry *self, uint64_t total_samples) | |||
553 | } else | 553 | } else |
554 | ret = fprintf(fp, "%12d ", self->count); | 554 | ret = fprintf(fp, "%12d ", self->count); |
555 | 555 | ||
556 | list_for_each_entry(se, &hist_entry__sort_list, list) | 556 | list_for_each_entry(se, &hist_entry__sort_list, list) { |
557 | fprintf(fp, " "); | ||
557 | ret += se->print(fp, self); | 558 | ret += se->print(fp, self); |
559 | } | ||
558 | 560 | ||
559 | ret += fprintf(fp, "\n"); | 561 | ret += fprintf(fp, "\n"); |
560 | 562 | ||
@@ -721,13 +723,14 @@ static size_t output__fprintf(FILE *fp, uint64_t total_samples) | |||
721 | struct rb_node *nd; | 723 | struct rb_node *nd; |
722 | size_t ret = 0; | 724 | size_t ret = 0; |
723 | 725 | ||
726 | fprintf(fp, "\n"); | ||
724 | fprintf(fp, "#\n"); | 727 | fprintf(fp, "#\n"); |
725 | fprintf(fp, "# (%Ld profiler events)\n", (__u64)total_samples); | 728 | fprintf(fp, "# (%Ld profiler events)\n", (__u64)total_samples); |
726 | fprintf(fp, "#\n"); | 729 | fprintf(fp, "#\n"); |
727 | 730 | ||
728 | fprintf(fp, "# Overhead"); | 731 | fprintf(fp, "# Overhead"); |
729 | list_for_each_entry(se, &hist_entry__sort_list, list) | 732 | list_for_each_entry(se, &hist_entry__sort_list, list) |
730 | fprintf(fp, " %s", se->header); | 733 | fprintf(fp, " %s", se->header); |
731 | fprintf(fp, "\n"); | 734 | fprintf(fp, "\n"); |
732 | 735 | ||
733 | fprintf(fp, "# ........"); | 736 | fprintf(fp, "# ........"); |
@@ -735,7 +738,7 @@ static size_t output__fprintf(FILE *fp, uint64_t total_samples) | |||
735 | int i; | 738 | int i; |
736 | 739 | ||
737 | fprintf(fp, " "); | 740 | fprintf(fp, " "); |
738 | for (i = 0; i < strlen(se->header)-1; i++) | 741 | for (i = 0; i < strlen(se->header); i++) |
739 | fprintf(fp, "."); | 742 | fprintf(fp, "."); |
740 | } | 743 | } |
741 | fprintf(fp, "\n"); | 744 | fprintf(fp, "\n"); |
@@ -749,9 +752,10 @@ static size_t output__fprintf(FILE *fp, uint64_t total_samples) | |||
749 | 752 | ||
750 | if (!strcmp(sort_order, default_sort_order)) { | 753 | if (!strcmp(sort_order, default_sort_order)) { |
751 | fprintf(fp, "#\n"); | 754 | fprintf(fp, "#\n"); |
752 | fprintf(fp, "# ( For more details, try: perf report --sort comm,dso,symbol )\n"); | 755 | fprintf(fp, "# (For more details, try: perf report --sort comm,dso,symbol)\n"); |
753 | fprintf(fp, "#\n"); | 756 | fprintf(fp, "#\n"); |
754 | } | 757 | } |
758 | fprintf(fp, "\n"); | ||
755 | 759 | ||
756 | return ret; | 760 | return ret; |
757 | } | 761 | } |