efrat wrote: > Hello, > > I'd like to determine at runtime the computer's CPU frequency and memory. > > Is there a module for these types of queries? platform.platform returns > the computer's CPU name and type, but not its frequency; nor does it > report how much memory the computer has. In the python help(), I > searched for moudles cpu, but non were found. > (Please note: I'm interested in hardware stuff, like how much memory the > machine has; not how much free memory is available.) > > Many Thanks, > > Efrat
For looking at memory on windows you might be able to make improvements to this class I wrote. I was going to add memget() methods for getting individual items, but it wasn't as useful as I was hoping it would be in checking my python memory use. For that I need info on individual tasks, but this might be better for your use. Cheers, Ron from ctypes import * from ctypes.wintypes import DWORD SIZE_T = c_ulong class MemStat(Structure): _fields_ = [ ("dwLength", DWORD), ("dwMemoryLength", DWORD), ("dwTotalPhys", SIZE_T), ("dwAvailPhys", SIZE_T), ("dwTotalPageFile", SIZE_T), ("dwAvailPageFile", SIZE_T), ("dwTotalVirtual", SIZE_T), ("dwAvailVirtualPhys", SIZE_T) ] def update(self): windll.kernel32.GlobalMemoryStatus(byref(self)) def show(self): self.update() result = [] for field_name, field_type in self._fields_: result.append("%s, %s\n" \ % (field_name, getattr(self, field_name))) return ''.join(result) memstat = MemStat() if __name__ == '__main__': print memstat.show() -- http://mail.python.org/mailman/listinfo/python-list