[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABPqkBQFhjreGVUGK6CS9YAYVJv_2ic+WQsR5Y1j6j-GKphiGw@mail.gmail.com>
Date: Wed, 7 Nov 2012 11:02:12 +0100
From: Stephane Eranian <eranian@...gle.com>
To: Namhyung Kim <namhyung@...nel.org>
Cc: Arnaldo Carvalho de Melo <acme@...stprotocols.net>,
LKML <linux-kernel@...r.kernel.org>,
Andi Kleen <andi@...stfloor.org>,
Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>,
Peter Zijlstra <peterz@...radead.org>,
Jiri Olsa <jolsa@...hat.com>, Ingo Molnar <mingo@...nel.org>
Subject: Re: [PATCH v2 00/16] perf: add memory access sampling support
On Wed, Nov 7, 2012 at 8:38 AM, Namhyung Kim <namhyung@...nel.org> wrote:
> Hi Arnaldo,
>
> On Tue, 6 Nov 2012 17:52:21 -0300, Arnaldo Carvalho de Melo wrote:
>> Em Mon, Nov 05, 2012 at 02:50:47PM +0100, Stephane Eranian escreveu:
>> [root@...dy acme]# perf mem -t load rep --stdio --sort=symbol,symbol_daddr,cost
>> # Samples: 30 of event 'cpu/mem-loads/pp'
>> # Total cost : 640
>> # Sort order : symbol,symbol_daddr,cost
>> #
>> # Overhead Samples Symbol Data Symbol Cost
>> # ........ ........... ...................... ...................... .......
>> #
>> 55.00% 1 [k] lookup_fast [k] 0xffff8803b7521bd4 352
>> 5.47% 1 [k] cache_alloc_refill [k] 0xffff880407705024 35
>> 3.44% 1 [k] cache_alloc_refill [k] 0xffff88041d8527d8 22
>> 3.28% 1 [k] run_timer_softirq [k] 0xffff88041e2c3e90 21
>> 2.50% 1 [k] __list_add [k] 0xffff8803b7521d68 16
>> 2.19% 1 [.] __strcoll_l [.] 0x00007fffa8d44080 14
>> 1.88% 1 [.] __strcoll_l [.] 0x00007fffa8d44104 12
>>
>> If we go to the annotation browser to see where is that lookup_fast hitting we get:
>>
>> 100.00 │ mov -0x34(%rbp),%eax
>>
>> How to map 0xffff8803b7521bd4 to a stack variable, struct members and all?
>>
Yes, you need dwarf to achieve this. But I think we should first fix the problem
with global variables at the user and kernel levels and there all you
need is the
data symbol table (which we load because of the -d option) and correct
base+offset
calculations. For now, I am getting perf-xxxx.map for global variables.
For instance, I use the following simple test program with:
$ perf mem rec mcol 10000
I expect to see symbol aa+offset in the data symbol column and mcol in the
data object column. But instance, I get raw hex and perf-xxxx.map.
I think that's what we need to fix first.
/* mcol.c */
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
typedef struct {
long real;
long img;
} elem_t;
#define NB 100000ULL
static elem_t aa[NB * 2];
uint64_t
mat_column(elem_t *m, size_t nr, size_t nc, elem_t *n)
{
uint64_t real = 0 , img = 0;
elem_t *p;
size_t i, j;
/* scan by columns */
for(i=0; i < nc; i++) {
for(j=0; j < nr; j++) {
real += (m+i+nc*j)->real;
img += (m+i+nc*j)->img;
}
}
return (real+img) > 0 ? 0 : 1;
}
int main(int argc, char **argv)
{
size_t rows, cols;
unsigned long long nloop, nl;
elem_t number;
number.real = 1;
number.img = 5;
nloop = nl = argc > 1 ? strtoul(argv[1], NULL, 0) : 10000;
rows = NB;
cols = 2;
printf("mat[%p:%p] size=%zuMiB\n", aa, &aa[-1+NB*2], sizeof(aa) >> 20);
while(nl--) {
number.img++;
number.real += mat_column(aa, rows, cols, &number);
}
return 0;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists