MCPcopy Create free account
hub / github.com/pydata/numexpr / get_cache

Method get_cache

numexpr3/cpuinfo.py:1015–1036  ·  view source on GitHub ↗
(self, max_extension_support)

Source from the content-addressed store, hash-verified

1013
1014 # http://en.wikipedia.org/wiki/CPUID#EAX.3D80000006h:_Extended_L2_Cache_Features
1015 def get_cache(self, max_extension_support):
1016 cache_info = {}
1017
1018 # Just return if the cache feature is not supported
1019 if max_extension_support < 0x80000006:
1020 return cache_info
1021
1022 # ECX
1023 ecx = self._run_asm(
1024 b"\xB8\x06\x00\x00\x80" # mov ax,0x80000006
1025 b"\x0f\xa2" # cpuid
1026 b"\x89\xC8" # mov ax,cx
1027 b"\xC3" # ret
1028 )
1029
1030 cache_info = {
1031 'size_kb' : ecx & 0xFF,
1032 'line_size_b' : (ecx >> 12) & 0xF,
1033 'associativity' : (ecx >> 16) & 0xFFFF
1034 }
1035
1036 return cache_info
1037
1038 def get_ticks(self):
1039 retval = None

Callers 1

Calls 1

_run_asmMethod · 0.95

Tested by

no test coverage detected