Determing cache sizes -- request for testing
Don
nospam at nospam.com.au
Wed Sep 10 08:07:26 PDT 2008
bearophile wrote:
> Don:
>> The value shown for L3 should be greater than the memory size, if there
>> is no L2 cache. (you never fall out of the L3 cache). So it's correct.
>
> I don't understand. And I have L2 cache.
Oops, that should have been "if there is no L3 cache".
> The results I expect from your code running on my PC are:
>
> L1: 32 + 32 KB
> L2: 1024 KB
> L3: 0 MB
> RAM: 2 GB
(1) Unfortunately, I don't think it's possible to determine the amount
of RAM without help from the OS. So I give the last value uint.max
bytes. Perhaps that is too confusing.
(2) The cache values are per core.
> Or if you want an output more usable by an algorithm, it can output a dynamic array of longs:
>
> Memory levels ==> [65536, 1048576, 2147483648]
Perhaps. I haven't decided on a final interface. Note, though, that the
relevant size of the cache depends on what you are doing. For example,
if you are operating on 3 arrays, you need to divide the cache size by
3. But if the cache level has an associativity less than 3, you have the
risk of cache thrashing.
So generally you need to make your own table of cache sizes anyway.
More information about the Digitalmars-d
mailing list