如何使用运行在Windows系统上的PythonfindCPU的L3caching大小?
尝试py-cpuinfo
但它只输出二级caching信息,而不是L3。
import cpuinfo print cpuinfo.get_cpu_info()
产量
{'count': 12, 'l2_cache_line_size': 6L, 'hz_advertised': '3.5000 GHz', 'bits': 64, 'brand': u'Intel(R) Core(TM) i7-5930K CPU @ 3.50GHz', 'vendor_id': u'GenuineIntel', 'cpuinfo_version': (3 , 3, 0), 'flags': ['3dnow', 'acpi', 'clflush', 'cmov', 'de', 'dts', 'fxsr', 'ia64', 'mca', 'mce', 'mmx', 'msr', 'mtrr', 'pse', 'sep', 'serial', 'ss', 'sse', 'sse2', 'tm', 'tsc'], 'raw_arch _string': 'AMD64', 'l2_cache_size': 64L, 'l2_cache_associativity': '0x100L', 'hz_actual_raw': (3500000000L, 0), 'hz_actual': '3.5000 GHz', 'arch': 'X86_64', 'hz_advertised_raw': (350000000 0L, 0)}
在Windows上,
import subprocess subprocess.Popen('wmic cpu get L3CacheSize')
足以检索有关L3缓存大小的信息。