Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1239970
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 07/16] perf tools: Add support for sorting on the iaddr |
| Date | 2015-10-05 23:10 +0200 |
| Message-ID | <qglbd-2cb-49@gated-at.bofh.it> (permalink) |
| References | <qglbb-2cb-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Don Zickus <dzickus@redhat.com>
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>
---
tools/perf/util/hist.h | 1 +
tools/perf/util/sort.c | 37 +++++++++++++++++++++++++++++++++++++
tools/perf/util/sort.h | 1 +
3 files changed, 39 insertions(+)
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 {
HISTC_MEM_LVL,
HISTC_MEM_SNOOP,
HISTC_MEM_DCACHELINE,
+ HISTC_MEM_IADDR_SYMBOL,
HISTC_TRANSACTION,
HISTC_CYCLES,
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,
}
static int64_t
+sort__iaddr_cmp(struct hist_entry *left, struct hist_entry *right)
+{
+ uint64_t l = 0, r = 0;
+
+ if (left->mem_info)
+ l = left->mem_info->iaddr.addr;
+ if (right->mem_info)
+ r = right->mem_info->iaddr.addr;
+
+ return (int64_t)(r - l);
+}
+
+static int hist_entry__iaddr_snprintf(struct hist_entry *he, char *bf,
+ size_t size, unsigned int width)
+{
+ uint64_t addr = 0;
+ struct map *map = NULL;
+ struct symbol *sym = NULL;
+
+ if (he->mem_info) {
+ addr = he->mem_info->iaddr.addr;
+ map = he->mem_info->iaddr.map;
+ sym = he->mem_info->iaddr.sym;
+ }
+ return _hist_entry__sym_snprintf(map, sym, addr, he->level, bf, size,
+ width);
+}
+
+static int64_t
sort__dso_daddr_cmp(struct hist_entry *left, struct hist_entry *right)
{
struct map *map_l = NULL;
@@ -1077,6 +1106,13 @@ struct sort_entry sort_mem_daddr_sym = {
.se_width_idx = HISTC_MEM_DADDR_SYMBOL,
};
+struct sort_entry sort_mem_iaddr_sym = {
+ .se_header = "Code Symbol",
+ .se_cmp = sort__iaddr_cmp,
+ .se_snprintf = hist_entry__iaddr_snprintf,
+ .se_width_idx = HISTC_MEM_IADDR_SYMBOL,
+};
+
struct sort_entry sort_mem_daddr_dso = {
.se_header = "Data Object",
.se_cmp = sort__dso_daddr_cmp,
@@ -1299,6 +1335,7 @@ static struct sort_dimension bstack_sort_dimensions[] = {
static struct sort_dimension memory_sort_dimensions[] = {
DIM(SORT_MEM_DADDR_SYMBOL, "symbol_daddr", sort_mem_daddr_sym),
+ DIM(SORT_MEM_IADDR_SYMBOL, "symbol_iaddr", sort_mem_iaddr_sym),
DIM(SORT_MEM_DADDR_DSO, "dso_daddr", sort_mem_daddr_dso),
DIM(SORT_MEM_LOCKED, "locked", sort_mem_locked),
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 {
SORT_MEM_LVL,
SORT_MEM_SNOOP,
SORT_MEM_DCACHELINE,
+ SORT_MEM_IADDR_SYMBOL,
};
/*
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[GIT PULL 00/16] perf/core improvements and fixes Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-10-05 23:10 +0200
[PATCH 01/16] tools lib api fs: No need to use PATH_MAX + 1 Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-10-05 23:10 +0200
[PATCH 05/16] perf tools: Introduce 'P' modifier to request max precision Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-10-05 23:10 +0200
[PATCH 08/16] perf tools: Setup proper width for symbol_iaddr field Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-10-05 23:10 +0200
[PATCH 13/16] perf callchain: Switch default to 'graph,0.5,caller' Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-10-05 23:10 +0200
Re: [PATCH 13/16] perf callchain: Switch default to 'graph,0.5,caller' Brendan Gregg <brendan.d.gregg@gmail.com> - 2015-10-09 22:40 +0200
Re: [PATCH 13/16] perf callchain: Switch default to 'graph,0.5,caller' Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-10-10 00:00 +0200
Re: [PATCH 13/16] perf callchain: Switch default to 'graph,0.5,caller' Brendan Gregg <brendan.d.gregg@gmail.com> - 2015-10-10 00:20 +0200
Re: [PATCH 13/16] perf callchain: Switch default to 'graph,0.5,caller' Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com> - 2015-10-10 00:30 +0200
Re: [PATCH 13/16] perf callchain: Switch default to 'graph,0.5,caller' Ingo Molnar <mingo@kernel.org> - 2015-10-10 09:10 +0200
Re: [PATCH 13/16] perf callchain: Switch default to 'graph,0.5,caller' Brendan Gregg <brendan.d.gregg@gmail.com> - 2015-10-10 09:40 +0200
Re: [PATCH 13/16] perf callchain: Switch default to 'graph,0.5,caller' Ingo Molnar <mingo@kernel.org> - 2015-10-10 11:10 +0200
Re: [PATCH 13/16] perf callchain: Switch default to 'graph,0.5,caller' Frederic Weisbecker <fweisbec@gmail.com> - 2015-10-12 17:30 +0200
Re: [PATCH 13/16] perf callchain: Switch default to 'graph,0.5,caller' Namhyung Kim <namhyung@kernel.org> - 2015-10-13 06:50 +0200
[PATCH 04/16] perf tools: Export perf_event_attr__set_max_precise_ip() Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-10-05 23:10 +0200
[PATCH 10/16] perf tests: Add arch tests Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-10-05 23:10 +0200
[PATCH 09/16] perf tools: Handle -h and -v options Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-10-05 23:10 +0200
[PATCH 07/16] perf tools: Add support for sorting on the iaddr Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-10-05 23:10 +0200
[PATCH 12/16] perf tests: Add Intel CQM test Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-10-05 23:10 +0200
Re: [GIT PULL 00/16] perf/core improvements and fixes Ingo Molnar <mingo@kernel.org> - 2015-10-06 09:10 +0200
csiph-web