Python Module for Determining CPU Freq. and Memory?

Michele Petrazzo michele.petrazzo at TOGLIunipex.it
Thu Apr 6 03:49:15 EDT 2006


Tim Golden wrote:
> [efrat]
> 
> |    I'd like to determine at runtime the computer's CPU frequency and 
> | memory.
> | 
> | (Please note: I'm interested in hardware stuff, like how much 
> | memory the 
> | machine has; not how much free memory is available.)
> 
> I don't know if there's a cross-platform solution for this.
> For Windows, you could use WMI. Something like this:

<-cut->

For linux (and also for other *nix?)

something like this

 >>> os.system("cat /proc/cpuinfo | grep cpu")
cpu family      : 6
cpu MHz         : 1922.308

or:

 >>> open("/proc/cpuinfo").readlines()
['processor\t: 0\n', 'vendor_id\t: AuthenticAMD\n' ....


Michele



More information about the Python-list mailing list