Skip to content

Commit

Permalink
Merge pull request #182 from workhorsy/lscpu_changes
Browse files Browse the repository at this point in the history
Lscpu changes
  • Loading branch information
workhorsy authored Sep 7, 2022
2 parents 21e4f3b + 850e2a0 commit 45b5144
Show file tree
Hide file tree
Showing 4 changed files with 681 additions and 0 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
* Release 8.1.0
* Fixed Bug #178: Changes to lscpu breaks parsing of cache info
* Fixed Bug #152: CPU stepping, model, and family values are blank if 0
* Fixed Bug #177: Officially drop support for Python 2
* Fixed Bug #171: Replace Python 3.11 deprecated unittest.makeSuite
Expand Down
4 changes: 4 additions & 0 deletions cpuinfo/cpuinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -1912,18 +1912,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
Expand Down
2 changes: 2 additions & 0 deletions test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
from test_linux_debian_8_5_x86_64 import TestLinuxDebian_8_5_X86_64
from test_linux_debian_8_7_1_ppc64le import TestLinuxDebian_8_7_1_ppc64le
from test_linux_ubuntu_16_04_x86_64 import TestLinuxUbuntu_16_04_X86_64
from test_linux_ubuntu_22_04_x86_64 import TestLinuxUbuntu_22_04_X86_64
from test_linux_fedora_24_x86_64 import TestLinuxFedora_24_X86_64
from test_linux_fedora_24_ppc64le import TestLinuxFedora_24_ppc64le
from test_linux_fedora_29_x86_64_ryzen_7 import Test_Linux_Fedora_29_X86_64_Ryzen_7
Expand Down Expand Up @@ -98,6 +99,7 @@ def logger(msg):
TestLinuxDebian_8_5_X86_64,
TestLinuxDebian_8_7_1_ppc64le,
TestLinuxUbuntu_16_04_X86_64,
TestLinuxUbuntu_22_04_X86_64,
TestLinuxFedora_24_X86_64,
TestLinuxFedora_24_ppc64le,
Test_Linux_Fedora_29_X86_64_Ryzen_7,
Expand Down
Loading

0 comments on commit 45b5144

Please sign in to comment.