Wygląda brakującego skryptu w odpowiedzi @Spacedman jest tutaj:
https://github.com/pydata/numexpr/blob/master/numexpr/cpuinfo.py
Jest łatany do pracy z Pythonem 3.
>python cpuinfo.py
CPU information: CPUInfoBase__get_nbits=32 getNCPUs=2 has_mmx is_32bit is_Intel is_i686
Struktura danych jest rzeczywiście OS zależne w systemie Windows wygląda to tak:
>python -c "import cpuinfo, pprint; pprint.pprint(cpuinfo.cpu.info[0])"
{'Component Information': '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00',
'Configuration Data': '\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00',
'Family': 6,
'FeatureSet': 2687451135L,
'Identifier': u'x86 Family 6 Model 23 Stepping 10',
'Model': 23,
'Platform ID': 128,
'Previous Update Signature': '\x00\x00\x00\x00\x0c\n\x00\x00',
'Processor': '0',
'ProcessorNameString': u'Intel(R) Core(TM)2 Duo CPU P8600 @ 2.40GHz',
'Stepping': 10,
'Update Signature': '\x00\x00\x00\x00\x0c\n\x00\x00',
'Update Status': 2,
'VendorIdentifier': u'GenuineIntel',
'~MHz': 2394}
W systemie Linux jest inaczej:
# python -c "import cpuinfo, pprint; pprint.pprint(cpuinfo.cpu.info[0])"
{'address sizes': '36 bits physical, 48 bits virtual',
'apicid': '0',
'bogomips': '6424.11',
'bugs': '',
'cache size': '2048 KB',
'cache_alignment': '128',
'clflush size': '64',
'core id': '0',
'cpu MHz': '2800.000',
'cpu cores': '2',
'cpu family': '15',
'cpuid level': '6',
'flags': 'fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm const
ant_tsc pebs bts nopl pni dtes64 monitor ds_cpl est cid cx16 xtpr pdcm lahf_lm',
'fpu': 'yes',
'fpu_exception': 'yes',
'initial apicid': '0',
'microcode': '0xb',
'model': '6',
'model name': 'Intel(R) Pentium(R) D CPU 3.20GHz',
'physical id': '0',
'power management': '',
'processor': '0',
'siblings': '2',
'stepping': '5',
'uname_m': 'x86_64',
'vendor_id': 'GenuineIntel',
'wp': 'yes'}
Czy ktoś może powiedzieć, czy jest to niezależne od platformy wyjście. to znaczy. czy zawsze daje dokładnie takie samo wyjście dla tego samego procesora w systemie Windows/Linux/Osx? –
Zwraca pusty ciąg znaków w moim systemie (python 2.6.5 w systemie Ubuntu) ... – Spacedman
@gnibbler: Czy istnieje powód, aby wątpić, że dane wyjściowe mogą się różnić? Chociaż mam nadzieję, że ktoś może potwierdzić. – user225312