2009/5/25 Josef Weidendorfer <[email protected]>:
> Hi,
>
> On Sunday 24 May 2009, Raphael Clifford wrote:
>
>> I am mystified by the D1 cache miss lines. I get
>>
>> D   refs:      144,057,551  (94,023,790 rd   + 50,033,761 wr)
>> D1  misses:      2,119,185  ( 1,993,960 rd   +    125,225 wr)
>
> Why mystified?
> If you look at your code, with length=2000000
>
>>   for (i=0;i<length;i++) {
>>     val = rand() % length;
>>     temp +=  p[val];
>>     p[val] = i;
>>  }
>
> There are 2000000 loop bodies, and the first random access into p[] is
> a read access in line
>
>        temp +=  p[val];
>
> It is expected that almost any access here gives a L1 read miss, and
> actually, you see around 2 million D1 read misses.
>
> As the memory block containing p[val] is in the cache afterwards, there
> will be no further misses (esp. no write misses).

Thanks. As you point out I didn't really understand the output from
valgrind.   The line that was confusing me was the percentage one but
I should have realised that most of this is not from the array access
at all but from everything else associated with running the code.

Raphael

------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com 
_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to