diff options
Diffstat (limited to 'Documentation/perf_counter')
-rw-r--r-- | Documentation/perf_counter/builtin-report.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c index 982abce0e7c1..a634022bae07 100644 --- a/Documentation/perf_counter/builtin-report.c +++ b/Documentation/perf_counter/builtin-report.c | |||
@@ -732,6 +732,35 @@ static struct sort_entry sort_thread = { | |||
732 | }; | 732 | }; |
733 | 733 | ||
734 | static int64_t | 734 | static int64_t |
735 | sort__comm_cmp(struct hist_entry *left, struct hist_entry *right) | ||
736 | { | ||
737 | char *comm_l = left->thread->comm; | ||
738 | char *comm_r = right->thread->comm; | ||
739 | |||
740 | if (!comm_l || !comm_r) { | ||
741 | if (!comm_l && !comm_r) | ||
742 | return 0; | ||
743 | else if (!comm_l) | ||
744 | return -1; | ||
745 | else | ||
746 | return 1; | ||
747 | } | ||
748 | |||
749 | return strcmp(comm_l, comm_r); | ||
750 | } | ||
751 | |||
752 | static size_t | ||
753 | sort__comm_print(FILE *fp, struct hist_entry *self) | ||
754 | { | ||
755 | return fprintf(fp, "%20s ", self->thread->comm ?: "<unknown>"); | ||
756 | } | ||
757 | |||
758 | static struct sort_entry sort_comm = { | ||
759 | .cmp = sort__comm_cmp, | ||
760 | .print = sort__comm_print, | ||
761 | }; | ||
762 | |||
763 | static int64_t | ||
735 | sort__sym_cmp(struct hist_entry *left, struct hist_entry *right) | 764 | sort__sym_cmp(struct hist_entry *left, struct hist_entry *right) |
736 | { | 765 | { |
737 | uint64_t ip_l, ip_r; | 766 | uint64_t ip_l, ip_r; |
@@ -779,6 +808,7 @@ struct sort_dimension { | |||
779 | 808 | ||
780 | static struct sort_dimension sort_dimensions[] = { | 809 | static struct sort_dimension sort_dimensions[] = { |
781 | { .name = "pid", .entry = &sort_thread, }, | 810 | { .name = "pid", .entry = &sort_thread, }, |
811 | { .name = "comm", .entry = &sort_comm, }, | ||
782 | { .name = "symbol", .entry = &sort_sym, }, | 812 | { .name = "symbol", .entry = &sort_sym, }, |
783 | }; | 813 | }; |
784 | 814 | ||