|
@@ -161,6 +161,11 @@ struct sort_entry sort_dso = {
|
|
|
|
|
|
/* --sort symbol */
|
|
/* --sort symbol */
|
|
|
|
|
|
|
|
+static int64_t _sort__addr_cmp(u64 left_ip, u64 right_ip)
|
|
|
|
+{
|
|
|
|
+ return (int64_t)(right_ip - left_ip);
|
|
|
|
+}
|
|
|
|
+
|
|
static int64_t _sort__sym_cmp(struct symbol *sym_l, struct symbol *sym_r)
|
|
static int64_t _sort__sym_cmp(struct symbol *sym_l, struct symbol *sym_r)
|
|
{
|
|
{
|
|
u64 ip_l, ip_r;
|
|
u64 ip_l, ip_r;
|
|
@@ -183,7 +188,7 @@ sort__sym_cmp(struct hist_entry *left, struct hist_entry *right)
|
|
int64_t ret;
|
|
int64_t ret;
|
|
|
|
|
|
if (!left->ms.sym && !right->ms.sym)
|
|
if (!left->ms.sym && !right->ms.sym)
|
|
- return right->level - left->level;
|
|
|
|
|
|
+ return _sort__addr_cmp(left->ip, right->ip);
|
|
|
|
|
|
/*
|
|
/*
|
|
* comparing symbol address alone is not enough since it's a
|
|
* comparing symbol address alone is not enough since it's a
|
|
@@ -372,7 +377,7 @@ sort__sym_from_cmp(struct hist_entry *left, struct hist_entry *right)
|
|
struct addr_map_symbol *from_r = &right->branch_info->from;
|
|
struct addr_map_symbol *from_r = &right->branch_info->from;
|
|
|
|
|
|
if (!from_l->sym && !from_r->sym)
|
|
if (!from_l->sym && !from_r->sym)
|
|
- return right->level - left->level;
|
|
|
|
|
|
+ return _sort__addr_cmp(from_l->addr, from_r->addr);
|
|
|
|
|
|
return _sort__sym_cmp(from_l->sym, from_r->sym);
|
|
return _sort__sym_cmp(from_l->sym, from_r->sym);
|
|
}
|
|
}
|
|
@@ -384,7 +389,7 @@ sort__sym_to_cmp(struct hist_entry *left, struct hist_entry *right)
|
|
struct addr_map_symbol *to_r = &right->branch_info->to;
|
|
struct addr_map_symbol *to_r = &right->branch_info->to;
|
|
|
|
|
|
if (!to_l->sym && !to_r->sym)
|
|
if (!to_l->sym && !to_r->sym)
|
|
- return right->level - left->level;
|
|
|
|
|
|
+ return _sort__addr_cmp(to_l->addr, to_r->addr);
|
|
|
|
|
|
return _sort__sym_cmp(to_l->sym, to_r->sym);
|
|
return _sort__sym_cmp(to_l->sym, to_r->sym);
|
|
}
|
|
}
|