Fix #10371
cpuinfo.get_cpu_info() doesn't seem to include the l2_cache_size key on some architectures. PiperOrigin-RevId: 158021008
This commit is contained in:
parent
a51a9846cf
commit
69ba4d3d49
@ -96,7 +96,7 @@ def gather_cpu_info():
|
||||
cpu_info.cpu_info = info['brand']
|
||||
cpu_info.num_cores = info['count']
|
||||
cpu_info.mhz_per_cpu = info['hz_advertised_raw'][0] / 1.0e6
|
||||
l2_cache_size = re.match(r'(\d+)', str(info['l2_cache_size']))
|
||||
l2_cache_size = re.match(r'(\d+)', str(info.get('l2_cache_size', '')))
|
||||
if l2_cache_size:
|
||||
# If a value is returned, it's in KB
|
||||
cpu_info.cache_size['L2'] = int(l2_cache_size.group(0)) * 1024
|
||||
|
Loading…
Reference in New Issue
Block a user