aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/perf_counter/builtin-report.c40
1 files changed, 30 insertions, 10 deletions
diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index 30e12c7f7108..6df95c2698c6 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -708,6 +708,7 @@ struct sort_entry {
708 struct list_head list; 708 struct list_head list;
709 709
710 int64_t (*cmp)(struct hist_entry *, struct hist_entry *); 710 int64_t (*cmp)(struct hist_entry *, struct hist_entry *);
711 size_t (*print_header)(FILE *fp);
711 size_t (*print)(FILE *fp, struct hist_entry *); 712 size_t (*print)(FILE *fp, struct hist_entry *);
712}; 713};
713 714
@@ -722,7 +723,7 @@ sort__thread_print(FILE *fp, struct hist_entry *self)
722{ 723{
723 char bf[32]; 724 char bf[32];
724 725
725 return fprintf(fp, "%14s ", 726 return fprintf(fp, " %16s",
726 thread__name(self->thread, bf, sizeof(bf))); 727 thread__name(self->thread, bf, sizeof(bf)));
727} 728}
728 729
@@ -752,7 +753,7 @@ sort__comm_cmp(struct hist_entry *left, struct hist_entry *right)
752static size_t 753static size_t
753sort__comm_print(FILE *fp, struct hist_entry *self) 754sort__comm_print(FILE *fp, struct hist_entry *self)
754{ 755{
755 return fprintf(fp, "%20s ", self->thread->comm ?: "<unknown>"); 756 return fprintf(fp, " %16s", self->thread->comm ?: "<unknown>");
756} 757}
757 758
758static struct sort_entry sort_comm = { 759static struct sort_entry sort_comm = {
@@ -781,7 +782,7 @@ sort__dso_cmp(struct hist_entry *left, struct hist_entry *right)
781static size_t 782static size_t
782sort__dso_print(FILE *fp, struct hist_entry *self) 783sort__dso_print(FILE *fp, struct hist_entry *self)
783{ 784{
784 return fprintf(fp, "%64s ", self->dso ? self->dso->name : "<unknown>"); 785 return fprintf(fp, " %64s", self->dso ? self->dso->name : "<unknown>");
785} 786}
786 787
787static struct sort_entry sort_dso = { 788static struct sort_entry sort_dso = {
@@ -803,21 +804,33 @@ sort__sym_cmp(struct hist_entry *left, struct hist_entry *right)
803 return (int64_t)(ip_r - ip_l); 804 return (int64_t)(ip_r - ip_l);
804} 805}
805 806
807static size_t sort__sym_print_header(FILE *fp)
808{
809 size_t ret = 0;
810
811 ret += fprintf(fp, "#\n");
812 ret += fprintf(fp, "# Overhead Command File: Symbol\n");
813 ret += fprintf(fp, "# ........ ....... ............\n");
814 ret += fprintf(fp, "#\n");
815
816 return ret;
817}
818
806static size_t 819static size_t
807sort__sym_print(FILE *fp, struct hist_entry *self) 820sort__sym_print(FILE *fp, struct hist_entry *self)
808{ 821{
809 size_t ret = 0; 822 size_t ret = 0;
810 823
811 ret += fprintf(fp, "[%c] ", self->level); 824 ret += fprintf(fp, " [%c] ", self->level);
812 825
813 if (verbose) 826 if (verbose)
814 ret += fprintf(fp, "%#018llx ", (unsigned long long)self->ip); 827 ret += fprintf(fp, " %#018llx", (unsigned long long)self->ip);
815 828
816 if (self->level != '.') 829 if (self->level != '.')
817 ret += fprintf(fp, "%s ", 830 ret += fprintf(fp, " kernel: %s",
818 self->sym ? self->sym->name : "<unknown>"); 831 self->sym ? self->sym->name : "<unknown>");
819 else 832 else
820 ret += fprintf(fp, "%s: %s ", 833 ret += fprintf(fp, " %s: %s",
821 self->dso ? self->dso->name : "<unknown>", 834 self->dso ? self->dso->name : "<unknown>",
822 self->sym ? self->sym->name : "<unknown>"); 835 self->sym ? self->sym->name : "<unknown>");
823 836
@@ -825,8 +838,9 @@ sort__sym_print(FILE *fp, struct hist_entry *self)
825} 838}
826 839
827static struct sort_entry sort_sym = { 840static struct sort_entry sort_sym = {
828 .cmp = sort__sym_cmp, 841 .cmp = sort__sym_cmp,
829 .print = sort__sym_print, 842 .print_header = sort__sym_print_header,
843 .print = sort__sym_print,
830}; 844};
831 845
832struct sort_dimension { 846struct sort_dimension {
@@ -898,7 +912,7 @@ hist_entry__fprintf(FILE *fp, struct hist_entry *self, uint64_t total_samples)
898 size_t ret; 912 size_t ret;
899 913
900 if (total_samples) { 914 if (total_samples) {
901 ret = fprintf(fp, "%5.2f%% ", 915 ret = fprintf(fp, " %5.2f%%",
902 (self->count * 100.0) / total_samples); 916 (self->count * 100.0) / total_samples);
903 } else 917 } else
904 ret = fprintf(fp, "%12d ", self->count); 918 ret = fprintf(fp, "%12d ", self->count);
@@ -1003,9 +1017,15 @@ static void output__resort(void)
1003static size_t output__fprintf(FILE *fp, uint64_t total_samples) 1017static size_t output__fprintf(FILE *fp, uint64_t total_samples)
1004{ 1018{
1005 struct hist_entry *pos; 1019 struct hist_entry *pos;
1020 struct sort_entry *se;
1006 struct rb_node *nd; 1021 struct rb_node *nd;
1007 size_t ret = 0; 1022 size_t ret = 0;
1008 1023
1024 list_for_each_entry(se, &hist_entry__sort_list, list) {
1025 if (se->print_header)
1026 ret += se->print_header(fp);
1027 }
1028
1009 for (nd = rb_first(&output_hists); nd; nd = rb_next(nd)) { 1029 for (nd = rb_first(&output_hists); nd; nd = rb_next(nd)) {
1010 pos = rb_entry(nd, struct hist_entry, rb_node); 1030 pos = rb_entry(nd, struct hist_entry, rb_node);
1011 ret += hist_entry__fprintf(fp, pos, total_samples); 1031 ret += hist_entry__fprintf(fp, pos, total_samples);