[pypy-issue] [issue673] Linux L2 cache size

Stefano Rivera tracker at bugs.pypy.org
Tue Dec 13 01:03:07 CET 2011

Stefano Rivera <pypy at rivera.za.net> added the comment:

Here's a quick patch I whipped up for the architectures that I can determine the L2 
cache size on (i386, amd64, alpha, ppc, ia64, pa-risc, and sparc)
I can't determine it on: ARM, avr32, hurd, kfreebsd, MIPS, and sh4.
The only alpha machine I've looked at says it's L2 cache size is N/A. I'm assuming it 
doesn't have any installed (AFAIK it's user-installable).

I'm afraid, it's pretty untested, as the bulid chroots I have on these machines don't 
have /sys mounted, and I can't run the pypy outside the chroots as its linked against unavailable libraries.
I did test the code under cpython, though.

> /sys/devices/system/cpu/cpuN/cache/indexN/size
> is more portable.

It's only fractionally more portable. It's used on x86 and ia64. Sparc uses something 

> dmidecode seems not to be available in the default repositories fur Ubuntu 10.10 on 

DMI is a BIOS thing. You won't find it on non-x86 architectures (although it's on ia64 

nosy: +stefanor

PyPy bug tracker <tracker at bugs.pypy.org>

More information about the pypy-issue mailing list