aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/perf_counter
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/perf_counter')
-rw-r--r--Documentation/perf_counter/builtin-report.c30
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
734static int64_t 734static int64_t
735sort__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
752static size_t
753sort__comm_print(FILE *fp, struct hist_entry *self)
754{
755 return fprintf(fp, "%20s ", self->thread->comm ?: "<unknown>");
756}
757
758static struct sort_entry sort_comm = {
759 .cmp = sort__comm_cmp,
760 .print = sort__comm_print,
761};
762
763static int64_t
735sort__sym_cmp(struct hist_entry *left, struct hist_entry *right) 764sort__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
780static struct sort_dimension sort_dimensions[] = { 809static 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