Posted on November 7, 2012, 4:37 am
Accessing the CPU and retrieving information about it is a fairly low-level task that requires some assembly-fu. Something that Python isn’t geared to do out of the box. But it’s possible to get that information with C and hand it over to Python.
So, I made a small library in C based on the cpuinfo program found in MPlayer. You can access the page for the PyCPU here.
I built this on Windows using MinGW. The Makefile is set up for Windows builds, but can be altered to work on Linux and OS X (Intel-based).
I’d like to extend this further for ARM architectures but alas I don’t have any of that kind of hardware lying around. For now though, PyCPU works on Intel, AMD, Cyrix, and Centaur processors, both 32- and 64-bit.
Categories: Programming Tags: cpu, Programming, Python