Reputation: 140
How could I get information about the L1,L2 and L3 associativity settings? I can get the size but not the associativity, any idea?
so far I haven't found anything usefull
Upvotes: 1
Views: 313
Reputation: 365737
The x86 CPUID
instruction doesn't require any privileges, so you can run it in a program for any OS.
It has cache associativity information in leaf 2 (eax=2
). See also the x86 tag wiki for more links to docs.
It only works on x86, though, so if you care about portability to Windows on non-x86, you'll have to find something else for other architectures.
There are libraries to decode this CPUID info, if you don't want to reinvent the wheel by writing a decoding function, and the asm function or inline asm to run CPUID in the first place.
Upvotes: 2