diff --git a/ChangeLog b/ChangeLog index 59d8633..bbab4e5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,5 @@ * Release 8.1.0 + * Fixed Bug #178: Changes to lscpu breaks parsing of cache info * Fixed Bug #177: Officially drop support for Python 2 * Fixed Bug #171: Replace Python 3.11 deprecated unittest.makeSuite * Fixed Bug #173: Fix lgtm.com alerts diff --git a/cpuinfo/cpuinfo.py b/cpuinfo/cpuinfo.py index b00dd32..f91aef0 100644 --- a/cpuinfo/cpuinfo.py +++ b/cpuinfo/cpuinfo.py @@ -1894,18 +1894,22 @@ def _get_cpu_info_from_lscpu(): l1_data_cache_size = _get_field(False, output, None, None, 'L1d cache') if l1_data_cache_size: + l1_data_cache_size = l1_data_cache_size.split('(')[0].strip() info['l1_data_cache_size'] = _friendly_bytes_to_int(l1_data_cache_size) l1_instruction_cache_size = _get_field(False, output, None, None, 'L1i cache') if l1_instruction_cache_size: + l1_instruction_cache_size = l1_instruction_cache_size.split('(')[0].strip() info['l1_instruction_cache_size'] = _friendly_bytes_to_int(l1_instruction_cache_size) l2_cache_size = _get_field(False, output, None, None, 'L2 cache', 'L2d cache') if l2_cache_size: + l2_cache_size = l2_cache_size.split('(')[0].strip() info['l2_cache_size'] = _friendly_bytes_to_int(l2_cache_size) l3_cache_size = _get_field(False, output, None, None, 'L3 cache') if l3_cache_size: + l3_cache_size = l3_cache_size.split('(')[0].strip() info['l3_cache_size'] = _friendly_bytes_to_int(l3_cache_size) # Flags diff --git a/tests/test_linux_ubuntu_22_04_x86_64.py b/tests/test_linux_ubuntu_22_04_x86_64.py index 5004470..0ebc953 100644 --- a/tests/test_linux_ubuntu_22_04_x86_64.py +++ b/tests/test_linux_ubuntu_22_04_x86_64.py @@ -565,7 +565,7 @@ def test_get_cpu_info_from_lscpu(self): self.assertEqual(512 * 1024, info['l1_instruction_cache_size']) self.assertEqual(256 * 1024, info['l1_data_cache_size']) self.assertEqual(4 * 1024 * 1024, info['l2_cache_size']) - self.assertEqual(512 * 1024, info['l3_cache_size']) + self.assertEqual(16 * 1024 * 1024, info['l3_cache_size']) self.assertEqual( ['3dnowprefetch', 'abm', 'adx', 'aes', 'aperfmperf', 'apic', 'arat', 'avic', 'avx', 'avx2', 'bmi1', 'bmi2', 'bpext', 'clflush',