diff options
| author | Don Zickus <dzickus@redhat.com> | 2015-10-05 14:06:07 -0400 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-10-05 15:32:00 -0400 |
| commit | 28e6db205b3ed3f1d86a00c69b3304190377da5f (patch) | |
| tree | 1982c76d4bedd78a5eb54de4ac4a1ec1f1b8692d /tools/perf | |
| parent | ddd83c9717ef8204f17cc63d6dcb5053d472caee (diff) | |
perf tools: Add support for sorting on the iaddr
Sorting on 'symbol' gives to broad a resolution as it can cover a range
of IP address. Use the iaddr instead to get proper sorting on IP
addresses. Need to use the 'mem_sort' feature of perf record.
New sort option is: symbol_iaddr, header label is 'Code Symbol'.
$ perf mem report --stdio -F +symbol_iaddr
# Overhead Samples Code Symbol Local Weight
# ........ ............ ........................ ............
#
54.08% 1 [k] nmi_handle 192
4.51% 1 [k] finish_task_switch 16
3.66% 1 [.] malloc 13
3.10% 1 [.] __strcoll_l 11
Signed-off-by: Don Zickus <dzickus@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1444068369-20978-8-git-send-email-jolsa@kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
| -rw-r--r-- | tools/perf/util/hist.h | 1 | ||||
| -rw-r--r-- | tools/perf/util/sort.c | 37 | ||||
| -rw-r--r-- | tools/perf/util/sort.h | 1 |
3 files changed, 39 insertions, 0 deletions
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h index 8c20a8f6b214..a48a2078d288 100644 --- a/tools/perf/util/hist.h +++ b/tools/perf/util/hist.h | |||
| @@ -49,6 +49,7 @@ enum hist_column { | |||
| 49 | HISTC_MEM_LVL, | 49 | HISTC_MEM_LVL, |
| 50 | HISTC_MEM_SNOOP, | 50 | HISTC_MEM_SNOOP, |
| 51 | HISTC_MEM_DCACHELINE, | 51 | HISTC_MEM_DCACHELINE, |
| 52 | HISTC_MEM_IADDR_SYMBOL, | ||
| 52 | HISTC_TRANSACTION, | 53 | HISTC_TRANSACTION, |
| 53 | HISTC_CYCLES, | 54 | HISTC_CYCLES, |
| 54 | HISTC_NR_COLS, /* Last entry */ | 55 | HISTC_NR_COLS, /* Last entry */ |
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c index 6b9556d298c9..ee94b728fca4 100644 --- a/tools/perf/util/sort.c +++ b/tools/perf/util/sort.c | |||
| @@ -655,6 +655,35 @@ static int hist_entry__daddr_snprintf(struct hist_entry *he, char *bf, | |||
| 655 | } | 655 | } |
| 656 | 656 | ||
| 657 | static int64_t | 657 | static int64_t |
| 658 | sort__iaddr_cmp(struct hist_entry *left, struct hist_entry *right) | ||
| 659 | { | ||
| 660 | uint64_t l = 0, r = 0; | ||
| 661 | |||
| 662 | if (left->mem_info) | ||
| 663 | l = left->mem_info->iaddr.addr; | ||
| 664 | if (right->mem_info) | ||
| 665 | r = right->mem_info->iaddr.addr; | ||
| 666 | |||
| 667 | return (int64_t)(r - l); | ||
| 668 | } | ||
| 669 | |||
| 670 | static int hist_entry__iaddr_snprintf(struct hist_entry *he, char *bf, | ||
| 671 | size_t size, unsigned int width) | ||
| 672 | { | ||
| 673 | uint64_t addr = 0; | ||
| 674 | struct map *map = NULL; | ||
| 675 | struct symbol *sym = NULL; | ||
| 676 | |||
| 677 | if (he->mem_info) { | ||
| 678 | addr = he->mem_info->iaddr.addr; | ||
| 679 | map = he->mem_info->iaddr.map; | ||
| 680 | sym = he->mem_info->iaddr.sym; | ||
| 681 | } | ||
| 682 | return _hist_entry__sym_snprintf(map, sym, addr, he->level, bf, size, | ||
| 683 | width); | ||
| 684 | } | ||
| 685 | |||
| 686 | static int64_t | ||
| 658 | sort__dso_daddr_cmp(struct hist_entry *left, struct hist_entry *right) | 687 | sort__dso_daddr_cmp(struct hist_entry *left, struct hist_entry *right) |
| 659 | { | 688 | { |
| 660 | struct map *map_l = NULL; | 689 | struct map *map_l = NULL; |
| @@ -1077,6 +1106,13 @@ struct sort_entry sort_mem_daddr_sym = { | |||
| 1077 | .se_width_idx = HISTC_MEM_DADDR_SYMBOL, | 1106 | .se_width_idx = HISTC_MEM_DADDR_SYMBOL, |
| 1078 | }; | 1107 | }; |
| 1079 | 1108 | ||
| 1109 | struct sort_entry sort_mem_iaddr_sym = { | ||
| 1110 | .se_header = "Code Symbol", | ||
| 1111 | .se_cmp = sort__iaddr_cmp, | ||
| 1112 | .se_snprintf = hist_entry__iaddr_snprintf, | ||
| 1113 | .se_width_idx = HISTC_MEM_IADDR_SYMBOL, | ||
| 1114 | }; | ||
| 1115 | |||
| 1080 | struct sort_entry sort_mem_daddr_dso = { | 1116 | struct sort_entry sort_mem_daddr_dso = { |
| 1081 | .se_header = "Data Object", | 1117 | .se_header = "Data Object", |
| 1082 | .se_cmp = sort__dso_daddr_cmp, | 1118 | .se_cmp = sort__dso_daddr_cmp, |
| @@ -1299,6 +1335,7 @@ static struct sort_dimension bstack_sort_dimensions[] = { | |||
| 1299 | 1335 | ||
| 1300 | static struct sort_dimension memory_sort_dimensions[] = { | 1336 | static struct sort_dimension memory_sort_dimensions[] = { |
| 1301 | DIM(SORT_MEM_DADDR_SYMBOL, "symbol_daddr", sort_mem_daddr_sym), | 1337 | DIM(SORT_MEM_DADDR_SYMBOL, "symbol_daddr", sort_mem_daddr_sym), |
| 1338 | DIM(SORT_MEM_IADDR_SYMBOL, "symbol_iaddr", sort_mem_iaddr_sym), | ||
| 1302 | DIM(SORT_MEM_DADDR_DSO, "dso_daddr", sort_mem_daddr_dso), | 1339 | DIM(SORT_MEM_DADDR_DSO, "dso_daddr", sort_mem_daddr_dso), |
| 1303 | DIM(SORT_MEM_LOCKED, "locked", sort_mem_locked), | 1340 | DIM(SORT_MEM_LOCKED, "locked", sort_mem_locked), |
| 1304 | DIM(SORT_MEM_TLB, "tlb", sort_mem_tlb), | 1341 | DIM(SORT_MEM_TLB, "tlb", sort_mem_tlb), |
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h index c06b75746613..33b3d30e18d3 100644 --- a/tools/perf/util/sort.h +++ b/tools/perf/util/sort.h | |||
| @@ -201,6 +201,7 @@ enum sort_type { | |||
| 201 | SORT_MEM_LVL, | 201 | SORT_MEM_LVL, |
| 202 | SORT_MEM_SNOOP, | 202 | SORT_MEM_SNOOP, |
| 203 | SORT_MEM_DCACHELINE, | 203 | SORT_MEM_DCACHELINE, |
| 204 | SORT_MEM_IADDR_SYMBOL, | ||
| 204 | }; | 205 | }; |
| 205 | 206 | ||
| 206 | /* | 207 | /* |
