aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/sort.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/sort.c')
-rw-r--r--tools/perf/util/sort.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 313a5a730112..5f118a089519 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -7,6 +7,8 @@ const char default_parent_pattern[] = "^sys_|^do_page_fault";
7const char *parent_pattern = default_parent_pattern; 7const char *parent_pattern = default_parent_pattern;
8const char default_sort_order[] = "comm,dso,symbol"; 8const char default_sort_order[] = "comm,dso,symbol";
9const char *sort_order = default_sort_order; 9const char *sort_order = default_sort_order;
10regex_t ignore_callees_regex;
11int have_ignore_callees = 0;
10int sort__need_collapse = 0; 12int sort__need_collapse = 0;
11int sort__has_parent = 0; 13int sort__has_parent = 0;
12int sort__has_sym = 0; 14int sort__has_sym = 0;
@@ -55,14 +57,14 @@ static int64_t cmp_null(void *l, void *r)
55static int64_t 57static int64_t
56sort__thread_cmp(struct hist_entry *left, struct hist_entry *right) 58sort__thread_cmp(struct hist_entry *left, struct hist_entry *right)
57{ 59{
58 return right->thread->pid - left->thread->pid; 60 return right->thread->tid - left->thread->tid;
59} 61}
60 62
61static int hist_entry__thread_snprintf(struct hist_entry *self, char *bf, 63static int hist_entry__thread_snprintf(struct hist_entry *self, char *bf,
62 size_t size, unsigned int width) 64 size_t size, unsigned int width)
63{ 65{
64 return repsep_snprintf(bf, size, "%*s:%5d", width - 6, 66 return repsep_snprintf(bf, size, "%*s:%5d", width - 6,
65 self->thread->comm ?: "", self->thread->pid); 67 self->thread->comm ?: "", self->thread->tid);
66} 68}
67 69
68struct sort_entry sort_thread = { 70struct sort_entry sort_thread = {
@@ -77,7 +79,7 @@ struct sort_entry sort_thread = {
77static int64_t 79static int64_t
78sort__comm_cmp(struct hist_entry *left, struct hist_entry *right) 80sort__comm_cmp(struct hist_entry *left, struct hist_entry *right)
79{ 81{
80 return right->thread->pid - left->thread->pid; 82 return right->thread->tid - left->thread->tid;
81} 83}
82 84
83static int64_t 85static int64_t
@@ -872,6 +874,8 @@ static struct sort_dimension common_sort_dimensions[] = {
872 DIM(SORT_PARENT, "parent", sort_parent), 874 DIM(SORT_PARENT, "parent", sort_parent),
873 DIM(SORT_CPU, "cpu", sort_cpu), 875 DIM(SORT_CPU, "cpu", sort_cpu),
874 DIM(SORT_SRCLINE, "srcline", sort_srcline), 876 DIM(SORT_SRCLINE, "srcline", sort_srcline),
877 DIM(SORT_LOCAL_WEIGHT, "local_weight", sort_local_weight),
878 DIM(SORT_GLOBAL_WEIGHT, "weight", sort_global_weight),
875}; 879};
876 880
877#undef DIM 881#undef DIM
@@ -891,8 +895,6 @@ static struct sort_dimension bstack_sort_dimensions[] = {
891#define DIM(d, n, func) [d - __SORT_MEMORY_MODE] = { .name = n, .entry = &(func) } 895#define DIM(d, n, func) [d - __SORT_MEMORY_MODE] = { .name = n, .entry = &(func) }
892 896
893static struct sort_dimension memory_sort_dimensions[] = { 897static struct sort_dimension memory_sort_dimensions[] = {
894 DIM(SORT_LOCAL_WEIGHT, "local_weight", sort_local_weight),
895 DIM(SORT_GLOBAL_WEIGHT, "weight", sort_global_weight),
896 DIM(SORT_MEM_DADDR_SYMBOL, "symbol_daddr", sort_mem_daddr_sym), 898 DIM(SORT_MEM_DADDR_SYMBOL, "symbol_daddr", sort_mem_daddr_sym),
897 DIM(SORT_MEM_DADDR_DSO, "dso_daddr", sort_mem_daddr_dso), 899 DIM(SORT_MEM_DADDR_DSO, "dso_daddr", sort_mem_daddr_dso),
898 DIM(SORT_MEM_LOCKED, "locked", sort_mem_locked), 900 DIM(SORT_MEM_LOCKED, "locked", sort_mem_locked),