aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/machine.c
diff options
context:
space:
mode:
authorStephane Eranian <eranian@google.com>2013-01-24 10:10:35 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-04-01 11:20:13 -0400
commit98a3b32c99ada4bca8aaf4f91efd96fc906dd5c4 (patch)
treef10d745caaecb65307a4aa71205a0c5836b186db /tools/perf/util/machine.c
parent05484298cbfebbf8c8c55b000541a245bc286bec (diff)
perf tools: Add mem access sampling core support
This patch adds the sorting and histogram support functions to enable profiling of memory accesses. The following sorting orders are added: - symbol_daddr: data address symbol (or raw address) - dso_daddr: data address shared object - locked: access uses locked transaction - tlb : TLB access - mem : memory level of the access (L1, L2, L3, RAM, ...) - snoop: access snoop mode Signed-off-by: Stephane Eranian <eranian@google.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung.kim@lge.com> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/1359040242-8269-12-git-send-email-eranian@google.com [ committer note: changed to cope with fc5871ed, the move of methods to machine.[ch], and the rename of dsrc to data_src, to match the change made in the PERF_SAMPLE_DSRC in a previous patch. ] Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/machine.c')
-rw-r--r--tools/perf/util/machine.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index c5e3b123782b..d77ba869d7ed 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -1097,6 +1097,38 @@ found:
1097 ams->map = al.map; 1097 ams->map = al.map;
1098} 1098}
1099 1099
1100static void ip__resolve_data(struct machine *machine, struct thread *thread,
1101 u8 m, struct addr_map_symbol *ams, u64 addr)
1102{
1103 struct addr_location al;
1104
1105 memset(&al, 0, sizeof(al));
1106
1107 thread__find_addr_location(thread, machine, m, MAP__VARIABLE, addr, &al,
1108 NULL);
1109 ams->addr = addr;
1110 ams->al_addr = al.addr;
1111 ams->sym = al.sym;
1112 ams->map = al.map;
1113}
1114
1115struct mem_info *machine__resolve_mem(struct machine *machine,
1116 struct thread *thr,
1117 struct perf_sample *sample,
1118 u8 cpumode)
1119{
1120 struct mem_info *mi = zalloc(sizeof(*mi));
1121
1122 if (!mi)
1123 return NULL;
1124
1125 ip__resolve_ams(machine, thr, &mi->iaddr, sample->ip);
1126 ip__resolve_data(machine, thr, cpumode, &mi->daddr, sample->addr);
1127 mi->data_src.val = sample->data_src;
1128
1129 return mi;
1130}
1131
1100struct branch_info *machine__resolve_bstack(struct machine *machine, 1132struct branch_info *machine__resolve_bstack(struct machine *machine,
1101 struct thread *thr, 1133 struct thread *thr,
1102 struct branch_stack *bs) 1134 struct branch_stack *bs)