././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1666730267.8677893 py-cpuinfo-9.0.0/0000775000175000017500000000000014326044434012353 5ustar00mattmatt././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666724780.0 py-cpuinfo-9.0.0/ChangeLog0000664000175000017500000001341114326031654014125 0ustar00mattmatt10/25/2022 Release 9.0.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 * Fixed Bug #173: Fix lgtm.com alerts * Fixed Bug #165: Support Wheel * Fixed Bug #167: Add support for RISC-V 04/14/2021 Release 8.0.0 * Fixed Bug #161: Accept arm64 as an alias for aarch64 * Fixed Bug #160: Add MIPS architecture support * Fixed Bug #74: Add option to trace code paths to file * Fixed Bug #157: Remove multiple checks for sestatus 07/05/2020 Release 7.0.0 * Fixed Bug #133: CPU flags vary between runs on Mac OS X * Fixed Bug #150: Change 'byte code' to 'machine code' * Fixed Bug #128: Overhead from generating machine code throws off CPUID HZ * Fixed Bug #136: On non BeOS systems, calling sysinfo may open GUI program * Fixed Bug #138: Invalid escape sequences warn when building in Python 3.8 * Fixed Bug #147: Remove extended_model and extended_family fields * Fixed Bug #146: CPUID family and model is wrong * Fixed Bug #144: Cache fields should be full ints instead of kb strings 06/11/2020 Release 6.0.0 * Fixed Bug #140: The get_cache function has swapped fields * Fixed Bug #142: Remove empty and zeroed fields * Fixed Bug #115: Missing data on Ryzen CPUs * Fixed Bug #122: Rename fields to be more clear * Fixed Bug #125: Add option to return --version * Fixed Bug #126: Make test suite also check SELinux * Fixed Bug #120: Make unit tests also test CPUID * Fixed Bug #69: Add s390x support 03/20/2019 Release 5.0.0 * Fixed Bug #117: Remove PyInstaller hacks * Fixed Bug #108: Client script runs multiple times without __main__ * Fixed Bug #113: Add option to return results in json * Fixed Bug #110: Always tries to run wmic in get_system_info.py 04/01/2018 Release 4.0.0 * Fixed Bug #80: Broken when using Pyinstaller * Fixed Bug #77: Get L1, L2, and L3 cache info from lscpu * Fixed Bug #79: Byte formats are inconsistent * Fixed Bug #81: Byte formatter breaks on non strings * Fixed Bug #84: Fixed wrong setup of CPUID machine code and added more flags * Fixed Bug #88: Get Windows CPU info with wmic * Fixed Bug #94: Fails to detect winreg imported as _winreg in get_system_info * Fixed Bug #95: Include if Python is 32 or 64 bit in get_system_info * Fixed Bug #87: lscpu gets brand field twice * Fixed Bug #96: Include Python version in output * Fixed Bug #85: CPUID HZ measurement is scaled wrong * Fixed Bug #100: Officially drop support for Python 2.6 * Fixed Bug #101: Made it only check the dmesg boot log on Linux * Fixed Bug #102: Parsing Haiku sysinfo fails 06/10/2017 Release 3.3.0 * Fixed Bug #70: subprocess.Popen breaks under Windows GUI app * Fixed Bug #72: Fails to parse invalid CPUID result. 04/19/2017 Release 3.2.0 * Fixed Bug #68: Broken Qemu guest CPU flag parsing on Ubuntu 17.04 POWER8 04/19/2017 Release 3.1.0 * Fixed Bug #63: Include py-cpuinfo version in output * Fixed Bug #29: Missing AVX2 CPU flag on OS X * Fixed Bug #41: Broken on Odroid XU3 armhf ARM 32bit * Fixed Bug #61: Not working on RHEL7.3 ppc64le * Fixed Bug #56: Not working on Red Flag Linux ppc64le * Fixed Bug #55: Not working on Fedora 24 ppc64le 04/05/2017 Release 3.0.0 * Change API to hide low level functions * Fixed Bug #51: Combine data from all sources instead of picking one * Fixed Bug #59: Not working on OS X 10.12 Sierra * Fixed Bug #58: Change version number format * Fixed Bug #60: Not working on ARM64 odroid-c2 03/13/2017 Release 0.2.7 * Fixed Bug #53: CPUID breaks test suite when SE Linux is on (Fedora 25) * Fixed Bug #54: CPUID breaks when it returns nothing (Fedora 26) 02/27/2017 Release 0.2.6 * New release because pypi does not allow deleting broken uploads 02/27/2017 Release 0.2.5 * New release because pypi does not allow deleting broken uploads 02/27/2017 Release 0.2.4 * Fixed Bug #35: Add basic documentation * Fixed Bug #36: Make test suite test real functions too * Fixed Bug #38: get_cpu_info_from_cpuid breaks with Python3 * Fixed Bug #47: Include sysctl leaf7_features and extfeatures flags 02/23/2016 Release 0.2.3 * Fixed Bug #34: Fixed issue with imports breaking in python3 02/23/2016 Release 0.2.2 * Same as previous release. Pypi bug broke uploaded files. 02/23/2016 Release 0.2.0 * Fixed Bug #32: Please ship tests to pypi * Fixed Bug #31: Make "python -m cpuinfo" possible * Fixed Bug #5: Importing is different depending on install method 12/16/2015 Release 0.1.8 * New release to get around the brokenness of pypi 12/16/2015 Release 0.1.7 * Fixed Bug #23: CPUID failure segfaults Python * Fixed Bug #16: Make it work on Raspberry Pi * FIxed Bug #27: System exit called if CPU is not supported 07/07/2015 Release 0.1.6 * Fixed Bug #25: dmesg is missing extra Features in flags * Fixed Bug #19: Add a test suite * Fixed Bug #24: CPUID breaks on brands with many NULL terminators 06/14/2015 Release 0.1.5 * Fixed Bug #17: Make a script for easy gathering of CPU info * Fixed Bug #21: Getting CPU info from dmesg fails on Linux but not BSD * Fixed Bug #20: Subprocess stderr is sometimes printed to console * Fixed Bug #15: Make it work on a BeagleBone * Fixed Bug #10: Stepping parse TypeError on ARM 02/11/2015 Release 0.1.4 * New release to get around the brokenness of pypi 02/11/2015 Release 0.1.3 * Fixed Bug #11: Support cpu strings that do not have @ in them * Fixed Bug #13: Support cpu strings that do not have Hz in them 09/30/2014 Release 0.1.2 * Added support for installing to binary path. * Fixed issue with crashing in python 3. 09/23/2014 Release 0.1.1 * Fixed Bug #3: It is not obvious if Hz Raw is the current Hz, or the advertised Hz * Fixed Bug #2: Wrong CPU frequency in get_cpu_info_from_proc_cpuinfo() ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/LICENSE0000664000175000017500000000214714325641176013371 0ustar00mattmattThe MIT License (MIT) Copyright (c) 2014-2022 Matthew Brennan Jones Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/MANIFEST.in0000664000175000017500000000007414325641176014117 0ustar00mattmattinclude README.rst ChangeLog LICENSE tests/* test_suite.py ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1666730267.8677893 py-cpuinfo-9.0.0/PKG-INFO0000664000175000017500000000143214326044434013450 0ustar00mattmattMetadata-Version: 2.1 Name: py-cpuinfo Version: 9.0.0 Summary: Get CPU info with pure Python Home-page: https://github.com/workhorsy/py-cpuinfo Author: Matthew Brennan Jones Author-email: matthew.brennan.jones@gmail.com License: MIT Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Topic :: Utilities Classifier: License :: OSI Approved :: MIT License Classifier: Programming Language :: Python :: 3 License-File: LICENSE py-cpuinfo ========== Py-cpuinfo gets CPU info with pure Python. Py-cpuinfo should work without any extra programs or libraries, beyond what your OS provides. It does not require any compilation(C/C++, assembly, et cetera) to use. It works with Python 3. Documentation can be viewed here: https://github.com/workhorsy/py-cpuinfo ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/README.rst0000664000175000017500000000051414325641176014047 0ustar00mattmattpy-cpuinfo ========== Py-cpuinfo gets CPU info with pure Python. Py-cpuinfo should work without any extra programs or libraries, beyond what your OS provides. It does not require any compilation(C/C++, assembly, et cetera) to use. It works with Python 3. Documentation can be viewed here: https://github.com/workhorsy/py-cpuinfo ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1666730267.8637893 py-cpuinfo-9.0.0/cpuinfo/0000775000175000017500000000000014326044434014016 5ustar00mattmatt././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/cpuinfo/__init__.py0000664000175000017500000000005414325641176016133 0ustar00mattmatt import sys from cpuinfo.cpuinfo import * ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/cpuinfo/__main__.py0000664000175000017500000000004114325641176016110 0ustar00mattmatt import cpuinfo cpuinfo.main() ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666724835.0 py-cpuinfo-9.0.0/cpuinfo/cpuinfo.py0000664000175000017500000024464414326031743016050 0ustar00mattmatt#!/usr/bin/env python # -*- coding: UTF-8 -*- # Copyright (c) 2014-2022 Matthew Brennan Jones # Py-cpuinfo gets CPU info with pure Python # It uses the MIT License # It is hosted at: https://github.com/workhorsy/py-cpuinfo # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. CPUINFO_VERSION = (9, 0, 0) CPUINFO_VERSION_STRING = '.'.join([str(n) for n in CPUINFO_VERSION]) import os, sys import platform import multiprocessing import ctypes CAN_CALL_CPUID_IN_SUBPROCESS = True g_trace = None class Trace(object): def __init__(self, is_active, is_stored_in_string): self._is_active = is_active if not self._is_active: return from datetime import datetime from io import StringIO if is_stored_in_string: self._output = StringIO() else: date = datetime.now().strftime("%Y-%m-%d_%H-%M-%S-%f") self._output = open('cpuinfo_trace_{0}.trace'.format(date), 'w') self._stdout = StringIO() self._stderr = StringIO() self._err = None def header(self, msg): if not self._is_active: return from inspect import stack frame = stack()[1] file = frame[1] line = frame[2] self._output.write("{0} ({1} {2})\n".format(msg, file, line)) self._output.flush() def success(self): if not self._is_active: return from inspect import stack frame = stack()[1] file = frame[1] line = frame[2] self._output.write("Success ... ({0} {1})\n\n".format(file, line)) self._output.flush() def fail(self, msg): if not self._is_active: return from inspect import stack frame = stack()[1] file = frame[1] line = frame[2] if isinstance(msg, str): msg = ''.join(['\t' + line for line in msg.split('\n')]) + '\n' self._output.write(msg) self._output.write("Failed ... ({0} {1})\n\n".format(file, line)) self._output.flush() elif isinstance(msg, Exception): from traceback import format_exc err_string = format_exc() self._output.write("\tFailed ... ({0} {1})\n".format(file, line)) self._output.write(''.join(['\t\t{0}\n'.format(n) for n in err_string.split('\n')]) + '\n') self._output.flush() def command_header(self, msg): if not self._is_active: return from inspect import stack frame = stack()[3] file = frame[1] line = frame[2] self._output.write("\t{0} ({1} {2})\n".format(msg, file, line)) self._output.flush() def command_output(self, msg, output): if not self._is_active: return self._output.write("\t\t{0}\n".format(msg)) self._output.write(''.join(['\t\t\t{0}\n'.format(n) for n in output.split('\n')]) + '\n') self._output.flush() def keys(self, keys, info, new_info): if not self._is_active: return from inspect import stack frame = stack()[2] file = frame[1] line = frame[2] # List updated keys self._output.write("\tChanged keys ({0} {1})\n".format(file, line)) changed_keys = [key for key in keys if key in info and key in new_info and info[key] != new_info[key]] if changed_keys: for key in changed_keys: self._output.write('\t\t{0}: {1} to {2}\n'.format(key, info[key], new_info[key])) else: self._output.write('\t\tNone\n') # List new keys self._output.write("\tNew keys ({0} {1})\n".format(file, line)) new_keys = [key for key in keys if key in new_info and key not in info] if new_keys: for key in new_keys: self._output.write('\t\t{0}: {1}\n'.format(key, new_info[key])) else: self._output.write('\t\tNone\n') self._output.write('\n') self._output.flush() def write(self, msg): if not self._is_active: return self._output.write(msg + '\n') self._output.flush() def to_dict(self, info, is_fail): return { 'output' : self._output.getvalue(), 'stdout' : self._stdout.getvalue(), 'stderr' : self._stderr.getvalue(), 'info' : info, 'err' : self._err, 'is_fail' : is_fail } class DataSource(object): bits = platform.architecture()[0] cpu_count = multiprocessing.cpu_count() is_windows = platform.system().lower() == 'windows' arch_string_raw = platform.machine() uname_string_raw = platform.uname()[5] can_cpuid = True @staticmethod def has_proc_cpuinfo(): return os.path.exists('/proc/cpuinfo') @staticmethod def has_dmesg(): return len(_program_paths('dmesg')) > 0 @staticmethod def has_var_run_dmesg_boot(): uname = platform.system().strip().strip('"').strip("'").strip().lower() return 'linux' in uname and os.path.exists('/var/run/dmesg.boot') @staticmethod def has_cpufreq_info(): return len(_program_paths('cpufreq-info')) > 0 @staticmethod def has_sestatus(): return len(_program_paths('sestatus')) > 0 @staticmethod def has_sysctl(): return len(_program_paths('sysctl')) > 0 @staticmethod def has_isainfo(): return len(_program_paths('isainfo')) > 0 @staticmethod def has_kstat(): return len(_program_paths('kstat')) > 0 @staticmethod def has_sysinfo(): uname = platform.system().strip().strip('"').strip("'").strip().lower() is_beos = 'beos' in uname or 'haiku' in uname return is_beos and len(_program_paths('sysinfo')) > 0 @staticmethod def has_lscpu(): return len(_program_paths('lscpu')) > 0 @staticmethod def has_ibm_pa_features(): return len(_program_paths('lsprop')) > 0 @staticmethod def has_wmic(): returncode, output = _run_and_get_stdout(['wmic', 'os', 'get', 'Version']) return returncode == 0 and len(output) > 0 @staticmethod def cat_proc_cpuinfo(): return _run_and_get_stdout(['cat', '/proc/cpuinfo']) @staticmethod def cpufreq_info(): return _run_and_get_stdout(['cpufreq-info']) @staticmethod def sestatus_b(): return _run_and_get_stdout(['sestatus', '-b']) @staticmethod def dmesg_a(): return _run_and_get_stdout(['dmesg', '-a']) @staticmethod def cat_var_run_dmesg_boot(): return _run_and_get_stdout(['cat', '/var/run/dmesg.boot']) @staticmethod def sysctl_machdep_cpu_hw_cpufrequency(): return _run_and_get_stdout(['sysctl', 'machdep.cpu', 'hw.cpufrequency']) @staticmethod def isainfo_vb(): return _run_and_get_stdout(['isainfo', '-vb']) @staticmethod def kstat_m_cpu_info(): return _run_and_get_stdout(['kstat', '-m', 'cpu_info']) @staticmethod def sysinfo_cpu(): return _run_and_get_stdout(['sysinfo', '-cpu']) @staticmethod def lscpu(): return _run_and_get_stdout(['lscpu']) @staticmethod def ibm_pa_features(): import glob ibm_features = glob.glob('/proc/device-tree/cpus/*/ibm,pa-features') if ibm_features: return _run_and_get_stdout(['lsprop', ibm_features[0]]) @staticmethod def wmic_cpu(): return _run_and_get_stdout(['wmic', 'cpu', 'get', 'Name,CurrentClockSpeed,L2CacheSize,L3CacheSize,Description,Caption,Manufacturer', '/format:list']) @staticmethod def winreg_processor_brand(): processor_brand = _read_windows_registry_key(r"Hardware\Description\System\CentralProcessor\0", "ProcessorNameString") return processor_brand.strip() @staticmethod def winreg_vendor_id_raw(): vendor_id_raw = _read_windows_registry_key(r"Hardware\Description\System\CentralProcessor\0", "VendorIdentifier") return vendor_id_raw @staticmethod def winreg_arch_string_raw(): arch_string_raw = _read_windows_registry_key(r"SYSTEM\CurrentControlSet\Control\Session Manager\Environment", "PROCESSOR_ARCHITECTURE") return arch_string_raw @staticmethod def winreg_hz_actual(): hz_actual = _read_windows_registry_key(r"Hardware\Description\System\CentralProcessor\0", "~Mhz") hz_actual = _to_decimal_string(hz_actual) return hz_actual @staticmethod def winreg_feature_bits(): feature_bits = _read_windows_registry_key(r"Hardware\Description\System\CentralProcessor\0", "FeatureSet") return feature_bits def _program_paths(program_name): paths = [] exts = filter(None, os.environ.get('PATHEXT', '').split(os.pathsep)) for p in os.environ['PATH'].split(os.pathsep): p = os.path.join(p, program_name) if os.access(p, os.X_OK): paths.append(p) for e in exts: pext = p + e if os.access(pext, os.X_OK): paths.append(pext) return paths def _run_and_get_stdout(command, pipe_command=None): from subprocess import Popen, PIPE g_trace.command_header('Running command "' + ' '.join(command) + '" ...') # Run the command normally if not pipe_command: p1 = Popen(command, stdout=PIPE, stderr=PIPE, stdin=PIPE) # Run the command and pipe it into another command else: p2 = Popen(command, stdout=PIPE, stderr=PIPE, stdin=PIPE) p1 = Popen(pipe_command, stdin=p2.stdout, stdout=PIPE, stderr=PIPE) p2.stdout.close() # Get the stdout and stderr stdout_output, stderr_output = p1.communicate() stdout_output = stdout_output.decode(encoding='UTF-8') stderr_output = stderr_output.decode(encoding='UTF-8') # Send the result to the logger g_trace.command_output('return code:', str(p1.returncode)) g_trace.command_output('stdout:', stdout_output) # Return the return code and stdout return p1.returncode, stdout_output def _read_windows_registry_key(key_name, field_name): g_trace.command_header('Reading Registry key "{0}" field "{1}" ...'.format(key_name, field_name)) try: import _winreg as winreg except ImportError as err: try: import winreg except ImportError as err: pass key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, key_name) value = winreg.QueryValueEx(key, field_name)[0] winreg.CloseKey(key) g_trace.command_output('value:', str(value)) return value # Make sure we are running on a supported system def _check_arch(): arch, bits = _parse_arch(DataSource.arch_string_raw) if not arch in ['X86_32', 'X86_64', 'ARM_7', 'ARM_8', 'PPC_64', 'S390X', 'MIPS_32', 'MIPS_64', "RISCV_32", "RISCV_64"]: raise Exception("py-cpuinfo currently only works on X86 " "and some ARM/PPC/S390X/MIPS/RISCV CPUs.") def _obj_to_b64(thing): import pickle import base64 a = thing b = pickle.dumps(a) c = base64.b64encode(b) d = c.decode('utf8') return d def _b64_to_obj(thing): import pickle import base64 try: a = base64.b64decode(thing) b = pickle.loads(a) return b except Exception: return {} def _utf_to_str(input): if isinstance(input, list): return [_utf_to_str(element) for element in input] elif isinstance(input, dict): return {_utf_to_str(key): _utf_to_str(value) for key, value in input.items()} else: return input def _copy_new_fields(info, new_info): keys = [ 'vendor_id_raw', 'hardware_raw', 'brand_raw', 'hz_advertised_friendly', 'hz_actual_friendly', 'hz_advertised', 'hz_actual', 'arch', 'bits', 'count', 'arch_string_raw', 'uname_string_raw', 'l2_cache_size', 'l2_cache_line_size', 'l2_cache_associativity', 'stepping', 'model', 'family', 'processor_type', 'flags', 'l3_cache_size', 'l1_data_cache_size', 'l1_instruction_cache_size' ] g_trace.keys(keys, info, new_info) # Update the keys with new values for key in keys: if new_info.get(key, None) and not info.get(key, None): info[key] = new_info[key] elif key == 'flags' and new_info.get('flags'): for f in new_info['flags']: if f not in info['flags']: info['flags'].append(f) info['flags'].sort() def _get_field_actual(cant_be_number, raw_string, field_names): for line in raw_string.splitlines(): for field_name in field_names: field_name = field_name.lower() if ':' in line: left, right = line.split(':', 1) left = left.strip().lower() right = right.strip() if left == field_name and len(right) > 0: if cant_be_number: if not right.isdigit(): return right else: return right return None def _get_field(cant_be_number, raw_string, convert_to, default_value, *field_names): retval = _get_field_actual(cant_be_number, raw_string, field_names) # Convert the return value if retval and convert_to: try: retval = convert_to(retval) except Exception: retval = default_value # Return the default if there is no return value if retval is None: retval = default_value return retval def _to_decimal_string(ticks): try: # Convert to string ticks = '{0}'.format(ticks) # Sometimes ',' is used as a decimal separator ticks = ticks.replace(',', '.') # Strip off non numbers and decimal places ticks = "".join(n for n in ticks if n.isdigit() or n=='.').strip() if ticks == '': ticks = '0' # Add decimal if missing if '.' not in ticks: ticks = '{0}.0'.format(ticks) # Remove trailing zeros ticks = ticks.rstrip('0') # Add one trailing zero for empty right side if ticks.endswith('.'): ticks = '{0}0'.format(ticks) # Make sure the number can be converted to a float ticks = float(ticks) ticks = '{0}'.format(ticks) return ticks except Exception: return '0.0' def _hz_short_to_full(ticks, scale): try: # Make sure the number can be converted to a float ticks = float(ticks) ticks = '{0}'.format(ticks) # Scale the numbers hz = ticks.lstrip('0') old_index = hz.index('.') hz = hz.replace('.', '') hz = hz.ljust(scale + old_index+1, '0') new_index = old_index + scale hz = '{0}.{1}'.format(hz[:new_index], hz[new_index:]) left, right = hz.split('.') left, right = int(left), int(right) return (left, right) except Exception: return (0, 0) def _hz_friendly_to_full(hz_string): try: hz_string = hz_string.strip().lower() hz, scale = (None, None) if hz_string.endswith('ghz'): scale = 9 elif hz_string.endswith('mhz'): scale = 6 elif hz_string.endswith('hz'): scale = 0 hz = "".join(n for n in hz_string if n.isdigit() or n=='.').strip() if not '.' in hz: hz += '.0' hz, scale = _hz_short_to_full(hz, scale) return (hz, scale) except Exception: return (0, 0) def _hz_short_to_friendly(ticks, scale): try: # Get the raw Hz as a string left, right = _hz_short_to_full(ticks, scale) result = '{0}.{1}'.format(left, right) # Get the location of the dot, and remove said dot dot_index = result.index('.') result = result.replace('.', '') # Get the Hz symbol and scale symbol = "Hz" scale = 0 if dot_index > 9: symbol = "GHz" scale = 9 elif dot_index > 6: symbol = "MHz" scale = 6 elif dot_index > 3: symbol = "KHz" scale = 3 # Get the Hz with the dot at the new scaled point result = '{0}.{1}'.format(result[:-scale-1], result[-scale-1:]) # Format the ticks to have 4 numbers after the decimal # and remove any superfluous zeroes. result = '{0:.4f} {1}'.format(float(result), symbol) result = result.rstrip('0') return result except Exception: return '0.0000 Hz' def _to_friendly_bytes(input): import re if not input: return input input = "{0}".format(input) formats = { r"^[0-9]+B$" : 'B', r"^[0-9]+K$" : 'KB', r"^[0-9]+M$" : 'MB', r"^[0-9]+G$" : 'GB' } for pattern, friendly_size in formats.items(): if re.match(pattern, input): return "{0} {1}".format(input[ : -1].strip(), friendly_size) return input def _friendly_bytes_to_int(friendly_bytes): input = friendly_bytes.lower() formats = [ {'gib' : 1024 * 1024 * 1024}, {'mib' : 1024 * 1024}, {'kib' : 1024}, {'gb' : 1024 * 1024 * 1024}, {'mb' : 1024 * 1024}, {'kb' : 1024}, {'g' : 1024 * 1024 * 1024}, {'m' : 1024 * 1024}, {'k' : 1024}, {'b' : 1}, ] try: for entry in formats: pattern = list(entry.keys())[0] multiplier = list(entry.values())[0] if input.endswith(pattern): return int(input.split(pattern)[0].strip()) * multiplier except Exception as err: pass return friendly_bytes def _parse_cpu_brand_string(cpu_string): # Just return 0 if the processor brand does not have the Hz if not 'hz' in cpu_string.lower(): return ('0.0', 0) hz = cpu_string.lower() scale = 0 if hz.endswith('mhz'): scale = 6 elif hz.endswith('ghz'): scale = 9 if '@' in hz: hz = hz.split('@')[1] else: hz = hz.rsplit(None, 1)[1] hz = hz.rstrip('mhz').rstrip('ghz').strip() hz = _to_decimal_string(hz) return (hz, scale) def _parse_cpu_brand_string_dx(cpu_string): import re # Find all the strings inside brackets () starts = [m.start() for m in re.finditer(r"\(", cpu_string)] ends = [m.start() for m in re.finditer(r"\)", cpu_string)] insides = {k: v for k, v in zip(starts, ends)} insides = [cpu_string[start+1 : end] for start, end in insides.items()] # Find all the fields vendor_id, stepping, model, family = (None, None, None, None) for inside in insides: for pair in inside.split(','): pair = [n.strip() for n in pair.split(':')] if len(pair) > 1: name, value = pair[0], pair[1] if name == 'origin': vendor_id = value.strip('"') elif name == 'stepping': stepping = int(value.lstrip('0x'), 16) elif name == 'model': model = int(value.lstrip('0x'), 16) elif name in ['fam', 'family']: family = int(value.lstrip('0x'), 16) # Find the Processor Brand # Strip off extra strings in brackets at end brand = cpu_string.strip() is_working = True while is_working: is_working = False for inside in insides: full = "({0})".format(inside) if brand.endswith(full): brand = brand[ :-len(full)].strip() is_working = True # Find the Hz in the brand string hz_brand, scale = _parse_cpu_brand_string(brand) # Find Hz inside brackets () after the brand string if hz_brand == '0.0': for inside in insides: hz = inside for entry in ['GHz', 'MHz', 'Hz']: if entry in hz: hz = "CPU @ " + hz[ : hz.find(entry) + len(entry)] hz_brand, scale = _parse_cpu_brand_string(hz) break return (hz_brand, scale, brand, vendor_id, stepping, model, family) def _parse_dmesg_output(output): try: # Get all the dmesg lines that might contain a CPU string lines = output.split(' CPU0:')[1:] + \ output.split(' CPU1:')[1:] + \ output.split(' CPU:')[1:] + \ output.split('\nCPU0:')[1:] + \ output.split('\nCPU1:')[1:] + \ output.split('\nCPU:')[1:] lines = [l.split('\n')[0].strip() for l in lines] # Convert the lines to CPU strings cpu_strings = [_parse_cpu_brand_string_dx(l) for l in lines] # Find the CPU string that has the most fields best_string = None highest_count = 0 for cpu_string in cpu_strings: count = sum([n is not None for n in cpu_string]) if count > highest_count: highest_count = count best_string = cpu_string # If no CPU string was found, return {} if not best_string: return {} hz_actual, scale, processor_brand, vendor_id, stepping, model, family = best_string # Origin if ' Origin=' in output: fields = output[output.find(' Origin=') : ].split('\n')[0] fields = fields.strip().split() fields = [n.strip().split('=') for n in fields] fields = [{n[0].strip().lower() : n[1].strip()} for n in fields] for field in fields: name = list(field.keys())[0] value = list(field.values())[0] if name == 'origin': vendor_id = value.strip('"') elif name == 'stepping': stepping = int(value.lstrip('0x'), 16) elif name == 'model': model = int(value.lstrip('0x'), 16) elif name in ['fam', 'family']: family = int(value.lstrip('0x'), 16) # Features flag_lines = [] for category in [' Features=', ' Features2=', ' AMD Features=', ' AMD Features2=']: if category in output: flag_lines.append(output.split(category)[1].split('\n')[0]) flags = [] for line in flag_lines: line = line.split('<')[1].split('>')[0].lower() for flag in line.split(','): flags.append(flag) flags.sort() # Convert from GHz/MHz string to Hz hz_advertised, scale = _parse_cpu_brand_string(processor_brand) # If advertised hz not found, use the actual hz if hz_advertised == '0.0': scale = 6 hz_advertised = _to_decimal_string(hz_actual) info = { 'vendor_id_raw' : vendor_id, 'brand_raw' : processor_brand, 'stepping' : stepping, 'model' : model, 'family' : family, 'flags' : flags } if hz_advertised and hz_advertised != '0.0': info['hz_advertised_friendly'] = _hz_short_to_friendly(hz_advertised, scale) info['hz_actual_friendly'] = _hz_short_to_friendly(hz_actual, scale) if hz_advertised and hz_advertised != '0.0': info['hz_advertised'] = _hz_short_to_full(hz_advertised, scale) info['hz_actual'] = _hz_short_to_full(hz_actual, scale) return {k: v for k, v in info.items() if v} except Exception as err: g_trace.fail(err) #raise return {} def _parse_arch(arch_string_raw): import re arch, bits = None, None arch_string_raw = arch_string_raw.lower() # X86 if re.match(r'^i\d86$|^x86$|^x86_32$|^i86pc$|^ia32$|^ia-32$|^bepc$', arch_string_raw): arch = 'X86_32' bits = 32 elif re.match(r'^x64$|^x86_64$|^x86_64t$|^i686-64$|^amd64$|^ia64$|^ia-64$', arch_string_raw): arch = 'X86_64' bits = 64 # ARM elif re.match(r'^armv8-a|aarch64|arm64$', arch_string_raw): arch = 'ARM_8' bits = 64 elif re.match(r'^armv7$|^armv7[a-z]$|^armv7-[a-z]$|^armv6[a-z]$', arch_string_raw): arch = 'ARM_7' bits = 32 elif re.match(r'^armv8$|^armv8[a-z]$|^armv8-[a-z]$', arch_string_raw): arch = 'ARM_8' bits = 32 # PPC elif re.match(r'^ppc32$|^prep$|^pmac$|^powermac$', arch_string_raw): arch = 'PPC_32' bits = 32 elif re.match(r'^powerpc$|^ppc64$|^ppc64le$', arch_string_raw): arch = 'PPC_64' bits = 64 # SPARC elif re.match(r'^sparc32$|^sparc$', arch_string_raw): arch = 'SPARC_32' bits = 32 elif re.match(r'^sparc64$|^sun4u$|^sun4v$', arch_string_raw): arch = 'SPARC_64' bits = 64 # S390X elif re.match(r'^s390x$', arch_string_raw): arch = 'S390X' bits = 64 elif arch_string_raw == 'mips': arch = 'MIPS_32' bits = 32 elif arch_string_raw == 'mips64': arch = 'MIPS_64' bits = 64 # RISCV elif re.match(r'^riscv$|^riscv32$|^riscv32be$', arch_string_raw): arch = 'RISCV_32' bits = 32 elif re.match(r'^riscv64$|^riscv64be$', arch_string_raw): arch = 'RISCV_64' bits = 64 return (arch, bits) def _is_bit_set(reg, bit): mask = 1 << bit is_set = reg & mask > 0 return is_set def _is_selinux_enforcing(trace): # Just return if the SE Linux Status Tool is not installed if not DataSource.has_sestatus(): trace.fail('Failed to find sestatus.') return False # Run the sestatus, and just return if it failed to run returncode, output = DataSource.sestatus_b() if returncode != 0: trace.fail('Failed to run sestatus. Skipping ...') return False # Figure out if explicitly in enforcing mode for line in output.splitlines(): line = line.strip().lower() if line.startswith("current mode:"): if line.endswith("enforcing"): return True else: return False # Figure out if we can execute heap and execute memory can_selinux_exec_heap = False can_selinux_exec_memory = False for line in output.splitlines(): line = line.strip().lower() if line.startswith("allow_execheap") and line.endswith("on"): can_selinux_exec_heap = True elif line.startswith("allow_execmem") and line.endswith("on"): can_selinux_exec_memory = True trace.command_output('can_selinux_exec_heap:', can_selinux_exec_heap) trace.command_output('can_selinux_exec_memory:', can_selinux_exec_memory) return (not can_selinux_exec_heap or not can_selinux_exec_memory) def _filter_dict_keys_with_empty_values(info, acceptable_values = {}): filtered_info = {} for key in info: value = info[key] # Keep if value is acceptable if key in acceptable_values: if acceptable_values[key] == value: filtered_info[key] = value continue # Filter out None, 0, "", (), {}, [] if not value: continue # Filter out (0, 0) if value == (0, 0): continue # Filter out -1 if value == -1: continue # Filter out strings that start with "0.0" if type(value) == str and value.startswith('0.0'): continue filtered_info[key] = value return filtered_info class ASM(object): def __init__(self, restype=None, argtypes=(), machine_code=[]): self.restype = restype self.argtypes = argtypes self.machine_code = machine_code self.prochandle = None self.mm = None self.func = None self.address = None self.size = 0 def compile(self): machine_code = bytes.join(b'', self.machine_code) self.size = ctypes.c_size_t(len(machine_code)) if DataSource.is_windows: # Allocate a memory segment the size of the machine code, and make it executable size = len(machine_code) # Alloc at least 1 page to ensure we own all pages that we want to change protection on if size < 0x1000: size = 0x1000 MEM_COMMIT = ctypes.c_ulong(0x1000) PAGE_READWRITE = ctypes.c_ulong(0x4) pfnVirtualAlloc = ctypes.windll.kernel32.VirtualAlloc pfnVirtualAlloc.restype = ctypes.c_void_p self.address = pfnVirtualAlloc(None, ctypes.c_size_t(size), MEM_COMMIT, PAGE_READWRITE) if not self.address: raise Exception("Failed to VirtualAlloc") # Copy the machine code into the memory segment memmove = ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_size_t)(ctypes._memmove_addr) if memmove(self.address, machine_code, size) < 0: raise Exception("Failed to memmove") # Enable execute permissions PAGE_EXECUTE = ctypes.c_ulong(0x10) old_protect = ctypes.c_ulong(0) pfnVirtualProtect = ctypes.windll.kernel32.VirtualProtect res = pfnVirtualProtect(ctypes.c_void_p(self.address), ctypes.c_size_t(size), PAGE_EXECUTE, ctypes.byref(old_protect)) if not res: raise Exception("Failed VirtualProtect") # Flush Instruction Cache # First, get process Handle if not self.prochandle: pfnGetCurrentProcess = ctypes.windll.kernel32.GetCurrentProcess pfnGetCurrentProcess.restype = ctypes.c_void_p self.prochandle = ctypes.c_void_p(pfnGetCurrentProcess()) # Actually flush cache res = ctypes.windll.kernel32.FlushInstructionCache(self.prochandle, ctypes.c_void_p(self.address), ctypes.c_size_t(size)) if not res: raise Exception("Failed FlushInstructionCache") else: from mmap import mmap, MAP_PRIVATE, MAP_ANONYMOUS, PROT_WRITE, PROT_READ, PROT_EXEC # Allocate a private and executable memory segment the size of the machine code machine_code = bytes.join(b'', self.machine_code) self.size = len(machine_code) self.mm = mmap(-1, self.size, flags=MAP_PRIVATE | MAP_ANONYMOUS, prot=PROT_WRITE | PROT_READ | PROT_EXEC) # Copy the machine code into the memory segment self.mm.write(machine_code) self.address = ctypes.addressof(ctypes.c_int.from_buffer(self.mm)) # Cast the memory segment into a function functype = ctypes.CFUNCTYPE(self.restype, *self.argtypes) self.func = functype(self.address) def run(self): # Call the machine code like a function retval = self.func() return retval def free(self): # Free the function memory segment if DataSource.is_windows: MEM_RELEASE = ctypes.c_ulong(0x8000) ctypes.windll.kernel32.VirtualFree(ctypes.c_void_p(self.address), ctypes.c_size_t(0), MEM_RELEASE) else: self.mm.close() self.prochandle = None self.mm = None self.func = None self.address = None self.size = 0 class CPUID(object): def __init__(self, trace=None): if trace is None: trace = Trace(False, False) # Figure out if SE Linux is on and in enforcing mode self.is_selinux_enforcing = _is_selinux_enforcing(trace) def _asm_func(self, restype=None, argtypes=(), machine_code=[]): asm = ASM(restype, argtypes, machine_code) asm.compile() return asm def _run_asm(self, *machine_code): asm = ASM(ctypes.c_uint32, (), machine_code) asm.compile() retval = asm.run() asm.free() return retval # http://en.wikipedia.org/wiki/CPUID#EAX.3D0:_Get_vendor_ID def get_vendor_id(self): # EBX ebx = self._run_asm( b"\x31\xC0", # xor eax,eax b"\x0F\xA2" # cpuid b"\x89\xD8" # mov ax,bx b"\xC3" # ret ) # ECX ecx = self._run_asm( b"\x31\xC0", # xor eax,eax b"\x0f\xa2" # cpuid b"\x89\xC8" # mov ax,cx b"\xC3" # ret ) # EDX edx = self._run_asm( b"\x31\xC0", # xor eax,eax b"\x0f\xa2" # cpuid b"\x89\xD0" # mov ax,dx b"\xC3" # ret ) # Each 4bits is a ascii letter in the name vendor_id = [] for reg in [ebx, edx, ecx]: for n in [0, 8, 16, 24]: vendor_id.append(chr((reg >> n) & 0xFF)) vendor_id = ''.join(vendor_id) return vendor_id # http://en.wikipedia.org/wiki/CPUID#EAX.3D1:_Processor_Info_and_Feature_Bits def get_info(self): # EAX eax = self._run_asm( b"\xB8\x01\x00\x00\x00", # mov eax,0x1" b"\x0f\xa2" # cpuid b"\xC3" # ret ) # Get the CPU info stepping_id = (eax >> 0) & 0xF # 4 bits model = (eax >> 4) & 0xF # 4 bits family_id = (eax >> 8) & 0xF # 4 bits processor_type = (eax >> 12) & 0x3 # 2 bits extended_model_id = (eax >> 16) & 0xF # 4 bits extended_family_id = (eax >> 20) & 0xFF # 8 bits family = 0 if family_id in [15]: family = extended_family_id + family_id else: family = family_id if family_id in [6, 15]: model = (extended_model_id << 4) + model return { 'stepping' : stepping_id, 'model' : model, 'family' : family, 'processor_type' : processor_type } # http://en.wikipedia.org/wiki/CPUID#EAX.3D80000000h:_Get_Highest_Extended_Function_Supported def get_max_extension_support(self): # Check for extension support max_extension_support = self._run_asm( b"\xB8\x00\x00\x00\x80" # mov ax,0x80000000 b"\x0f\xa2" # cpuid b"\xC3" # ret ) return max_extension_support # http://en.wikipedia.org/wiki/CPUID#EAX.3D1:_Processor_Info_and_Feature_Bits def get_flags(self, max_extension_support): # EDX edx = self._run_asm( b"\xB8\x01\x00\x00\x00", # mov eax,0x1" b"\x0f\xa2" # cpuid b"\x89\xD0" # mov ax,dx b"\xC3" # ret ) # ECX ecx = self._run_asm( b"\xB8\x01\x00\x00\x00", # mov eax,0x1" b"\x0f\xa2" # cpuid b"\x89\xC8" # mov ax,cx b"\xC3" # ret ) # Get the CPU flags flags = { 'fpu' : _is_bit_set(edx, 0), 'vme' : _is_bit_set(edx, 1), 'de' : _is_bit_set(edx, 2), 'pse' : _is_bit_set(edx, 3), 'tsc' : _is_bit_set(edx, 4), 'msr' : _is_bit_set(edx, 5), 'pae' : _is_bit_set(edx, 6), 'mce' : _is_bit_set(edx, 7), 'cx8' : _is_bit_set(edx, 8), 'apic' : _is_bit_set(edx, 9), #'reserved1' : _is_bit_set(edx, 10), 'sep' : _is_bit_set(edx, 11), 'mtrr' : _is_bit_set(edx, 12), 'pge' : _is_bit_set(edx, 13), 'mca' : _is_bit_set(edx, 14), 'cmov' : _is_bit_set(edx, 15), 'pat' : _is_bit_set(edx, 16), 'pse36' : _is_bit_set(edx, 17), 'pn' : _is_bit_set(edx, 18), 'clflush' : _is_bit_set(edx, 19), #'reserved2' : _is_bit_set(edx, 20), 'dts' : _is_bit_set(edx, 21), 'acpi' : _is_bit_set(edx, 22), 'mmx' : _is_bit_set(edx, 23), 'fxsr' : _is_bit_set(edx, 24), 'sse' : _is_bit_set(edx, 25), 'sse2' : _is_bit_set(edx, 26), 'ss' : _is_bit_set(edx, 27), 'ht' : _is_bit_set(edx, 28), 'tm' : _is_bit_set(edx, 29), 'ia64' : _is_bit_set(edx, 30), 'pbe' : _is_bit_set(edx, 31), 'pni' : _is_bit_set(ecx, 0), 'pclmulqdq' : _is_bit_set(ecx, 1), 'dtes64' : _is_bit_set(ecx, 2), 'monitor' : _is_bit_set(ecx, 3), 'ds_cpl' : _is_bit_set(ecx, 4), 'vmx' : _is_bit_set(ecx, 5), 'smx' : _is_bit_set(ecx, 6), 'est' : _is_bit_set(ecx, 7), 'tm2' : _is_bit_set(ecx, 8), 'ssse3' : _is_bit_set(ecx, 9), 'cid' : _is_bit_set(ecx, 10), #'reserved3' : _is_bit_set(ecx, 11), 'fma' : _is_bit_set(ecx, 12), 'cx16' : _is_bit_set(ecx, 13), 'xtpr' : _is_bit_set(ecx, 14), 'pdcm' : _is_bit_set(ecx, 15), #'reserved4' : _is_bit_set(ecx, 16), 'pcid' : _is_bit_set(ecx, 17), 'dca' : _is_bit_set(ecx, 18), 'sse4_1' : _is_bit_set(ecx, 19), 'sse4_2' : _is_bit_set(ecx, 20), 'x2apic' : _is_bit_set(ecx, 21), 'movbe' : _is_bit_set(ecx, 22), 'popcnt' : _is_bit_set(ecx, 23), 'tscdeadline' : _is_bit_set(ecx, 24), 'aes' : _is_bit_set(ecx, 25), 'xsave' : _is_bit_set(ecx, 26), 'osxsave' : _is_bit_set(ecx, 27), 'avx' : _is_bit_set(ecx, 28), 'f16c' : _is_bit_set(ecx, 29), 'rdrnd' : _is_bit_set(ecx, 30), 'hypervisor' : _is_bit_set(ecx, 31) } # Get a list of only the flags that are true flags = [k for k, v in flags.items() if v] # http://en.wikipedia.org/wiki/CPUID#EAX.3D7.2C_ECX.3D0:_Extended_Features if max_extension_support >= 7: # EBX ebx = self._run_asm( b"\x31\xC9", # xor ecx,ecx b"\xB8\x07\x00\x00\x00" # mov eax,7 b"\x0f\xa2" # cpuid b"\x89\xD8" # mov ax,bx b"\xC3" # ret ) # ECX ecx = self._run_asm( b"\x31\xC9", # xor ecx,ecx b"\xB8\x07\x00\x00\x00" # mov eax,7 b"\x0f\xa2" # cpuid b"\x89\xC8" # mov ax,cx b"\xC3" # ret ) # Get the extended CPU flags extended_flags = { #'fsgsbase' : _is_bit_set(ebx, 0), #'IA32_TSC_ADJUST' : _is_bit_set(ebx, 1), 'sgx' : _is_bit_set(ebx, 2), 'bmi1' : _is_bit_set(ebx, 3), 'hle' : _is_bit_set(ebx, 4), 'avx2' : _is_bit_set(ebx, 5), #'reserved' : _is_bit_set(ebx, 6), 'smep' : _is_bit_set(ebx, 7), 'bmi2' : _is_bit_set(ebx, 8), 'erms' : _is_bit_set(ebx, 9), 'invpcid' : _is_bit_set(ebx, 10), 'rtm' : _is_bit_set(ebx, 11), 'pqm' : _is_bit_set(ebx, 12), #'FPU CS and FPU DS deprecated' : _is_bit_set(ebx, 13), 'mpx' : _is_bit_set(ebx, 14), 'pqe' : _is_bit_set(ebx, 15), 'avx512f' : _is_bit_set(ebx, 16), 'avx512dq' : _is_bit_set(ebx, 17), 'rdseed' : _is_bit_set(ebx, 18), 'adx' : _is_bit_set(ebx, 19), 'smap' : _is_bit_set(ebx, 20), 'avx512ifma' : _is_bit_set(ebx, 21), 'pcommit' : _is_bit_set(ebx, 22), 'clflushopt' : _is_bit_set(ebx, 23), 'clwb' : _is_bit_set(ebx, 24), 'intel_pt' : _is_bit_set(ebx, 25), 'avx512pf' : _is_bit_set(ebx, 26), 'avx512er' : _is_bit_set(ebx, 27), 'avx512cd' : _is_bit_set(ebx, 28), 'sha' : _is_bit_set(ebx, 29), 'avx512bw' : _is_bit_set(ebx, 30), 'avx512vl' : _is_bit_set(ebx, 31), 'prefetchwt1' : _is_bit_set(ecx, 0), 'avx512vbmi' : _is_bit_set(ecx, 1), 'umip' : _is_bit_set(ecx, 2), 'pku' : _is_bit_set(ecx, 3), 'ospke' : _is_bit_set(ecx, 4), #'reserved' : _is_bit_set(ecx, 5), 'avx512vbmi2' : _is_bit_set(ecx, 6), #'reserved' : _is_bit_set(ecx, 7), 'gfni' : _is_bit_set(ecx, 8), 'vaes' : _is_bit_set(ecx, 9), 'vpclmulqdq' : _is_bit_set(ecx, 10), 'avx512vnni' : _is_bit_set(ecx, 11), 'avx512bitalg' : _is_bit_set(ecx, 12), #'reserved' : _is_bit_set(ecx, 13), 'avx512vpopcntdq' : _is_bit_set(ecx, 14), #'reserved' : _is_bit_set(ecx, 15), #'reserved' : _is_bit_set(ecx, 16), #'mpx0' : _is_bit_set(ecx, 17), #'mpx1' : _is_bit_set(ecx, 18), #'mpx2' : _is_bit_set(ecx, 19), #'mpx3' : _is_bit_set(ecx, 20), #'mpx4' : _is_bit_set(ecx, 21), 'rdpid' : _is_bit_set(ecx, 22), #'reserved' : _is_bit_set(ecx, 23), #'reserved' : _is_bit_set(ecx, 24), #'reserved' : _is_bit_set(ecx, 25), #'reserved' : _is_bit_set(ecx, 26), #'reserved' : _is_bit_set(ecx, 27), #'reserved' : _is_bit_set(ecx, 28), #'reserved' : _is_bit_set(ecx, 29), 'sgx_lc' : _is_bit_set(ecx, 30), #'reserved' : _is_bit_set(ecx, 31) } # Get a list of only the flags that are true extended_flags = [k for k, v in extended_flags.items() if v] flags += extended_flags # http://en.wikipedia.org/wiki/CPUID#EAX.3D80000001h:_Extended_Processor_Info_and_Feature_Bits if max_extension_support >= 0x80000001: # EBX ebx = self._run_asm( b"\xB8\x01\x00\x00\x80" # mov ax,0x80000001 b"\x0f\xa2" # cpuid b"\x89\xD8" # mov ax,bx b"\xC3" # ret ) # ECX ecx = self._run_asm( b"\xB8\x01\x00\x00\x80" # mov ax,0x80000001 b"\x0f\xa2" # cpuid b"\x89\xC8" # mov ax,cx b"\xC3" # ret ) # Get the extended CPU flags extended_flags = { 'fpu' : _is_bit_set(ebx, 0), 'vme' : _is_bit_set(ebx, 1), 'de' : _is_bit_set(ebx, 2), 'pse' : _is_bit_set(ebx, 3), 'tsc' : _is_bit_set(ebx, 4), 'msr' : _is_bit_set(ebx, 5), 'pae' : _is_bit_set(ebx, 6), 'mce' : _is_bit_set(ebx, 7), 'cx8' : _is_bit_set(ebx, 8), 'apic' : _is_bit_set(ebx, 9), #'reserved' : _is_bit_set(ebx, 10), 'syscall' : _is_bit_set(ebx, 11), 'mtrr' : _is_bit_set(ebx, 12), 'pge' : _is_bit_set(ebx, 13), 'mca' : _is_bit_set(ebx, 14), 'cmov' : _is_bit_set(ebx, 15), 'pat' : _is_bit_set(ebx, 16), 'pse36' : _is_bit_set(ebx, 17), #'reserved' : _is_bit_set(ebx, 18), 'mp' : _is_bit_set(ebx, 19), 'nx' : _is_bit_set(ebx, 20), #'reserved' : _is_bit_set(ebx, 21), 'mmxext' : _is_bit_set(ebx, 22), 'mmx' : _is_bit_set(ebx, 23), 'fxsr' : _is_bit_set(ebx, 24), 'fxsr_opt' : _is_bit_set(ebx, 25), 'pdpe1gp' : _is_bit_set(ebx, 26), 'rdtscp' : _is_bit_set(ebx, 27), #'reserved' : _is_bit_set(ebx, 28), 'lm' : _is_bit_set(ebx, 29), '3dnowext' : _is_bit_set(ebx, 30), '3dnow' : _is_bit_set(ebx, 31), 'lahf_lm' : _is_bit_set(ecx, 0), 'cmp_legacy' : _is_bit_set(ecx, 1), 'svm' : _is_bit_set(ecx, 2), 'extapic' : _is_bit_set(ecx, 3), 'cr8_legacy' : _is_bit_set(ecx, 4), 'abm' : _is_bit_set(ecx, 5), 'sse4a' : _is_bit_set(ecx, 6), 'misalignsse' : _is_bit_set(ecx, 7), '3dnowprefetch' : _is_bit_set(ecx, 8), 'osvw' : _is_bit_set(ecx, 9), 'ibs' : _is_bit_set(ecx, 10), 'xop' : _is_bit_set(ecx, 11), 'skinit' : _is_bit_set(ecx, 12), 'wdt' : _is_bit_set(ecx, 13), #'reserved' : _is_bit_set(ecx, 14), 'lwp' : _is_bit_set(ecx, 15), 'fma4' : _is_bit_set(ecx, 16), 'tce' : _is_bit_set(ecx, 17), #'reserved' : _is_bit_set(ecx, 18), 'nodeid_msr' : _is_bit_set(ecx, 19), #'reserved' : _is_bit_set(ecx, 20), 'tbm' : _is_bit_set(ecx, 21), 'topoext' : _is_bit_set(ecx, 22), 'perfctr_core' : _is_bit_set(ecx, 23), 'perfctr_nb' : _is_bit_set(ecx, 24), #'reserved' : _is_bit_set(ecx, 25), 'dbx' : _is_bit_set(ecx, 26), 'perftsc' : _is_bit_set(ecx, 27), 'pci_l2i' : _is_bit_set(ecx, 28), #'reserved' : _is_bit_set(ecx, 29), #'reserved' : _is_bit_set(ecx, 30), #'reserved' : _is_bit_set(ecx, 31) } # Get a list of only the flags that are true extended_flags = [k for k, v in extended_flags.items() if v] flags += extended_flags flags.sort() return flags # http://en.wikipedia.org/wiki/CPUID#EAX.3D80000002h.2C80000003h.2C80000004h:_Processor_Brand_String def get_processor_brand(self, max_extension_support): processor_brand = "" # Processor brand string if max_extension_support >= 0x80000004: instructions = [ b"\xB8\x02\x00\x00\x80", # mov ax,0x80000002 b"\xB8\x03\x00\x00\x80", # mov ax,0x80000003 b"\xB8\x04\x00\x00\x80" # mov ax,0x80000004 ] for instruction in instructions: # EAX eax = self._run_asm( instruction, # mov ax,0x8000000? b"\x0f\xa2" # cpuid b"\x89\xC0" # mov ax,ax b"\xC3" # ret ) # EBX ebx = self._run_asm( instruction, # mov ax,0x8000000? b"\x0f\xa2" # cpuid b"\x89\xD8" # mov ax,bx b"\xC3" # ret ) # ECX ecx = self._run_asm( instruction, # mov ax,0x8000000? b"\x0f\xa2" # cpuid b"\x89\xC8" # mov ax,cx b"\xC3" # ret ) # EDX edx = self._run_asm( instruction, # mov ax,0x8000000? b"\x0f\xa2" # cpuid b"\x89\xD0" # mov ax,dx b"\xC3" # ret ) # Combine each of the 4 bytes in each register into the string for reg in [eax, ebx, ecx, edx]: for n in [0, 8, 16, 24]: processor_brand += chr((reg >> n) & 0xFF) # Strip off any trailing NULL terminators and white space processor_brand = processor_brand.strip("\0").strip() return processor_brand # http://en.wikipedia.org/wiki/CPUID#EAX.3D80000006h:_Extended_L2_Cache_Features def get_cache(self, max_extension_support): cache_info = {} # Just return if the cache feature is not supported if max_extension_support < 0x80000006: return cache_info # ECX ecx = self._run_asm( b"\xB8\x06\x00\x00\x80" # mov ax,0x80000006 b"\x0f\xa2" # cpuid b"\x89\xC8" # mov ax,cx b"\xC3" # ret ) cache_info = { 'size_b' : (ecx & 0xFF) * 1024, 'associativity' : (ecx >> 12) & 0xF, 'line_size_b' : (ecx >> 16) & 0xFFFF } return cache_info def get_ticks_func(self): retval = None if DataSource.bits == '32bit': # Works on x86_32 restype = None argtypes = (ctypes.POINTER(ctypes.c_uint), ctypes.POINTER(ctypes.c_uint)) get_ticks_x86_32 = self._asm_func(restype, argtypes, [ b"\x55", # push bp b"\x89\xE5", # mov bp,sp b"\x31\xC0", # xor ax,ax b"\x0F\xA2", # cpuid b"\x0F\x31", # rdtsc b"\x8B\x5D\x08", # mov bx,[di+0x8] b"\x8B\x4D\x0C", # mov cx,[di+0xc] b"\x89\x13", # mov [bp+di],dx b"\x89\x01", # mov [bx+di],ax b"\x5D", # pop bp b"\xC3" # ret ] ) # Monkey patch func to combine high and low args into one return old_func = get_ticks_x86_32.func def new_func(): # Pass two uint32s into function high = ctypes.c_uint32(0) low = ctypes.c_uint32(0) old_func(ctypes.byref(high), ctypes.byref(low)) # Shift the two uint32s into one uint64 retval = ((high.value << 32) & 0xFFFFFFFF00000000) | low.value return retval get_ticks_x86_32.func = new_func retval = get_ticks_x86_32 elif DataSource.bits == '64bit': # Works on x86_64 restype = ctypes.c_uint64 argtypes = () get_ticks_x86_64 = self._asm_func(restype, argtypes, [ b"\x48", # dec ax b"\x31\xC0", # xor ax,ax b"\x0F\xA2", # cpuid b"\x0F\x31", # rdtsc b"\x48", # dec ax b"\xC1\xE2\x20", # shl dx,byte 0x20 b"\x48", # dec ax b"\x09\xD0", # or ax,dx b"\xC3", # ret ] ) retval = get_ticks_x86_64 return retval def get_raw_hz(self): from time import sleep ticks_fn = self.get_ticks_func() start = ticks_fn.func() sleep(1) end = ticks_fn.func() ticks = (end - start) ticks_fn.free() return ticks def _get_cpu_info_from_cpuid_actual(): ''' Warning! This function has the potential to crash the Python runtime. Do not call it directly. Use the _get_cpu_info_from_cpuid function instead. It will safely call this function in another process. ''' from io import StringIO trace = Trace(True, True) info = {} # Pipe stdout and stderr to strings sys.stdout = trace._stdout sys.stderr = trace._stderr try: # Get the CPU arch and bits arch, bits = _parse_arch(DataSource.arch_string_raw) # Return none if this is not an X86 CPU if not arch in ['X86_32', 'X86_64']: trace.fail('Not running on X86_32 or X86_64. Skipping ...') return trace.to_dict(info, True) # Return none if SE Linux is in enforcing mode cpuid = CPUID(trace) if cpuid.is_selinux_enforcing: trace.fail('SELinux is enforcing. Skipping ...') return trace.to_dict(info, True) # Get the cpu info from the CPUID register max_extension_support = cpuid.get_max_extension_support() cache_info = cpuid.get_cache(max_extension_support) info = cpuid.get_info() processor_brand = cpuid.get_processor_brand(max_extension_support) # Get the Hz and scale hz_actual = cpuid.get_raw_hz() hz_actual = _to_decimal_string(hz_actual) # Get the Hz and scale hz_advertised, scale = _parse_cpu_brand_string(processor_brand) info = { 'vendor_id_raw' : cpuid.get_vendor_id(), 'hardware_raw' : '', 'brand_raw' : processor_brand, 'hz_advertised_friendly' : _hz_short_to_friendly(hz_advertised, scale), 'hz_actual_friendly' : _hz_short_to_friendly(hz_actual, 0), 'hz_advertised' : _hz_short_to_full(hz_advertised, scale), 'hz_actual' : _hz_short_to_full(hz_actual, 0), 'l2_cache_size' : cache_info['size_b'], 'l2_cache_line_size' : cache_info['line_size_b'], 'l2_cache_associativity' : cache_info['associativity'], 'stepping' : info['stepping'], 'model' : info['model'], 'family' : info['family'], 'processor_type' : info['processor_type'], 'flags' : cpuid.get_flags(max_extension_support) } info = _filter_dict_keys_with_empty_values(info) trace.success() except Exception as err: from traceback import format_exc err_string = format_exc() trace._err = ''.join(['\t\t{0}\n'.format(n) for n in err_string.split('\n')]) + '\n' return trace.to_dict(info, True) return trace.to_dict(info, False) def _get_cpu_info_from_cpuid_subprocess_wrapper(queue): orig_stdout = sys.stdout orig_stderr = sys.stderr output = _get_cpu_info_from_cpuid_actual() sys.stdout = orig_stdout sys.stderr = orig_stderr queue.put(_obj_to_b64(output)) def _get_cpu_info_from_cpuid(): ''' Returns the CPU info gathered by querying the X86 cpuid register in a new process. Returns {} on non X86 cpus. Returns {} if SELinux is in enforcing mode. ''' g_trace.header('Tying to get info from CPUID ...') from multiprocessing import Process, Queue # Return {} if can't cpuid if not DataSource.can_cpuid: g_trace.fail('Can\'t CPUID. Skipping ...') return {} # Get the CPU arch and bits arch, bits = _parse_arch(DataSource.arch_string_raw) # Return {} if this is not an X86 CPU if not arch in ['X86_32', 'X86_64']: g_trace.fail('Not running on X86_32 or X86_64. Skipping ...') return {} try: if CAN_CALL_CPUID_IN_SUBPROCESS: # Start running the function in a subprocess queue = Queue() p = Process(target=_get_cpu_info_from_cpuid_subprocess_wrapper, args=(queue,)) p.start() # Wait for the process to end, while it is still alive while p.is_alive(): p.join(0) # Return {} if it failed if p.exitcode != 0: g_trace.fail('Failed to run CPUID in process. Skipping ...') return {} # Return {} if no results if queue.empty(): g_trace.fail('Failed to get anything from CPUID process. Skipping ...') return {} # Return the result, only if there is something to read else: output = _b64_to_obj(queue.get()) import pprint pp = pprint.PrettyPrinter(indent=4) #pp.pprint(output) if 'output' in output and output['output']: g_trace.write(output['output']) if 'stdout' in output and output['stdout']: sys.stdout.write('{0}\n'.format(output['stdout'])) sys.stdout.flush() if 'stderr' in output and output['stderr']: sys.stderr.write('{0}\n'.format(output['stderr'])) sys.stderr.flush() if 'is_fail' not in output: g_trace.fail('Failed to get is_fail from CPUID process. Skipping ...') return {} # Fail if there was an exception if 'err' in output and output['err']: g_trace.fail('Failed to run CPUID in process. Skipping ...') g_trace.write(output['err']) g_trace.write('Failed ...') return {} if 'is_fail' in output and output['is_fail']: g_trace.write('Failed ...') return {} if 'info' not in output or not output['info']: g_trace.fail('Failed to get return info from CPUID process. Skipping ...') return {} return output['info'] else: # FIXME: This should write the values like in the above call to actual orig_stdout = sys.stdout orig_stderr = sys.stderr output = _get_cpu_info_from_cpuid_actual() sys.stdout = orig_stdout sys.stderr = orig_stderr g_trace.success() return output['info'] except Exception as err: g_trace.fail(err) # Return {} if everything failed return {} def _get_cpu_info_from_proc_cpuinfo(): ''' Returns the CPU info gathered from /proc/cpuinfo. Returns {} if /proc/cpuinfo is not found. ''' g_trace.header('Tying to get info from /proc/cpuinfo ...') try: # Just return {} if there is no cpuinfo if not DataSource.has_proc_cpuinfo(): g_trace.fail('Failed to find /proc/cpuinfo. Skipping ...') return {} returncode, output = DataSource.cat_proc_cpuinfo() if returncode != 0: g_trace.fail('Failed to run cat /proc/cpuinfo. Skipping ...') return {} # Various fields vendor_id = _get_field(False, output, None, '', 'vendor_id', 'vendor id', 'vendor') processor_brand = _get_field(True, output, None, None, 'model name', 'cpu', 'processor', 'uarch') cache_size = _get_field(False, output, None, '', 'cache size') stepping = _get_field(False, output, int, -1, 'stepping') model = _get_field(False, output, int, -1, 'model') family = _get_field(False, output, int, -1, 'cpu family') hardware = _get_field(False, output, None, '', 'Hardware') # Flags flags = _get_field(False, output, None, None, 'flags', 'Features', 'ASEs implemented') if flags: flags = flags.split() flags.sort() # Check for other cache format if not cache_size: try: for i in range(0, 10): name = "cache{0}".format(i) value = _get_field(False, output, None, None, name) if value: value = [entry.split('=') for entry in value.split(' ')] value = dict(value) if 'level' in value and value['level'] == '3' and 'size' in value: cache_size = value['size'] break except Exception: pass # Convert from MHz string to Hz hz_actual = _get_field(False, output, None, '', 'cpu MHz', 'cpu speed', 'clock', 'cpu MHz dynamic', 'cpu MHz static') hz_actual = hz_actual.lower().rstrip('mhz').strip() hz_actual = _to_decimal_string(hz_actual) # Convert from GHz/MHz string to Hz hz_advertised, scale = (None, 0) try: hz_advertised, scale = _parse_cpu_brand_string(processor_brand) except Exception: pass info = { 'hardware_raw' : hardware, 'brand_raw' : processor_brand, 'l3_cache_size' : _friendly_bytes_to_int(cache_size), 'flags' : flags, 'vendor_id_raw' : vendor_id, 'stepping' : stepping, 'model' : model, 'family' : family, } # Make the Hz the same for actual and advertised if missing any if not hz_advertised or hz_advertised == '0.0': hz_advertised = hz_actual scale = 6 elif not hz_actual or hz_actual == '0.0': hz_actual = hz_advertised # Add the Hz if there is one if _hz_short_to_full(hz_advertised, scale) > (0, 0): info['hz_advertised_friendly'] = _hz_short_to_friendly(hz_advertised, scale) info['hz_advertised'] = _hz_short_to_full(hz_advertised, scale) if _hz_short_to_full(hz_actual, scale) > (0, 0): info['hz_actual_friendly'] = _hz_short_to_friendly(hz_actual, 6) info['hz_actual'] = _hz_short_to_full(hz_actual, 6) info = _filter_dict_keys_with_empty_values(info, {'stepping':0, 'model':0, 'family':0}) g_trace.success() return info except Exception as err: g_trace.fail(err) #raise # NOTE: To have this throw on error, uncomment this line return {} def _get_cpu_info_from_cpufreq_info(): ''' Returns the CPU info gathered from cpufreq-info. Returns {} if cpufreq-info is not found. ''' g_trace.header('Tying to get info from cpufreq-info ...') try: hz_brand, scale = '0.0', 0 if not DataSource.has_cpufreq_info(): g_trace.fail('Failed to find cpufreq-info. Skipping ...') return {} returncode, output = DataSource.cpufreq_info() if returncode != 0: g_trace.fail('Failed to run cpufreq-info. Skipping ...') return {} hz_brand = output.split('current CPU frequency is')[1].split('\n')[0] i = hz_brand.find('Hz') assert(i != -1) hz_brand = hz_brand[0 : i+2].strip().lower() if hz_brand.endswith('mhz'): scale = 6 elif hz_brand.endswith('ghz'): scale = 9 hz_brand = hz_brand.rstrip('mhz').rstrip('ghz').strip() hz_brand = _to_decimal_string(hz_brand) info = { 'hz_advertised_friendly' : _hz_short_to_friendly(hz_brand, scale), 'hz_actual_friendly' : _hz_short_to_friendly(hz_brand, scale), 'hz_advertised' : _hz_short_to_full(hz_brand, scale), 'hz_actual' : _hz_short_to_full(hz_brand, scale), } info = _filter_dict_keys_with_empty_values(info) g_trace.success() return info except Exception as err: g_trace.fail(err) #raise # NOTE: To have this throw on error, uncomment this line return {} def _get_cpu_info_from_lscpu(): ''' Returns the CPU info gathered from lscpu. Returns {} if lscpu is not found. ''' g_trace.header('Tying to get info from lscpu ...') try: if not DataSource.has_lscpu(): g_trace.fail('Failed to find lscpu. Skipping ...') return {} returncode, output = DataSource.lscpu() if returncode != 0: g_trace.fail('Failed to run lscpu. Skipping ...') return {} info = {} new_hz = _get_field(False, output, None, None, 'CPU max MHz', 'CPU MHz') if new_hz: new_hz = _to_decimal_string(new_hz) scale = 6 info['hz_advertised_friendly'] = _hz_short_to_friendly(new_hz, scale) info['hz_actual_friendly'] = _hz_short_to_friendly(new_hz, scale) info['hz_advertised'] = _hz_short_to_full(new_hz, scale) info['hz_actual'] = _hz_short_to_full(new_hz, scale) new_hz = _get_field(False, output, None, None, 'CPU dynamic MHz', 'CPU static MHz') if new_hz: new_hz = _to_decimal_string(new_hz) scale = 6 info['hz_advertised_friendly'] = _hz_short_to_friendly(new_hz, scale) info['hz_actual_friendly'] = _hz_short_to_friendly(new_hz, scale) info['hz_advertised'] = _hz_short_to_full(new_hz, scale) info['hz_actual'] = _hz_short_to_full(new_hz, scale) vendor_id = _get_field(False, output, None, None, 'Vendor ID') if vendor_id: info['vendor_id_raw'] = vendor_id brand = _get_field(False, output, None, None, 'Model name') if brand: info['brand_raw'] = brand else: brand = _get_field(False, output, None, None, 'Model') if brand and not brand.isdigit(): info['brand_raw'] = brand family = _get_field(False, output, None, None, 'CPU family') if family and family.isdigit(): info['family'] = int(family) stepping = _get_field(False, output, None, None, 'Stepping') if stepping and stepping.isdigit(): info['stepping'] = int(stepping) model = _get_field(False, output, None, None, 'Model') if model and model.isdigit(): info['model'] = int(model) 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 flags = _get_field(False, output, None, None, 'flags', 'Features', 'ASEs implemented') if flags: flags = flags.split() flags.sort() info['flags'] = flags info = _filter_dict_keys_with_empty_values(info, {'stepping':0, 'model':0, 'family':0}) g_trace.success() return info except Exception as err: g_trace.fail(err) #raise # NOTE: To have this throw on error, uncomment this line return {} def _get_cpu_info_from_dmesg(): ''' Returns the CPU info gathered from dmesg. Returns {} if dmesg is not found or does not have the desired info. ''' g_trace.header('Tying to get info from the dmesg ...') # Just return {} if this arch has an unreliable dmesg log arch, bits = _parse_arch(DataSource.arch_string_raw) if arch in ['S390X']: g_trace.fail('Running on S390X. Skipping ...') return {} # Just return {} if there is no dmesg if not DataSource.has_dmesg(): g_trace.fail('Failed to find dmesg. Skipping ...') return {} # If dmesg fails return {} returncode, output = DataSource.dmesg_a() if output is None or returncode != 0: g_trace.fail('Failed to run \"dmesg -a\". Skipping ...') return {} info = _parse_dmesg_output(output) g_trace.success() return info # https://openpowerfoundation.org/wp-content/uploads/2016/05/LoPAPR_DRAFT_v11_24March2016_cmt1.pdf # page 767 def _get_cpu_info_from_ibm_pa_features(): ''' Returns the CPU info gathered from lsprop /proc/device-tree/cpus/*/ibm,pa-features Returns {} if lsprop is not found or ibm,pa-features does not have the desired info. ''' g_trace.header('Tying to get info from lsprop ...') try: # Just return {} if there is no lsprop if not DataSource.has_ibm_pa_features(): g_trace.fail('Failed to find lsprop. Skipping ...') return {} # If ibm,pa-features fails return {} returncode, output = DataSource.ibm_pa_features() if output is None or returncode != 0: g_trace.fail('Failed to glob /proc/device-tree/cpus/*/ibm,pa-features. Skipping ...') return {} # Filter out invalid characters from output value = output.split("ibm,pa-features")[1].lower() value = [s for s in value if s in list('0123456789abcfed')] value = ''.join(value) # Get data converted to Uint32 chunks left = int(value[0 : 8], 16) right = int(value[8 : 16], 16) # Get the CPU flags flags = { # Byte 0 'mmu' : _is_bit_set(left, 0), 'fpu' : _is_bit_set(left, 1), 'slb' : _is_bit_set(left, 2), 'run' : _is_bit_set(left, 3), #'reserved' : _is_bit_set(left, 4), 'dabr' : _is_bit_set(left, 5), 'ne' : _is_bit_set(left, 6), 'wtr' : _is_bit_set(left, 7), # Byte 1 'mcr' : _is_bit_set(left, 8), 'dsisr' : _is_bit_set(left, 9), 'lp' : _is_bit_set(left, 10), 'ri' : _is_bit_set(left, 11), 'dabrx' : _is_bit_set(left, 12), 'sprg3' : _is_bit_set(left, 13), 'rislb' : _is_bit_set(left, 14), 'pp' : _is_bit_set(left, 15), # Byte 2 'vpm' : _is_bit_set(left, 16), 'dss_2.05' : _is_bit_set(left, 17), #'reserved' : _is_bit_set(left, 18), 'dar' : _is_bit_set(left, 19), #'reserved' : _is_bit_set(left, 20), 'ppr' : _is_bit_set(left, 21), 'dss_2.02' : _is_bit_set(left, 22), 'dss_2.06' : _is_bit_set(left, 23), # Byte 3 'lsd_in_dscr' : _is_bit_set(left, 24), 'ugr_in_dscr' : _is_bit_set(left, 25), #'reserved' : _is_bit_set(left, 26), #'reserved' : _is_bit_set(left, 27), #'reserved' : _is_bit_set(left, 28), #'reserved' : _is_bit_set(left, 29), #'reserved' : _is_bit_set(left, 30), #'reserved' : _is_bit_set(left, 31), # Byte 4 'sso_2.06' : _is_bit_set(right, 0), #'reserved' : _is_bit_set(right, 1), #'reserved' : _is_bit_set(right, 2), #'reserved' : _is_bit_set(right, 3), #'reserved' : _is_bit_set(right, 4), #'reserved' : _is_bit_set(right, 5), #'reserved' : _is_bit_set(right, 6), #'reserved' : _is_bit_set(right, 7), # Byte 5 'le' : _is_bit_set(right, 8), 'cfar' : _is_bit_set(right, 9), 'eb' : _is_bit_set(right, 10), 'lsq_2.07' : _is_bit_set(right, 11), #'reserved' : _is_bit_set(right, 12), #'reserved' : _is_bit_set(right, 13), #'reserved' : _is_bit_set(right, 14), #'reserved' : _is_bit_set(right, 15), # Byte 6 'dss_2.07' : _is_bit_set(right, 16), #'reserved' : _is_bit_set(right, 17), #'reserved' : _is_bit_set(right, 18), #'reserved' : _is_bit_set(right, 19), #'reserved' : _is_bit_set(right, 20), #'reserved' : _is_bit_set(right, 21), #'reserved' : _is_bit_set(right, 22), #'reserved' : _is_bit_set(right, 23), # Byte 7 #'reserved' : _is_bit_set(right, 24), #'reserved' : _is_bit_set(right, 25), #'reserved' : _is_bit_set(right, 26), #'reserved' : _is_bit_set(right, 27), #'reserved' : _is_bit_set(right, 28), #'reserved' : _is_bit_set(right, 29), #'reserved' : _is_bit_set(right, 30), #'reserved' : _is_bit_set(right, 31), } # Get a list of only the flags that are true flags = [k for k, v in flags.items() if v] flags.sort() info = { 'flags' : flags } info = _filter_dict_keys_with_empty_values(info) g_trace.success() return info except Exception as err: g_trace.fail(err) return {} def _get_cpu_info_from_cat_var_run_dmesg_boot(): ''' Returns the CPU info gathered from /var/run/dmesg.boot. Returns {} if dmesg is not found or does not have the desired info. ''' g_trace.header('Tying to get info from the /var/run/dmesg.boot log ...') # Just return {} if there is no /var/run/dmesg.boot if not DataSource.has_var_run_dmesg_boot(): g_trace.fail('Failed to find /var/run/dmesg.boot file. Skipping ...') return {} # If dmesg.boot fails return {} returncode, output = DataSource.cat_var_run_dmesg_boot() if output is None or returncode != 0: g_trace.fail('Failed to run \"cat /var/run/dmesg.boot\". Skipping ...') return {} info = _parse_dmesg_output(output) g_trace.success() return info def _get_cpu_info_from_sysctl(): ''' Returns the CPU info gathered from sysctl. Returns {} if sysctl is not found. ''' g_trace.header('Tying to get info from sysctl ...') try: # Just return {} if there is no sysctl if not DataSource.has_sysctl(): g_trace.fail('Failed to find sysctl. Skipping ...') return {} # If sysctl fails return {} returncode, output = DataSource.sysctl_machdep_cpu_hw_cpufrequency() if output is None or returncode != 0: g_trace.fail('Failed to run \"sysctl machdep.cpu hw.cpufrequency\". Skipping ...') return {} # Various fields vendor_id = _get_field(False, output, None, None, 'machdep.cpu.vendor') processor_brand = _get_field(True, output, None, None, 'machdep.cpu.brand_string') cache_size = _get_field(False, output, int, 0, 'machdep.cpu.cache.size') stepping = _get_field(False, output, int, 0, 'machdep.cpu.stepping') model = _get_field(False, output, int, 0, 'machdep.cpu.model') family = _get_field(False, output, int, 0, 'machdep.cpu.family') # Flags flags = _get_field(False, output, None, '', 'machdep.cpu.features').lower().split() flags.extend(_get_field(False, output, None, '', 'machdep.cpu.leaf7_features').lower().split()) flags.extend(_get_field(False, output, None, '', 'machdep.cpu.extfeatures').lower().split()) flags.sort() # Convert from GHz/MHz string to Hz hz_advertised, scale = _parse_cpu_brand_string(processor_brand) hz_actual = _get_field(False, output, None, None, 'hw.cpufrequency') hz_actual = _to_decimal_string(hz_actual) info = { 'vendor_id_raw' : vendor_id, 'brand_raw' : processor_brand, 'hz_advertised_friendly' : _hz_short_to_friendly(hz_advertised, scale), 'hz_actual_friendly' : _hz_short_to_friendly(hz_actual, 0), 'hz_advertised' : _hz_short_to_full(hz_advertised, scale), 'hz_actual' : _hz_short_to_full(hz_actual, 0), 'l2_cache_size' : int(cache_size) * 1024, 'stepping' : stepping, 'model' : model, 'family' : family, 'flags' : flags } info = _filter_dict_keys_with_empty_values(info) g_trace.success() return info except Exception as err: g_trace.fail(err) return {} def _get_cpu_info_from_sysinfo(): ''' Returns the CPU info gathered from sysinfo. Returns {} if sysinfo is not found. ''' info = _get_cpu_info_from_sysinfo_v1() info.update(_get_cpu_info_from_sysinfo_v2()) return info def _get_cpu_info_from_sysinfo_v1(): ''' Returns the CPU info gathered from sysinfo. Returns {} if sysinfo is not found. ''' g_trace.header('Tying to get info from sysinfo version 1 ...') try: # Just return {} if there is no sysinfo if not DataSource.has_sysinfo(): g_trace.fail('Failed to find sysinfo. Skipping ...') return {} # If sysinfo fails return {} returncode, output = DataSource.sysinfo_cpu() if output is None or returncode != 0: g_trace.fail('Failed to run \"sysinfo -cpu\". Skipping ...') return {} # Various fields vendor_id = '' #_get_field(False, output, None, None, 'CPU #0: ') processor_brand = output.split('CPU #0: "')[1].split('"\n')[0].strip() cache_size = '' #_get_field(False, output, None, None, 'machdep.cpu.cache.size') stepping = int(output.split(', stepping ')[1].split(',')[0].strip()) model = int(output.split(', model ')[1].split(',')[0].strip()) family = int(output.split(', family ')[1].split(',')[0].strip()) # Flags flags = [] for line in output.split('\n'): if line.startswith('\t\t'): for flag in line.strip().lower().split(): flags.append(flag) flags.sort() # Convert from GHz/MHz string to Hz hz_advertised, scale = _parse_cpu_brand_string(processor_brand) hz_actual = hz_advertised info = { 'vendor_id_raw' : vendor_id, 'brand_raw' : processor_brand, 'hz_advertised_friendly' : _hz_short_to_friendly(hz_advertised, scale), 'hz_actual_friendly' : _hz_short_to_friendly(hz_actual, scale), 'hz_advertised' : _hz_short_to_full(hz_advertised, scale), 'hz_actual' : _hz_short_to_full(hz_actual, scale), 'l2_cache_size' : _to_friendly_bytes(cache_size), 'stepping' : stepping, 'model' : model, 'family' : family, 'flags' : flags } info = _filter_dict_keys_with_empty_values(info) g_trace.success() return info except Exception as err: g_trace.fail(err) #raise # NOTE: To have this throw on error, uncomment this line return {} def _get_cpu_info_from_sysinfo_v2(): ''' Returns the CPU info gathered from sysinfo. Returns {} if sysinfo is not found. ''' g_trace.header('Tying to get info from sysinfo version 2 ...') try: # Just return {} if there is no sysinfo if not DataSource.has_sysinfo(): g_trace.fail('Failed to find sysinfo. Skipping ...') return {} # If sysinfo fails return {} returncode, output = DataSource.sysinfo_cpu() if output is None or returncode != 0: g_trace.fail('Failed to run \"sysinfo -cpu\". Skipping ...') return {} # Various fields vendor_id = '' #_get_field(False, output, None, None, 'CPU #0: ') processor_brand = output.split('CPU #0: "')[1].split('"\n')[0].strip() cache_size = '' #_get_field(False, output, None, None, 'machdep.cpu.cache.size') signature = output.split('Signature:')[1].split('\n')[0].strip() # stepping = int(signature.split('stepping ')[1].split(',')[0].strip()) model = int(signature.split('model ')[1].split(',')[0].strip()) family = int(signature.split('family ')[1].split(',')[0].strip()) # Flags def get_subsection_flags(output): retval = [] for line in output.split('\n')[1:]: if not line.startswith(' ') and not line.startswith(' '): break for entry in line.strip().lower().split(' '): retval.append(entry) return retval flags = get_subsection_flags(output.split('Features: ')[1]) + \ get_subsection_flags(output.split('Extended Features (0x00000001): ')[1]) + \ get_subsection_flags(output.split('Extended Features (0x80000001): ')[1]) flags.sort() # Convert from GHz/MHz string to Hz lines = [n for n in output.split('\n') if n] raw_hz = lines[0].split('running at ')[1].strip().lower() hz_advertised = raw_hz.rstrip('mhz').rstrip('ghz').strip() hz_advertised = _to_decimal_string(hz_advertised) hz_actual = hz_advertised scale = 0 if raw_hz.endswith('mhz'): scale = 6 elif raw_hz.endswith('ghz'): scale = 9 info = { 'vendor_id_raw' : vendor_id, 'brand_raw' : processor_brand, 'hz_advertised_friendly' : _hz_short_to_friendly(hz_advertised, scale), 'hz_actual_friendly' : _hz_short_to_friendly(hz_actual, scale), 'hz_advertised' : _hz_short_to_full(hz_advertised, scale), 'hz_actual' : _hz_short_to_full(hz_actual, scale), 'l2_cache_size' : _to_friendly_bytes(cache_size), 'stepping' : stepping, 'model' : model, 'family' : family, 'flags' : flags } info = _filter_dict_keys_with_empty_values(info) g_trace.success() return info except Exception as err: g_trace.fail(err) #raise # NOTE: To have this throw on error, uncomment this line return {} def _get_cpu_info_from_wmic(): ''' Returns the CPU info gathered from WMI. Returns {} if not on Windows, or wmic is not installed. ''' g_trace.header('Tying to get info from wmic ...') try: # Just return {} if not Windows or there is no wmic if not DataSource.is_windows or not DataSource.has_wmic(): g_trace.fail('Failed to find WMIC, or not on Windows. Skipping ...') return {} returncode, output = DataSource.wmic_cpu() if output is None or returncode != 0: g_trace.fail('Failed to run wmic. Skipping ...') return {} # Break the list into key values pairs value = output.split("\n") value = [s.rstrip().split('=') for s in value if '=' in s] value = {k: v for k, v in value if v} # Get the advertised MHz processor_brand = value.get('Name') hz_advertised, scale_advertised = _parse_cpu_brand_string(processor_brand) # Get the actual MHz hz_actual = value.get('CurrentClockSpeed') scale_actual = 6 if hz_actual: hz_actual = _to_decimal_string(hz_actual) # Get cache sizes l2_cache_size = value.get('L2CacheSize') # NOTE: L2CacheSize is in kilobytes if l2_cache_size: l2_cache_size = int(l2_cache_size) * 1024 l3_cache_size = value.get('L3CacheSize') # NOTE: L3CacheSize is in kilobytes if l3_cache_size: l3_cache_size = int(l3_cache_size) * 1024 # Get family, model, and stepping family, model, stepping = '', '', '' description = value.get('Description') or value.get('Caption') entries = description.split(' ') if 'Family' in entries and entries.index('Family') < len(entries)-1: i = entries.index('Family') family = int(entries[i + 1]) if 'Model' in entries and entries.index('Model') < len(entries)-1: i = entries.index('Model') model = int(entries[i + 1]) if 'Stepping' in entries and entries.index('Stepping') < len(entries)-1: i = entries.index('Stepping') stepping = int(entries[i + 1]) info = { 'vendor_id_raw' : value.get('Manufacturer'), 'brand_raw' : processor_brand, 'hz_advertised_friendly' : _hz_short_to_friendly(hz_advertised, scale_advertised), 'hz_actual_friendly' : _hz_short_to_friendly(hz_actual, scale_actual), 'hz_advertised' : _hz_short_to_full(hz_advertised, scale_advertised), 'hz_actual' : _hz_short_to_full(hz_actual, scale_actual), 'l2_cache_size' : l2_cache_size, 'l3_cache_size' : l3_cache_size, 'stepping' : stepping, 'model' : model, 'family' : family, } info = _filter_dict_keys_with_empty_values(info) g_trace.success() return info except Exception as err: g_trace.fail(err) #raise # NOTE: To have this throw on error, uncomment this line return {} def _get_cpu_info_from_registry(): ''' Returns the CPU info gathered from the Windows Registry. Returns {} if not on Windows. ''' g_trace.header('Tying to get info from Windows registry ...') try: # Just return {} if not on Windows if not DataSource.is_windows: g_trace.fail('Not running on Windows. Skipping ...') return {} # Get the CPU name processor_brand = DataSource.winreg_processor_brand().strip() # Get the CPU vendor id vendor_id = DataSource.winreg_vendor_id_raw() # Get the CPU arch and bits arch_string_raw = DataSource.winreg_arch_string_raw() arch, bits = _parse_arch(arch_string_raw) # Get the actual CPU Hz hz_actual = DataSource.winreg_hz_actual() hz_actual = _to_decimal_string(hz_actual) # Get the advertised CPU Hz hz_advertised, scale = _parse_cpu_brand_string(processor_brand) # If advertised hz not found, use the actual hz if hz_advertised == '0.0': scale = 6 hz_advertised = _to_decimal_string(hz_actual) # Get the CPU features feature_bits = DataSource.winreg_feature_bits() def is_set(bit): mask = 0x80000000 >> bit retval = mask & feature_bits > 0 return retval # http://en.wikipedia.org/wiki/CPUID # http://unix.stackexchange.com/questions/43539/what-do-the-flags-in-proc-cpuinfo-mean # http://www.lohninger.com/helpcsuite/public_constants_cpuid.htm flags = { 'fpu' : is_set(0), # Floating Point Unit 'vme' : is_set(1), # V86 Mode Extensions 'de' : is_set(2), # Debug Extensions - I/O breakpoints supported 'pse' : is_set(3), # Page Size Extensions (4 MB pages supported) 'tsc' : is_set(4), # Time Stamp Counter and RDTSC instruction are available 'msr' : is_set(5), # Model Specific Registers 'pae' : is_set(6), # Physical Address Extensions (36 bit address, 2MB pages) 'mce' : is_set(7), # Machine Check Exception supported 'cx8' : is_set(8), # Compare Exchange Eight Byte instruction available 'apic' : is_set(9), # Local APIC present (multiprocessor operation support) 'sepamd' : is_set(10), # Fast system calls (AMD only) 'sep' : is_set(11), # Fast system calls 'mtrr' : is_set(12), # Memory Type Range Registers 'pge' : is_set(13), # Page Global Enable 'mca' : is_set(14), # Machine Check Architecture 'cmov' : is_set(15), # Conditional MOVe instructions 'pat' : is_set(16), # Page Attribute Table 'pse36' : is_set(17), # 36 bit Page Size Extensions 'serial' : is_set(18), # Processor Serial Number 'clflush' : is_set(19), # Cache Flush #'reserved1' : is_set(20), # reserved 'dts' : is_set(21), # Debug Trace Store 'acpi' : is_set(22), # ACPI support 'mmx' : is_set(23), # MultiMedia Extensions 'fxsr' : is_set(24), # FXSAVE and FXRSTOR instructions 'sse' : is_set(25), # SSE instructions 'sse2' : is_set(26), # SSE2 (WNI) instructions 'ss' : is_set(27), # self snoop #'reserved2' : is_set(28), # reserved 'tm' : is_set(29), # Automatic clock control 'ia64' : is_set(30), # IA64 instructions '3dnow' : is_set(31) # 3DNow! instructions available } # Get a list of only the flags that are true flags = [k for k, v in flags.items() if v] flags.sort() info = { 'vendor_id_raw' : vendor_id, 'brand_raw' : processor_brand, 'hz_advertised_friendly' : _hz_short_to_friendly(hz_advertised, scale), 'hz_actual_friendly' : _hz_short_to_friendly(hz_actual, 6), 'hz_advertised' : _hz_short_to_full(hz_advertised, scale), 'hz_actual' : _hz_short_to_full(hz_actual, 6), 'flags' : flags } info = _filter_dict_keys_with_empty_values(info) g_trace.success() return info except Exception as err: g_trace.fail(err) return {} def _get_cpu_info_from_kstat(): ''' Returns the CPU info gathered from isainfo and kstat. Returns {} if isainfo or kstat are not found. ''' g_trace.header('Tying to get info from kstat ...') try: # Just return {} if there is no isainfo or kstat if not DataSource.has_isainfo() or not DataSource.has_kstat(): g_trace.fail('Failed to find isinfo or kstat. Skipping ...') return {} # If isainfo fails return {} returncode, flag_output = DataSource.isainfo_vb() if flag_output is None or returncode != 0: g_trace.fail('Failed to run \"isainfo -vb\". Skipping ...') return {} # If kstat fails return {} returncode, kstat = DataSource.kstat_m_cpu_info() if kstat is None or returncode != 0: g_trace.fail('Failed to run \"kstat -m cpu_info\". Skipping ...') return {} # Various fields vendor_id = kstat.split('\tvendor_id ')[1].split('\n')[0].strip() processor_brand = kstat.split('\tbrand ')[1].split('\n')[0].strip() stepping = int(kstat.split('\tstepping ')[1].split('\n')[0].strip()) model = int(kstat.split('\tmodel ')[1].split('\n')[0].strip()) family = int(kstat.split('\tfamily ')[1].split('\n')[0].strip()) # Flags flags = flag_output.strip().split('\n')[-1].strip().lower().split() flags.sort() # Convert from GHz/MHz string to Hz scale = 6 hz_advertised = kstat.split('\tclock_MHz ')[1].split('\n')[0].strip() hz_advertised = _to_decimal_string(hz_advertised) # Convert from GHz/MHz string to Hz hz_actual = kstat.split('\tcurrent_clock_Hz ')[1].split('\n')[0].strip() hz_actual = _to_decimal_string(hz_actual) info = { 'vendor_id_raw' : vendor_id, 'brand_raw' : processor_brand, 'hz_advertised_friendly' : _hz_short_to_friendly(hz_advertised, scale), 'hz_actual_friendly' : _hz_short_to_friendly(hz_actual, 0), 'hz_advertised' : _hz_short_to_full(hz_advertised, scale), 'hz_actual' : _hz_short_to_full(hz_actual, 0), 'stepping' : stepping, 'model' : model, 'family' : family, 'flags' : flags } info = _filter_dict_keys_with_empty_values(info) g_trace.success() return info except Exception as err: g_trace.fail(err) return {} def _get_cpu_info_from_platform_uname(): g_trace.header('Tying to get info from platform.uname ...') try: uname = DataSource.uname_string_raw.split(',')[0] family, model, stepping = (None, None, None) entries = uname.split(' ') if 'Family' in entries and entries.index('Family') < len(entries)-1: i = entries.index('Family') family = int(entries[i + 1]) if 'Model' in entries and entries.index('Model') < len(entries)-1: i = entries.index('Model') model = int(entries[i + 1]) if 'Stepping' in entries and entries.index('Stepping') < len(entries)-1: i = entries.index('Stepping') stepping = int(entries[i + 1]) info = { 'family' : family, 'model' : model, 'stepping' : stepping } info = _filter_dict_keys_with_empty_values(info) g_trace.success() return info except Exception as err: g_trace.fail(err) return {} def _get_cpu_info_internal(): ''' Returns the CPU info by using the best sources of information for your OS. Returns {} if nothing is found. ''' g_trace.write('!' * 80) # Get the CPU arch and bits arch, bits = _parse_arch(DataSource.arch_string_raw) friendly_maxsize = { 2**31-1: '32 bit', 2**63-1: '64 bit' }.get(sys.maxsize) or 'unknown bits' friendly_version = "{0}.{1}.{2}.{3}.{4}".format(*sys.version_info) PYTHON_VERSION = "{0} ({1})".format(friendly_version, friendly_maxsize) info = { 'python_version' : PYTHON_VERSION, 'cpuinfo_version' : CPUINFO_VERSION, 'cpuinfo_version_string' : CPUINFO_VERSION_STRING, 'arch' : arch, 'bits' : bits, 'count' : DataSource.cpu_count, 'arch_string_raw' : DataSource.arch_string_raw, } g_trace.write("python_version: {0}".format(info['python_version'])) g_trace.write("cpuinfo_version: {0}".format(info['cpuinfo_version'])) g_trace.write("arch: {0}".format(info['arch'])) g_trace.write("bits: {0}".format(info['bits'])) g_trace.write("count: {0}".format(info['count'])) g_trace.write("arch_string_raw: {0}".format(info['arch_string_raw'])) # Try the Windows wmic _copy_new_fields(info, _get_cpu_info_from_wmic()) # Try the Windows registry _copy_new_fields(info, _get_cpu_info_from_registry()) # Try /proc/cpuinfo _copy_new_fields(info, _get_cpu_info_from_proc_cpuinfo()) # Try cpufreq-info _copy_new_fields(info, _get_cpu_info_from_cpufreq_info()) # Try LSCPU _copy_new_fields(info, _get_cpu_info_from_lscpu()) # Try sysctl _copy_new_fields(info, _get_cpu_info_from_sysctl()) # Try kstat _copy_new_fields(info, _get_cpu_info_from_kstat()) # Try dmesg _copy_new_fields(info, _get_cpu_info_from_dmesg()) # Try /var/run/dmesg.boot _copy_new_fields(info, _get_cpu_info_from_cat_var_run_dmesg_boot()) # Try lsprop ibm,pa-features _copy_new_fields(info, _get_cpu_info_from_ibm_pa_features()) # Try sysinfo _copy_new_fields(info, _get_cpu_info_from_sysinfo()) # Try querying the CPU cpuid register # FIXME: This should print stdout and stderr to trace log _copy_new_fields(info, _get_cpu_info_from_cpuid()) # Try platform.uname _copy_new_fields(info, _get_cpu_info_from_platform_uname()) g_trace.write('!' * 80) return info def get_cpu_info_json(): ''' Returns the CPU info by using the best sources of information for your OS. Returns the result in a json string ''' import json output = None # If running under pyinstaller, run normally if getattr(sys, 'frozen', False): info = _get_cpu_info_internal() output = json.dumps(info) output = "{0}".format(output) # if not running under pyinstaller, run in another process. # This is done because multiprocesing has a design flaw that # causes non main programs to run multiple times on Windows. else: from subprocess import Popen, PIPE command = [sys.executable, __file__, '--json'] p1 = Popen(command, stdout=PIPE, stderr=PIPE, stdin=PIPE) output = p1.communicate()[0] if p1.returncode != 0: return "{}" output = output.decode(encoding='UTF-8') return output def get_cpu_info(): ''' Returns the CPU info by using the best sources of information for your OS. Returns the result in a dict ''' import json output = get_cpu_info_json() # Convert JSON to Python with non unicode strings output = json.loads(output, object_hook = _utf_to_str) return output def main(): from argparse import ArgumentParser import json # Parse args parser = ArgumentParser(description='Gets CPU info with pure Python') parser.add_argument('--json', action='store_true', help='Return the info in JSON format') parser.add_argument('--version', action='store_true', help='Return the version of py-cpuinfo') parser.add_argument('--trace', action='store_true', help='Traces code paths used to find CPU info to file') args = parser.parse_args() global g_trace g_trace = Trace(args.trace, False) try: _check_arch() except Exception as err: sys.stderr.write(str(err) + "\n") sys.exit(1) info = _get_cpu_info_internal() if not info: sys.stderr.write("Failed to find cpu info\n") sys.exit(1) if args.json: print(json.dumps(info)) elif args.version: print(CPUINFO_VERSION_STRING) else: print('Python Version: {0}'.format(info.get('python_version', ''))) print('Cpuinfo Version: {0}'.format(info.get('cpuinfo_version_string', ''))) print('Vendor ID Raw: {0}'.format(info.get('vendor_id_raw', ''))) print('Hardware Raw: {0}'.format(info.get('hardware_raw', ''))) print('Brand Raw: {0}'.format(info.get('brand_raw', ''))) print('Hz Advertised Friendly: {0}'.format(info.get('hz_advertised_friendly', ''))) print('Hz Actual Friendly: {0}'.format(info.get('hz_actual_friendly', ''))) print('Hz Advertised: {0}'.format(info.get('hz_advertised', ''))) print('Hz Actual: {0}'.format(info.get('hz_actual', ''))) print('Arch: {0}'.format(info.get('arch', ''))) print('Bits: {0}'.format(info.get('bits', ''))) print('Count: {0}'.format(info.get('count', ''))) print('Arch String Raw: {0}'.format(info.get('arch_string_raw', ''))) print('L1 Data Cache Size: {0}'.format(info.get('l1_data_cache_size', ''))) print('L1 Instruction Cache Size: {0}'.format(info.get('l1_instruction_cache_size', ''))) print('L2 Cache Size: {0}'.format(info.get('l2_cache_size', ''))) print('L2 Cache Line Size: {0}'.format(info.get('l2_cache_line_size', ''))) print('L2 Cache Associativity: {0}'.format(info.get('l2_cache_associativity', ''))) print('L3 Cache Size: {0}'.format(info.get('l3_cache_size', ''))) print('Stepping: {0}'.format(info.get('stepping', ''))) print('Model: {0}'.format(info.get('model', ''))) print('Family: {0}'.format(info.get('family', ''))) print('Processor Type: {0}'.format(info.get('processor_type', ''))) print('Flags: {0}'.format(', '.join(info.get('flags', '')))) if __name__ == '__main__': main() else: g_trace = Trace(False, False) _check_arch() ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1666730267.8637893 py-cpuinfo-9.0.0/py_cpuinfo.egg-info/0000775000175000017500000000000014326044434016220 5ustar00mattmatt././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666730267.0 py-cpuinfo-9.0.0/py_cpuinfo.egg-info/PKG-INFO0000664000175000017500000000143214326044433017314 0ustar00mattmattMetadata-Version: 2.1 Name: py-cpuinfo Version: 9.0.0 Summary: Get CPU info with pure Python Home-page: https://github.com/workhorsy/py-cpuinfo Author: Matthew Brennan Jones Author-email: matthew.brennan.jones@gmail.com License: MIT Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Topic :: Utilities Classifier: License :: OSI Approved :: MIT License Classifier: Programming Language :: Python :: 3 License-File: LICENSE py-cpuinfo ========== Py-cpuinfo gets CPU info with pure Python. Py-cpuinfo should work without any extra programs or libraries, beyond what your OS provides. It does not require any compilation(C/C++, assembly, et cetera) to use. It works with Python 3. Documentation can be viewed here: https://github.com/workhorsy/py-cpuinfo ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666730267.0 py-cpuinfo-9.0.0/py_cpuinfo.egg-info/SOURCES.txt0000664000175000017500000000337014326044433020106 0ustar00mattmattChangeLog LICENSE MANIFEST.in README.rst pyproject.toml setup.cfg setup.py test_suite.py cpuinfo/__init__.py cpuinfo/__main__.py cpuinfo/cpuinfo.py py_cpuinfo.egg-info/PKG-INFO py_cpuinfo.egg-info/SOURCES.txt py_cpuinfo.egg-info/dependency_links.txt py_cpuinfo.egg-info/entry_points.txt py_cpuinfo.egg-info/top_level.txt tests/helpers.py tests/test_actual.py tests/test_bug_152_cpu_zero.py tests/test_cli.py tests/test_compile_errors.py tests/test_cpuid.py tests/test_example.py tests/test_filter.py tests/test_free_bsd_11_x86_64.py tests/test_haiku_x86_32.py tests/test_haiku_x86_64.py tests/test_haiku_x86_64_beta_1_ryzen_7.py tests/test_invalid_cpu.py tests/test_linux_aarch64_64.py tests/test_linux_alt_p9_mipsel_bfk3.py tests/test_linux_beagle_bone_arm.py tests/test_linux_debian_8_5_x86_64.py tests/test_linux_debian_8_7_1_ppc64le.py tests/test_linux_debian_8_x86_64.py tests/test_linux_fedora_24_ppc64le.py tests/test_linux_fedora_24_x86_64.py tests/test_linux_fedora_29_x86_64_ryzen_7.py tests/test_linux_fedora_5_s390x.py tests/test_linux_gentoo_2_2_x86_64.py tests/test_linux_mips64el_loongson3A3000.py tests/test_linux_odroid_c2_aarch64.py tests/test_linux_odroid_xu3_arm_32.py tests/test_linux_raspberry_pi_model_b_arm.py tests/test_linux_rhel_7_3_ppc64le.py tests/test_linux_ubuntu_16_04_x86_64.py tests/test_linux_ubuntu_21_04_riscv64.py tests/test_linux_ubuntu_22_04_x86_64.py tests/test_open_indiana_5_11_x86_64_ryzen_7.py tests/test_osx_10_12_x86_64.py tests/test_osx_10_9_x86_64.py tests/test_parse_cpu_string.py tests/test_parse_errors.py tests/test_pcbsd_10_x86_64.py tests/test_selinux.py tests/test_solaris_11_x86_32.py tests/test_true_os_18_x86_64_ryzen_7.py tests/test_windows_10_x86_64.py tests/test_windows_10_x86_64_ryzen_7.py tests/test_windows_8_x86_64.py././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666730267.0 py-cpuinfo-9.0.0/py_cpuinfo.egg-info/dependency_links.txt0000664000175000017500000000000114326044433022265 0ustar00mattmatt ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666730267.0 py-cpuinfo-9.0.0/py_cpuinfo.egg-info/entry_points.txt0000664000175000017500000000005214326044433021512 0ustar00mattmatt[console_scripts] cpuinfo = cpuinfo:main ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666730267.0 py-cpuinfo-9.0.0/py_cpuinfo.egg-info/top_level.txt0000664000175000017500000000001014326044433020740 0ustar00mattmattcpuinfo ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/pyproject.toml0000664000175000017500000000014514325641176015274 0ustar00mattmatt[build-system] requires = [ "setuptools", "wheel", ] build-backend = "setuptools.build_meta" ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1666730267.8677893 py-cpuinfo-9.0.0/setup.cfg0000664000175000017500000000010314326044434014166 0ustar00mattmatt[bdist_wheel] universal = 0 [egg_info] tag_build = tag_date = 0 ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666724806.0 py-cpuinfo-9.0.0/setup.py0000664000175000017500000000175014326031706014066 0ustar00mattmatt# Copyright (c) 2014-2022 Matthew Brennan Jones # Py-cpuinfo gets CPU info with pure Python # It uses the MIT License # It is hosted at: https://github.com/workhorsy/py-cpuinfo import os from setuptools import setup with open(os.path.join(os.getcwd(), 'README.rst'), 'r') as f: readme_content = f.read() setup( name = "py-cpuinfo", version = "9.0.0", author = "Matthew Brennan Jones", author_email = "matthew.brennan.jones@gmail.com", description = "Get CPU info with pure Python", long_description=readme_content, license = "MIT", url = "https://github.com/workhorsy/py-cpuinfo", packages=['cpuinfo'], test_suite="test_suite", entry_points = { 'console_scripts': ['cpuinfo = cpuinfo:main'], }, classifiers=[ "Development Status :: 5 - Production/Stable", "Topic :: Utilities", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3" ], ) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/test_suite.py0000664000175000017500000001253014325641176015123 0ustar00mattmatt#!/usr/bin/env python # -*- coding: UTF-8 -*- # Copyright (c) 2014-2022 Matthew Brennan Jones # Py-cpuinfo gets CPU info with pure Python # It uses the MIT License # It is hosted at: https://github.com/workhorsy/py-cpuinfo # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. import os, sys import unittest # Add the path of all the tests to this path sys.path.append(os.path.realpath('tests')) # Import all the test files from test_compile_errors import TestCompileErrors from test_example import TestExample from test_parse_errors import TestParseErrors from test_parse_cpu_string import TestParseCPUString from test_invalid_cpu import TestInvalidCPU from test_selinux import TestSELinux from test_linux_debian_8_x86_64 import TestLinuxDebian_8_X86_64 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 from test_linux_fedora_5_s390x import TestLinuxFedora_5_s390x from test_linux_aarch64_64 import TestLinux_Aarch_64 from test_linux_gentoo_2_2_x86_64 import TestLinuxGentoo_2_2_X86_64 from test_linux_rhel_7_3_ppc64le import TestLinuxRHEL_7_3_ppc64le from test_linux_beagle_bone_arm import TestLinux_BeagleBone from test_linux_raspberry_pi_model_b_arm import TestLinux_RaspberryPiModelB from test_linux_odroid_c2_aarch64 import TestLinux_Odroid_C2_Aarch_64 from test_linux_odroid_xu3_arm_32 import TestLinux_Odroid_XU3_arm_32 from test_linux_alt_p9_mipsel_bfk3 import TestLinuxAlt_p9_mipsel_bfk3 from test_linux_mips64el_loongson3A3000 import TestLinux_mips64el_Loongson3A3000 from test_linux_ubuntu_21_04_riscv64 import TestLinuxUbuntu_21_04_riscv64 from test_pcbsd_10_x86_64 import TestPCBSD from test_free_bsd_11_x86_64 import TestFreeBSD_11_X86_64 from test_osx_10_9_x86_64 import TestOSX_10_9 from test_osx_10_12_x86_64 import TestOSX_10_12 from test_solaris_11_x86_32 import TestSolaris_11 from test_open_indiana_5_11_x86_64_ryzen_7 import TestOpenIndiana_5_11_Ryzen_7 from test_haiku_x86_32 import TestHaiku_x86_32 from test_haiku_x86_64 import TestHaiku_x86_64 from test_haiku_x86_64_beta_1_ryzen_7 import TestHaiku_x86_64_Beta_1_Ryzen7 from test_true_os_18_x86_64_ryzen_7 import TestTrueOS_18_X86_64_Ryzen7 from test_windows_8_x86_64 import TestWindows_8_X86_64 from test_windows_10_x86_64 import TestWindows_10_X86_64 from test_windows_10_x86_64_ryzen_7 import TestWindows_10_X86_64_Ryzen7 from test_cpuid import TestCPUID from test_actual import TestActual from test_cli import TestCLI from test_bug_152_cpu_zero import TestBug152 from test_filter import TestFilter if __name__ == '__main__': def logger(msg): import inspect print("\n{0}:{1}".format(msg, inspect.stack()[1][1:3])) unittest.logger = logger # Get all the tests tests = [ TestCompileErrors, TestParseCPUString, TestExample, TestParseErrors, TestInvalidCPU, TestSELinux, TestLinuxAlt_p9_mipsel_bfk3, TestLinux_mips64el_Loongson3A3000, TestLinuxDebian_8_X86_64, 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, TestLinuxFedora_5_s390x, TestLinux_Aarch_64, TestLinuxGentoo_2_2_X86_64, TestLinuxRHEL_7_3_ppc64le, TestLinux_BeagleBone, TestLinux_RaspberryPiModelB, TestLinux_Odroid_C2_Aarch_64, TestLinux_Odroid_XU3_arm_32, TestLinuxUbuntu_21_04_riscv64, TestFreeBSD_11_X86_64, TestPCBSD, TestOSX_10_9, TestOSX_10_12, TestSolaris_11, TestOpenIndiana_5_11_Ryzen_7, TestHaiku_x86_32, TestHaiku_x86_64, TestHaiku_x86_64_Beta_1_Ryzen7, TestTrueOS_18_X86_64_Ryzen7, TestWindows_8_X86_64, TestWindows_10_X86_64, TestWindows_10_X86_64_Ryzen7, TestCPUID, TestActual, TestCLI, TestBug152, TestFilter, ] # Add the tests to the suite suite = unittest.TestSuite() loader = unittest.TestLoader() for test in tests: suite.addTest(loader.loadTestsFromTestCase(test)) # Run the tests runner = unittest.TextTestRunner() runner.run(suite) ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1666730267.8677893 py-cpuinfo-9.0.0/tests/0000775000175000017500000000000014326044434013515 5ustar00mattmatt././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/tests/helpers.py0000664000175000017500000003507614325641176015551 0ustar00mattmatt#!/usr/bin/env python # -*- coding: UTF-8 -*- # Copyright (c) 2014-2022 Matthew Brennan Jones # Py-cpuinfo gets CPU info with pure Python # It uses the MIT License # It is hosted at: https://github.com/workhorsy/py-cpuinfo # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. class EmptyDataSource(object): @staticmethod def has_proc_cpuinfo(): return False @staticmethod def has_lscpu(): return False @staticmethod def has_ibm_pa_features(): return False @staticmethod def has_wmic(): return False @staticmethod def has_dmesg(): return False @staticmethod def has_var_run_dmesg_boot(): return False @staticmethod def has_cpufreq_info(): return False @staticmethod def has_sestatus(): return False @staticmethod def has_sysctl(): return False @staticmethod def has_isainfo(): return False @staticmethod def has_kstat(): return False @staticmethod def has_sysinfo(): return False def get_os_type(): import platform os_type = 'Unknown' # Figure out the general OS type uname = platform.system().strip().strip('"').strip("'").strip().lower() if 'beos' in uname or 'haiku' in uname: os_type = 'BeOS' elif 'bsd' in uname or 'gnu/kfreebsd' in uname: os_type = 'BSD' elif 'cygwin' in uname: os_type = 'Cygwin' elif 'darwin' in uname: os_type = 'MacOS' elif 'linux' in uname: os_type = 'Linux' elif 'solaris' in uname or 'sunos' in uname: os_type = 'Solaris' elif 'windows' in uname: os_type = 'Windows' return os_type def monkey_patch_data_source(cpuinfo, NewDataSource): # Replace all methods with ones that return false _actual_monkey_patch_data_source(cpuinfo, EmptyDataSource) # Copy any methods that are the same over _actual_monkey_patch_data_source(cpuinfo, NewDataSource) def _actual_monkey_patch_data_source(cpuinfo, NewDataSource): if hasattr(NewDataSource, 'bits'): cpuinfo.DataSource.bits = NewDataSource.bits if hasattr(NewDataSource, 'cpu_count'): cpuinfo.DataSource.cpu_count = NewDataSource.cpu_count if hasattr(NewDataSource, 'is_windows'): cpuinfo.DataSource.is_windows = NewDataSource.is_windows if hasattr(NewDataSource, 'arch_string_raw'): cpuinfo.DataSource.arch_string_raw = NewDataSource.arch_string_raw if hasattr(NewDataSource, 'uname_string_raw'): cpuinfo.DataSource.uname_string_raw = NewDataSource.uname_string_raw if hasattr(NewDataSource, 'can_cpuid'): cpuinfo.DataSource.can_cpuid = NewDataSource.can_cpuid if hasattr(NewDataSource, 'has_proc_cpuinfo'): cpuinfo.DataSource.has_proc_cpuinfo = staticmethod(NewDataSource.has_proc_cpuinfo) if hasattr(NewDataSource, 'has_dmesg'): cpuinfo.DataSource.has_dmesg = staticmethod(NewDataSource.has_dmesg) if hasattr(NewDataSource, 'has_var_run_dmesg_boot'): cpuinfo.DataSource.has_var_run_dmesg_boot = staticmethod(NewDataSource.has_var_run_dmesg_boot) if hasattr(NewDataSource, 'has_cpufreq_info'): cpuinfo.DataSource.has_cpufreq_info = staticmethod(NewDataSource.has_cpufreq_info) if hasattr(NewDataSource, 'has_sestatus'): cpuinfo.DataSource.has_sestatus = staticmethod(NewDataSource.has_sestatus) if hasattr(NewDataSource, 'has_sysctl'): cpuinfo.DataSource.has_sysctl = staticmethod(NewDataSource.has_sysctl) if hasattr(NewDataSource, 'has_isainfo'): cpuinfo.DataSource.has_isainfo = staticmethod(NewDataSource.has_isainfo) if hasattr(NewDataSource, 'has_kstat'): cpuinfo.DataSource.has_kstat = staticmethod(NewDataSource.has_kstat) if hasattr(NewDataSource, 'has_sysinfo'): cpuinfo.DataSource.has_sysinfo = staticmethod(NewDataSource.has_sysinfo) if hasattr(NewDataSource, 'has_ibm_pa_features'): cpuinfo.DataSource.has_ibm_pa_features = staticmethod(NewDataSource.has_ibm_pa_features) if hasattr(NewDataSource, 'has_wmic'): cpuinfo.DataSource.has_wmic = staticmethod(NewDataSource.has_wmic) if hasattr(NewDataSource, 'has_lscpu'): cpuinfo.DataSource.has_lscpu = staticmethod(NewDataSource.has_lscpu) if hasattr(NewDataSource, 'cat_proc_cpuinfo'): cpuinfo.DataSource.cat_proc_cpuinfo = staticmethod(NewDataSource.cat_proc_cpuinfo) if hasattr(NewDataSource, 'cpufreq_info'): cpuinfo.DataSource.cpufreq_info = staticmethod(NewDataSource.cpufreq_info) if hasattr(NewDataSource, 'sestatus_b'): cpuinfo.DataSource.sestatus_b = staticmethod(NewDataSource.sestatus_b) if hasattr(NewDataSource, 'dmesg_a'): cpuinfo.DataSource.dmesg_a = staticmethod(NewDataSource.dmesg_a) if hasattr(NewDataSource, 'cat_var_run_dmesg_boot'): cpuinfo.DataSource.cat_var_run_dmesg_boot = staticmethod(NewDataSource.cat_var_run_dmesg_boot) if hasattr(NewDataSource, 'sysctl_machdep_cpu_hw_cpufrequency'): cpuinfo.DataSource.sysctl_machdep_cpu_hw_cpufrequency = staticmethod(NewDataSource.sysctl_machdep_cpu_hw_cpufrequency) if hasattr(NewDataSource, 'isainfo_vb'): cpuinfo.DataSource.isainfo_vb = staticmethod(NewDataSource.isainfo_vb) if hasattr(NewDataSource, 'kstat_m_cpu_info'): cpuinfo.DataSource.kstat_m_cpu_info = staticmethod(NewDataSource.kstat_m_cpu_info) if hasattr(NewDataSource, 'lscpu'): cpuinfo.DataSource.lscpu = staticmethod(NewDataSource.lscpu) if hasattr(NewDataSource, 'ibm_pa_features'): cpuinfo.DataSource.ibm_pa_features = staticmethod(NewDataSource.ibm_pa_features) if hasattr(NewDataSource, 'wmic_cpu'): cpuinfo.DataSource.wmic_cpu = staticmethod(NewDataSource.wmic_cpu) if hasattr(NewDataSource, 'sysinfo_cpu'): cpuinfo.DataSource.sysinfo_cpu = staticmethod(NewDataSource.sysinfo_cpu) if hasattr(NewDataSource, 'winreg_processor_brand'): cpuinfo.DataSource.winreg_processor_brand = staticmethod(NewDataSource.winreg_processor_brand) if hasattr(NewDataSource, 'winreg_vendor_id_raw'): cpuinfo.DataSource.winreg_vendor_id_raw = staticmethod(NewDataSource.winreg_vendor_id_raw) if hasattr(NewDataSource, 'winreg_arch_string_raw'): cpuinfo.DataSource.winreg_arch_string_raw = staticmethod(NewDataSource.winreg_arch_string_raw) if hasattr(NewDataSource, 'winreg_hz_actual'): cpuinfo.DataSource.winreg_hz_actual = staticmethod(NewDataSource.winreg_hz_actual) if hasattr(NewDataSource, 'winreg_feature_bits'): cpuinfo.DataSource.winreg_feature_bits = staticmethod(NewDataSource.winreg_feature_bits) def backup_data_source(cpuinfo): BackupDataSource = type('BackupDataSource', (object,), {}) cpuinfo.BackupDataSource = BackupDataSource() cpuinfo.BackupDataSource.bits = cpuinfo.DataSource.bits cpuinfo.BackupDataSource.cpu_count = cpuinfo.DataSource.cpu_count cpuinfo.BackupDataSource.is_windows = cpuinfo.DataSource.is_windows cpuinfo.BackupDataSource.arch_string_raw = cpuinfo.DataSource.arch_string_raw cpuinfo.BackupDataSource.uname_string_raw = cpuinfo.DataSource.uname_string_raw cpuinfo.BackupDataSource.can_cpuid = cpuinfo.DataSource.can_cpuid cpuinfo.BackupDataSource.has_proc_cpuinfo = staticmethod(cpuinfo.DataSource.has_proc_cpuinfo) cpuinfo.BackupDataSource.has_dmesg = staticmethod(cpuinfo.DataSource.has_dmesg) cpuinfo.BackupDataSource.has_var_run_dmesg_boot = staticmethod(cpuinfo.DataSource.has_var_run_dmesg_boot) cpuinfo.BackupDataSource.has_cpufreq_info = staticmethod(cpuinfo.DataSource.has_cpufreq_info) cpuinfo.BackupDataSource.has_sestatus = staticmethod(cpuinfo.DataSource.has_sestatus) cpuinfo.BackupDataSource.has_sysctl = staticmethod(cpuinfo.DataSource.has_sysctl) cpuinfo.BackupDataSource.has_isainfo = staticmethod(cpuinfo.DataSource.has_isainfo) cpuinfo.BackupDataSource.has_kstat = staticmethod(cpuinfo.DataSource.has_kstat) cpuinfo.BackupDataSource.has_sysinfo = staticmethod(cpuinfo.DataSource.has_sysinfo) cpuinfo.BackupDataSource.has_lscpu = staticmethod(cpuinfo.DataSource.has_lscpu) cpuinfo.BackupDataSource.has_ibm_pa_features = staticmethod(cpuinfo.DataSource.has_ibm_pa_features) cpuinfo.BackupDataSource.has_wmic = staticmethod(cpuinfo.DataSource.has_wmic) cpuinfo.BackupDataSource.cat_proc_cpuinfo = staticmethod(cpuinfo.DataSource.cat_proc_cpuinfo) cpuinfo.BackupDataSource.cpufreq_info = staticmethod(cpuinfo.DataSource.cpufreq_info) cpuinfo.BackupDataSource.sestatus_b = staticmethod(cpuinfo.DataSource.sestatus_b) cpuinfo.BackupDataSource.dmesg_a = staticmethod(cpuinfo.DataSource.dmesg_a) cpuinfo.BackupDataSource.cat_var_run_dmesg_boot = staticmethod(cpuinfo.DataSource.cat_var_run_dmesg_boot) cpuinfo.BackupDataSource.sysctl_machdep_cpu_hw_cpufrequency = staticmethod(cpuinfo.DataSource.sysctl_machdep_cpu_hw_cpufrequency) cpuinfo.BackupDataSource.isainfo_vb = staticmethod(cpuinfo.DataSource.isainfo_vb) cpuinfo.BackupDataSource.kstat_m_cpu_info = staticmethod(cpuinfo.DataSource.kstat_m_cpu_info) cpuinfo.BackupDataSource.lscpu = staticmethod(cpuinfo.DataSource.lscpu) cpuinfo.BackupDataSource.ibm_pa_features = staticmethod(cpuinfo.DataSource.ibm_pa_features) cpuinfo.BackupDataSource.wmic_cpu = staticmethod(cpuinfo.DataSource.wmic_cpu) cpuinfo.BackupDataSource.sysinfo_cpu = staticmethod(cpuinfo.DataSource.sysinfo_cpu) cpuinfo.BackupDataSource.winreg_processor_brand = staticmethod(cpuinfo.DataSource.winreg_processor_brand) cpuinfo.BackupDataSource.winreg_vendor_id_raw = staticmethod(cpuinfo.DataSource.winreg_vendor_id_raw) cpuinfo.BackupDataSource.winreg_arch_string_raw = staticmethod(cpuinfo.DataSource.winreg_arch_string_raw) cpuinfo.BackupDataSource.winreg_hz_actual = staticmethod(cpuinfo.DataSource.winreg_hz_actual) cpuinfo.BackupDataSource.winreg_feature_bits = staticmethod(cpuinfo.DataSource.winreg_feature_bits) def restore_data_source(cpuinfo): cpuinfo.DataSource.bits = cpuinfo.BackupDataSource.bits cpuinfo.DataSource.cpu_count = cpuinfo.BackupDataSource.cpu_count cpuinfo.DataSource.is_windows = cpuinfo.BackupDataSource.is_windows cpuinfo.DataSource.arch_string_raw = cpuinfo.BackupDataSource.arch_string_raw cpuinfo.DataSource.uname_string_raw = cpuinfo.BackupDataSource.uname_string_raw cpuinfo.DataSource.can_cpuid = cpuinfo.BackupDataSource.can_cpuid cpuinfo.DataSource.has_proc_cpuinfo = cpuinfo.BackupDataSource.has_proc_cpuinfo cpuinfo.DataSource.has_dmesg = cpuinfo.BackupDataSource.has_dmesg cpuinfo.DataSource.has_var_run_dmesg_boot = cpuinfo.BackupDataSource.has_var_run_dmesg_boot cpuinfo.DataSource.has_cpufreq_info = cpuinfo.BackupDataSource.has_cpufreq_info cpuinfo.DataSource.has_sestatus = cpuinfo.BackupDataSource.has_sestatus cpuinfo.DataSource.has_sysctl = cpuinfo.BackupDataSource.has_sysctl cpuinfo.DataSource.has_isainfo = cpuinfo.BackupDataSource.has_isainfo cpuinfo.DataSource.has_kstat = cpuinfo.BackupDataSource.has_kstat cpuinfo.DataSource.has_sysinfo = cpuinfo.BackupDataSource.has_sysinfo cpuinfo.DataSource.has_lscpu = cpuinfo.BackupDataSource.has_lscpu cpuinfo.DataSource.has_ibm_pa_features = cpuinfo.BackupDataSource.has_ibm_pa_features cpuinfo.DataSource.has_wmic = cpuinfo.BackupDataSource.has_wmic cpuinfo.DataSource.cat_proc_cpuinfo = cpuinfo.BackupDataSource.cat_proc_cpuinfo cpuinfo.DataSource.cpufreq_info = cpuinfo.BackupDataSource.cpufreq_info cpuinfo.DataSource.sestatus_b = cpuinfo.BackupDataSource.sestatus_b cpuinfo.DataSource.dmesg_a = cpuinfo.BackupDataSource.dmesg_a cpuinfo.DataSource.cat_var_run_dmesg_boot = cpuinfo.BackupDataSource.cat_var_run_dmesg_boot cpuinfo.DataSource.sysctl_machdep_cpu_hw_cpufrequency = cpuinfo.BackupDataSource.sysctl_machdep_cpu_hw_cpufrequency cpuinfo.DataSource.isainfo_vb = cpuinfo.BackupDataSource.isainfo_vb cpuinfo.DataSource.kstat_m_cpu_info = cpuinfo.BackupDataSource.kstat_m_cpu_info cpuinfo.DataSource.lscpu = cpuinfo.BackupDataSource.lscpu cpuinfo.DataSource.ibm_pa_features = cpuinfo.BackupDataSource.ibm_pa_features cpuinfo.DataSource.wmic_cpu = cpuinfo.BackupDataSource.wmic_cpu cpuinfo.DataSource.sysinfo_cpu = cpuinfo.BackupDataSource.sysinfo_cpu cpuinfo.DataSource.winreg_processor_brand = cpuinfo.BackupDataSource.winreg_processor_brand cpuinfo.DataSource.winreg_vendor_id_raw = cpuinfo.BackupDataSource.winreg_vendor_id_raw cpuinfo.DataSource.winreg_arch_string_raw = cpuinfo.BackupDataSource.winreg_arch_string_raw cpuinfo.DataSource.winreg_hz_actual = cpuinfo.BackupDataSource.winreg_hz_actual cpuinfo.DataSource.winreg_feature_bits = cpuinfo.BackupDataSource.winreg_feature_bits def backup_cpuid(cpuinfo): BackupCPUID = type('BackupCPUID', (object,), {}) cpuinfo.BackupCPUID = BackupCPUID() cpuinfo.BackupCPUID._run_asm = cpuinfo.CPUID._run_asm cpuinfo.BackupCPUID._asm_func = cpuinfo.CPUID._asm_func def monkey_patch_cpuid(cpuinfo, return_hz, return_values): class MockCPUID(object): _counter = 0 _is_first = False def _asm_func(self, restype=None, argtypes=(), machine_code=[]): class CPUIDGetTicks(object): # NOTE: This assumes that the function returned is a get_ticks function def func(self): MockCPUID._is_first = not MockCPUID._is_first if MockCPUID._is_first: return return_hz else: return 0 def free(self): pass return CPUIDGetTicks() def _run_asm(self, *machine_code): result = return_values[MockCPUID._counter] MockCPUID._counter += 1 if MockCPUID._counter == len(return_values): MockCPUID._counter = 0 return result cpuinfo.CPUID._run_asm = MockCPUID.__dict__['_run_asm'] cpuinfo.CPUID._asm_func = MockCPUID.__dict__['_asm_func'] def restore_cpuid(cpuinfo): cpuinfo.CPUID._run_asm = cpuinfo.BackupCPUID._run_asm cpuinfo.CPUID._asm_func = cpuinfo.BackupCPUID._asm_func def backup_asm(cpuinfo): BackupASM = type('BackupASM', (object,), {}) cpuinfo.BackupASM = BackupASM() cpuinfo.BackupASM.compile = cpuinfo.ASM.compile cpuinfo.BackupASM.run = cpuinfo.ASM.run cpuinfo.BackupASM.free = cpuinfo.ASM.free def monkey_patch_asm(cpuinfo, NewASM): cpuinfo.ASM.compile = NewASM.__dict__['compile'] cpuinfo.ASM.run = NewASM.__dict__['run'] cpuinfo.ASM.free = NewASM.__dict__['free'] def restore_asm(cpuinfo): cpuinfo.ASM.compile = cpuinfo.BackupASM.compile cpuinfo.ASM.run = cpuinfo.BackupASM.run cpuinfo.ASM.free = cpuinfo.BackupASM.free ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/tests/test_actual.py0000664000175000017500000001277214325641176016415 0ustar00mattmatt import unittest from cpuinfo import * import helpers class TestActual(unittest.TestCase): def setUp(self): helpers.backup_data_source(cpuinfo) def tearDown(self): helpers.restore_data_source(cpuinfo) def test_all(self): os_type = helpers.get_os_type() if os_type == 'BeOS': self.assertEqual({}, cpuinfo._get_cpu_info_from_registry()) self.assertEqual({}, cpuinfo._get_cpu_info_from_cpufreq_info()) self.assertEqual({}, cpuinfo._get_cpu_info_from_lscpu()) self.assertEqual({}, cpuinfo._get_cpu_info_from_proc_cpuinfo()) self.assertEqual({}, cpuinfo._get_cpu_info_from_sysctl()) self.assertEqual({}, cpuinfo._get_cpu_info_from_kstat()) self.assertEqual({}, cpuinfo._get_cpu_info_from_dmesg()) self.assertEqual({}, cpuinfo._get_cpu_info_from_cat_var_run_dmesg_boot()) self.assertTrue(len(cpuinfo._get_cpu_info_from_sysinfo()) > 0) #self.assertTrue(len(cpuinfo._get_cpu_info_from_cpuid()) > 0) self.assertTrue(len(cpuinfo.get_cpu_info()) > 0) elif os_type == 'BSD': self.assertEqual({}, cpuinfo._get_cpu_info_from_registry()) self.assertEqual({}, cpuinfo._get_cpu_info_from_cpufreq_info()) self.assertEqual({}, cpuinfo._get_cpu_info_from_lscpu()) self.assertEqual({}, cpuinfo._get_cpu_info_from_proc_cpuinfo()) self.assertEqual({}, cpuinfo._get_cpu_info_from_sysctl()) self.assertEqual({}, cpuinfo._get_cpu_info_from_kstat()) self.assertTrue(len(cpuinfo._get_cpu_info_from_dmesg()) > 0) self.assertEqual({}, cpuinfo._get_cpu_info_from_cat_var_run_dmesg_boot()) self.assertEqual({}, cpuinfo._get_cpu_info_from_sysinfo()) # FIXME: This fails by segfaulting for some reason #self.assertEqual({}, cpuinfo._get_cpu_info_from_cpuid()) self.assertTrue(len(cpuinfo.get_cpu_info()) > 0) elif os_type == 'Cygwin': self.assertEqual({}, cpuinfo._get_cpu_info_from_registry()) self.assertEqual({}, cpuinfo._get_cpu_info_from_cpufreq_info()) self.assertEqual({}, cpuinfo._get_cpu_info_from_lscpu()) self.assertTrue(len(cpuinfo._get_cpu_info_from_proc_cpuinfo()) > 0) self.assertEqual({}, cpuinfo._get_cpu_info_from_sysctl()) self.assertEqual({}, cpuinfo._get_cpu_info_from_kstat()) self.assertEqual({}, cpuinfo._get_cpu_info_from_dmesg()) self.assertEqual({}, cpuinfo._get_cpu_info_from_cat_var_run_dmesg_boot()) self.assertEqual({}, cpuinfo._get_cpu_info_from_sysinfo()) # FIXME: This fails by segfaulting for some reason #self.assertEqual({}, cpuinfo._get_cpu_info_from_cpuid()) self.assertTrue(len(cpuinfo.get_cpu_info()) > 0) elif os_type == 'MacOS': self.assertEqual({}, cpuinfo._get_cpu_info_from_registry()) self.assertEqual({}, cpuinfo._get_cpu_info_from_cpufreq_info()) self.assertEqual({}, cpuinfo._get_cpu_info_from_lscpu()) self.assertEqual({}, cpuinfo._get_cpu_info_from_proc_cpuinfo()) self.assertTrue(len(cpuinfo._get_cpu_info_from_sysctl()) > 0) self.assertEqual({}, cpuinfo._get_cpu_info_from_kstat()) self.assertEqual({}, cpuinfo._get_cpu_info_from_dmesg()) self.assertEqual({}, cpuinfo._get_cpu_info_from_cat_var_run_dmesg_boot()) self.assertEqual({}, cpuinfo._get_cpu_info_from_sysinfo()) # FIXME: This fails by segfaulting for some reason #self.assertEqual({}, cpuinfo._get_cpu_info_from_cpuid()) self.assertTrue(len(cpuinfo.get_cpu_info()) > 0) elif os_type == 'Linux': self.assertEqual({}, cpuinfo._get_cpu_info_from_registry()) self.assertEqual({}, cpuinfo._get_cpu_info_from_cpufreq_info()) #self.assertTrue(len(cpuinfo._get_cpu_info_from_lscpu()) > 0) self.assertTrue(len(cpuinfo._get_cpu_info_from_proc_cpuinfo()) > 0) self.assertEqual({}, cpuinfo._get_cpu_info_from_sysctl()) self.assertEqual({}, cpuinfo._get_cpu_info_from_kstat()) self.assertEqual({}, cpuinfo._get_cpu_info_from_dmesg()) self.assertEqual({}, cpuinfo._get_cpu_info_from_cat_var_run_dmesg_boot()) self.assertEqual({}, cpuinfo._get_cpu_info_from_sysinfo()) #self.assertTrue(len(cpuinfo._get_cpu_info_from_cpuid()) > 0) self.assertTrue(len(cpuinfo.get_cpu_info()) > 0) elif os_type == 'Solaris': self.assertEqual({}, cpuinfo._get_cpu_info_from_registry()) self.assertEqual({}, cpuinfo._get_cpu_info_from_cpufreq_info()) self.assertEqual({}, cpuinfo._get_cpu_info_from_lscpu()) self.assertEqual({}, cpuinfo._get_cpu_info_from_proc_cpuinfo()) self.assertEqual({}, cpuinfo._get_cpu_info_from_sysctl()) self.assertTrue(len(cpuinfo._get_cpu_info_from_kstat()) > 0) self.assertEqual({}, cpuinfo._get_cpu_info_from_dmesg()) self.assertEqual({}, cpuinfo._get_cpu_info_from_cat_var_run_dmesg_boot()) self.assertEqual({}, cpuinfo._get_cpu_info_from_sysinfo()) # FIXME: This fails by segfaulting for some reason #self.assertEqual({}, cpuinfo._get_cpu_info_from_cpuid()) self.assertTrue(len(cpuinfo.get_cpu_info()) > 0) elif os_type == 'Windows': self.assertTrue(len(cpuinfo._get_cpu_info_from_registry()) > 0) self.assertEqual({}, cpuinfo._get_cpu_info_from_cpufreq_info()) self.assertEqual({}, cpuinfo._get_cpu_info_from_lscpu()) self.assertEqual({}, cpuinfo._get_cpu_info_from_proc_cpuinfo()) self.assertEqual({}, cpuinfo._get_cpu_info_from_sysctl()) self.assertEqual({}, cpuinfo._get_cpu_info_from_kstat()) self.assertEqual({}, cpuinfo._get_cpu_info_from_dmesg()) self.assertEqual({}, cpuinfo._get_cpu_info_from_cat_var_run_dmesg_boot()) self.assertEqual({}, cpuinfo._get_cpu_info_from_sysinfo()) #self.assertTrue(len(cpuinfo._get_cpu_info_from_cpuid()) > 0) self.assertTrue(len(cpuinfo.get_cpu_info()) > 0) else: raise AssertionError('Unexpected OS type "{0}".'.format(os_type)) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/tests/test_bug_152_cpu_zero.py0000664000175000017500000000717114325641176020213 0ustar00mattmatt import unittest from cpuinfo import * import helpers class MockDataSource(object): bits = '64bit' cpu_count = 1 is_windows = False arch_string_raw = 'x86_64' uname_string_raw = 'x86_64' can_cpuid = False @staticmethod def has_proc_cpuinfo(): return True @staticmethod def has_lscpu(): return True @staticmethod def cat_proc_cpuinfo(): returncode = 0 output = r''' processor : 0 vendor_id : GenuineIntel cpu family : 0 model : 0 model name : Intel(R) Pentium(R) CPU G640 @ 2.80GHz stepping : 0 microcode : 0x29 cpu MHz : 1901.375 cache size : 3072 KB physical id : 0 siblings : 2 core id : 0 cpu cores : 2 apicid : 0 initial apicid : 0 fpu : yes fpu_exception : yes cpuid level : 13 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 popcnt tsc_deadline_timer xsave lahf_lm epb tpr_shadow vnmi flexpriority ept vpid xsaveopt dtherm arat pln pts bugs : bogomips : 5587.32 clflush size : 64 cache_alignment : 64 address sizes : 36 bits physical, 48 bits virtual power management: ''' return returncode, output @staticmethod def lscpu(): returncode = 0 output = r''' Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 2 On-line CPU(s) list: 0,1 Thread(s) per core: 1 Core(s) per socket: 2 Socket(s): 1 NUMA node(s): 1 Vendor ID: GenuineIntel CPU family: 0 Model: 0 Model name: Intel(R) Pentium(R) CPU G640 @ 2.80GHz Stepping: 0 CPU MHz: 2070.796 CPU max MHz: 2800.0000 CPU min MHz: 1600.0000 BogoMIPS: 5587.32 Virtualization: VT-x L1d cache: 32K L1i cache: 32K L2 cache: 256K L3 cache: 3072K NUMA node0 CPU(s): 0,1 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 popcnt tsc_deadline_timer xsave lahf_lm epb tpr_shadow vnmi flexpriority ept vpid xsaveopt dtherm arat pln pts ''' return returncode, output # Confirms fix for: https://github.com/workhorsy/py-cpuinfo/issues/152 # CPU stepping, model, and family values are blank if 0 class TestBug152(unittest.TestCase): def setUp(self): helpers.backup_data_source(cpuinfo) helpers.monkey_patch_data_source(cpuinfo, MockDataSource) def tearDown(self): helpers.restore_data_source(cpuinfo) def test_get_cpu_info_from_lscpu(self): info = cpuinfo._get_cpu_info_from_lscpu() # Make sure fields with 0 are not filtered out self.assertIn('stepping', info.keys()) self.assertIn('model', info.keys()) self.assertIn('family', info.keys()) self.assertEqual(0, info['stepping']) self.assertEqual(0, info['model']) self.assertEqual(0, info['family']) def test_get_cpu_info_from_proc_cpuinfo(self): info = cpuinfo._get_cpu_info_from_proc_cpuinfo() # Make sure fields with 0 are not filtered out self.assertIn('stepping', info.keys()) self.assertIn('model', info.keys()) self.assertIn('family', info.keys()) self.assertEqual(0, info['stepping']) self.assertEqual(0, info['model']) self.assertEqual(0, info['family']) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/tests/test_cli.py0000664000175000017500000000513014325641176015701 0ustar00mattmatt import unittest from cpuinfo import * import helpers class TestCLI(unittest.TestCase): def setUp(self): helpers.backup_data_source(cpuinfo) def tearDown(self): helpers.restore_data_source(cpuinfo) def test_json(self): from subprocess import Popen, PIPE import json command = [sys.executable, 'cpuinfo/cpuinfo.py', '--json'] p1 = Popen(command, stdout=PIPE, stderr=PIPE, stdin=PIPE) output = p1.communicate()[0] self.assertEqual(0, p1.returncode) output = output.decode(encoding='UTF-8') info = json.loads(output, object_hook = cpuinfo._utf_to_str) self.assertEqual(list(cpuinfo.CPUINFO_VERSION), info['cpuinfo_version']) self.assertEqual(cpuinfo.CPUINFO_VERSION_STRING, info['cpuinfo_version_string']) def test_version(self): from subprocess import Popen, PIPE command = [sys.executable, 'cpuinfo/cpuinfo.py', '--version'] p1 = Popen(command, stdout=PIPE, stderr=PIPE, stdin=PIPE) output = p1.communicate()[0] self.assertEqual(0, p1.returncode) output = output.decode(encoding='UTF-8') output = output.strip() self.assertEqual(cpuinfo.CPUINFO_VERSION_STRING, output) def test_trace(self): import os import re from subprocess import Popen, PIPE # Get all log files before test before_log_files = [f for f in os.listdir('.') if os.path.isfile(f) and re.match(r'^cpuinfo_trace_\d+-\d+-\d+_\d+-\d+-\d+-\d+.trace$', f)] #print('\n', before_log_files) # Run with trace to generate new log file command = [sys.executable, 'cpuinfo/cpuinfo.py', '--trace'] p1 = Popen(command, stdout=PIPE, stderr=PIPE, stdin=PIPE) output = p1.communicate()[0] self.assertEqual(0, p1.returncode) # Get all log files after test after_log_files = [f for f in os.listdir('.') if os.path.isfile(f) and re.match(r'^cpuinfo_trace_\d+-\d+-\d+_\d+-\d+-\d+-\d+.trace$', f)] #print('\n', after_log_files) # Read the new log file into a string new_log_file = list(set(after_log_files) - set(before_log_files))[0] with open(new_log_file, 'r') as f: output = f.read().strip() # Remove the new log file os.remove(new_log_file) self.assertTrue(len(output) > 200) self.assertTrue(output.startswith('!' * 80)) self.assertTrue(output.endswith('!' * 80)) def test_default(self): from subprocess import Popen, PIPE command = [sys.executable, 'cpuinfo/cpuinfo.py'] p1 = Popen(command, stdout=PIPE, stderr=PIPE, stdin=PIPE) output = p1.communicate()[0] self.assertEqual(0, p1.returncode) output = output.decode(encoding='UTF-8') version = output.split('Cpuinfo Version: ')[1].split('\n')[0].strip() self.assertEqual(cpuinfo.CPUINFO_VERSION_STRING, version) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/tests/test_compile_errors.py0000664000175000017500000000154214325641176020161 0ustar00mattmatt import sys import unittest import helpers class TestCompileErrors(unittest.TestCase): def test_all(self): self.maxDiff = None import os from subprocess import Popen, PIPE # Find all the python files py_files = [] for root, dirs, files in os.walk("."): for file in files: if file.lower().endswith(".py"): py_files.append(os.path.join(root, file).lstrip(".\\").lstrip('/')) # Compile the files and check for errors command = sys.executable + " -Wall -m py_compile " + ' '.join(py_files) p1 = Popen(command.split(' '), stdout=PIPE, stderr=PIPE, stdin=PIPE) p1_stdout, p1_stderr = p1.communicate() p1_stdout = p1_stdout.decode(encoding='UTF-8') p1_stderr = p1_stderr.decode(encoding='UTF-8') # Check for no errors self.assertEqual("", p1_stderr) self.assertEqual("", p1_stdout) self.assertEqual(0, p1.returncode) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/tests/test_cpuid.py0000664000175000017500000002061314325641176016241 0ustar00mattmatt import unittest from cpuinfo import * import helpers class MockASM(ASM): is_first = False def __init__(self, restype=None, argtypes=(), machine_code=[]): super(MockASM, self).__init__(restype, argtypes, machine_code) def compile(self): self.func = self.run def run(self): machine_code = tuple(self.machine_code) # get_max_extension_support if machine_code == \ (b"\xB8\x00\x00\x00\x80" # mov ax,0x80000000 b"\x0f\xa2" # cpuid b"\xC3",): # ret return 0x8000001f # get_cache if machine_code == \ (b"\xB8\x06\x00\x00\x80" # mov ax,0x80000006 b"\x0f\xa2" # cpuid b"\x89\xC8" # mov ax,cx b"\xC3",): # ret)) return 0x2006140 # get_info if machine_code == \ (b"\xB8\x01\x00\x00\x00", # mov eax,0x1" b"\x0f\xa2" # cpuid b"\xC3",): # ret return 0x800f82 # get_processor_brand if machine_code == \ (b"\xB8\x02\x00\x00\x80", # mov ax,0x80000002 b"\x0f\xa2" # cpuid b"\x89\xC0" # mov ax,ax b"\xC3",): # ret return 0x20444d41 elif machine_code == \ (b"\xB8\x02\x00\x00\x80", # mov ax,0x80000002 b"\x0f\xa2" # cpuid b"\x89\xD8" # mov ax,bx b"\xC3",): # ret return 0x657a7952 elif machine_code == \ (b"\xB8\x02\x00\x00\x80", # mov ax,0x80000002 b"\x0f\xa2" # cpuid b"\x89\xC8" # mov ax,cx b"\xC3",): # ret return 0x2037206e elif machine_code == \ (b"\xB8\x02\x00\x00\x80", # mov ax,0x80000002 b"\x0f\xa2" # cpuid b"\x89\xD0" # mov ax,dx b"\xC3",): # ret return 0x30303732 elif machine_code == \ (b"\xB8\x03\x00\x00\x80", # mov ax,0x80000003 b"\x0f\xa2" # cpuid b"\x89\xC0" # mov ax,ax b"\xC3",): # ret return 0x69452058 elif machine_code == \ (b"\xB8\x03\x00\x00\x80", # mov ax,0x80000003 b"\x0f\xa2" # cpuid b"\x89\xD8" # mov ax,bx b"\xC3",): # ret return 0x2d746867 elif machine_code == \ (b"\xB8\x03\x00\x00\x80", # mov ax,0x80000003 b"\x0f\xa2" # cpuid b"\x89\xC8" # mov ax,cx b"\xC3",): # ret return 0x65726f43 elif machine_code == \ (b"\xB8\x03\x00\x00\x80", # mov ax,0x80000003 b"\x0f\xa2" # cpuid b"\x89\xD0" # mov ax,dx b"\xC3",): # ret return 0x6f725020 elif machine_code == \ (b"\xB8\x04\x00\x00\x80", # mov ax,0x80000004 b"\x0f\xa2" # cpuid b"\x89\xC0" # mov ax,ax b"\xC3",): # ret return 0x73736563 elif machine_code == \ (b"\xB8\x04\x00\x00\x80", # mov ax,0x80000004 b"\x0f\xa2" # cpuid b"\x89\xD8" # mov ax,bx b"\xC3",): # ret return 0x2020726f elif machine_code == \ (b"\xB8\x04\x00\x00\x80", # mov ax,0x80000004 b"\x0f\xa2" # cpuid b"\x89\xC8" # mov ax,cx b"\xC3",): # ret return 0x20202020 elif machine_code == \ (b"\xB8\x04\x00\x00\x80", # mov ax,0x80000004 b"\x0f\xa2" # cpuid b"\x89\xD0" # mov ax,dx b"\xC3",): # ret return 0x202020 # get_vendor_id if machine_code == \ (b"\x31\xC0", # xor eax,eax b"\x0F\xA2" # cpuid b"\x89\xD8" # mov ax,bx b"\xC3",): # ret return 0x68747541 elif machine_code == \ (b"\x31\xC0", # xor eax,eax b"\x0f\xa2" # cpuid b"\x89\xC8" # mov ax,cx b"\xC3",): # ret return 0x444d4163 elif machine_code == \ (b"\x31\xC0", # xor eax,eax b"\x0f\xa2" # cpuid b"\x89\xD0" # mov ax,dx b"\xC3",): # ret return 0x69746e65 # get_flags if machine_code == \ (b"\xB8\x01\x00\x00\x00", # mov eax,0x1" b"\x0f\xa2" # cpuid b"\x89\xD0" # mov ax,dx b"\xC3",): # ret return 0x178bfbff elif machine_code == \ (b"\xB8\x01\x00\x00\x00", # mov eax,0x1" b"\x0f\xa2" # cpuid b"\x89\xC8" # mov ax,cx b"\xC3",): # ret return 0x7ed8320b elif machine_code == \ (b"\x31\xC9", # xor ecx,ecx b"\xB8\x07\x00\x00\x00" # mov eax,7 b"\x0f\xa2" # cpuid b"\x89\xD8" # mov ax,bx b"\xC3",): # ret return 0x209c01a9 elif machine_code == \ (b"\x31\xC9", # xor ecx,ecx b"\xB8\x07\x00\x00\x00" # mov eax,7 b"\x0f\xa2" # cpuid b"\x89\xC8" # mov ax,cx b"\xC3",): # ret return 0x0 elif machine_code == \ (b"\xB8\x01\x00\x00\x80" # mov ax,0x80000001 b"\x0f\xa2" # cpuid b"\x89\xD8" # mov ax,bx b"\xC3",): # ret return 0x20000000 elif machine_code == \ (b"\xB8\x01\x00\x00\x80" # mov ax,0x80000001 b"\x0f\xa2" # cpuid b"\x89\xC8" # mov ax,cx b"\xC3",): # ret return 0x35c233ff # get_ticks # 32 bit if machine_code == \ (b"\x55", # push bp b"\x89\xE5", # mov bp,sp b"\x31\xC0", # xor ax,ax b"\x0F\xA2", # cpuid b"\x0F\x31", # rdtsc b"\x8B\x5D\x08", # mov bx,[di+0x8] b"\x8B\x4D\x0C", # mov cx,[di+0xc] b"\x89\x13", # mov [bp+di],dx b"\x89\x01", # mov [bx+di],ax b"\x5D", # pop bp b"\xC3",): # ret raise Exception("FIXME: Add ticks for 32bit get_ticks") # 64 bit elif machine_code == \ (b"\x48", # dec ax b"\x31\xC0", # xor ax,ax b"\x0F\xA2", # cpuid b"\x0F\x31", # rdtsc b"\x48", # dec ax b"\xC1\xE2\x20", # shl dx,byte 0x20 b"\x48", # dec ax b"\x09\xD0", # or ax,dx b"\xC3",): # ret MockASM.is_first = not MockASM.is_first if MockASM.is_first: return 19233706151817 else: return 19237434253761 raise Exception("Unexpected machine code") def free(self): self.func = None class MockDataSource(object): bits = '64bit' cpu_count = 1 is_windows = platform.system().lower() == 'windows' arch_string_raw = 'INVALID' uname_string_raw = 'INVALID' can_cpuid = True class TestCPUID(unittest.TestCase): def setUp(self): helpers.backup_data_source(cpuinfo) helpers.monkey_patch_data_source(cpuinfo, MockDataSource) helpers.backup_asm(cpuinfo) helpers.monkey_patch_asm(cpuinfo, MockASM) def tearDown(self): helpers.restore_data_source(cpuinfo) helpers.restore_asm(cpuinfo) # Make sure this returns {} on an invalid arch def test_return_empty(self): self.assertEqual({}, cpuinfo._get_cpu_info_from_cpuid()) def test_normal(self): cpuid = CPUID() self.assertIsNotNone(cpuid) self.assertFalse(cpuid.is_selinux_enforcing) max_extension_support = cpuid.get_max_extension_support() self.assertEqual(0x8000001f, max_extension_support) cache_info = cpuid.get_cache(max_extension_support) self.assertEqual({'size_b': 64 * 1024, 'line_size_b': 512, 'associativity': 6}, cache_info) info = cpuid.get_info() self.assertEqual({'stepping': 2, 'model': 8, 'family': 23, 'processor_type': 0}, info) processor_brand = cpuid.get_processor_brand(max_extension_support) self.assertEqual("AMD Ryzen 7 2700X Eight-Core Processor", processor_brand) hz_actual = cpuid.get_raw_hz() self.assertEqual(3728101944, hz_actual) vendor_id = cpuid.get_vendor_id() self.assertEqual('AuthenticAMD', vendor_id) flags = cpuid.get_flags(max_extension_support) self.assertEqual( ['3dnowprefetch', 'abm', 'adx', 'aes', 'apic', 'avx', 'avx2', 'bmi1', 'bmi2', 'clflush', 'clflushopt', 'cmov', 'cmp_legacy', 'cr8_legacy', 'cx16', 'cx8', 'dbx', 'de', 'extapic', 'f16c', 'fma', 'fpu', 'fxsr', 'ht', 'lahf_lm', 'lm', 'mca', 'mce', 'misalignsse', 'mmx', 'monitor', 'movbe', 'msr', 'mtrr', 'osvw', 'osxsave', 'pae', 'pat', 'pci_l2i', 'pclmulqdq', 'perfctr_core', 'perfctr_nb', 'pge', 'pni', 'popcnt', 'pse', 'pse36', 'rdrnd', 'rdseed', 'sep', 'sha', 'skinit', 'smap', 'smep', 'sse', 'sse2', 'sse4_1', 'sse4_2', 'sse4a', 'ssse3', 'svm', 'tce', 'topoext', 'tsc', 'vme', 'wdt', 'xsave' ], flags) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/tests/test_example.py0000664000175000017500000000452114325641176016570 0ustar00mattmatt import unittest from cpuinfo import * import helpers class MockDataSource(object): bits = '64bit' cpu_count = 1 is_windows = False arch_string_raw = 'x86_64' uname_string_raw = 'x86_64' @staticmethod def has_proc_cpuinfo(): return False @staticmethod def has_dmesg(): return False @staticmethod def has_var_run_dmesg_boot(): return False @staticmethod def has_cpufreq_info(): return False @staticmethod def has_sestatus(): return False @staticmethod def has_sysctl(): return False @staticmethod def has_isainfo(): return False @staticmethod def has_kstat(): return False @staticmethod def has_sysinfo(): return False @staticmethod def has_lscpu(): return False @staticmethod def cat_proc_cpuinfo(): return 1, None @staticmethod def cpufreq_info(): return 1, None @staticmethod def sestatus_b(): return 1, None @staticmethod def dmesg_a(): return 1, None @staticmethod def cat_var_run_dmesg_boot(): return 1, None @staticmethod def sysctl_machdep_cpu_hw_cpufrequency(): return 1, None @staticmethod def isainfo_vb(): return 1, None @staticmethod def kstat_m_cpu_info(): return 1, None @staticmethod def lscpu(): return 1, None @staticmethod def sysinfo_cpu(): return 1, None @staticmethod def winreg_processor_brand(): return None @staticmethod def winreg_vendor_id_raw(): return None @staticmethod def winreg_arch_string_raw(): return None @staticmethod def winreg_hz_actual(): return None @staticmethod def winreg_feature_bits(): return None class TestExample(unittest.TestCase): def setUp(self): helpers.backup_data_source(cpuinfo) helpers.monkey_patch_data_source(cpuinfo, MockDataSource) def tearDown(self): helpers.restore_data_source(cpuinfo) def test_all(self): self.assertEqual({}, cpuinfo._get_cpu_info_from_registry()) self.assertEqual({}, cpuinfo._get_cpu_info_from_proc_cpuinfo()) self.assertEqual({}, cpuinfo._get_cpu_info_from_sysctl()) self.assertEqual({}, cpuinfo._get_cpu_info_from_kstat()) self.assertEqual({}, cpuinfo._get_cpu_info_from_dmesg()) self.assertEqual({}, cpuinfo._get_cpu_info_from_cat_var_run_dmesg_boot()) self.assertEqual({}, cpuinfo._get_cpu_info_from_sysinfo()) #self.assertEqual({}, cpuinfo._get_cpu_info_from_cpuid()) #self.assertEqual({}, cpuinfo._get_cpu_info_internal()) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/tests/test_filter.py0000664000175000017500000000176514325641176016431 0ustar00mattmatt import unittest from cpuinfo import * import helpers class TestFilter(unittest.TestCase): def test_filter(self): # Make sure NON empty values DON'T get filtered out for x in [2, "abc", ("one"), {"key" : "val"}, [9, 8, 7]]: info = { 'example' : x } info = cpuinfo._filter_dict_keys_with_empty_values(info) self.assertEqual(info, { 'example' : x }) # Make sure empty values get filtered out for x in [None, 0, -1, "", (), {}, [], (0, 0), "0.0"]: info = { 'example' : x } info = cpuinfo._filter_dict_keys_with_empty_values(info) self.assertEqual(info, {}) # Make sure 0 values get filtered out info = { 'aaa':1, 'bbb':0, 'ccc':2 } info = cpuinfo._filter_dict_keys_with_empty_values(info) self.assertEqual(info, { 'aaa':1, 'ccc':2 }) # Make sure 0 values dont get filtered out with 0 as acceptable value info = { 'aaa':1, 'bbb':0, 'ccc':2 } info = cpuinfo._filter_dict_keys_with_empty_values(info, { 'bbb' : 0 }) self.assertEqual(info, { 'aaa':1, 'bbb':0, 'ccc':2 }) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/tests/test_free_bsd_11_x86_64.py0000664000175000017500000001354614325641176020234 0ustar00mattmatt import unittest from cpuinfo import * import helpers class MockDataSource(object): bits = '64bit' cpu_count = 1 is_windows = False arch_string_raw = 'amd64' uname_string_raw = 'x86_64' can_cpuid = False @staticmethod def has_dmesg(): return True @staticmethod def has_var_run_dmesg_boot(): return True @staticmethod def dmesg_a(): retcode = 0 output = r'''Copyright (c) 1992-2014 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. FreeBSD is a registered trademark of The FreeBSD Foundation. FreeBSD 10.0-RELEASE-p17 #0: Tue Sep 16 14:33:46 UTC 2014 root@amd64-builder.pcbsd.org:/usr/obj/usr/src/sys/GENERIC amd64 FreeBSD clang version 3.3 (tags/RELEASE_33/final 183502) 20130610 VT(vga): text 80x25 CPU: Intel(R) Pentium(R) CPU G640 @ 2.80GHz (2793.73-MHz K8-class CPU) Origin="GenuineIntel" Id=0x206a7 Family=0x6 Model=02a Stepping=7 Features=0x1783fbff Features2=0xc982203 AMD Features=0x28100800 AMD Features2=0x1 TSC: P-state invariant ''' return retcode, output @staticmethod def cat_var_run_dmesg_boot(): retcode = 0 output = r''' VT(vga): text 80x25 CPU: Intel(R) Pentium(R) CPU G640 @ 2.80GHz (2793.73-MHz K8-class CPU) Origin="GenuineIntel" Id=0x206a7 Family=0x6 Model=02a Stepping=7 Features=0x1783fbff Features2=0xc982203 AMD Features=0x28100800 AMD Features2=0x1 TSC: P-state invariant ''' return retcode, output class TestFreeBSD_11_X86_64(unittest.TestCase): def setUp(self): helpers.backup_data_source(cpuinfo) helpers.monkey_patch_data_source(cpuinfo, MockDataSource) def tearDown(self): helpers.restore_data_source(cpuinfo) ''' Make sure calls return the expected number of fields. ''' def test_returns(self): self.assertEqual(0, len(cpuinfo._get_cpu_info_from_registry())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpufreq_info())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_lscpu())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_proc_cpuinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysctl())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_kstat())) self.assertEqual(10, len(cpuinfo._get_cpu_info_from_dmesg())) self.assertEqual(10, len(cpuinfo._get_cpu_info_from_cat_var_run_dmesg_boot())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_ibm_pa_features())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpuid())) self.assertEqual(17, len(cpuinfo._get_cpu_info_internal())) def test_get_cpu_info_from_dmesg(self): info = cpuinfo._get_cpu_info_from_dmesg() self.assertEqual('GenuineIntel', info['vendor_id_raw']) self.assertEqual('Intel(R) Pentium(R) CPU G640 @ 2.80GHz', info['brand_raw']) self.assertEqual('2.8000 GHz', info['hz_advertised_friendly']) self.assertEqual('2.8000 GHz', info['hz_actual_friendly']) self.assertEqual((2800000000, 0), info['hz_advertised']) self.assertEqual((2800000000, 0), info['hz_actual']) self.assertEqual(7, info['stepping']) self.assertEqual(42, info['model']) self.assertEqual(6, info['family']) self.assertEqual( ['apic', 'cmov', 'cx16', 'cx8', 'de', 'fpu', 'fxsr', 'htt', 'lahf', 'lm', 'mca', 'mce', 'mmx', 'msr', 'mtrr', 'nx', 'osxsave', 'pae', 'pat', 'pclmulqdq', 'pge', 'popcnt', 'pse', 'pse36', 'rdtscp', 'sep', 'sse', 'sse2', 'sse3', 'sse4.1', 'sse4.2', 'ssse3', 'syscall', 'tsc', 'vme', 'xsave'] , info['flags'] ) def test_get_cpu_info_from_cat_var_run_dmesg_boot(self): info = cpuinfo._get_cpu_info_from_cat_var_run_dmesg_boot() self.assertEqual('GenuineIntel', info['vendor_id_raw']) self.assertEqual('Intel(R) Pentium(R) CPU G640 @ 2.80GHz', info['brand_raw']) self.assertEqual('2.8000 GHz', info['hz_advertised_friendly']) self.assertEqual('2.8000 GHz', info['hz_actual_friendly']) self.assertEqual((2800000000, 0), info['hz_advertised']) self.assertEqual((2800000000, 0), info['hz_actual']) self.assertEqual(7, info['stepping']) self.assertEqual(42, info['model']) self.assertEqual(6, info['family']) self.assertEqual( ['apic', 'cmov', 'cx16', 'cx8', 'de', 'fpu', 'fxsr', 'htt', 'lahf', 'lm', 'mca', 'mce', 'mmx', 'msr', 'mtrr', 'nx', 'osxsave', 'pae', 'pat', 'pclmulqdq', 'pge', 'popcnt', 'pse', 'pse36', 'rdtscp', 'sep', 'sse', 'sse2', 'sse3', 'sse4.1', 'sse4.2', 'ssse3', 'syscall', 'tsc', 'vme', 'xsave'] , info['flags'] ) def test_all(self): info = cpuinfo._get_cpu_info_internal() self.assertEqual('GenuineIntel', info['vendor_id_raw']) self.assertEqual('Intel(R) Pentium(R) CPU G640 @ 2.80GHz', info['brand_raw']) self.assertEqual('2.8000 GHz', info['hz_advertised_friendly']) self.assertEqual('2.8000 GHz', info['hz_actual_friendly']) self.assertEqual((2800000000, 0), info['hz_advertised']) self.assertEqual((2800000000, 0), info['hz_actual']) self.assertEqual('X86_64', info['arch']) self.assertEqual(64, info['bits']) self.assertEqual(1, info['count']) self.assertEqual('amd64', info['arch_string_raw']) self.assertEqual(7, info['stepping']) self.assertEqual(42, info['model']) self.assertEqual(6, info['family']) self.assertEqual( ['apic', 'cmov', 'cx16', 'cx8', 'de', 'fpu', 'fxsr', 'htt', 'lahf', 'lm', 'mca', 'mce', 'mmx', 'msr', 'mtrr', 'nx', 'osxsave', 'pae', 'pat', 'pclmulqdq', 'pge', 'popcnt', 'pse', 'pse36', 'rdtscp', 'sep', 'sse', 'sse2', 'sse3', 'sse4.1', 'sse4.2', 'ssse3', 'syscall', 'tsc', 'vme', 'xsave'] , info['flags'] ) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/tests/test_haiku_x86_32.py0000664000175000017500000001033514325641176017247 0ustar00mattmatt import unittest from cpuinfo import * import helpers class MockDataSource(object): bits = '32bit' cpu_count = 4 is_windows = False arch_string_raw = 'BePC' uname_string_raw = 'x86_32' can_cpuid = False @staticmethod def has_sysinfo(): return True @staticmethod def sysinfo_cpu(): returncode = 0 output = r''' 4 Intel Core i7, revision 46e5 running at 2928MHz (ID: 0x00000000 0x00000000) CPU #0: "Intel(R) Core(TM) i7 CPU 870 @ 2.93GHz" Type 0, family 6, model 30, stepping 5, features 0x178bfbbf FPU VME DE PSE TSC MSR MCE CX8 APIC SEP MTRR PGE MCA CMOV PAT PSE36 CFLUSH MMX FXSTR SSE SSE2 HTT Extended Intel: 0x00000201 SSE3 SSSE3 Extended AMD: type 0, family 0, model 0, stepping 0, features 0x08000000 RDTSCP Power Management Features: L2 Data cache 8-way set associative, 1 lines/tag, 64 bytes/line L2 cache: 0 KB, 1-way set associative, 0 lines/tag, 63 bytes/line Data TLB: 2M/4M-bytes pages, 4-way set associative, 32 entries Data TLB: 4k-byte pages, 4-way set associative, 64 entries Inst TLB: 2M/4M-bytes pages, fully associative, 7 entries L3 cache: 8192 KB, 16-way set associative, 64-bytes/line Inst TLB: 4K-bytes pages, 4-way set associative, 128 entries 64-byte Prefetching L1 data cache: 32 KB, 8-way set associative, 64 bytes/line L2 cache: 256 KB (MLC), 8-way set associative, 64-bytes/line Shared 2nd-level TLB: 4K, 4-way set associative, 512 entries Unknown cache descriptor 0x09 ''' return returncode, output class TestHaiku_x86_32(unittest.TestCase): def setUp(self): helpers.backup_data_source(cpuinfo) helpers.monkey_patch_data_source(cpuinfo, MockDataSource) def tearDown(self): helpers.restore_data_source(cpuinfo) ''' Make sure calls return the expected number of fields. ''' def test_returns(self): self.assertEqual(0, len(cpuinfo._get_cpu_info_from_registry())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpufreq_info())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_lscpu())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_proc_cpuinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysctl())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_kstat())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_dmesg())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cat_var_run_dmesg_boot())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_ibm_pa_features())) self.assertEqual(9, len(cpuinfo._get_cpu_info_from_sysinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpuid())) self.assertEqual(16, len(cpuinfo._get_cpu_info_internal())) def test_get_cpu_info_from_sysinfo(self): info = cpuinfo._get_cpu_info_from_sysinfo() self.assertEqual('Intel(R) Core(TM) i7 CPU 870 @ 2.93GHz', info['brand_raw']) self.assertEqual('2.9300 GHz', info['hz_advertised_friendly']) self.assertEqual('2.9300 GHz', info['hz_actual_friendly']) self.assertEqual((2930000000, 0), info['hz_advertised']) self.assertEqual((2930000000, 0), info['hz_actual']) self.assertEqual(5, info['stepping']) self.assertEqual(30, info['model']) self.assertEqual(6, info['family']) self.assertEqual( ['apic', 'cflush', 'cmov', 'cx8', 'de', 'fpu', 'fxstr', 'htt', 'mca', 'mce', 'mmx', 'msr', 'mtrr', 'pat', 'pge', 'pse', 'pse36', 'rdtscp', 'sep', 'sse', 'sse2', 'sse3', 'ssse3', 'tsc', 'vme'] , info['flags'] ) def test_all(self): info = cpuinfo._get_cpu_info_internal() self.assertEqual('Intel(R) Core(TM) i7 CPU 870 @ 2.93GHz', info['brand_raw']) self.assertEqual('2.9300 GHz', info['hz_advertised_friendly']) self.assertEqual('2.9300 GHz', info['hz_actual_friendly']) self.assertEqual((2930000000, 0), info['hz_advertised']) self.assertEqual((2930000000, 0), info['hz_actual']) self.assertEqual('X86_32', info['arch']) self.assertEqual(32, info['bits']) self.assertEqual(4, info['count']) self.assertEqual('BePC', info['arch_string_raw']) self.assertEqual(5, info['stepping']) self.assertEqual(30, info['model']) self.assertEqual(6, info['family']) self.assertEqual( ['apic', 'cflush', 'cmov', 'cx8', 'de', 'fpu', 'fxstr', 'htt', 'mca', 'mce', 'mmx', 'msr', 'mtrr', 'pat', 'pge', 'pse', 'pse36', 'rdtscp', 'sep', 'sse', 'sse2', 'sse3', 'ssse3', 'tsc', 'vme'] , info['flags'] ) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/tests/test_haiku_x86_64.py0000664000175000017500000001073714325641176017262 0ustar00mattmatt import unittest from cpuinfo import * import helpers class MockDataSource(object): bits = '64bit' cpu_count = 4 is_windows = False arch_string_raw = 'BePC' uname_string_raw = 'x86_64' can_cpuid = False @staticmethod def has_sysinfo(): return True @staticmethod def sysinfo_cpu(): returncode = 0 output = r''' 1 Intel Core i7, revision 106e5 running at 2933MHz CPU #0: "Intel(R) Core(TM) i7 CPU 870 @ 2.93GHz" Signature: 0x0106e5; Type 0, family 6, model 30, stepping 5 Features: 0x078bfbff FPU VME DE PSE TSC MSR PAE MCE CX8 APIC SEP MTRR PGE MCA CMOV PAT PSE36 CFLUSH MMX FXSTR SSE SSE2 Extended Features (0x00000001): 0x00180209 SSE3 MONITOR SSSE3 SSE4.1 SSE4.2 Extended Features (0x80000001): 0x28100800 SCE NX RDTSCP 64 L2 Data cache fully associative, 1 lines/tag, 64 bytes/line L2 cache: 0 KB, 1-way set associative, 0 lines/tag, 63 bytes/line L0 Data TLB: 2M/4M-bytes pages, 4-way set associative, 32 entries Data TLB: 4k-byte pages, 4-way set associative, 64 entries Inst TLB: 2M/4M-bytes pages, fully associative, 7 entries L3 cache: 8192 KB, 16-way set associative, 64-bytes/line Inst TLB: 4K-bytes pages, 4-way set associative, 128 entries 64-byte Prefetching L1 data cache: 32 KB, 8-way set associative, 64 bytes/line L2 cache: 256 KB (MLC), 8-way set associative, 64-bytes/line Shared 2nd-level TLB: 4K, 4-way set associative, 512 entries Unknown cache descriptor 0x09 ''' return returncode, output class TestHaiku_x86_64(unittest.TestCase): def setUp(self): helpers.backup_data_source(cpuinfo) helpers.monkey_patch_data_source(cpuinfo, MockDataSource) def tearDown(self): helpers.restore_data_source(cpuinfo) ''' Make sure calls return the expected number of fields. ''' def test_returns(self): self.assertEqual(0, len(cpuinfo._get_cpu_info_from_registry())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpufreq_info())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_lscpu())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_proc_cpuinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysctl())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_kstat())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_dmesg())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cat_var_run_dmesg_boot())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_ibm_pa_features())) self.assertEqual(9, len(cpuinfo._get_cpu_info_from_sysinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpuid())) self.assertEqual(16, len(cpuinfo._get_cpu_info_internal())) def test_get_cpu_info_from_sysinfo(self): info = cpuinfo._get_cpu_info_from_sysinfo() self.assertEqual('Intel(R) Core(TM) i7 CPU 870 @ 2.93GHz', info['brand_raw']) self.assertEqual('2.9330 GHz', info['hz_advertised_friendly']) self.assertEqual('2.9330 GHz', info['hz_actual_friendly']) self.assertEqual((2933000000, 0), info['hz_advertised']) self.assertEqual((2933000000, 0), info['hz_actual']) self.assertEqual(5, info['stepping']) self.assertEqual(30, info['model']) self.assertEqual(6, info['family']) self.assertEqual( ['64', 'apic', 'cflush', 'cmov', 'cx8', 'de', 'fpu', 'fxstr', 'mca', 'mce', 'mmx', 'monitor', 'msr', 'mtrr', 'nx', 'pae', 'pat', 'pge', 'pse', 'pse36', 'rdtscp', 'sce', 'sep', 'sse', 'sse2', 'sse3', 'sse4.1', 'sse4.2', 'ssse3', 'tsc', 'vme'] , info['flags'] ) def test_all(self): info = cpuinfo._get_cpu_info_internal() self.assertEqual('Intel(R) Core(TM) i7 CPU 870 @ 2.93GHz', info['brand_raw']) self.assertEqual('2.9330 GHz', info['hz_advertised_friendly']) self.assertEqual('2.9330 GHz', info['hz_actual_friendly']) self.assertEqual((2933000000, 0), info['hz_advertised']) self.assertEqual((2933000000, 0), info['hz_actual']) self.assertEqual('X86_32', info['arch']) self.assertEqual(32, info['bits']) self.assertEqual(4, info['count']) self.assertEqual('BePC', info['arch_string_raw']) self.assertEqual(5, info['stepping']) self.assertEqual(30, info['model']) self.assertEqual(6, info['family']) self.assertEqual( ['64', 'apic', 'cflush', 'cmov', 'cx8', 'de', 'fpu', 'fxstr', 'mca', 'mce', 'mmx', 'monitor', 'msr', 'mtrr', 'nx', 'pae', 'pat', 'pge', 'pse', 'pse36', 'rdtscp', 'sce', 'sep', 'sse', 'sse2', 'sse3', 'sse4.1', 'sse4.2', 'ssse3', 'tsc', 'vme'] , info['flags'] ) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/tests/test_haiku_x86_64_beta_1_ryzen_7.py0000664000175000017500000001067014325641176022146 0ustar00mattmatt import unittest from cpuinfo import * import helpers class MockDataSource(object): bits = '32bit' cpu_count = 2 is_windows = False arch_string_raw = 'BePC' uname_string_raw = 'x86_32' can_cpuid = False @staticmethod def has_sysinfo(): return True @staticmethod def sysinfo_cpu(): returncode = 0 output = r''' 2 AMD Ryzen 7, revision 800f82 running at 3693MHz CPU #0: "AMD Ryzen 7 2700X Eight-Core Processor " Signature: 0x800f82; Type 0, family 23, model 8, stepping 2 Features: 0x178bfbff FPU VME DE PSE TSC MSR PAE MCE CX8 APIC SEP MTRR PGE MCA CMOV PAT PSE36 CFLUSH MMX FXSTR SSE SSE2 HTT Extended Features (0x00000001): 0x56d82203 SSE3 PCLMULDQ SSSE3 CX16 SSE4.1 SSE4.2 MOVEB POPCNT AES XSAVE AVX RDRND Extended Features (0x80000001): 0x2bd3fb7f SCE NX AMD-MMX FXSR FFXSR RDTSCP 64 Extended Features (0x80000007): 0x00000100 ITSC Extended Features (0x80000008): 0x00000000 Inst TLB: 2M/4M-byte pages, 64 entries, fully associative Data TLB: 2M/4M-byte pages, 64 entries, fully associative Inst TLB: 4K-byte pages, 64 entries, fully associative Data TLB: 4K-byte pages, 64 entries, fully associative L1 inst cache: 32 KB, 8-way set associative, 1 lines/tag, 64 bytes/line L1 data cache: 64 KB, 4-way set associative, 1 lines/tag, 64 bytes/line L2 cache: 512 KB, 8-way set associative, 1 lines/tag, 64 bytes/line ''' return returncode, output class TestHaiku_x86_64_Beta_1_Ryzen7(unittest.TestCase): def setUp(self): helpers.backup_data_source(cpuinfo) helpers.monkey_patch_data_source(cpuinfo, MockDataSource) def tearDown(self): helpers.restore_data_source(cpuinfo) ''' Make sure calls return the expected number of fields. ''' def test_returns(self): self.assertEqual(0, len(cpuinfo._get_cpu_info_from_registry())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpufreq_info())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_lscpu())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_proc_cpuinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysctl())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_kstat())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_dmesg())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cat_var_run_dmesg_boot())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_ibm_pa_features())) self.assertEqual(9, len(cpuinfo._get_cpu_info_from_sysinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpuid())) self.assertEqual(16, len(cpuinfo._get_cpu_info_internal())) def test_get_cpu_info_from_sysinfo(self): info = cpuinfo._get_cpu_info_from_sysinfo() self.assertEqual('AMD Ryzen 7 2700X Eight-Core Processor', info['brand_raw']) self.assertEqual('3.6930 GHz', info['hz_advertised_friendly']) self.assertEqual('3.6930 GHz', info['hz_actual_friendly']) self.assertEqual((3693000000, 0), info['hz_advertised']) self.assertEqual((3693000000, 0), info['hz_actual']) self.assertEqual(2, info['stepping']) self.assertEqual(8, info['model']) self.assertEqual(23, info['family']) self.assertEqual( ['64', 'aes', 'amd-mmx', 'apic', 'avx', 'cflush', 'cmov', 'cx16', 'cx8', 'de', 'ffxsr', 'fpu', 'fxsr', 'fxstr', 'htt', 'mca', 'mce', 'mmx', 'moveb', 'msr', 'mtrr', 'nx', 'pae', 'pat', 'pclmuldq', 'pge', 'popcnt', 'pse', 'pse36', 'rdrnd', 'rdtscp', 'sce', 'sep', 'sse', 'sse2', 'sse3', 'sse4.1', 'sse4.2', 'ssse3', 'tsc', 'vme', 'xsave'] , info['flags'] ) def test_all(self): info = cpuinfo._get_cpu_info_internal() self.assertEqual('AMD Ryzen 7 2700X Eight-Core Processor', info['brand_raw']) self.assertEqual('3.6930 GHz', info['hz_advertised_friendly']) self.assertEqual('3.6930 GHz', info['hz_actual_friendly']) self.assertEqual((3693000000, 0), info['hz_advertised']) self.assertEqual((3693000000, 0), info['hz_actual']) self.assertEqual('X86_32', info['arch']) self.assertEqual(32, info['bits']) self.assertEqual(2, info['count']) self.assertEqual('BePC', info['arch_string_raw']) self.assertEqual(2, info['stepping']) self.assertEqual(8, info['model']) self.assertEqual(23, info['family']) self.assertEqual( ['64', 'aes', 'amd-mmx', 'apic', 'avx', 'cflush', 'cmov', 'cx16', 'cx8', 'de', 'ffxsr', 'fpu', 'fxsr', 'fxstr', 'htt', 'mca', 'mce', 'mmx', 'moveb', 'msr', 'mtrr', 'nx', 'pae', 'pat', 'pclmuldq', 'pge', 'popcnt', 'pse', 'pse36', 'rdrnd', 'rdtscp', 'sce', 'sep', 'sse', 'sse2', 'sse3', 'sse4.1', 'sse4.2', 'ssse3', 'tsc', 'vme', 'xsave'] , info['flags'] ) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/tests/test_invalid_cpu.py0000664000175000017500000000166014325641176017433 0ustar00mattmatt import unittest from cpuinfo import * import helpers class MockDataSource(object): bits = '32bit' cpu_count = 1 is_windows = False arch_string_raw = 'unknown_cpu' uname_string_raw = 'unknown_cpu' class TestInvalidCPU(unittest.TestCase): def setUp(self): helpers.backup_data_source(cpuinfo) helpers.monkey_patch_data_source(cpuinfo, MockDataSource) def tearDown(self): helpers.restore_data_source(cpuinfo) def test_arch_parse_unknown(self): # If the arch is unknown, the result should be null arch, bits = cpuinfo._parse_arch(DataSource.arch_string_raw) self.assertIsNone(arch) self.assertIsNone(bits) def test_check_arch_exception(self): # If the arch is unknown, it should raise and exception try: cpuinfo._check_arch() self.fail('Failed to raise Exception') except Exception as err: self.assertEqual('py-cpuinfo currently only works on X86 and some ARM/PPC/S390X/MIPS/RISCV CPUs.', err.args[0]) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/tests/test_linux_aarch64_64.py0000664000175000017500000001213414325641176020114 0ustar00mattmatt import unittest from cpuinfo import * import helpers class MockDataSource(object): bits = '64bit' cpu_count = 6 is_windows = False arch_string_raw = 'aarch64' uname_string_raw = '' can_cpuid = False @staticmethod def has_proc_cpuinfo(): return True @staticmethod def has_lscpu(): return True @staticmethod def cat_proc_cpuinfo(): returncode = 0 output = r''' processor : 90 BogoMIPS : 200.00 Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics CPU implementer : 0x43 CPU architecture: 8 CPU variant : 0x1 CPU part : 0x0a1 CPU revision : 0 processor : 91 BogoMIPS : 200.00 Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics CPU implementer : 0x43 CPU architecture: 8 CPU variant : 0x1 CPU part : 0x0a1 CPU revision : 0 processor : 92 BogoMIPS : 200.00 Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics CPU implementer : 0x43 CPU architecture: 8 CPU variant : 0x1 CPU part : 0x0a1 CPU revision : 0 processor : 93 BogoMIPS : 200.00 Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics CPU implementer : 0x43 CPU architecture: 8 CPU variant : 0x1 CPU part : 0x0a1 CPU revision : 0 processor : 94 BogoMIPS : 200.00 Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics CPU implementer : 0x43 CPU architecture: 8 CPU variant : 0x1 CPU part : 0x0a1 CPU revision : 0 processor : 95 BogoMIPS : 200.00 Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics CPU implementer : 0x43 CPU architecture: 8 CPU variant : 0x1 CPU part : 0x0a1 CPU revision : 0 ''' return returncode, output @staticmethod def lscpu(): returncode = 0 output = r''' Architecture: aarch64 Byte Order: Little Endian CPU(s): 96 On-line CPU(s) list: 0-95 Thread(s) per core: 1 Core(s) per socket: 48 Socket(s): 2 NUMA node(s): 2 L1d cache: 32K L1i cache: 78K L2 cache: 16384K NUMA node0 CPU(s): 0-47 NUMA node1 CPU(s): 48-95 ''' return returncode, output class TestLinux_Aarch_64(unittest.TestCase): def setUp(self): helpers.backup_data_source(cpuinfo) helpers.monkey_patch_data_source(cpuinfo, MockDataSource) def tearDown(self): helpers.restore_data_source(cpuinfo) ''' Make sure calls return the expected number of fields. ''' def test_returns(self): self.assertEqual(0, len(cpuinfo._get_cpu_info_from_registry())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpufreq_info())) self.assertEqual(3, len(cpuinfo._get_cpu_info_from_lscpu())) self.assertEqual(1, len(cpuinfo._get_cpu_info_from_proc_cpuinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysctl())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_kstat())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_dmesg())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cat_var_run_dmesg_boot())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_ibm_pa_features())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpuid())) self.assertEqual(11, len(cpuinfo._get_cpu_info_internal())) def test_get_cpu_info_from_lscpu(self): info = cpuinfo._get_cpu_info_from_lscpu() self.assertEqual(78 * 1024, info['l1_instruction_cache_size']) self.assertEqual(32 * 1024, info['l1_data_cache_size']) self.assertEqual(16384 * 1024, info['l2_cache_size']) self.assertEqual(3, len(info)) def test_get_cpu_info_from_proc_cpuinfo(self): info = cpuinfo._get_cpu_info_from_proc_cpuinfo() self.assertEqual( ['aes', 'asimd', 'atomics', 'crc32', 'evtstrm', 'fp', 'pmull', 'sha1', 'sha2'] , info['flags'] ) @unittest.skip("FIXME: This fails because it does not have a way to get CPU brand string and Hz.") def test_all(self): info = cpuinfo._get_cpu_info_internal() self.assertEqual('', info['vendor_id_raw']) self.assertEqual('FIXME', info['hardware_raw']) self.assertEqual('FIXME', info['brand_raw']) self.assertEqual('FIXME', info['hz_advertised_friendly']) self.assertEqual('FIXME', info['hz_actual_friendly']) self.assertEqual((1000000000, 0), info['hz_advertised']) self.assertEqual((1000000000, 0), info['hz_actual']) self.assertEqual('ARM_8', info['arch']) self.assertEqual(64, info['bits']) self.assertEqual(6, info['count']) self.assertEqual('aarch64', info['arch_string_raw']) self.assertEqual(78 * 1024, info['l1_instruction_cache_size']) self.assertEqual(32 * 1024, info['l1_data_cache_size']) self.assertEqual(16384 * 1024, info['l2_cache_size']) self.assertEqual(0, info['l2_cache_line_size']) self.assertEqual(0, info['l2_cache_associativity']) self.assertEqual(0, info['l3_cache_size']) self.assertEqual(0, info['stepping']) self.assertEqual(0, info['model']) self.assertEqual(0, info['family']) self.assertEqual(0, info['processor_type']) self.assertEqual( ['aes', 'asimd', 'atomics', 'crc32', 'evtstrm', 'fp', 'pmull', 'sha1', 'sha2'] , info['flags'] ) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/tests/test_linux_alt_p9_mipsel_bfk3.py0000664000175000017500000000763214325641176022030 0ustar00mattmatt import unittest from cpuinfo import * import helpers class MockDataSource(object): bits = '32bit' cpu_count = 2 is_windows = False arch_string_raw = 'mips' uname_string_raw = '' can_cpuid = False @staticmethod def has_proc_cpuinfo(): return True @staticmethod def has_lscpu(): return True @staticmethod def cat_proc_cpuinfo(): returncode = 0 output = r''' system type : Baikal-T Generic SoC machine : Baikal-T1 BFK3 evaluation board processor : 0 cpu model : MIPS P5600 V3.0 FPU V2.0 BogoMIPS : 1196.85 wait instruction : yes microsecond timers : yes tlb_entries : 576 extra interrupt vector : yes hardware watchpoint : yes, count: 4, address/irw mask: [0x0ffc, 0x0ffc, 0x0ffb, 0x0ffb] isa : mips1 mips2 mips32r1 mips32r2 ASEs implemented : vz msa eva xpa shadow register sets : 1 kscratch registers : 3 package : 0 core : 0 VCED exceptions : not available VCEI exceptions : not available processor : 1 cpu model : MIPS P5600 V3.0 FPU V2.0 BogoMIPS : 1202.58 wait instruction : yes microsecond timers : yes tlb_entries : 576 extra interrupt vector : yes hardware watchpoint : yes, count: 4, address/irw mask: [0x0ffc, 0x0ffc, 0x0ffb, 0x0ffb] isa : mips1 mips2 mips32r1 mips32r2 ASEs implemented : vz msa eva xpa shadow register sets : 1 kscratch registers : 3 package : 0 core : 1 VCED exceptions : not available VCEI exceptions : not available ''' return returncode, output @staticmethod def lscpu(): returncode = 0 output = r''' Architecture: mips Byte Order: Little Endian CPU(s): 2 On-line CPU(s) list: 0,1 Thread(s) per core: 1 Core(s) per socket: 2 Socket(s): 1 Model: MIPS P5600 V3.0 FPU V2.0 CPU max MHz: 1200,0000 CPU min MHz: 200,0000 BogoMIPS: 1196.85 Flags: vz msa eva xpa ''' return returncode, output class TestLinuxAlt_p9_mipsel_bfk3(unittest.TestCase): def setUp(self): helpers.backup_data_source(cpuinfo) helpers.monkey_patch_data_source(cpuinfo, MockDataSource) def tearDown(self): helpers.restore_data_source(cpuinfo) ''' Make sure calls return the expected number of fields. ''' def test_returns(self): self.assertEqual(0, len(cpuinfo._get_cpu_info_from_registry())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpufreq_info())) self.assertEqual(6, len(cpuinfo._get_cpu_info_from_lscpu())) self.assertEqual(1, len(cpuinfo._get_cpu_info_from_proc_cpuinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysctl())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_kstat())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_dmesg())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cat_var_run_dmesg_boot())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_ibm_pa_features())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpuid())) self.assertEqual(13, len(cpuinfo._get_cpu_info_internal())) def test_get_cpu_info_from_lscpu(self): info = cpuinfo._get_cpu_info_from_lscpu() self.assertEqual('MIPS P5600 V3.0 FPU V2.0', info['brand_raw']) self.assertEqual('1.2000 GHz', info['hz_advertised_friendly']) self.assertEqual('1.2000 GHz', info['hz_actual_friendly']) self.assertEqual((1200000000, 0), info['hz_advertised']) self.assertEqual((1200000000, 0), info['hz_actual']) self.assertEqual(['eva', 'msa', 'vz', 'xpa'], info['flags']) def test_get_cpu_info_from_proc_cpuinfo(self): info = cpuinfo._get_cpu_info_from_proc_cpuinfo() self.assertEqual(['eva', 'msa', 'vz', 'xpa'], info['flags']) def test_all(self): info = cpuinfo._get_cpu_info_internal() self.assertEqual('MIPS P5600 V3.0 FPU V2.0', info['brand_raw']) self.assertEqual('MIPS_32', info['arch']) self.assertEqual(32, info['bits']) self.assertEqual(2, info['count']) self.assertEqual('mips', info['arch_string_raw']) self.assertEqual(['eva', 'msa', 'vz', 'xpa'], info['flags']) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/tests/test_linux_beagle_bone_arm.py0000664000175000017500000001003714325641176021434 0ustar00mattmatt import unittest from cpuinfo import * import helpers class MockDataSource(object): bits = '32bit' cpu_count = 1 is_windows = False arch_string_raw = 'armv7l' uname_string_raw = '' @staticmethod def has_proc_cpuinfo(): return True @staticmethod def has_cpufreq_info(): return True @staticmethod def cat_proc_cpuinfo(): returncode = 0 output = r''' processor : 0 model name : ARMv6-compatible processor rev 7 (v6l) Features : swp half thumb fastmult vfp edsp java tls CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x0 CPU part : 0xb76 CPU revision : 7 Hardware : BCM2708 Revision : 0010 Serial : 00000000be6d9ba0 ''' return returncode, output @staticmethod def cpufreq_info(): returncode = 0 output = r''' cpufrequtils 008: cpufreq-info (C) Dominik Brodowski 2004-2009 Report errors and bugs to cpufreq@vger.kernel.org, please. analyzing CPU 0: driver: generic_cpu0 CPUs which run at the same hardware frequency: 0 CPUs which need to have their frequency coordinated by software: 0 maximum transition latency: 300 us. hardware limits: 300 MHz - 1000 MHz available frequency steps: 300 MHz, 600 MHz, 800 MHz, 1000 MHz available cpufreq governors: conservative, ondemand, userspace, powersave, performance current policy: frequency should be within 300 MHz and 1000 MHz. The governor "performance" may decide which speed to use within this range. current CPU frequency is 1000 MHz. cpufreq stats: 300 MHz:0.00%, 600 MHz:0.00%, 800 MHz:0.00%, 1000 MHz:100.00% ''' return returncode, output class TestLinux_BeagleBone(unittest.TestCase): def setUp(self): helpers.backup_data_source(cpuinfo) helpers.monkey_patch_data_source(cpuinfo, MockDataSource) def tearDown(self): helpers.restore_data_source(cpuinfo) ''' Make sure calls return the expected number of fields. ''' def test_returns(self): self.assertEqual(0, len(cpuinfo._get_cpu_info_from_registry())) self.assertEqual(4, len(cpuinfo._get_cpu_info_from_cpufreq_info())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_lscpu())) self.assertEqual(3, len(cpuinfo._get_cpu_info_from_proc_cpuinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysctl())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_kstat())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_dmesg())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cat_var_run_dmesg_boot())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_ibm_pa_features())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpuid())) self.assertEqual(14, len(cpuinfo._get_cpu_info_internal())) def test_get_cpu_info_from_cpufreq_info(self): info = cpuinfo._get_cpu_info_from_cpufreq_info() self.assertEqual('1.0000 GHz', info['hz_advertised_friendly']) self.assertEqual('1.0000 GHz', info['hz_actual_friendly']) self.assertEqual((1000000000, 0), info['hz_advertised']) self.assertEqual((1000000000, 0), info['hz_actual']) def test_get_cpu_info_from_proc_cpuinfo(self): info = cpuinfo._get_cpu_info_from_proc_cpuinfo() self.assertEqual('BCM2708', info['hardware_raw']) self.assertEqual('ARMv6-compatible processor rev 7 (v6l)', info['brand_raw']) self.assertEqual( ['edsp', 'fastmult', 'half', 'java', 'swp', 'thumb', 'tls', 'vfp'] , info['flags'] ) def test_all(self): info = cpuinfo._get_cpu_info_internal() self.assertEqual('BCM2708', info['hardware_raw']) self.assertEqual('ARMv6-compatible processor rev 7 (v6l)', info['brand_raw']) self.assertEqual('1.0000 GHz', info['hz_advertised_friendly']) self.assertEqual('1.0000 GHz', info['hz_actual_friendly']) self.assertEqual((1000000000, 0), info['hz_advertised']) self.assertEqual((1000000000, 0), info['hz_actual']) self.assertEqual('ARM_7', info['arch']) self.assertEqual(32, info['bits']) self.assertEqual(1, info['count']) self.assertEqual('armv7l', info['arch_string_raw']) self.assertEqual( ['edsp', 'fastmult', 'half', 'java', 'swp', 'thumb', 'tls', 'vfp'] , info['flags'] ) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/tests/test_linux_debian_8_5_x86_64.py0000664000175000017500000006701614325641176021277 0ustar00mattmatt import unittest from cpuinfo import * import helpers class MockDataSource(object): bits = '64bit' cpu_count = 2 is_windows = False arch_string_raw = 'x86_64' uname_string_raw = 'x86_64' can_cpuid = False @staticmethod def has_proc_cpuinfo(): return True @staticmethod def has_dmesg(): return True @staticmethod def has_lscpu(): return True @staticmethod def cat_proc_cpuinfo(): returncode = 0 output = r''' processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 42 model name : Intel(R) Pentium(R) CPU G640 @ 2.80GHz stepping : 7 cpu MHz : 2793.652 cache size : 3072 KB physical id : 0 siblings : 2 core id : 0 cpu cores : 2 apicid : 0 initial apicid : 0 fpu : yes fpu_exception : yes cpuid level : 13 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt xsave hypervisor lahf_lm bogomips : 5587.30 clflush size : 64 cache_alignment : 64 address sizes : 36 bits physical, 48 bits virtual power management: processor : 1 vendor_id : GenuineIntel cpu family : 6 model : 42 model name : Intel(R) Pentium(R) CPU G640 @ 2.80GHz stepping : 7 cpu MHz : 2793.652 cache size : 3072 KB physical id : 0 siblings : 2 core id : 1 cpu cores : 2 apicid : 1 initial apicid : 1 fpu : yes fpu_exception : yes cpuid level : 13 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt xsave hypervisor lahf_lm bogomips : 5587.30 clflush size : 64 cache_alignment : 64 address sizes : 36 bits physical, 48 bits virtual power management: ''' return returncode, output @staticmethod def dmesg_a(): returncode = 0 output = r''' [ 0.000000] Initializing cgroup subsys cpuset [ 0.000000] Initializing cgroup subsys cpu [ 0.000000] Initializing cgroup subsys cpuacct [ 0.000000] Linux version 3.16.0-4-amd64 (debian-kernel@lists.debian.org) (gcc version 4.8.4 (Debian 4.8.4-1) ) #1 SMP Debian 3.16.36-1+deb8u2 (2016-10-19) [ 0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-3.16.0-4-amd64 root=UUID=12618f16-cbe6-4b2b-9f80-b71195be06e7 ro quiet [ 0.000000] e820: BIOS-provided physical RAM map: [ 0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable [ 0.000000] BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved [ 0.000000] BIOS-e820: [mem 0x0000000000100000-0x00000000dffeffff] usable [ 0.000000] BIOS-e820: [mem 0x00000000dfff0000-0x00000000dfffffff] ACPI data [ 0.000000] BIOS-e820: [mem 0x00000000fec00000-0x00000000fec00fff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000fee00000-0x00000000fee00fff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved [ 0.000000] BIOS-e820: [mem 0x0000000100000000-0x000000011fffffff] usable [ 0.000000] NX (Execute Disable) protection: active [ 0.000000] SMBIOS 2.5 present. [ 0.000000] DMI: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006 [ 0.000000] Hypervisor detected: KVM [ 0.000000] e820: update [mem 0x00000000-0x00000fff] usable ==> reserved [ 0.000000] e820: remove [mem 0x000a0000-0x000fffff] usable [ 0.000000] AGP: No AGP bridge found [ 0.000000] e820: last_pfn = 0x120000 max_arch_pfn = 0x400000000 [ 0.000000] MTRR default type: uncachable [ 0.000000] MTRR variable ranges disabled: [ 0.000000] x86 PAT enabled: cpu 0, old 0x7040600070406, new 0x7010600070106 [ 0.000000] CPU MTRRs all blank - virtualized system. [ 0.000000] e820: last_pfn = 0xdfff0 max_arch_pfn = 0x400000000 [ 0.000000] found SMP MP-table at [mem 0x0009fff0-0x0009ffff] mapped at [ffff88000009fff0] [ 0.000000] Base memory trampoline at [ffff880000099000] 99000 size 24576 [ 0.000000] init_memory_mapping: [mem 0x00000000-0x000fffff] [ 0.000000] [mem 0x00000000-0x000fffff] page 4k [ 0.000000] BRK [0x01af4000, 0x01af4fff] PGTABLE [ 0.000000] BRK [0x01af5000, 0x01af5fff] PGTABLE [ 0.000000] BRK [0x01af6000, 0x01af6fff] PGTABLE [ 0.000000] init_memory_mapping: [mem 0x11fe00000-0x11fffffff] [ 0.000000] [mem 0x11fe00000-0x11fffffff] page 2M [ 0.000000] BRK [0x01af7000, 0x01af7fff] PGTABLE [ 0.000000] init_memory_mapping: [mem 0x11c000000-0x11fdfffff] [ 0.000000] [mem 0x11c000000-0x11fdfffff] page 2M [ 0.000000] init_memory_mapping: [mem 0x100000000-0x11bffffff] [ 0.000000] [mem 0x100000000-0x11bffffff] page 2M [ 0.000000] init_memory_mapping: [mem 0x00100000-0xdffeffff] [ 0.000000] [mem 0x00100000-0x001fffff] page 4k [ 0.000000] [mem 0x00200000-0xdfdfffff] page 2M [ 0.000000] [mem 0xdfe00000-0xdffeffff] page 4k [ 0.000000] RAMDISK: [mem 0x3634a000-0x3719cfff] [ 0.000000] ACPI: Early table checksum verification disabled [ 0.000000] ACPI: RSDP 0x00000000000E0000 000024 (v02 VBOX ) [ 0.000000] ACPI: XSDT 0x00000000DFFF0030 00003C (v01 VBOX VBOXXSDT 00000001 ASL 00000061) [ 0.000000] ACPI: FACP 0x00000000DFFF00F0 0000F4 (v04 VBOX VBOXFACP 00000001 ASL 00000061) [ 0.000000] ACPI: DSDT 0x00000000DFFF0470 00210F (v01 VBOX VBOXBIOS 00000002 INTL 20160108) [ 0.000000] ACPI: FACS 0x00000000DFFF0200 000040 [ 0.000000] ACPI: FACS 0x00000000DFFF0200 000040 [ 0.000000] ACPI: APIC 0x00000000DFFF0240 00005C (v02 VBOX VBOXAPIC 00000001 ASL 00000061) [ 0.000000] ACPI: SSDT 0x00000000DFFF02A0 0001CC (v01 VBOX VBOXCPUT 00000002 INTL 20160108) [ 0.000000] ACPI: Local APIC address 0xfee00000 [ 0.000000] No NUMA configuration found [ 0.000000] Faking a node at [mem 0x0000000000000000-0x000000011fffffff] [ 0.000000] Initmem setup node 0 [mem 0x00000000-0x11fffffff] [ 0.000000] NODE_DATA [mem 0x11fff7000-0x11fffbfff] [ 0.000000] kvm-clock: Using msrs 4b564d01 and 4b564d00 [ 0.000000] kvm-clock: cpu 0, msr 1:1ffef001, primary cpu clock [ 0.000000] [ffffea0000000000-ffffea0003ffffff] PMD -> [ffff88011b600000-ffff88011effffff] on node 0 [ 0.000000] Zone ranges: [ 0.000000] DMA [mem 0x00001000-0x00ffffff] [ 0.000000] DMA32 [mem 0x01000000-0xffffffff] [ 0.000000] Normal [mem 0x100000000-0x11fffffff] [ 0.000000] Movable zone start for each node [ 0.000000] Early memory node ranges [ 0.000000] node 0: [mem 0x00001000-0x0009efff] [ 0.000000] node 0: [mem 0x00100000-0xdffeffff] [ 0.000000] node 0: [mem 0x100000000-0x11fffffff] [ 0.000000] On node 0 totalpages: 1048462 [ 0.000000] DMA zone: 56 pages used for memmap [ 0.000000] DMA zone: 21 pages reserved [ 0.000000] DMA zone: 3998 pages, LIFO batch:0 [ 0.000000] DMA32 zone: 12488 pages used for memmap [ 0.000000] DMA32 zone: 913392 pages, LIFO batch:31 [ 0.000000] Normal zone: 1792 pages used for memmap [ 0.000000] Normal zone: 131072 pages, LIFO batch:31 [ 0.000000] ACPI: PM-Timer IO Port: 0x4008 [ 0.000000] ACPI: Local APIC address 0xfee00000 [ 0.000000] ACPI: LAPIC (acpi_id[0x00] lapic_id[0x00] enabled) [ 0.000000] ACPI: LAPIC (acpi_id[0x01] lapic_id[0x01] enabled) [ 0.000000] ACPI: IOAPIC (id[0x02] address[0xfec00000] gsi_base[0]) [ 0.000000] IOAPIC[0]: apic_id 2, version 32, address 0xfec00000, GSI 0-23 [ 0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl) [ 0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level) [ 0.000000] ACPI: IRQ0 used by override. [ 0.000000] ACPI: IRQ2 used by override. [ 0.000000] ACPI: IRQ9 used by override. [ 0.000000] Using ACPI (MADT) for SMP configuration information [ 0.000000] smpboot: Allowing 2 CPUs, 0 hotplug CPUs [ 0.000000] nr_irqs_gsi: 40 [ 0.000000] PM: Registered nosave memory: [mem 0x0009f000-0x0009ffff] [ 0.000000] PM: Registered nosave memory: [mem 0x000a0000-0x000effff] [ 0.000000] PM: Registered nosave memory: [mem 0x000f0000-0x000fffff] [ 0.000000] PM: Registered nosave memory: [mem 0xdfff0000-0xdfffffff] [ 0.000000] PM: Registered nosave memory: [mem 0xe0000000-0xfebfffff] [ 0.000000] PM: Registered nosave memory: [mem 0xfec00000-0xfec00fff] [ 0.000000] PM: Registered nosave memory: [mem 0xfec01000-0xfedfffff] [ 0.000000] PM: Registered nosave memory: [mem 0xfee00000-0xfee00fff] [ 0.000000] PM: Registered nosave memory: [mem 0xfee01000-0xfffbffff] [ 0.000000] PM: Registered nosave memory: [mem 0xfffc0000-0xffffffff] [ 0.000000] e820: [mem 0xe0000000-0xfebfffff] available for PCI devices [ 0.000000] Booting paravirtualized kernel on KVM [ 0.000000] setup_percpu: NR_CPUS:512 nr_cpumask_bits:512 nr_cpu_ids:2 nr_node_ids:1 [ 0.000000] PERCPU: Embedded 27 pages/cpu @ffff88011fc00000 s80960 r8192 d21440 u1048576 [ 0.000000] pcpu-alloc: s80960 r8192 d21440 u1048576 alloc=1*2097152 [ 0.000000] pcpu-alloc: [0] 0 1 [ 0.000000] Built 1 zonelists in Node order, mobility grouping on. Total pages: 1034105 [ 0.000000] Policy zone: Normal [ 0.000000] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-3.16.0-4-amd64 root=UUID=12618f16-cbe6-4b2b-9f80-b71195be06e7 ro quiet [ 0.000000] PID hash table entries: 4096 (order: 3, 32768 bytes) [ 0.000000] xsave: enabled xstate_bv 0x3, cntxt size 0x240 [ 0.000000] AGP: Checking aperture... [ 0.000000] AGP: No AGP bridge found [ 0.000000] Calgary: detecting Calgary via BIOS EBDA area [ 0.000000] Calgary: Unable to locate Rio Grande table in EBDA - bailing! [ 0.000000] Memory: 4041880K/4193848K available (5237K kernel code, 947K rwdata, 1836K rodata, 1204K init, 840K bss, 151968K reserved) [ 0.000000] Hierarchical RCU implementation. [ 0.000000] RCU dyntick-idle grace-period acceleration is enabled. [ 0.000000] RCU restricting CPUs from NR_CPUS=512 to nr_cpu_ids=2. [ 0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=2 [ 0.000000] NR_IRQS:33024 nr_irqs:512 16 [ 0.000000] Console: colour VGA+ 80x25 [ 0.000000] console [tty0] enabled [ 0.000000] tsc: Detected 2793.652 MHz processor [ 9.015923] Calibrating delay loop (skipped) preset value.. 5587.30 BogoMIPS (lpj=11174608) [ 9.015926] pid_max: default: 32768 minimum: 301 [ 9.015934] ACPI: Core revision 20140424 [ 9.017020] ACPI: All ACPI Tables successfully acquired [ 9.017050] Security Framework initialized [ 9.017058] AppArmor: AppArmor disabled by boot time parameter [ 9.017059] Yama: disabled by default; enable with sysctl kernel.yama.* [ 9.017855] Dentry cache hash table entries: 524288 (order: 10, 4194304 bytes) [ 9.019277] Inode-cache hash table entries: 262144 (order: 9, 2097152 bytes) [ 9.019613] Mount-cache hash table entries: 8192 (order: 4, 65536 bytes) [ 9.019619] Mountpoint-cache hash table entries: 8192 (order: 4, 65536 bytes) [ 9.019883] Initializing cgroup subsys memory [ 9.019888] Initializing cgroup subsys devices [ 9.019895] Initializing cgroup subsys freezer [ 9.019897] Initializing cgroup subsys net_cls [ 9.019901] Initializing cgroup subsys blkio [ 9.019904] Initializing cgroup subsys perf_event [ 9.019906] Initializing cgroup subsys net_prio [ 9.019987] CPU: Physical Processor ID: 0 [ 9.019988] CPU: Processor Core ID: 0 [ 9.020005] mce: CPU supports 0 MCE banks [ 9.020039] Last level iTLB entries: 4KB 512, 2MB 8, 4MB 8 Last level dTLB entries: 4KB 512, 2MB 32, 4MB 32, 1GB 0 tlb_flushall_shift: 6 [ 9.020376] Freeing SMP alternatives memory: 20K (ffffffff81a1b000 - ffffffff81a20000) [ 9.024990] ftrace: allocating 21697 entries in 85 pages [ 9.059874] ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1 [ 9.059878] smpboot: CPU0: Intel(R) Pentium(R) CPU G640 @ 2.80GHz (fam: 06, model: 2a, stepping: 07) [ 9.164299] Performance Events: unsupported p6 CPU model 42 no PMU driver, software events only. [ 9.165780] NMI watchdog: disabled (cpu0): hardware events not enabled [ 9.165895] x86: Booting SMP configuration: [ 9.165897] .... node #0, CPUs: #1 [ 9.176166] kvm-clock: cpu 1, msr 1:1ffef041, secondary cpu clock [ 9.177165] mce: CPU supports 0 MCE banks [ 9.179301] x86: Booted up 1 node, 2 CPUs [ 9.179305] smpboot: Total of 2 processors activated (11174.60 BogoMIPS) [ 9.180688] devtmpfs: initialized [ 9.187316] pinctrl core: initialized pinctrl subsystem [ 9.187487] NET: Registered protocol family 16 [ 9.187619] cpuidle: using governor ladder [ 9.187623] cpuidle: using governor menu [ 9.187667] ACPI: bus type PCI registered [ 9.187669] acpiphp: ACPI Hot Plug PCI Controller Driver version: 0.5 [ 9.187894] PCI: Using configuration type 1 for base access [ 9.204747] ACPI: Added _OSI(Module Device) [ 9.204751] ACPI: Added _OSI(Processor Device) [ 9.204752] ACPI: Added _OSI(3.0 _SCP Extensions) [ 9.204753] ACPI: Added _OSI(Processor Aggregator Device) [ 9.205356] ACPI: Executed 1 blocks of module-level executable AML code [ 9.207882] ACPI: Interpreter enabled [ 9.207888] ACPI Exception: AE_NOT_FOUND, While evaluating Sleep State [\_S1_] (20140424/hwxface-580) [ 9.207891] ACPI Exception: AE_NOT_FOUND, While evaluating Sleep State [\_S2_] (20140424/hwxface-580) [ 9.207894] ACPI Exception: AE_NOT_FOUND, While evaluating Sleep State [\_S3_] (20140424/hwxface-580) [ 9.207897] ACPI Exception: AE_NOT_FOUND, While evaluating Sleep State [\_S4_] (20140424/hwxface-580) [ 9.207902] ACPI: (supports S0 S5) [ 9.207904] ACPI: Using IOAPIC for interrupt routing [ 9.208077] PCI: Using host bridge windows from ACPI; if necessary, use "pci=nocrs" and report a bug [ 9.211597] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff]) [ 9.211603] acpi PNP0A03:00: _OSC: OS supports [ASPM ClockPM Segments MSI] [ 9.211607] acpi PNP0A03:00: _OSC failed (AE_NOT_FOUND); disabling ASPM [ 9.211681] acpi PNP0A03:00: fail to add MMCONFIG information, can't access extended PCI configuration space under this bridge. [ 9.211887] PCI host bridge to bus 0000:00 [ 9.211890] pci_bus 0000:00: root bus resource [bus 00-ff] [ 9.211892] pci_bus 0000:00: root bus resource [io 0x0000-0x0cf7] [ 9.211893] pci_bus 0000:00: root bus resource [io 0x0d00-0xffff] [ 9.211895] pci_bus 0000:00: root bus resource [mem 0x000a0000-0x000bffff] [ 9.211896] pci_bus 0000:00: root bus resource [mem 0xe0000000-0xffdfffff] [ 9.211930] pci 0000:00:00.0: [8086:1237] type 00 class 0x060000 [ 9.212373] pci 0000:00:01.0: [8086:7000] type 00 class 0x060100 [ 9.212889] pci 0000:00:01.1: [8086:7111] type 00 class 0x01018a [ 9.213393] pci 0000:00:01.1: reg 0x20: [io 0xd000-0xd00f] [ 9.213530] pci 0000:00:01.1: legacy IDE quirk: reg 0x10: [io 0x01f0-0x01f7] [ 9.213532] pci 0000:00:01.1: legacy IDE quirk: reg 0x14: [io 0x03f6] [ 9.213533] pci 0000:00:01.1: legacy IDE quirk: reg 0x18: [io 0x0170-0x0177] [ 9.213534] pci 0000:00:01.1: legacy IDE quirk: reg 0x1c: [io 0x0376] [ 9.213732] pci 0000:00:02.0: [80ee:beef] type 00 class 0x030000 [ 9.216760] pci 0000:00:02.0: reg 0x10: [mem 0xe0000000-0xe0ffffff pref] [ 9.239260] pci 0000:00:03.0: [8086:100e] type 00 class 0x020000 [ 9.242528] pci 0000:00:03.0: reg 0x10: [mem 0xf0000000-0xf001ffff] [ 9.250446] pci 0000:00:03.0: reg 0x18: [io 0xd010-0xd017] [ 9.267404] pci 0000:00:04.0: [80ee:cafe] type 00 class 0x088000 [ 9.270818] pci 0000:00:04.0: reg 0x10: [io 0xd020-0xd03f] [ 9.276122] pci 0000:00:04.0: reg 0x14: [mem 0xf0400000-0xf07fffff] [ 9.279813] pci 0000:00:04.0: reg 0x18: [mem 0xf0800000-0xf0803fff pref] [ 9.293767] pci 0000:00:05.0: [8086:2415] type 00 class 0x040100 [ 9.293857] pci 0000:00:05.0: reg 0x10: [io 0xd100-0xd1ff] [ 9.293917] pci 0000:00:05.0: reg 0x14: [io 0xd200-0xd23f] [ 9.294374] pci 0000:00:06.0: [106b:003f] type 00 class 0x0c0310 [ 9.297803] pci 0000:00:06.0: reg 0x10: [mem 0xf0804000-0xf0804fff] [ 9.317868] pci 0000:00:07.0: [8086:7113] type 00 class 0x068000 [ 9.318252] pci 0000:00:07.0: quirk: [io 0x4000-0x403f] claimed by PIIX4 ACPI [ 9.318262] pci 0000:00:07.0: quirk: [io 0x4100-0x410f] claimed by PIIX4 SMB [ 9.318538] pci 0000:00:0d.0: [8086:2829] type 00 class 0x010601 [ 9.321461] pci 0000:00:0d.0: reg 0x10: [io 0xd240-0xd247] [ 9.328895] pci 0000:00:0d.0: reg 0x18: [io 0xd250-0xd257] [ 9.336455] pci 0000:00:0d.0: reg 0x20: [io 0xd260-0xd26f] [ 9.339258] pci 0000:00:0d.0: reg 0x24: [mem 0xf0806000-0xf0807fff] [ 9.345202] ACPI: PCI Interrupt Link [LNKA] (IRQs 5 9 10 *11) [ 9.345408] ACPI: PCI Interrupt Link [LNKB] (IRQs 5 9 10 *11) [ 9.345488] ACPI: PCI Interrupt Link [LNKC] (IRQs 5 9 *10 11) [ 9.345567] ACPI: PCI Interrupt Link [LNKD] (IRQs 5 *9 10 11) [ 9.345694] ACPI: Enabled 2 GPEs in block 00 to 07 [ 9.346069] vgaarb: setting as boot device: PCI:0000:00:02.0 [ 9.346072] vgaarb: device added: PCI:0000:00:02.0,decodes=io+mem,owns=io+mem,locks=none [ 9.346074] vgaarb: loaded [ 9.346075] vgaarb: bridge control possible 0000:00:02.0 [ 9.346163] PCI: Using ACPI for IRQ routing [ 9.346165] PCI: pci_cache_line_size set to 64 bytes [ 9.346311] e820: reserve RAM buffer [mem 0x0009fc00-0x0009ffff] [ 9.346317] e820: reserve RAM buffer [mem 0xdfff0000-0xdfffffff] [ 9.346558] Switched to clocksource kvm-clock [ 9.353995] pnp: PnP ACPI init [ 9.354008] ACPI: bus type PNP registered [ 9.354101] pnp 00:00: Plug and Play ACPI device, IDs PNP0303 (active) [ 9.354188] pnp 00:01: Plug and Play ACPI device, IDs PNP0f03 (active) [ 9.354752] pnp: PnP ACPI: found 2 devices [ 9.354753] ACPI: bus type PNP unregistered [ 9.371389] pci_bus 0000:00: resource 4 [io 0x0000-0x0cf7] [ 9.371393] pci_bus 0000:00: resource 5 [io 0x0d00-0xffff] [ 9.371395] pci_bus 0000:00: resource 6 [mem 0x000a0000-0x000bffff] [ 9.371396] pci_bus 0000:00: resource 7 [mem 0xe0000000-0xffdfffff] [ 9.371619] NET: Registered protocol family 2 [ 9.372196] TCP established hash table entries: 32768 (order: 6, 262144 bytes) [ 9.372267] TCP bind hash table entries: 32768 (order: 7, 524288 bytes) [ 9.372334] TCP: Hash tables configured (established 32768 bind 32768) [ 9.372351] TCP: reno registered [ 9.372357] UDP hash table entries: 2048 (order: 4, 65536 bytes) [ 9.372372] UDP-Lite hash table entries: 2048 (order: 4, 65536 bytes) [ 9.372507] NET: Registered protocol family 1 [ 9.372527] pci 0000:00:00.0: Limiting direct PCI/PCI transfers [ 9.372559] pci 0000:00:01.0: Activating ISA DMA hang workarounds [ 9.372585] pci 0000:00:02.0: Video device with shadowed ROM [ 9.374015] PCI: CLS 0 bytes, default 64 [ 9.374087] Unpacking initramfs... [ 9.647919] Freeing initrd memory: 14668K (ffff88003634a000 - ffff88003719d000) [ 9.648004] PCI-DMA: Using software bounce buffering for IO (SWIOTLB) [ 9.648007] software IO TLB [mem 0xdbff0000-0xdfff0000] (64MB) mapped at [ffff8800dbff0000-ffff8800dffeffff] [ 9.648272] platform rtc_cmos: registered platform RTC device (no PNP device found) [ 9.648443] RAPL PMU detected, hw unit 2^-0 Joules, API unit is 2^-32 Joules, 3 fixed counters 10737418240 ms ovfl timer [ 9.648548] microcode: CPU0 sig=0x206a7, pf=0x10, revision=0x0 [ 9.648562] microcode: CPU1 sig=0x206a7, pf=0x10, revision=0x0 [ 9.648612] microcode: Microcode Update Driver: v2.00 , Peter Oruba [ 9.649451] futex hash table entries: 512 (order: 3, 32768 bytes) [ 9.649573] audit: initializing netlink subsys (disabled) [ 9.649598] audit: type=2000 audit(1488395362.069:1): initialized [ 9.650419] HugeTLB registered 2 MB page size, pre-allocated 0 pages [ 9.650441] zbud: loaded [ 9.650973] VFS: Disk quotas dquot_6.5.2 [ 9.651008] Dquot-cache hash table entries: 512 (order 0, 4096 bytes) [ 9.651084] msgmni has been set to 7922 [ 9.651798] alg: No test for stdrng (krng) [ 9.651846] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252) [ 9.651937] io scheduler noop registered [ 9.651941] io scheduler deadline registered [ 9.652016] io scheduler cfq registered (default) [ 9.652115] pci_hotplug: PCI Hot Plug PCI Core version: 0.5 [ 9.652132] pciehp: PCI Express Hot Plug Controller Driver version: 0.4 [ 9.652154] intel_idle: does not run on family 6 model 42 [ 9.652172] GHES: HEST is not enabled! [ 9.652242] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled [ 9.652548] Linux agpgart interface v0.103 [ 9.652677] i8042: PNP: PS/2 Controller [PNP0303:PS2K,PNP0f03:PS2M] at 0x60,0x64 irq 1,12 [ 9.653166] serio: i8042 KBD port at 0x60,0x64 irq 1 [ 9.653171] serio: i8042 AUX port at 0x60,0x64 irq 12 [ 9.653271] mousedev: PS/2 mouse device common for all mice [ 9.653687] input: AT Translated Set 2 keyboard as /devices/platform/i8042/serio0/input/input0 [ 9.653824] rtc_cmos rtc_cmos: rtc core: registered rtc_cmos as rtc0 [ 9.653882] rtc_cmos rtc_cmos: alarms up to one day, 114 bytes nvram [ 9.653896] ledtrig-cpu: registered to indicate activity on CPUs [ 9.653961] AMD IOMMUv2 driver by Joerg Roedel [ 9.653962] AMD IOMMUv2 functionality not available on this system [ 9.654038] TCP: cubic registered [ 9.654234] NET: Registered protocol family 10 [ 9.654554] mip6: Mobile IPv6 [ 9.654558] NET: Registered protocol family 17 [ 9.654564] mpls_gso: MPLS GSO support [ 9.654770] registered taskstats version 1 [ 9.656357] rtc_cmos rtc_cmos: setting system clock to 2017-03-01 19:09:11 UTC (1488395351) [ 9.656427] PM: Hibernation image not present or could not be loaded. [ 9.663167] Freeing unused kernel memory: 1204K (ffffffff818ee000 - ffffffff81a1b000) [ 9.663171] Write protecting the kernel read-only data: 8192k [ 9.663645] Freeing unused kernel memory: 896K (ffff880001520000 - ffff880001600000) [ 9.664120] Freeing unused kernel memory: 212K (ffff8800017cb000 - ffff880001800000) [ 9.677467] systemd-udevd[60]: starting version 215 [ 9.677730] random: systemd-udevd urandom read with 2 bits of entropy available [ 9.698416] ACPI: bus type USB registered [ 9.698445] usbcore: registered new interface driv ''' return returncode, output @staticmethod def lscpu(): returncode = 0 output = r''' Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 2 On-line CPU(s) list: 0,1 Thread(s) per core: 1 Core(s) per socket: 2 Socket(s): 1 NUMA node(s): 1 Vendor ID: GenuineIntel CPU family: 6 Model: 42 Model name: Intel(R) Pentium(R) CPU G640 @ 2.80GHz Stepping: 7 CPU MHz: 2793.652 BogoMIPS: 5587.30 Hypervisor vendor: KVM Virtualization type: full L1d cache: 32K L1i cache: 32K L2 cache: 256K L3 cache: 3072K NUMA node0 CPU(s): 0,1 ''' return returncode, output class TestLinuxDebian_8_5_X86_64(unittest.TestCase): def setUp(self): helpers.backup_data_source(cpuinfo) helpers.monkey_patch_data_source(cpuinfo, MockDataSource) def tearDown(self): helpers.restore_data_source(cpuinfo) ''' Make sure calls return the expected number of fields. ''' def test_returns(self): self.assertEqual(0, len(cpuinfo._get_cpu_info_from_registry())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpufreq_info())) self.assertEqual(13, len(cpuinfo._get_cpu_info_from_lscpu())) self.assertEqual(11, len(cpuinfo._get_cpu_info_from_proc_cpuinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysctl())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_kstat())) self.assertEqual(8, len(cpuinfo._get_cpu_info_from_dmesg())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cat_var_run_dmesg_boot())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_ibm_pa_features())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpuid())) self.assertEqual(21, len(cpuinfo._get_cpu_info_internal())) def test_get_cpu_info_from_lscpu(self): info = cpuinfo._get_cpu_info_from_lscpu() self.assertEqual('GenuineIntel', info['vendor_id_raw']) self.assertEqual('Intel(R) Pentium(R) CPU G640 @ 2.80GHz', info['brand_raw']) self.assertEqual('2.7937 GHz', info['hz_advertised_friendly']) self.assertEqual('2.7937 GHz', info['hz_actual_friendly']) self.assertEqual((2793652000, 0), info['hz_advertised']) self.assertEqual((2793652000, 0), info['hz_actual']) self.assertEqual(7, info['stepping']) self.assertEqual(42, info['model']) self.assertEqual(6, info['family']) self.assertEqual(32 * 1024, info['l1_instruction_cache_size']) self.assertEqual(32 * 1024, info['l1_data_cache_size']) self.assertEqual(256 * 1024, info['l2_cache_size']) self.assertEqual(3072 * 1024, info['l3_cache_size']) def test_get_cpu_info_from_dmesg(self): info = cpuinfo._get_cpu_info_from_dmesg() self.assertEqual('Intel(R) Pentium(R) CPU G640 @ 2.80GHz', info['brand_raw']) self.assertEqual('2.8000 GHz', info['hz_advertised_friendly']) self.assertEqual('2.8000 GHz', info['hz_actual_friendly']) self.assertEqual((2800000000, 0), info['hz_advertised']) self.assertEqual((2800000000, 0), info['hz_actual']) self.assertEqual(7, info['stepping']) self.assertEqual(42, info['model']) self.assertEqual(6, info['family']) def test_get_cpu_info_from_proc_cpuinfo(self): info = cpuinfo._get_cpu_info_from_proc_cpuinfo() self.assertEqual('GenuineIntel', info['vendor_id_raw']) self.assertEqual('Intel(R) Pentium(R) CPU G640 @ 2.80GHz', info['brand_raw']) self.assertEqual('2.8000 GHz', info['hz_advertised_friendly']) self.assertEqual('2.7937 GHz', info['hz_actual_friendly']) self.assertEqual((2800000000, 0), info['hz_advertised']) self.assertEqual((2793652000, 0), info['hz_actual']) self.assertEqual(3072 * 1024, info['l3_cache_size']) self.assertEqual(7, info['stepping']) self.assertEqual(42, info['model']) self.assertEqual(6, info['family']) self.assertEqual( ['apic', 'clflush', 'cmov', 'constant_tsc', 'cx16', 'cx8', 'de', 'fpu', 'fxsr', 'ht', 'hypervisor', 'lahf_lm', 'lm', 'mca', 'mce', 'mmx', 'msr', 'mtrr', 'nonstop_tsc', 'nopl', 'nx', 'pae', 'pat', 'pclmulqdq', 'pge', 'pni', 'popcnt', 'pse', 'pse36', 'rdtscp', 'rep_good', 'sep', 'sse', 'sse2', 'sse4_1', 'sse4_2', 'ssse3', 'syscall', 'tsc', 'vme', 'xsave', 'xtopology'] , info['flags'] ) def test_all(self): info = cpuinfo._get_cpu_info_internal() self.assertEqual('GenuineIntel', info['vendor_id_raw']) self.assertEqual('Intel(R) Pentium(R) CPU G640 @ 2.80GHz', info['brand_raw']) self.assertEqual('2.8000 GHz', info['hz_advertised_friendly']) self.assertEqual('2.7937 GHz', info['hz_actual_friendly']) self.assertEqual((2800000000, 0), info['hz_advertised']) self.assertEqual((2793652000, 0), info['hz_actual']) self.assertEqual('X86_64', info['arch']) self.assertEqual(64, info['bits']) self.assertEqual(2, info['count']) self.assertEqual('x86_64', info['arch_string_raw']) self.assertEqual(32 * 1024, info['l1_instruction_cache_size']) self.assertEqual(32 * 1024, info['l1_data_cache_size']) self.assertEqual(256 * 1024, info['l2_cache_size']) self.assertEqual(3072 * 1024, info['l3_cache_size']) self.assertEqual(7, info['stepping']) self.assertEqual(42, info['model']) self.assertEqual(6, info['family']) self.assertEqual( ['apic', 'clflush', 'cmov', 'constant_tsc', 'cx16', 'cx8', 'de', 'fpu', 'fxsr', 'ht', 'hypervisor', 'lahf_lm', 'lm', 'mca', 'mce', 'mmx', 'msr', 'mtrr', 'nonstop_tsc', 'nopl', 'nx', 'pae', 'pat', 'pclmulqdq', 'pge', 'pni', 'popcnt', 'pse', 'pse36', 'rdtscp', 'rep_good', 'sep', 'sse', 'sse2', 'sse4_1', 'sse4_2', 'ssse3', 'syscall', 'tsc', 'vme', 'xsave', 'xtopology'] , info['flags'] ) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/tests/test_linux_debian_8_7_1_ppc64le.py0000664000175000017500000006103014325641176022026 0ustar00mattmatt import unittest from cpuinfo import * import helpers class MockDataSource(object): bits = '64bit' cpu_count = 2 is_windows = False arch_string_raw = 'ppc64le' uname_string_raw = '' can_cpuid = False @staticmethod def has_proc_cpuinfo(): return True @staticmethod def has_dmesg(): return True @staticmethod def has_lscpu(): return True @staticmethod def has_ibm_pa_features(): return True @staticmethod def ibm_pa_features(): returncode = 0 output = r''' /proc/device-tree/cpus/PowerPC,POWER8@0/ibm,pa-features 18 00 f6 3f c7 c0 80 f0 80 00 00 00 00 00 00 00...?............ 00 00 80 00 80 00 80 00 80 00 .......... ''' return returncode, output @staticmethod def cat_proc_cpuinfo(): returncode = 0 output = r''' processor : 0 cpu : POWER7 (raw), altivec supported clock : 1000.000000MHz revision : 2.3 (pvr 003f 0203) processor : 1 cpu : POWER7 (raw), altivec supported clock : 1000.000000MHz revision : 2.3 (pvr 003f 0203) timebase : 512000000 platform : pSeries model : IBM pSeries (emulated by qemu) machine : CHRP IBM pSeries (emulated by qemu) ''' return returncode, output @staticmethod def dmesg_a(): returncode = 0 output = r''' [ 0.000000] Allocated 4718592 bytes for 2048 pacas at c00000000fb80000 [ 0.000000] Using pSeries machine description [ 0.000000] Page sizes from device-tree: [ 0.000000] base_shift=12: shift=12, sllp=0x0000, avpnm=0x00000000, tlbiel=1, penc=0 [ 0.000000] base_shift=24: shift=24, sllp=0x0100, avpnm=0x00000001, tlbiel=0, penc=0 [ 0.000000] Page orders: linear mapping = 24, virtual = 12, io = 12, vmemmap = 24 [ 0.000000] Using 1TB segments [ 0.000000] kvm_cma: CMA: reserved 128 MiB [ 0.000000] Found initrd at 0xc000000002f00000:0xc000000003e49d2c [ 0.000000] Partition configured for 2 cpus. [ 0.000000] CPU maps initialized for 1 thread per core [ 0.000000] (thread shift is 0) [ 0.000000] Freed 4653056 bytes for unused pacas [ 0.000000] Starting Linux PPC64 #1 SMP Debian 3.16.39-1+deb8u2 (2017-03-07) [ 0.000000] ----------------------------------------------------- [ 0.000000] ppc64_pft_size = 0x18 [ 0.000000] physicalMemorySize = 0x80000000 [ 0.000000] htab_hash_mask = 0x1ffff [ 0.000000] ----------------------------------------------------- [ 0.000000] Initializing cgroup subsys cpuset [ 0.000000] Initializing cgroup subsys cpu [ 0.000000] Initializing cgroup subsys cpuacct [ 0.000000] Linux version 3.16.0-4-powerpc64le (debian-kernel@lists.debian.org) (gcc version 4.8.4 (Debian 4.8.4-1) ) #1 SMP Debian 3.16.39-1+deb8u2 (2017-03-07) [ 0.000000] [boot]0012 Setup Arch [ 0.000000] Node 0 Memory: 0x0-0x80000000 [ 0.000000] PCI host bridge /pci@800000020000000 ranges: [ 0.000000] IO 0x0000010080000000..0x000001008000ffff -> 0x0000000000000000 [ 0.000000] MEM 0x00000100a0000000..0x000001101fffffff -> 0x0000000080000000 [ 0.000000] PPC64 nvram contains 65536 bytes [ 0.000000] Unable to enable relocation on exceptions: -55 [ 0.000000] Zone ranges: [ 0.000000] DMA [mem 0x00000000-0x7fffffff] [ 0.000000] Normal empty [ 0.000000] Movable zone start for each node [ 0.000000] Early memory node ranges [ 0.000000] node 0: [mem 0x00000000-0x7fffffff] [ 0.000000] On node 0 totalpages: 32768 [ 0.000000] DMA zone: 28 pages used for memmap [ 0.000000] DMA zone: 0 pages reserved [ 0.000000] DMA zone: 32768 pages, LIFO batch:1 [ 0.000000] [boot]0015 Setup Done [ 0.000000] PERCPU: Embedded 2 pages/cpu @c000000000e00000 s102400 r0 d28672 u524288 [ 0.000000] pcpu-alloc: s102400 r0 d28672 u524288 alloc=1*1048576 [ 0.000000] pcpu-alloc: [0] 0 1 [ 0.000000] Built 1 zonelists in Node order, mobility grouping on. Total pages: 32740 [ 0.000000] Policy zone: DMA [ 0.000000] Kernel command line: BOOT_IMAGE=/boot/vmlinux-3.16.0-4-powerpc64le root=UUID=35034901-f68b-4f2f-8073-ced7a2a5cd6f ro quiet [ 0.000000] PID hash table entries: 4096 (order: -1, 32768 bytes) [ 0.000000] Sorting __ex_table... [ 0.000000] Memory: 1918848K/2097152K available (7168K kernel code, 1280K rwdata, 1740K rodata, 896K init, 2197K bss, 178304K reserved) [ 0.000000] Hierarchical RCU implementation. [ 0.000000] CONFIG_RCU_FANOUT set to non-default value of 32 [ 0.000000] RCU dyntick-idle grace-period acceleration is enabled. [ 0.000000] RCU restricting CPUs from NR_CPUS=2048 to nr_cpu_ids=2. [ 0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=2 [ 0.000000] NR_IRQS:512 nr_irqs:512 16 [ 0.000000] pic: no ISA interrupt controller [ 0.000000] time_init: decrementer frequency = 512.000000 MHz [ 0.000000] time_init: processor frequency = 1000.000000 MHz [ 0.000350] clocksource: timebase mult[1f40000] shift[24] registered [ 0.000553] clockevent: decrementer mult[83126e98] shift[32] cpu[0] [ 0.013730] Console: colour dummy device 80x25 [ 0.014989] console [tty0] enabled [ 0.016748] pid_max: default: 32768 minimum: 301 [ 0.018500] Security Framework initialized [ 0.021966] AppArmor: AppArmor disabled by boot time parameter [ 0.022018] Yama: disabled by default; enable with sysctl kernel.yama.* [ 0.024790] Dentry cache hash table entries: 262144 (order: 5, 2097152 bytes) [ 0.037906] Inode-cache hash table entries: 131072 (order: 4, 1048576 bytes) [ 0.044210] Mount-cache hash table entries: 8192 (order: 0, 65536 bytes) [ 0.044309] Mountpoint-cache hash table entries: 8192 (order: 0, 65536 bytes) [ 0.057531] Initializing cgroup subsys memory [ 0.058793] Initializing cgroup subsys devices [ 0.062342] Initializing cgroup subsys freezer [ 0.062505] Initializing cgroup subsys net_cls [ 0.062628] Initializing cgroup subsys blkio [ 0.062729] Initializing cgroup subsys perf_event [ 0.062819] Initializing cgroup subsys net_prio [ 0.063556] ftrace: allocating 19452 entries in 8 pages [ 0.184012] EEH: pSeries platform initialized [ 0.184491] POWER7 performance monitor hardware support registered [ 0.751584] Brought up 2 CPUs [ 0.753947] Node 0 CPUs: 0-1 [ 0.755683] Enabling Asymmetric SMT scheduling [ 0.781637] devtmpfs: initialized [ 0.860457] EEH: devices created [ 0.890259] NET: Registered protocol family 16 [ 0.894867] EEH: No capable adapters found [ 0.896240] IBM eBus Device Driver [ 0.904539] cpuidle: using governor ladder [ 0.904768] cpuidle: using governor menu [ 0.915985] PCI: Probing PCI hardware [ 0.917879] no ibm,pcie-link-speed-stats property [ 0.919431] PCI host bridge to bus 0000:00 [ 0.919853] pci_bus 0000:00: root bus resource [io 0x10000-0x1ffff] (bus address [0x0000-0xffff]) [ 0.919975] pci_bus 0000:00: root bus resource [mem 0x100a0000000-0x1101fffffff] (bus address [0x80000000-0xfffffffff]) [ 0.920199] pci_bus 0000:00: root bus resource [bus 00-ff] [ 0.934921] IOMMU table initialized, virtual merging enabled [ 0.957593] PCI: Probing PCI hardware done [ 0.957881] opal: Node not found [ 0.957994] opal_async_comp_init: Opal node not found [ 1.068654] vgaarb: device added: PCI:0000:00:06.0,decodes=io+mem,owns=mem,locks=none [ 1.068755] vgaarb: loaded [ 1.068811] vgaarb: bridge control possible 0000:00:06.0 [ 1.084667] SCSI subsystem initialized [ 1.086205] libata version 3.00 loaded. [ 1.106689] Switched to clocksource timebase [ 1.285639] NET: Registered protocol family 2 [ 1.325801] TCP established hash table entries: 16384 (order: 1, 131072 bytes) [ 1.326813] TCP bind hash table entries: 16384 (order: 2, 262144 bytes) [ 1.329251] TCP: Hash tables configured (established 16384 bind 16384) [ 1.330103] TCP: reno registered [ 1.330292] UDP hash table entries: 2048 (order: 0, 65536 bytes) [ 1.331073] UDP-Lite hash table entries: 2048 (order: 0, 65536 bytes) [ 1.343933] NET: Registered protocol family 1 [ 1.402765] PCI: CLS 0 bytes, default 128 [ 1.408278] Unpacking initramfs... [ 3.824598] Freeing initrd memory: 15616K (c000000002f00000 - c000000003e40000) [ 3.827574] RTAS daemon started [ 3.850567] Hypercall H_BEST_ENERGY not supported [ 3.870435] futex hash table entries: 512 (order: 0, 65536 bytes) [ 3.875072] audit: initializing netlink subsys (disabled) [ 3.876188] audit: type=2000 audit(1489574672.324:1): initialized [ 3.897565] HugeTLB registered 16 MB page size, pre-allocated 0 pages [ 3.898287] zbud: loaded [ 3.955364] VFS: Disk quotas dquot_6.5.2 [ 3.957415] Dquot-cache hash table entries: 8192 (order 0, 65536 bytes) [ 3.962329] msgmni has been set to 4036 [ 3.991438] alg: No test for stdrng (krng) [ 3.993562] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252) [ 3.995908] io scheduler noop registered [ 3.996000] io scheduler deadline registered [ 3.999199] io scheduler cfq registered (default) [ 4.002993] pci_hotplug: PCI Hot Plug PCI Core version: 0.5 [ 4.003323] pciehp: PCI Express Hot Plug Controller Driver version: 0.4 [ 4.005685] Using unsupported 800x600 vga at 100a0000000, depth=32, pitch=3200 [ 4.038614] Console: switching to colour frame buffer device 100x37 [ 4.050446] fb0: Open Firmware frame buffer device on /pci@800000020000000/vga@6 [ 4.064118] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled [ 4.069855] Linux agpgart interface v0.103 [ 4.074416] mousedev: PS/2 mouse device common for all mice [ 4.076553] rtc-generic rtc-generic: rtc core: registered rtc-generic as rtc0 [ 4.078500] pseries_idle_driver registered [ 4.078781] ledtrig-cpu: registered to indicate activity on CPUs [ 4.079478] TCP: cubic registered [ 4.236623] NET: Registered protocol family 10 [ 4.297808] mip6: Mobile IPv6 [ 4.298028] NET: Registered protocol family 17 [ 4.298291] mpls_gso: MPLS GSO support [ 4.306632] registered taskstats version 1 [ 4.326061] rtc-generic rtc-generic: setting system clock to 2017-03-15 10:44:33 UTC (1489574673) [ 4.326427] PM: Hibernation image not present or could not be loaded. [ 4.378547] Freeing unused kernel memory: 896K (c0000000008c0000 - c0000000009a0000) [ 5.397702] systemd-udevd[62]: starting version 215 [ 5.465837] random: systemd-udevd: uninitialized urandom read (16 bytes read, 12 bits of entropy available) [ 6.151699] virtio-pci 0000:00:05.0: enabling device (0100 -> 0101) [ 6.199143] virtio-pci 0000:00:04.0: enabling device (0100 -> 0103) [ 6.201578] virtio-pci 0000:00:03.0: enabling device (0100 -> 0103) [ 6.376882] 8139cp: 8139cp: 10/100 PCI Ethernet driver v1.3 (Mar 22, 2004) [ 6.383373] 8139cp 0000:00:01.0: enabling device (0100 -> 0103) [ 6.391941] usbcore: registered new interface driver usbfs [ 6.392361] usbcore: registered new interface driver hub [ 6.395494] 8139cp 0000:00:01.0 eth0: RTL-8139C+ at 0xd000080080022100, 52:54:00:f7:51:69, IRQ 17 [ 6.422151] usbcore: registered new device driver usb [ 6.489837] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver [ 6.545154] 8139too: 8139too Fast Ethernet driver 0.9.28 [ 6.558285] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver [ 6.563301] ehci-pci: EHCI PCI platform driver [ 6.577800] ohci-pci: OHCI PCI platform driver [ 6.583639] ohci-pci 0000:00:02.0: OHCI PCI host controller [ 6.584250] ohci-pci 0000:00:02.0: new USB bus registered, assigned bus number 1 [ 6.588455] ohci-pci 0000:00:02.0: irq 20, io mem 0x100e0022000 [ 6.683252] usb usb1: New USB device found, idVendor=1d6b, idProduct=0001 [ 6.683315] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1 [ 6.684539] usb usb1: Product: OHCI PCI host controller [ 6.684614] usb usb1: Manufacturer: Linux 3.16.0-4-powerpc64le ohci_hcd [ 6.684655] usb usb1: SerialNumber: 0000:00:02.0 [ 6.706756] hub 1-0:1.0: USB hub found [ 6.709342] hub 1-0:1.0: 3 ports detected [ 6.856073] ibmvscsi 2000: SRP_VERSION: 16.a [ 6.858663] scsi0 : IBM POWER Virtual SCSI Adapter 1.5.9 [ 6.890482] ibmvscsi 2000: partner initialization complete [ 6.892225] ibmvscsi 2000: host srp version: 16.a, host partition qemu (0), OS 2, max io 2097152 [ 6.892445] ibmvscsi 2000: sent SRP login [ 6.892623] ibmvscsi 2000: SRP_LOGIN succeeded [ 6.960435] scsi 0:0:0:0: CD-ROM QEMU QEMU CD-ROM 2.5+ PQ: 0 ANSI: 5 [ 7.110257] usb 1-1: new full-speed USB device number 2 using ohci-pci [ 7.354618] usb 1-1: New USB device found, idVendor=0627, idProduct=0001 [ 7.354884] usb 1-1: New USB device strings: Mfr=1, Product=4, SerialNumber=5 [ 7.354915] usb 1-1: Product: QEMU USB Keyboard [ 7.354941] usb 1-1: Manufacturer: QEMU [ 7.354965] usb 1-1: SerialNumber: 42 [ 7.593230] usb 1-2: new full-speed USB device number 3 using ohci-pci [ 7.803140] usb 1-2: New USB device found, idVendor=0627, idProduct=0001 [ 7.803189] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=5 [ 7.803217] usb 1-2: Product: QEMU USB Mouse [ 7.803243] usb 1-2: Manufacturer: QEMU [ 7.803271] usb 1-2: SerialNumber: 42 [ 8.001788] usb 1-3: new full-speed USB device number 4 using ohci-pci [ 8.236126] usb 1-3: New USB device found, idVendor=0409, idProduct=55aa [ 8.236170] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 8.236197] usb 1-3: Product: QEMU USB Hub [ 8.236221] usb 1-3: Manufacturer: QEMU [ 8.236246] usb 1-3: SerialNumber: 314159-pci@800000020000000:02.0-3 [ 8.247796] hub 1-3:1.0: USB hub found [ 8.252272] vda: vda1 vda2 vda3 [ 8.255820] hub 1-3:1.0: 8 ports detected [ 8.575937] hidraw: raw HID events driver (C) Jiri Kosina [ 8.710814] usbcore: registered new interface driver usbhid [ 8.710897] usbhid: USB HID core driver [ 8.800556] input: QEMU QEMU USB Keyboard as /devices/pci0000:00/0000:00:02.0/usb1/1-1/1-1:1.0/0003:0627:0001.0001/input/input0 [ 8.813522] hid-generic 0003:0627:0001.0001: input,hidraw0: USB HID v1.11 Keyboard [QEMU QEMU USB Keyboard] on usb-0000:00:02.0-1/input0 [ 8.838628] input: QEMU QEMU USB Mouse as /devices/pci0000:00/0000:00:02.0/usb1/1-2/1-2:1.0/0003:0627:0001.0002/input/input1 [ 8.852773] hid-generic 0003:0627:0001.0002: input,hidraw1: USB HID v0.01 Mouse [QEMU QEMU USB Mouse] on usb-0000:00:02.0-2/input0 [ 9.684157] sr0: scsi3-mmc drive: 16x/50x cd/rw xa/form2 cdda tray [ 9.684447] cdrom: Uniform CD-ROM driver Revision: 3.20 [ 9.694687] sr 0:0:0:0: Attached scsi CD-ROM sr0 [ 9.733955] sr 0:0:0:0: Attached scsi generic sg0 type 5 [ 12.126890] EXT4-fs (vda2): mounted filesystem with ordered data mode. Opts: (null) [ 13.780089] random: systemd: uninitialized urandom read (16 bytes read, 86 bits of entropy available) [ 13.820325] systemd[1]: systemd 215 running in system mode. (+PAM +AUDIT +SELINUX +IMA +SYSVINIT +LIBCRYPTSETUP +GCRYPT +ACL +XZ -SECCOMP -APPARMOR) [ 13.827143] systemd[1]: Detected architecture 'ppc64-le'. [ 13.993889] systemd[1]: Inserted module 'autofs4' [ 14.005253] systemd[1]: Set hostname to . [ 14.043401] systemd[1]: /etc/mtab is not a symlink or not pointing to /proc/self/mounts. This is not supported anymore. Please make sure to replace this file by a symlink to avoid incorrect or misleading mount(8) output. [ 15.192167] random: systemd-sysv-ge: uninitialized urandom read (16 bytes read, 97 bits of entropy available) [ 15.731488] random: systemd: uninitialized urandom read (16 bytes read, 106 bits of entropy available) [ 15.735903] random: systemd: uninitialized urandom read (16 bytes read, 106 bits of entropy available) [ 15.738841] random: systemd: uninitialized urandom read (16 bytes read, 106 bits of entropy available) [ 15.835926] random: systemd: uninitialized urandom read (16 bytes read, 108 bits of entropy available) [ 15.838244] random: systemd: uninitialized urandom read (16 bytes read, 108 bits of entropy available) [ 15.839286] random: systemd: uninitialized urandom read (16 bytes read, 108 bits of entropy available) [ 15.950852] random: systemd: uninitialized urandom read (16 bytes read, 108 bits of entropy available) [ 16.361318] systemd[1]: Starting Forward Password Requests to Wall Directory Watch. [ 16.365674] systemd[1]: Started Forward Password Requests to Wall Directory Watch. [ 16.370172] systemd[1]: Expecting device dev-hvc0.device... [ 16.373395] systemd[1]: Starting Remote File Systems (Pre). [ 16.373853] systemd[1]: Reached target Remote File Systems (Pre). [ 16.375171] systemd[1]: Starting Arbitrary Executable File Formats File System Automount Point. [ 16.385704] systemd[1]: Set up automount Arbitrary Executable File Formats File System Automount Point. [ 16.386238] systemd[1]: Starting Encrypted Volumes. [ 16.386600] systemd[1]: Reached target Encrypted Volumes. [ 16.387000] systemd[1]: Starting Dispatch Password Requests to Console Directory Watch. [ 16.388184] systemd[1]: Started Dispatch Password Requests to Console Directory Watch. [ 16.388464] systemd[1]: Starting Paths. [ 16.388712] systemd[1]: Reached target Paths. [ 16.391942] systemd[1]: Expecting device dev-vda3.device... [ 16.392254] systemd[1]: Expecting device dev-disk-by\x2duuid-5a63f1d4\x2ddd93\x2d45fa\x2d8b04\x2d531d13b2f573.device... [ 16.392543] systemd[1]: Starting Root Slice. [ 16.394191] systemd[1]: Created slice Root Slice. [ 16.394525] systemd[1]: Starting /dev/initctl Compatibility Named Pipe. [ 16.397746] systemd[1]: Listening on /dev/initctl Compatibility Named Pipe. [ 16.398476] systemd[1]: Starting Delayed Shutdown Socket. [ 16.400495] systemd[1]: Listening on Delayed Shutdown Socket. [ 16.401265] systemd[1]: Starting Journal Socket (/dev/log). [ 16.402434] systemd[1]: Listening on Journal Socket (/dev/log). [ 16.402815] systemd[1]: Starting udev Control Socket. [ 16.403586] systemd[1]: Listening on udev Control Socket. [ 16.403922] systemd[1]: Starting udev Kernel Socket. [ 16.404558] systemd[1]: Listening on udev Kernel Socket. [ 16.405281] systemd[1]: Starting User and Session Slice. [ 16.407097] systemd[1]: Created slice User and Session Slice. [ 16.407376] systemd[1]: Starting Journal Socket. [ 16.408701] systemd[1]: Listening on Journal Socket. [ 16.409425] systemd[1]: Starting System Slice. [ 16.411517] systemd[1]: Created slice System Slice. [ 16.412696] systemd[1]: Starting Increase datagram queue length... [ 16.471051] systemd[1]: Mounting Debug File System... [ 16.534646] systemd[1]: Mounting Huge Pages File System... [ 16.609411] systemd[1]: Started Set Up Additional Binary Formats. [ 16.624922] systemd[1]: Starting Create list of required static device nodes for the current kernel... [ 16.699997] systemd[1]: Mounting POSIX Message Queue File System... [ 16.858052] systemd[1]: Starting Load Kernel Modules... [ 16.997970] systemd[1]: Starting udev Coldplug all Devices... [ 17.162057] systemd[1]: Starting system-getty.slice. [ 17.170940] systemd[1]: Created slice system-getty.slice. [ 17.182649] systemd[1]: Starting system-serial\x2dgetty.slice. [ 17.202996] systemd[1]: Created slice system-serial\x2dgetty.slice. [ 17.225948] systemd[1]: Started File System Check on Root Device. [ 17.227635] systemd[1]: Starting Slices. [ 17.227932] systemd[1]: Reached target Slices. [ 17.474563] systemd[1]: Started Increase datagram queue length. [ 17.576418] systemd[1]: Started Create list of required static device nodes for the current kernel. [ 17.643118] systemd[1]: Mounted Debug File System. [ 17.698436] systemd[1]: Mounted Huge Pages File System. [ 17.790500] systemd[1]: Mounted POSIX Message Queue File System. [ 18.208240] fuse init (API version 7.23) [ 18.405814] systemd[1]: Started Load Kernel Modules. [ 19.057106] systemd[1]: Mounting FUSE Control File System... [ 19.099902] systemd[1]: Starting Apply Kernel Variables... [ 19.175166] systemd[1]: Mounted Configuration File System. [ 19.191354] systemd[1]: Starting Create Static Device Nodes in /dev... [ 19.252059] systemd[1]: Starting Syslog Socket. [ 19.264507] systemd[1]: Listening on Syslog Socket. [ 19.293762] systemd[1]: Starting Journal Service... [ 19.424427] systemd[1]: Started Journal Service. [ 21.339528] systemd-udevd[153]: starting version 215 [ 22.636196] random: nonblocking pool is initialized [ 26.801725] [drm] Initialized drm 1.1.0 20060810 [ 27.190191] checking generic (100a0000000 1d4c00) vs hw (100a0000000 1000000) [ 27.190254] fb: switching to bochsdrmfb from OFfb vga [ 27.192042] Console: switching to colour dummy device 80x25 [ 27.316647] [drm] Found bochs VGA, ID 0xb0c5. [ 27.316718] [drm] Framebuffer size 16384 kB @ 0x100a0000000, mmio @ 0x100e0000000. [ 27.352534] [TTM] Zone kernel: Available graphics memory: 1033696 kiB [ 27.352610] [TTM] Initializing pool allocator [ 27.699633] Console: switching to colour frame buffer device 128x48 [ 28.241859] bochs-drm 0000:00:06.0: fb0: bochsdrmfb frame buffer device [ 28.241914] bochs-drm 0000:00:06.0: registered panic notifier [ 28.270473] [drm] Initialized bochs-drm 1.0.0 20130925 for 0000:00:06.0 on minor 0 [ 32.871945] Adding 2187200k swap on /dev/vda3. Priority:-1 extents:1 across:2187200k FS [ 37.271870] EXT4-fs (vda2): re-mounted. Opts: errors=remount-ro [ 39.257446] systemd-journald[148]: Received request to flush runtime journal from PID 1 [ 66.682979] RPC: Registered named UNIX socket transport module. [ 66.683180] RPC: Registered udp transport module. [ 66.683239] ''' return returncode, output @staticmethod def lscpu(): returncode = 0 output = r''' Architecture: ppc64le Byte Order: Little Endian CPU(s): 2 On-line CPU(s) list: 0,1 Thread(s) per core: 1 Core(s) per socket: 1 Socket(s): 2 NUMA node(s): 1 Model: IBM pSeries (emulated by qemu) L1d cache: 32K L1i cache: 32K NUMA node0 CPU(s): 0,1 ''' return returncode, output class TestLinuxDebian_8_7_1_ppc64le(unittest.TestCase): def setUp(self): helpers.backup_data_source(cpuinfo) helpers.monkey_patch_data_source(cpuinfo, MockDataSource) def tearDown(self): helpers.restore_data_source(cpuinfo) ''' Make sure calls return the expected number of fields. ''' def test_returns(self): self.assertEqual(0, len(cpuinfo._get_cpu_info_from_registry())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpufreq_info())) self.assertEqual(3, len(cpuinfo._get_cpu_info_from_lscpu())) self.assertEqual(5, len(cpuinfo._get_cpu_info_from_proc_cpuinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysctl())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_kstat())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_dmesg())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cat_var_run_dmesg_boot())) self.assertEqual(1, len(cpuinfo._get_cpu_info_from_ibm_pa_features())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpuid())) self.assertEqual(15, len(cpuinfo._get_cpu_info_internal())) def test_get_cpu_info_from_lscpu(self): info = cpuinfo._get_cpu_info_from_lscpu() self.assertEqual('IBM pSeries (emulated by qemu)', info['brand_raw']) self.assertEqual(32 * 1024, info['l1_instruction_cache_size']) self.assertEqual(32 * 1024, info['l1_data_cache_size']) self.assertEqual(3, len(info)) def test_get_cpu_info_from_ibm_pa_features(self): info = cpuinfo._get_cpu_info_from_ibm_pa_features() self.assertEqual( ['dabr', 'dabrx', 'dsisr', 'fpu', 'lp', 'mmu', 'pp', 'rislb', 'run', 'slb', 'sprg3'], info['flags'] ) def test_get_cpu_info_from_proc_cpuinfo(self): info = cpuinfo._get_cpu_info_from_proc_cpuinfo() self.assertEqual('POWER7 (raw), altivec supported', info['brand_raw']) self.assertEqual('1.0000 GHz', info['hz_advertised_friendly']) self.assertEqual('1.0000 GHz', info['hz_actual_friendly']) self.assertEqual((1000000000, 0), info['hz_advertised']) self.assertEqual((1000000000, 0), info['hz_actual']) def test_all(self): info = cpuinfo._get_cpu_info_internal() self.assertEqual('POWER7 (raw), altivec supported', info['brand_raw']) self.assertEqual('1.0000 GHz', info['hz_advertised_friendly']) self.assertEqual('1.0000 GHz', info['hz_actual_friendly']) self.assertEqual((1000000000, 0), info['hz_advertised']) self.assertEqual((1000000000, 0), info['hz_actual']) self.assertEqual('PPC_64', info['arch']) self.assertEqual(64, info['bits']) self.assertEqual(2, info['count']) self.assertEqual(32 * 1024, info['l1_instruction_cache_size']) self.assertEqual(32 * 1024, info['l1_data_cache_size']) self.assertEqual('ppc64le', info['arch_string_raw']) self.assertEqual( ['dabr', 'dabrx', 'dsisr', 'fpu', 'lp', 'mmu', 'pp', 'rislb', 'run', 'slb', 'sprg3'], info['flags'] ) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/tests/test_linux_debian_8_x86_64.py0000664000175000017500000001023714325641176021044 0ustar00mattmatt import unittest from cpuinfo import * import helpers class MockDataSource(object): bits = '64bit' cpu_count = 1 is_windows = False arch_string_raw = 'x86_64' uname_string_raw = 'x86_64' can_cpuid = False @staticmethod def has_proc_cpuinfo(): return True @staticmethod def cat_proc_cpuinfo(): returncode = 0 output = r''' processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 30 model name : Intel(R) Core(TM) i7 CPU 870 @ 2.93GHz stepping : 5 microcode : 0x616 cpu MHz : 2928.283 cache size : 6144 KB physical id : 0 siblings : 4 core id : 0 cpu cores : 4 apicid : 0 initial apicid : 0 fpu : yes fpu_exception : yes cpuid level : 5 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl pni ssse3 lahf_lm bogomips : 5856.56 clflush size : 64 cache_alignment : 64 address sizes : 36 bits physical, 48 bits virtual power management: ''' return returncode, output class TestLinuxDebian_8_X86_64(unittest.TestCase): def setUp(self): helpers.backup_data_source(cpuinfo) helpers.monkey_patch_data_source(cpuinfo, MockDataSource) def tearDown(self): helpers.restore_data_source(cpuinfo) ''' Make sure calls return the expected number of fields. ''' def test_returns(self): self.assertEqual(0, len(cpuinfo._get_cpu_info_from_registry())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpufreq_info())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_lscpu())) self.assertEqual(11, len(cpuinfo._get_cpu_info_from_proc_cpuinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysctl())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_kstat())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_dmesg())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cat_var_run_dmesg_boot())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_ibm_pa_features())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpuid())) self.assertEqual(18, len(cpuinfo._get_cpu_info_internal())) def test_get_cpu_info_from_proc_cpuinfo(self): info = cpuinfo._get_cpu_info_from_proc_cpuinfo() self.assertEqual('GenuineIntel', info['vendor_id_raw']) self.assertEqual('Intel(R) Core(TM) i7 CPU 870 @ 2.93GHz', info['brand_raw']) self.assertEqual('2.9300 GHz', info['hz_advertised_friendly']) self.assertEqual('2.9283 GHz', info['hz_actual_friendly']) self.assertEqual((2930000000, 0), info['hz_advertised']) self.assertEqual((2928283000, 0), info['hz_actual']) self.assertEqual(6144 * 1024, info['l3_cache_size']) self.assertEqual(5, info['stepping']) self.assertEqual(30, info['model']) self.assertEqual(6, info['family']) self.assertEqual( ['apic', 'clflush', 'cmov', 'constant_tsc', 'cx8', 'de', 'fpu', 'fxsr', 'ht', 'lahf_lm', 'lm', 'mca', 'mce', 'mmx', 'msr', 'mtrr', 'nopl', 'nx', 'pae', 'pat', 'pge', 'pni', 'pse', 'pse36', 'rdtscp', 'rep_good', 'sep', 'sse', 'sse2', 'ssse3', 'syscall', 'tsc', 'vme'] , info['flags'] ) def test_all(self): info = cpuinfo._get_cpu_info_internal() self.assertEqual('GenuineIntel', info['vendor_id_raw']) self.assertEqual('Intel(R) Core(TM) i7 CPU 870 @ 2.93GHz', info['brand_raw']) self.assertEqual('2.9300 GHz', info['hz_advertised_friendly']) self.assertEqual('2.9283 GHz', info['hz_actual_friendly']) self.assertEqual((2930000000, 0), info['hz_advertised']) self.assertEqual((2928283000, 0), info['hz_actual']) self.assertEqual('X86_64', info['arch']) self.assertEqual(64, info['bits']) self.assertEqual(1, info['count']) self.assertEqual('x86_64', info['arch_string_raw']) self.assertEqual(6144 * 1024, info['l3_cache_size']) self.assertEqual(5, info['stepping']) self.assertEqual(30, info['model']) self.assertEqual(6, info['family']) self.assertEqual( ['apic', 'clflush', 'cmov', 'constant_tsc', 'cx8', 'de', 'fpu', 'fxsr', 'ht', 'lahf_lm', 'lm', 'mca', 'mce', 'mmx', 'msr', 'mtrr', 'nopl', 'nx', 'pae', 'pat', 'pge', 'pni', 'pse', 'pse36', 'rdtscp', 'rep_good', 'sep', 'sse', 'sse2', 'ssse3', 'syscall', 'tsc', 'vme'] , info['flags'] ) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/tests/test_linux_fedora_24_ppc64le.py0000664000175000017500000005336314325641176021466 0ustar00mattmatt import unittest from cpuinfo import * import helpers class MockDataSource(object): bits = '64bit' cpu_count = 2 is_windows = False arch_string_raw = 'ppc64le' uname_string_raw = '' can_cpuid = False @staticmethod def has_proc_cpuinfo(): return True @staticmethod def has_dmesg(): return True @staticmethod def has_lscpu(): return True @staticmethod def has_ibm_pa_features(): return True @staticmethod def ibm_pa_features(): returncode = 0 output = r''' /proc/device-tree/cpus/PowerPC,POWER7@1/ibm,pa-features 3ff60006 c08000c7 ''' return returncode, output @staticmethod def cat_proc_cpuinfo(): returncode = 0 output = r''' processor : 0 cpu : POWER8E (raw), altivec supported clock : 3425.000000MHz revision : 2.1 (pvr 004b 0201) processor : 1 cpu : POWER8E (raw), altivec supported clock : 3425.000000MHz revision : 2.1 (pvr 004b 0201) timebase : 512000000 platform : pSeries model : IBM pSeries (emulated by qemu) machine : CHRP IBM pSeries (emulated by qemu) ''' return returncode, output @staticmethod def dmesg_a(): returncode = 0 output = r''' [ 0.000000] Allocated 2359296 bytes for 1024 pacas at c00000000fdc0000 [ 0.000000] Using pSeries machine description [ 0.000000] Page sizes from device-tree: [ 0.000000] base_shift=12: shift=12, sllp=0x0000, avpnm=0x00000000, tlbiel=1, penc=0 [ 0.000000] base_shift=16: shift=16, sllp=0x0110, avpnm=0x00000000, tlbiel=1, penc=1 [ 0.000000] Page orders: linear mapping = 16, virtual = 16, io = 12, vmemmap = 16 [ 0.000000] Using 1TB segments [ 0.000000] Found initrd at 0xc000000003700000:0xc00000000492fa44 [ 0.000000] bootconsole [udbg0] enabled [ 0.000000] Partition configured for 2 cpus. [ 0.000000] CPU maps initialized for 1 thread per core [ 0.000000] (thread shift is 0) [ 0.000000] Freed 2293760 bytes for unused pacas [ 0.000000] Starting Linux ppc64le #1 SMP Tue May 24 12:23:26 UTC 2016 [ 0.000000] ----------------------------------------------------- [ 0.000000] ppc64_pft_size = 0x1a [ 0.000000] phys_mem_size = 0x140000000 [ 0.000000] cpu_features = 0x17fc7a6c18500249 [ 0.000000] possible = 0x1fffffef18500649 [ 0.000000] always = 0x0000000018100040 [ 0.000000] cpu_user_features = 0xdc0065c2 0xef000000 [ 0.000000] mmu_features = 0x58000001 [ 0.000000] firmware_features = 0x000000014052440b [ 0.000000] htab_hash_mask = 0x7ffff [ 0.000000] ----------------------------------------------------- [ 0.000000] Linux version 4.5.5-300.fc24.ppc64le (mockbuild@buildvm-ppc64le-02.ppc.fedoraproject.org) (gcc version 6.1.1 20160510 (Red Hat 6.1.1-2) (GCC) ) #1 SMP Tue May 24 12:23:26 UTC 2016 [ 0.000000] Node 0 Memory: 0x0-0x140000000 [ 0.000000] numa: Initmem setup node 0 [mem 0x00000000-0x13fffffff] [ 0.000000] numa: NODE_DATA [mem 0x13ffda100-0x13ffe3fff] [ 0.000000] Section 317 and 319 (node 0) have a circular dependency on usemap and pgdat allocations [ 0.000000] PCI host bridge /pci@800000020000000 ranges: [ 0.000000] IO 0x0000010080000000..0x000001008000ffff -> 0x0000000000000000 [ 0.000000] MEM 0x00000100a0000000..0x000001101fffffff -> 0x0000000080000000 [ 0.000000] PPC64 nvram contains 65536 bytes [ 0.000000] Top of RAM: 0x140000000, Total RAM: 0x140000000 [ 0.000000] Memory hole size: 0MB [ 0.000000] Zone ranges: [ 0.000000] DMA [mem 0x0000000000000000-0x000000013fffffff] [ 0.000000] DMA32 empty [ 0.000000] Normal empty [ 0.000000] Movable zone start for each node [ 0.000000] Early memory node ranges [ 0.000000] node 0: [mem 0x0000000000000000-0x000000013fffffff] [ 0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x000000013fffffff] [ 0.000000] On node 0 totalpages: 81920 [ 0.000000] DMA zone: 80 pages used for memmap [ 0.000000] DMA zone: 0 pages reserved [ 0.000000] DMA zone: 81920 pages, LIFO batch:1 [ 0.000000] PERCPU: Embedded 3 pages/cpu @c00000013fe00000 s128792 r0 d67816 u524288 [ 0.000000] pcpu-alloc: s128792 r0 d67816 u524288 alloc=1*1048576 [ 0.000000] pcpu-alloc: [0] 0 1 [ 0.000000] Built 1 zonelists in Node order, mobility grouping on. Total pages: 81840 [ 0.000000] Policy zone: DMA [ 0.000000] Kernel command line: BOOT_IMAGE=/vmlinuz-4.5.5-300.fc24.ppc64le root=UUID=e310499a-7ae9-46e6-aeeb-e9babe31e019 ro no_timer_check console=tty1 console=ttyS0,115200n8 rhgb quiet console=hvc1 LANG=en_US.UTF-8 [ 0.000000] PID hash table entries: 4096 (order: -1, 32768 bytes) [ 0.000000] Sorting __ex_table... [ 0.000000] Memory: 5129088K/5242880K available (10048K kernel code, 1344K rwdata, 3028K rodata, 5312K init, 2684K bss, 113792K reserved, 0K cma-reserved) [ 0.000000] SLUB: HWalign=128, Order=0-3, MinObjects=0, CPUs=2, Nodes=1 [ 0.000000] Hierarchical RCU implementation. [ 0.000000] Build-time adjustment of leaf fanout to 64. [ 0.000000] RCU restricting CPUs from NR_CPUS=1024 to nr_cpu_ids=2. [ 0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=64, nr_cpu_ids=2 [ 0.000000] NR_IRQS:512 nr_irqs:512 16 [ 0.000000] pic: no ISA interrupt controller [ 0.000000] time_init: decrementer frequency = 512.000000 MHz [ 0.000000] time_init: processor frequency = 3425.000000 MHz [ 0.000001] clocksource: timebase: mask: 0xffffffffffffffff max_cycles: 0x761537d007, max_idle_ns: 440795202126 ns [ 0.000003] clocksource: timebase mult[1f40000] shift[24] registered [ 0.000005] clockevent: decrementer mult[83126e98] shift[32] cpu[0] [ 0.000040] Console: colour dummy device 80x25 [ 0.000068] console [tty1] enabled [ 0.000088] pid_max: default: 32768 minimum: 301 [ 0.000125] Security Framework initialized [ 0.000127] Yama: becoming mindful. [ 0.000131] SELinux: Initializing. [ 0.000146] SELinux: Starting in permissive mode [ 0.000227] Dentry cache hash table entries: 1048576 (order: 7, 8388608 bytes) [ 0.001739] Inode-cache hash table entries: 524288 (order: 6, 4194304 bytes) [ 0.002484] Mount-cache hash table entries: 16384 (order: 1, 131072 bytes) [ 0.002486] Mountpoint-cache hash table entries: 16384 (order: 1, 131072 bytes) [ 0.002754] ftrace: allocating 25021 entries in 10 pages [ 0.012417] EEH: pSeries platform initialized [ 0.012430] POWER8 performance monitor hardware support registered [ 0.012433] power8-pmu: PMAO restore workaround active. [ 0.014048] Brought up 2 CPUs [ 0.014066] Node 0 CPUs: 0-1 [ 0.014588] devtmpfs: initialized [ 0.025860] EEH: devices created [ 0.025904] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns [ 0.025964] atomic64_test: passed [ 0.026060] NET: Registered protocol family 16 [ 0.026973] EEH: No capable adapters found [ 0.027024] IBM eBus Device Driver [ 0.052266] cpuidle: using governor menu [ 0.052392] pstore: Registered nvram as persistent store backend [ 0.053138] PCI: Probing PCI hardware [ 0.053169] PCI host bridge to bus 0000:00 [ 0.053172] pci_bus 0000:00: root bus resource [io 0x10000-0x1ffff] (bus address [0x0000-0xffff]) [ 0.053174] pci_bus 0000:00: root bus resource [mem 0x100a0000000-0x1101fffffff] (bus address [0x80000000-0xfffffffff]) [ 0.053176] pci_bus 0000:00: root bus resource [bus 00-ff] [ 0.079786] IOMMU table initialized, virtual merging enabled [ 0.080038] PCI: Probing PCI hardware done [ 0.102679] vgaarb: loaded [ 0.102739] SCSI subsystem initialized [ 0.102766] libata version 3.00 loaded. [ 0.102802] usbcore: registered new interface driver usbfs [ 0.102810] usbcore: registered new interface driver hub [ 0.102823] usbcore: registered new device driver usb [ 0.103034] NetLabel: Initializing [ 0.103035] NetLabel: domain hash size = 128 [ 0.103035] NetLabel: protocols = UNLABELED CIPSOv4 [ 0.103044] NetLabel: unlabeled traffic allowed by default [ 0.103108] clocksource: Switched to clocksource timebase [ 0.110649] VFS: Disk quotas dquot_6.6.0 [ 0.110680] VFS: Dquot-cache hash table entries: 8192 (order 0, 65536 bytes) [ 0.110724] hugetlbfs: disabling because there are no supported hugepage sizes [ 0.113993] NET: Registered protocol family 2 [ 0.114128] TCP established hash table entries: 65536 (order: 3, 524288 bytes) [ 0.114243] TCP bind hash table entries: 65536 (order: 4, 1048576 bytes) [ 0.114372] TCP: Hash tables configured (established 65536 bind 65536) [ 0.114381] UDP hash table entries: 4096 (order: 1, 131072 bytes) [ 0.114398] UDP-Lite hash table entries: 4096 (order: 1, 131072 bytes) [ 0.114445] NET: Registered protocol family 1 [ 0.173318] PCI: CLS 0 bytes, default 128 [ 0.173399] Unpacking initramfs... [ 0.476072] Freeing initrd memory: 18560K (c000000003700000 - c000000004920000) [ 0.476263] RTAS daemon started [ 0.476812] rtas_flash: no firmware flash support [ 0.513298] futex hash table entries: 512 (order: 0, 65536 bytes) [ 0.513327] audit: initializing netlink subsys (disabled) [ 0.513355] audit: type=2000 audit(1491783180.510:1): initialized [ 0.513515] Initialise system trusted keyring [ 0.515510] zbud: loaded [ 0.516023] Key type big_key registered [ 0.516025] SELinux: Registering netfilter hooks [ 0.521239] NET: Registered protocol family 38 [ 0.521248] Key type asymmetric registered [ 0.521251] Asymmetric key parser 'x509' registered [ 0.521288] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252) [ 0.521315] io scheduler noop registered [ 0.521317] io scheduler deadline registered [ 0.521350] io scheduler cfq registered (default) [ 0.521402] pci_hotplug: PCI Hot Plug PCI Core version: 0.5 [ 0.521659] console [hvc1] enabled [ 0.521660] bootconsole [udbg0] disabled [ 0.521735] Linux agpgart interface v0.103 [ 0.521845] libphy: Fixed MDIO Bus: probed [ 0.521881] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver [ 0.521889] ehci-pci: EHCI PCI platform driver [ 0.521898] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver [ 0.521906] ohci-pci: OHCI PCI platform driver [ 0.522111] ohci-pci 0000:00:02.0: OHCI PCI host controller [ 0.522141] ohci-pci 0000:00:02.0: new USB bus registered, assigned bus number 1 [ 0.522220] ohci-pci 0000:00:02.0: irq 20, io mem 0x100e0002000 [ 0.573380] usb usb1: New USB device found, idVendor=1d6b, idProduct=0001 [ 0.573382] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1 [ 0.573384] usb usb1: Product: OHCI PCI host controller [ 0.573385] usb usb1: Manufacturer: Linux 4.5.5-300.fc24.ppc64le ohci_hcd [ 0.573386] usb usb1: SerialNumber: 0000:00:02.0 [ 0.573477] hub 1-0:1.0: USB hub found [ 0.573496] hub 1-0:1.0: 3 ports detected [ 0.573656] uhci_hcd: USB Universal Host Controller Interface driver [ 0.573694] usbcore: registered new interface driver usbserial [ 0.573699] usbcore: registered new interface driver usbserial_generic [ 0.573706] usbserial: USB Serial support registered for generic [ 0.573763] mousedev: PS/2 mouse device common for all mice [ 0.573863] rtc-generic rtc-generic: rtc core: registered rtc-generic as rtc0 [ 0.573932] device-mapper: uevent: version 1.0.3 [ 0.573994] device-mapper: ioctl: 4.34.0-ioctl (2015-10-28) initialised: dm-devel@redhat.com [ 0.574075] pseries_idle_driver registered [ 0.574087] hidraw: raw HID events driver (C) Jiri Kosina [ 0.574122] usbcore: registered new interface driver usbhid [ 0.574123] usbhid: USB HID core driver [ 0.574161] drop_monitor: Initializing network drop monitor service [ 0.574234] ip_tables: (C) 2000-2006 Netfilter Core Team [ 0.574249] Initializing XFRM netlink socket [ 0.574386] NET: Registered protocol family 10 [ 0.574535] mip6: Mobile IPv6 [ 0.574538] NET: Registered protocol family 17 [ 0.574586] Running MSI bitmap self-tests ... [ 0.574723] registered taskstats version 1 [ 0.574738] Loading compiled-in X.509 certificates [ 0.575418] Loaded X.509 cert 'Fedora kernel signing key: 5a5f33c227f5a1d54cd2ff7c19cb096bd38186c0' [ 0.575455] zswap: loaded using pool lzo/zbud [ 0.575662] rtc-generic rtc-generic: setting system clock to 2017-04-10 00:13:00 UTC (1491783180) [ 0.576274] Freeing unused kernel memory: 5312K (c000000000cd0000 - c000000001200000) [ 0.605405] random: systemd urandom read with 6 bits of entropy available [ 0.606905] systemd[1]: systemd 229 running in system mode. (+PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN) [ 0.606941] systemd[1]: Detected virtualization kvm. [ 0.606945] systemd[1]: Detected architecture ppc64-le. [ 0.606947] systemd[1]: Running in initial RAM disk. [ 0.606954] systemd[1]: No hostname configured. [ 0.606958] systemd[1]: Set hostname to . [ 0.606978] systemd[1]: Initializing machine ID from random generator. [ 0.668692] systemd[1]: Reached target Timers. [ 0.669077] systemd[1]: Created slice System Slice. [ 0.669110] systemd[1]: Listening on Journal Socket (/dev/log). [ 0.669126] systemd[1]: Listening on udev Kernel Socket. [ 0.669149] systemd[1]: Listening on udev Control Socket. [ 0.669175] systemd[1]: Listening on Journal Socket. [ 0.669586] systemd[1]: Starting Setup Virtual Console... [ 0.669653] systemd[1]: Listening on Journal Audit Socket. [ 0.672129] systemd[1]: Starting Journal Service... [ 0.672138] systemd[1]: Reached target Sockets. [ 0.672147] systemd[1]: Reached target Slices. [ 0.672232] systemd[1]: Reached target Local File Systems. [ 0.672240] systemd[1]: Reached target Swap. [ 0.672673] systemd[1]: Starting Create list of required static device nodes for the current kernel... [ 0.674014] systemd[1]: Starting Apply Kernel Variables... [ 0.674919] systemd[1]: Started Setup Virtual Console. [ 0.679667] audit: type=1130 audit(1491783180.590:2): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=kernel msg='unit=systemd-vconsole-setup comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success' [ 0.679905] systemd[1]: Started Create list of required static device nodes for the current kernel. [ 0.679919] audit: type=1130 audit(1491783180.590:3): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=kernel msg='unit=kmod-static-nodes comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success' [ 0.680081] systemd[1]: Started Apply Kernel Variables. [ 0.680092] audit: type=1130 audit(1491783180.590:4): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=kernel msg='unit=systemd-sysctl comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success' [ 0.680162] systemd[1]: Started Journal Service. [ 0.680185] audit: type=1130 audit(1491783180.590:5): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=kernel msg='unit=systemd-journald comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success' [ 0.694615] audit: type=1130 audit(1491783180.610:6): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=kernel msg='unit=systemd-tmpfiles-setup-dev comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success' [ 0.699549] audit: type=1130 audit(1491783180.610:7): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=kernel msg='unit=systemd-udevd comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success' [ 0.728515] audit: type=1130 audit(1491783180.640:8): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=kernel msg='unit=systemd-udev-trigger comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success' [ 0.739200] virtio-pci 0000:00:05.0: enabling device (0100 -> 0101) [ 0.739411] virtio-pci 0000:00:05.0: virtio_pci: leaving for legacy driver [ 0.740075] virtio-pci 0000:00:04.0: enabling device (0100 -> 0103) [ 0.740437] virtio-pci 0000:00:04.0: virtio_pci: leaving for legacy driver [ 0.757865] virtio-pci 0000:00:03.0: enabling device (0100 -> 0103) [ 0.758321] virtio-pci 0000:00:03.0: virtio_pci: leaving for legacy driver [ 0.763011] virtio-pci 0000:00:01.0: enabling device (0100 -> 0103) [ 0.763502] virtio-pci 0000:00:01.0: virtio_pci: leaving for legacy driver [ 0.768465] vdb: vdb1 vdb2 vdb3 [ 0.830235] audit: type=1130 audit(1491783180.740:9): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=kernel msg='unit=plymouth-start comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success' [ 2.148482] audit: type=1130 audit(1491783182.060:10): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=kernel msg='unit=systemd-fsck-root comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success' [ 2.189824] EXT4-fs (vdb3): mounted filesystem with ordered data mode. Opts: (null) [ 2.301223] systemd-journald[109]: Received SIGTERM from PID 1 (systemd). [ 2.351807] SELinux: 32768 avtab hash slots, 104786 rules. [ 2.365146] SELinux: 32768 avtab hash slots, 104786 rules. [ 2.383721] SELinux: 8 users, 14 roles, 5012 types, 303 bools, 1 sens, 1024 cats [ 2.383724] SELinux: 92 classes, 104786 rules [ 2.386155] SELinux: Permission validate_trans in class security not defined in policy. [ 2.386249] SELinux: the above unknown classes and permissions will be allowed [ 2.386252] SELinux: Completing initialization. [ 2.386253] SELinux: Setting up existing superblocks. [ 2.426718] systemd[1]: Successfully loaded SELinux policy in 103.506ms. [ 2.444699] systemd[1]: Relabelled /dev and /run in 11.979ms. [ 2.589401] EXT4-fs (vdb3): re-mounted. Opts: (null) [ 2.599542] systemd-journald[240]: Received request to flush runtime journal from PID 1 [ 2.779725] systemd-journald[240]: File /var/log/journal/4e9a0e2b5c824908abfd9075364301d9/system.journal corrupted or uncleanly shut down, renaming and replacing. [ 2.850831] Adding 102399936k swap on /dev/vda. Priority:-1 extents:1 across:102399936k FS [ 3.237747] EXT4-fs (vdb2): mounted filesystem with ordered data mode. Opts: (null) [ 16.065643] netlink: 12 bytes leftover after parsing attributes in process `ip'. [ 20.101004] random: nonblocking pool is initialized [ 26.987127] systemd-journald[240]: File /var/log/journal/4e9a0e2b5c824908abfd9075364301d9/user-1000.journal corrupted or uncleanly shut down, renaming and replacing. [ 95.273698] systemd-journald[240]: File /var/log/journal/4e9a0e2b5c824908abfd9075364301d9/user-1001.journal corrupted or uncleanly shut down, renaming and replacing. ''' return returncode, output @staticmethod def lscpu(): returncode = 0 output = r''' Architecture: ppc64le Byte Order: Little Endian CPU(s): 2 On-line CPU(s) list: 0,1 Thread(s) per core: 1 Core(s) per socket: 1 Socket(s): 2 NUMA node(s): 1 Model: 2.1 (pvr 004b 0201) Model name: POWER8E (raw), altivec supported Hypervisor vendor: KVM Virtualization type: para L1d cache: 64K L1i cache: 32K NUMA node0 CPU(s): 0,1 ''' return returncode, output class TestLinuxFedora_24_ppc64le(unittest.TestCase): def setUp(self): helpers.backup_data_source(cpuinfo) helpers.monkey_patch_data_source(cpuinfo, MockDataSource) def tearDown(self): helpers.restore_data_source(cpuinfo) ''' Make sure calls return the expected number of fields. ''' def test_returns(self): self.assertEqual(0, len(cpuinfo._get_cpu_info_from_registry())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpufreq_info())) self.assertEqual(3, len(cpuinfo._get_cpu_info_from_lscpu())) self.assertEqual(5, len(cpuinfo._get_cpu_info_from_proc_cpuinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysctl())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_kstat())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_dmesg())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cat_var_run_dmesg_boot())) self.assertEqual(1, len(cpuinfo._get_cpu_info_from_ibm_pa_features())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpuid())) self.assertEqual(15, len(cpuinfo._get_cpu_info_internal())) def test_get_cpu_info_from_lscpu(self): info = cpuinfo._get_cpu_info_from_lscpu() self.assertEqual(32 * 1024, info['l1_instruction_cache_size']) self.assertEqual(64 * 1024, info['l1_data_cache_size']) self.assertEqual('POWER8E (raw), altivec supported', info['brand_raw']) def test_get_cpu_info_from_ibm_pa_features(self): info = cpuinfo._get_cpu_info_from_ibm_pa_features() self.assertEqual( ['dss_2.02', 'dss_2.05', 'dss_2.06', 'fpu', 'lsd_in_dscr', 'ppr', 'slb', 'sso_2.06', 'ugr_in_dscr'], info['flags'] ) def test_get_cpu_info_from_proc_cpuinfo(self): info = cpuinfo._get_cpu_info_from_proc_cpuinfo() self.assertEqual('POWER8E (raw), altivec supported', info['brand_raw']) self.assertEqual('3.4250 GHz', info['hz_advertised_friendly']) self.assertEqual('3.4250 GHz', info['hz_actual_friendly']) self.assertEqual((3425000000, 0), info['hz_advertised']) self.assertEqual((3425000000, 0), info['hz_actual']) def test_all(self): info = cpuinfo._get_cpu_info_internal() self.assertEqual('POWER8E (raw), altivec supported', info['brand_raw']) self.assertEqual('3.4250 GHz', info['hz_advertised_friendly']) self.assertEqual('3.4250 GHz', info['hz_actual_friendly']) self.assertEqual((3425000000, 0), info['hz_advertised']) self.assertEqual((3425000000, 0), info['hz_actual']) self.assertEqual('PPC_64', info['arch']) self.assertEqual(64, info['bits']) self.assertEqual(2, info['count']) self.assertEqual(32 * 1024, info['l1_instruction_cache_size']) self.assertEqual(64 * 1024, info['l1_data_cache_size']) self.assertEqual('ppc64le', info['arch_string_raw']) self.assertEqual( ['dss_2.02', 'dss_2.05', 'dss_2.06', 'fpu', 'lsd_in_dscr', 'ppr', 'slb', 'sso_2.06', 'ugr_in_dscr'], info['flags'] ) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/tests/test_linux_fedora_24_x86_64.py0000664000175000017500000006701614325641176021147 0ustar00mattmatt import unittest from cpuinfo import * import helpers class MockDataSource(object): bits = '64bit' cpu_count = 2 is_windows = False arch_string_raw = 'x86_64' uname_string_raw = 'x86_64' can_cpuid = False @staticmethod def has_proc_cpuinfo(): return True @staticmethod def has_dmesg(): return True @staticmethod def has_lscpu(): return True @staticmethod def cat_proc_cpuinfo(): returncode = 0 output = r''' processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 42 model name : Intel(R) Pentium(R) CPU G640 @ 2.80GHz stepping : 7 cpu MHz : 2793.652 cache size : 3072 KB physical id : 0 siblings : 2 core id : 0 cpu cores : 2 apicid : 0 initial apicid : 0 fpu : yes fpu_exception : yes cpuid level : 13 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt xsave hypervisor lahf_lm bogomips : 5587.30 clflush size : 64 cache_alignment : 64 address sizes : 36 bits physical, 48 bits virtual power management: processor : 1 vendor_id : GenuineIntel cpu family : 6 model : 42 model name : Intel(R) Pentium(R) CPU G640 @ 2.80GHz stepping : 7 cpu MHz : 2793.652 cache size : 3072 KB physical id : 0 siblings : 2 core id : 1 cpu cores : 2 apicid : 1 initial apicid : 1 fpu : yes fpu_exception : yes cpuid level : 13 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt xsave hypervisor lahf_lm bogomips : 5587.30 clflush size : 64 cache_alignment : 64 address sizes : 36 bits physical, 48 bits virtual power management: ''' return returncode, output @staticmethod def dmesg_a(): returncode = 0 output = r''' [ 0.000000] Initializing cgroup subsys cpuset [ 0.000000] Initializing cgroup subsys cpu [ 0.000000] Initializing cgroup subsys cpuacct [ 0.000000] Linux version 3.16.0-4-amd64 (debian-kernel@lists.debian.org) (gcc version 4.8.4 (Debian 4.8.4-1) ) #1 SMP Debian 3.16.36-1+deb8u2 (2016-10-19) [ 0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-3.16.0-4-amd64 root=UUID=12618f16-cbe6-4b2b-9f80-b71195be06e7 ro quiet [ 0.000000] e820: BIOS-provided physical RAM map: [ 0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable [ 0.000000] BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved [ 0.000000] BIOS-e820: [mem 0x0000000000100000-0x00000000dffeffff] usable [ 0.000000] BIOS-e820: [mem 0x00000000dfff0000-0x00000000dfffffff] ACPI data [ 0.000000] BIOS-e820: [mem 0x00000000fec00000-0x00000000fec00fff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000fee00000-0x00000000fee00fff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved [ 0.000000] BIOS-e820: [mem 0x0000000100000000-0x000000011fffffff] usable [ 0.000000] NX (Execute Disable) protection: active [ 0.000000] SMBIOS 2.5 present. [ 0.000000] DMI: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006 [ 0.000000] Hypervisor detected: KVM [ 0.000000] e820: update [mem 0x00000000-0x00000fff] usable ==> reserved [ 0.000000] e820: remove [mem 0x000a0000-0x000fffff] usable [ 0.000000] AGP: No AGP bridge found [ 0.000000] e820: last_pfn = 0x120000 max_arch_pfn = 0x400000000 [ 0.000000] MTRR default type: uncachable [ 0.000000] MTRR variable ranges disabled: [ 0.000000] x86 PAT enabled: cpu 0, old 0x7040600070406, new 0x7010600070106 [ 0.000000] CPU MTRRs all blank - virtualized system. [ 0.000000] e820: last_pfn = 0xdfff0 max_arch_pfn = 0x400000000 [ 0.000000] found SMP MP-table at [mem 0x0009fff0-0x0009ffff] mapped at [ffff88000009fff0] [ 0.000000] Base memory trampoline at [ffff880000099000] 99000 size 24576 [ 0.000000] init_memory_mapping: [mem 0x00000000-0x000fffff] [ 0.000000] [mem 0x00000000-0x000fffff] page 4k [ 0.000000] BRK [0x01af4000, 0x01af4fff] PGTABLE [ 0.000000] BRK [0x01af5000, 0x01af5fff] PGTABLE [ 0.000000] BRK [0x01af6000, 0x01af6fff] PGTABLE [ 0.000000] init_memory_mapping: [mem 0x11fe00000-0x11fffffff] [ 0.000000] [mem 0x11fe00000-0x11fffffff] page 2M [ 0.000000] BRK [0x01af7000, 0x01af7fff] PGTABLE [ 0.000000] init_memory_mapping: [mem 0x11c000000-0x11fdfffff] [ 0.000000] [mem 0x11c000000-0x11fdfffff] page 2M [ 0.000000] init_memory_mapping: [mem 0x100000000-0x11bffffff] [ 0.000000] [mem 0x100000000-0x11bffffff] page 2M [ 0.000000] init_memory_mapping: [mem 0x00100000-0xdffeffff] [ 0.000000] [mem 0x00100000-0x001fffff] page 4k [ 0.000000] [mem 0x00200000-0xdfdfffff] page 2M [ 0.000000] [mem 0xdfe00000-0xdffeffff] page 4k [ 0.000000] RAMDISK: [mem 0x3634a000-0x3719cfff] [ 0.000000] ACPI: Early table checksum verification disabled [ 0.000000] ACPI: RSDP 0x00000000000E0000 000024 (v02 VBOX ) [ 0.000000] ACPI: XSDT 0x00000000DFFF0030 00003C (v01 VBOX VBOXXSDT 00000001 ASL 00000061) [ 0.000000] ACPI: FACP 0x00000000DFFF00F0 0000F4 (v04 VBOX VBOXFACP 00000001 ASL 00000061) [ 0.000000] ACPI: DSDT 0x00000000DFFF0470 00210F (v01 VBOX VBOXBIOS 00000002 INTL 20160108) [ 0.000000] ACPI: FACS 0x00000000DFFF0200 000040 [ 0.000000] ACPI: FACS 0x00000000DFFF0200 000040 [ 0.000000] ACPI: APIC 0x00000000DFFF0240 00005C (v02 VBOX VBOXAPIC 00000001 ASL 00000061) [ 0.000000] ACPI: SSDT 0x00000000DFFF02A0 0001CC (v01 VBOX VBOXCPUT 00000002 INTL 20160108) [ 0.000000] ACPI: Local APIC address 0xfee00000 [ 0.000000] No NUMA configuration found [ 0.000000] Faking a node at [mem 0x0000000000000000-0x000000011fffffff] [ 0.000000] Initmem setup node 0 [mem 0x00000000-0x11fffffff] [ 0.000000] NODE_DATA [mem 0x11fff7000-0x11fffbfff] [ 0.000000] kvm-clock: Using msrs 4b564d01 and 4b564d00 [ 0.000000] kvm-clock: cpu 0, msr 1:1ffef001, primary cpu clock [ 0.000000] [ffffea0000000000-ffffea0003ffffff] PMD -> [ffff88011b600000-ffff88011effffff] on node 0 [ 0.000000] Zone ranges: [ 0.000000] DMA [mem 0x00001000-0x00ffffff] [ 0.000000] DMA32 [mem 0x01000000-0xffffffff] [ 0.000000] Normal [mem 0x100000000-0x11fffffff] [ 0.000000] Movable zone start for each node [ 0.000000] Early memory node ranges [ 0.000000] node 0: [mem 0x00001000-0x0009efff] [ 0.000000] node 0: [mem 0x00100000-0xdffeffff] [ 0.000000] node 0: [mem 0x100000000-0x11fffffff] [ 0.000000] On node 0 totalpages: 1048462 [ 0.000000] DMA zone: 56 pages used for memmap [ 0.000000] DMA zone: 21 pages reserved [ 0.000000] DMA zone: 3998 pages, LIFO batch:0 [ 0.000000] DMA32 zone: 12488 pages used for memmap [ 0.000000] DMA32 zone: 913392 pages, LIFO batch:31 [ 0.000000] Normal zone: 1792 pages used for memmap [ 0.000000] Normal zone: 131072 pages, LIFO batch:31 [ 0.000000] ACPI: PM-Timer IO Port: 0x4008 [ 0.000000] ACPI: Local APIC address 0xfee00000 [ 0.000000] ACPI: LAPIC (acpi_id[0x00] lapic_id[0x00] enabled) [ 0.000000] ACPI: LAPIC (acpi_id[0x01] lapic_id[0x01] enabled) [ 0.000000] ACPI: IOAPIC (id[0x02] address[0xfec00000] gsi_base[0]) [ 0.000000] IOAPIC[0]: apic_id 2, version 32, address 0xfec00000, GSI 0-23 [ 0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl) [ 0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level) [ 0.000000] ACPI: IRQ0 used by override. [ 0.000000] ACPI: IRQ2 used by override. [ 0.000000] ACPI: IRQ9 used by override. [ 0.000000] Using ACPI (MADT) for SMP configuration information [ 0.000000] smpboot: Allowing 2 CPUs, 0 hotplug CPUs [ 0.000000] nr_irqs_gsi: 40 [ 0.000000] PM: Registered nosave memory: [mem 0x0009f000-0x0009ffff] [ 0.000000] PM: Registered nosave memory: [mem 0x000a0000-0x000effff] [ 0.000000] PM: Registered nosave memory: [mem 0x000f0000-0x000fffff] [ 0.000000] PM: Registered nosave memory: [mem 0xdfff0000-0xdfffffff] [ 0.000000] PM: Registered nosave memory: [mem 0xe0000000-0xfebfffff] [ 0.000000] PM: Registered nosave memory: [mem 0xfec00000-0xfec00fff] [ 0.000000] PM: Registered nosave memory: [mem 0xfec01000-0xfedfffff] [ 0.000000] PM: Registered nosave memory: [mem 0xfee00000-0xfee00fff] [ 0.000000] PM: Registered nosave memory: [mem 0xfee01000-0xfffbffff] [ 0.000000] PM: Registered nosave memory: [mem 0xfffc0000-0xffffffff] [ 0.000000] e820: [mem 0xe0000000-0xfebfffff] available for PCI devices [ 0.000000] Booting paravirtualized kernel on KVM [ 0.000000] setup_percpu: NR_CPUS:512 nr_cpumask_bits:512 nr_cpu_ids:2 nr_node_ids:1 [ 0.000000] PERCPU: Embedded 27 pages/cpu @ffff88011fc00000 s80960 r8192 d21440 u1048576 [ 0.000000] pcpu-alloc: s80960 r8192 d21440 u1048576 alloc=1*2097152 [ 0.000000] pcpu-alloc: [0] 0 1 [ 0.000000] Built 1 zonelists in Node order, mobility grouping on. Total pages: 1034105 [ 0.000000] Policy zone: Normal [ 0.000000] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-3.16.0-4-amd64 root=UUID=12618f16-cbe6-4b2b-9f80-b71195be06e7 ro quiet [ 0.000000] PID hash table entries: 4096 (order: 3, 32768 bytes) [ 0.000000] xsave: enabled xstate_bv 0x3, cntxt size 0x240 [ 0.000000] AGP: Checking aperture... [ 0.000000] AGP: No AGP bridge found [ 0.000000] Calgary: detecting Calgary via BIOS EBDA area [ 0.000000] Calgary: Unable to locate Rio Grande table in EBDA - bailing! [ 0.000000] Memory: 4041880K/4193848K available (5237K kernel code, 947K rwdata, 1836K rodata, 1204K init, 840K bss, 151968K reserved) [ 0.000000] Hierarchical RCU implementation. [ 0.000000] RCU dyntick-idle grace-period acceleration is enabled. [ 0.000000] RCU restricting CPUs from NR_CPUS=512 to nr_cpu_ids=2. [ 0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=2 [ 0.000000] NR_IRQS:33024 nr_irqs:512 16 [ 0.000000] Console: colour VGA+ 80x25 [ 0.000000] console [tty0] enabled [ 0.000000] tsc: Detected 2793.652 MHz processor [ 9.015923] Calibrating delay loop (skipped) preset value.. 5587.30 BogoMIPS (lpj=11174608) [ 9.015926] pid_max: default: 32768 minimum: 301 [ 9.015934] ACPI: Core revision 20140424 [ 9.017020] ACPI: All ACPI Tables successfully acquired [ 9.017050] Security Framework initialized [ 9.017058] AppArmor: AppArmor disabled by boot time parameter [ 9.017059] Yama: disabled by default; enable with sysctl kernel.yama.* [ 9.017855] Dentry cache hash table entries: 524288 (order: 10, 4194304 bytes) [ 9.019277] Inode-cache hash table entries: 262144 (order: 9, 2097152 bytes) [ 9.019613] Mount-cache hash table entries: 8192 (order: 4, 65536 bytes) [ 9.019619] Mountpoint-cache hash table entries: 8192 (order: 4, 65536 bytes) [ 9.019883] Initializing cgroup subsys memory [ 9.019888] Initializing cgroup subsys devices [ 9.019895] Initializing cgroup subsys freezer [ 9.019897] Initializing cgroup subsys net_cls [ 9.019901] Initializing cgroup subsys blkio [ 9.019904] Initializing cgroup subsys perf_event [ 9.019906] Initializing cgroup subsys net_prio [ 9.019987] CPU: Physical Processor ID: 0 [ 9.019988] CPU: Processor Core ID: 0 [ 9.020005] mce: CPU supports 0 MCE banks [ 9.020039] Last level iTLB entries: 4KB 512, 2MB 8, 4MB 8 Last level dTLB entries: 4KB 512, 2MB 32, 4MB 32, 1GB 0 tlb_flushall_shift: 6 [ 9.020376] Freeing SMP alternatives memory: 20K (ffffffff81a1b000 - ffffffff81a20000) [ 9.024990] ftrace: allocating 21697 entries in 85 pages [ 9.059874] ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1 [ 9.059878] smpboot: CPU0: Intel(R) Pentium(R) CPU G640 @ 2.80GHz (fam: 06, model: 2a, stepping: 07) [ 9.164299] Performance Events: unsupported p6 CPU model 42 no PMU driver, software events only. [ 9.165780] NMI watchdog: disabled (cpu0): hardware events not enabled [ 9.165895] x86: Booting SMP configuration: [ 9.165897] .... node #0, CPUs: #1 [ 9.176166] kvm-clock: cpu 1, msr 1:1ffef041, secondary cpu clock [ 9.177165] mce: CPU supports 0 MCE banks [ 9.179301] x86: Booted up 1 node, 2 CPUs [ 9.179305] smpboot: Total of 2 processors activated (11174.60 BogoMIPS) [ 9.180688] devtmpfs: initialized [ 9.187316] pinctrl core: initialized pinctrl subsystem [ 9.187487] NET: Registered protocol family 16 [ 9.187619] cpuidle: using governor ladder [ 9.187623] cpuidle: using governor menu [ 9.187667] ACPI: bus type PCI registered [ 9.187669] acpiphp: ACPI Hot Plug PCI Controller Driver version: 0.5 [ 9.187894] PCI: Using configuration type 1 for base access [ 9.204747] ACPI: Added _OSI(Module Device) [ 9.204751] ACPI: Added _OSI(Processor Device) [ 9.204752] ACPI: Added _OSI(3.0 _SCP Extensions) [ 9.204753] ACPI: Added _OSI(Processor Aggregator Device) [ 9.205356] ACPI: Executed 1 blocks of module-level executable AML code [ 9.207882] ACPI: Interpreter enabled [ 9.207888] ACPI Exception: AE_NOT_FOUND, While evaluating Sleep State [\_S1_] (20140424/hwxface-580) [ 9.207891] ACPI Exception: AE_NOT_FOUND, While evaluating Sleep State [\_S2_] (20140424/hwxface-580) [ 9.207894] ACPI Exception: AE_NOT_FOUND, While evaluating Sleep State [\_S3_] (20140424/hwxface-580) [ 9.207897] ACPI Exception: AE_NOT_FOUND, While evaluating Sleep State [\_S4_] (20140424/hwxface-580) [ 9.207902] ACPI: (supports S0 S5) [ 9.207904] ACPI: Using IOAPIC for interrupt routing [ 9.208077] PCI: Using host bridge windows from ACPI; if necessary, use "pci=nocrs" and report a bug [ 9.211597] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff]) [ 9.211603] acpi PNP0A03:00: _OSC: OS supports [ASPM ClockPM Segments MSI] [ 9.211607] acpi PNP0A03:00: _OSC failed (AE_NOT_FOUND); disabling ASPM [ 9.211681] acpi PNP0A03:00: fail to add MMCONFIG information, can't access extended PCI configuration space under this bridge. [ 9.211887] PCI host bridge to bus 0000:00 [ 9.211890] pci_bus 0000:00: root bus resource [bus 00-ff] [ 9.211892] pci_bus 0000:00: root bus resource [io 0x0000-0x0cf7] [ 9.211893] pci_bus 0000:00: root bus resource [io 0x0d00-0xffff] [ 9.211895] pci_bus 0000:00: root bus resource [mem 0x000a0000-0x000bffff] [ 9.211896] pci_bus 0000:00: root bus resource [mem 0xe0000000-0xffdfffff] [ 9.211930] pci 0000:00:00.0: [8086:1237] type 00 class 0x060000 [ 9.212373] pci 0000:00:01.0: [8086:7000] type 00 class 0x060100 [ 9.212889] pci 0000:00:01.1: [8086:7111] type 00 class 0x01018a [ 9.213393] pci 0000:00:01.1: reg 0x20: [io 0xd000-0xd00f] [ 9.213530] pci 0000:00:01.1: legacy IDE quirk: reg 0x10: [io 0x01f0-0x01f7] [ 9.213532] pci 0000:00:01.1: legacy IDE quirk: reg 0x14: [io 0x03f6] [ 9.213533] pci 0000:00:01.1: legacy IDE quirk: reg 0x18: [io 0x0170-0x0177] [ 9.213534] pci 0000:00:01.1: legacy IDE quirk: reg 0x1c: [io 0x0376] [ 9.213732] pci 0000:00:02.0: [80ee:beef] type 00 class 0x030000 [ 9.216760] pci 0000:00:02.0: reg 0x10: [mem 0xe0000000-0xe0ffffff pref] [ 9.239260] pci 0000:00:03.0: [8086:100e] type 00 class 0x020000 [ 9.242528] pci 0000:00:03.0: reg 0x10: [mem 0xf0000000-0xf001ffff] [ 9.250446] pci 0000:00:03.0: reg 0x18: [io 0xd010-0xd017] [ 9.267404] pci 0000:00:04.0: [80ee:cafe] type 00 class 0x088000 [ 9.270818] pci 0000:00:04.0: reg 0x10: [io 0xd020-0xd03f] [ 9.276122] pci 0000:00:04.0: reg 0x14: [mem 0xf0400000-0xf07fffff] [ 9.279813] pci 0000:00:04.0: reg 0x18: [mem 0xf0800000-0xf0803fff pref] [ 9.293767] pci 0000:00:05.0: [8086:2415] type 00 class 0x040100 [ 9.293857] pci 0000:00:05.0: reg 0x10: [io 0xd100-0xd1ff] [ 9.293917] pci 0000:00:05.0: reg 0x14: [io 0xd200-0xd23f] [ 9.294374] pci 0000:00:06.0: [106b:003f] type 00 class 0x0c0310 [ 9.297803] pci 0000:00:06.0: reg 0x10: [mem 0xf0804000-0xf0804fff] [ 9.317868] pci 0000:00:07.0: [8086:7113] type 00 class 0x068000 [ 9.318252] pci 0000:00:07.0: quirk: [io 0x4000-0x403f] claimed by PIIX4 ACPI [ 9.318262] pci 0000:00:07.0: quirk: [io 0x4100-0x410f] claimed by PIIX4 SMB [ 9.318538] pci 0000:00:0d.0: [8086:2829] type 00 class 0x010601 [ 9.321461] pci 0000:00:0d.0: reg 0x10: [io 0xd240-0xd247] [ 9.328895] pci 0000:00:0d.0: reg 0x18: [io 0xd250-0xd257] [ 9.336455] pci 0000:00:0d.0: reg 0x20: [io 0xd260-0xd26f] [ 9.339258] pci 0000:00:0d.0: reg 0x24: [mem 0xf0806000-0xf0807fff] [ 9.345202] ACPI: PCI Interrupt Link [LNKA] (IRQs 5 9 10 *11) [ 9.345408] ACPI: PCI Interrupt Link [LNKB] (IRQs 5 9 10 *11) [ 9.345488] ACPI: PCI Interrupt Link [LNKC] (IRQs 5 9 *10 11) [ 9.345567] ACPI: PCI Interrupt Link [LNKD] (IRQs 5 *9 10 11) [ 9.345694] ACPI: Enabled 2 GPEs in block 00 to 07 [ 9.346069] vgaarb: setting as boot device: PCI:0000:00:02.0 [ 9.346072] vgaarb: device added: PCI:0000:00:02.0,decodes=io+mem,owns=io+mem,locks=none [ 9.346074] vgaarb: loaded [ 9.346075] vgaarb: bridge control possible 0000:00:02.0 [ 9.346163] PCI: Using ACPI for IRQ routing [ 9.346165] PCI: pci_cache_line_size set to 64 bytes [ 9.346311] e820: reserve RAM buffer [mem 0x0009fc00-0x0009ffff] [ 9.346317] e820: reserve RAM buffer [mem 0xdfff0000-0xdfffffff] [ 9.346558] Switched to clocksource kvm-clock [ 9.353995] pnp: PnP ACPI init [ 9.354008] ACPI: bus type PNP registered [ 9.354101] pnp 00:00: Plug and Play ACPI device, IDs PNP0303 (active) [ 9.354188] pnp 00:01: Plug and Play ACPI device, IDs PNP0f03 (active) [ 9.354752] pnp: PnP ACPI: found 2 devices [ 9.354753] ACPI: bus type PNP unregistered [ 9.371389] pci_bus 0000:00: resource 4 [io 0x0000-0x0cf7] [ 9.371393] pci_bus 0000:00: resource 5 [io 0x0d00-0xffff] [ 9.371395] pci_bus 0000:00: resource 6 [mem 0x000a0000-0x000bffff] [ 9.371396] pci_bus 0000:00: resource 7 [mem 0xe0000000-0xffdfffff] [ 9.371619] NET: Registered protocol family 2 [ 9.372196] TCP established hash table entries: 32768 (order: 6, 262144 bytes) [ 9.372267] TCP bind hash table entries: 32768 (order: 7, 524288 bytes) [ 9.372334] TCP: Hash tables configured (established 32768 bind 32768) [ 9.372351] TCP: reno registered [ 9.372357] UDP hash table entries: 2048 (order: 4, 65536 bytes) [ 9.372372] UDP-Lite hash table entries: 2048 (order: 4, 65536 bytes) [ 9.372507] NET: Registered protocol family 1 [ 9.372527] pci 0000:00:00.0: Limiting direct PCI/PCI transfers [ 9.372559] pci 0000:00:01.0: Activating ISA DMA hang workarounds [ 9.372585] pci 0000:00:02.0: Video device with shadowed ROM [ 9.374015] PCI: CLS 0 bytes, default 64 [ 9.374087] Unpacking initramfs... [ 9.647919] Freeing initrd memory: 14668K (ffff88003634a000 - ffff88003719d000) [ 9.648004] PCI-DMA: Using software bounce buffering for IO (SWIOTLB) [ 9.648007] software IO TLB [mem 0xdbff0000-0xdfff0000] (64MB) mapped at [ffff8800dbff0000-ffff8800dffeffff] [ 9.648272] platform rtc_cmos: registered platform RTC device (no PNP device found) [ 9.648443] RAPL PMU detected, hw unit 2^-0 Joules, API unit is 2^-32 Joules, 3 fixed counters 10737418240 ms ovfl timer [ 9.648548] microcode: CPU0 sig=0x206a7, pf=0x10, revision=0x0 [ 9.648562] microcode: CPU1 sig=0x206a7, pf=0x10, revision=0x0 [ 9.648612] microcode: Microcode Update Driver: v2.00 , Peter Oruba [ 9.649451] futex hash table entries: 512 (order: 3, 32768 bytes) [ 9.649573] audit: initializing netlink subsys (disabled) [ 9.649598] audit: type=2000 audit(1488395362.069:1): initialized [ 9.650419] HugeTLB registered 2 MB page size, pre-allocated 0 pages [ 9.650441] zbud: loaded [ 9.650973] VFS: Disk quotas dquot_6.5.2 [ 9.651008] Dquot-cache hash table entries: 512 (order 0, 4096 bytes) [ 9.651084] msgmni has been set to 7922 [ 9.651798] alg: No test for stdrng (krng) [ 9.651846] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252) [ 9.651937] io scheduler noop registered [ 9.651941] io scheduler deadline registered [ 9.652016] io scheduler cfq registered (default) [ 9.652115] pci_hotplug: PCI Hot Plug PCI Core version: 0.5 [ 9.652132] pciehp: PCI Express Hot Plug Controller Driver version: 0.4 [ 9.652154] intel_idle: does not run on family 6 model 42 [ 9.652172] GHES: HEST is not enabled! [ 9.652242] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled [ 9.652548] Linux agpgart interface v0.103 [ 9.652677] i8042: PNP: PS/2 Controller [PNP0303:PS2K,PNP0f03:PS2M] at 0x60,0x64 irq 1,12 [ 9.653166] serio: i8042 KBD port at 0x60,0x64 irq 1 [ 9.653171] serio: i8042 AUX port at 0x60,0x64 irq 12 [ 9.653271] mousedev: PS/2 mouse device common for all mice [ 9.653687] input: AT Translated Set 2 keyboard as /devices/platform/i8042/serio0/input/input0 [ 9.653824] rtc_cmos rtc_cmos: rtc core: registered rtc_cmos as rtc0 [ 9.653882] rtc_cmos rtc_cmos: alarms up to one day, 114 bytes nvram [ 9.653896] ledtrig-cpu: registered to indicate activity on CPUs [ 9.653961] AMD IOMMUv2 driver by Joerg Roedel [ 9.653962] AMD IOMMUv2 functionality not available on this system [ 9.654038] TCP: cubic registered [ 9.654234] NET: Registered protocol family 10 [ 9.654554] mip6: Mobile IPv6 [ 9.654558] NET: Registered protocol family 17 [ 9.654564] mpls_gso: MPLS GSO support [ 9.654770] registered taskstats version 1 [ 9.656357] rtc_cmos rtc_cmos: setting system clock to 2017-03-01 19:09:11 UTC (1488395351) [ 9.656427] PM: Hibernation image not present or could not be loaded. [ 9.663167] Freeing unused kernel memory: 1204K (ffffffff818ee000 - ffffffff81a1b000) [ 9.663171] Write protecting the kernel read-only data: 8192k [ 9.663645] Freeing unused kernel memory: 896K (ffff880001520000 - ffff880001600000) [ 9.664120] Freeing unused kernel memory: 212K (ffff8800017cb000 - ffff880001800000) [ 9.677467] systemd-udevd[60]: starting version 215 [ 9.677730] random: systemd-udevd urandom read with 2 bits of entropy available [ 9.698416] ACPI: bus type USB registered [ 9.698445] usbcore: registered new interface driv ''' return returncode, output @staticmethod def lscpu(): returncode = 0 output = r''' Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 2 On-line CPU(s) list: 0,1 Thread(s) per core: 1 Core(s) per socket: 2 Socket(s): 1 NUMA node(s): 1 Vendor ID: GenuineIntel CPU family: 6 Model: 42 Model name: Intel(R) Pentium(R) CPU G640 @ 2.80GHz Stepping: 7 CPU MHz: 2793.652 BogoMIPS: 5587.30 Hypervisor vendor: KVM Virtualization type: full L1d cache: 32K L1i cache: 32K L2 cache: 256K L3 cache: 3072K NUMA node0 CPU(s): 0,1 ''' return returncode, output class TestLinuxFedora_24_X86_64(unittest.TestCase): def setUp(self): helpers.backup_data_source(cpuinfo) helpers.monkey_patch_data_source(cpuinfo, MockDataSource) def tearDown(self): helpers.restore_data_source(cpuinfo) ''' Make sure calls return the expected number of fields. ''' def test_returns(self): self.assertEqual(0, len(cpuinfo._get_cpu_info_from_registry())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpufreq_info())) self.assertEqual(13, len(cpuinfo._get_cpu_info_from_lscpu())) self.assertEqual(11, len(cpuinfo._get_cpu_info_from_proc_cpuinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysctl())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_kstat())) self.assertEqual(8, len(cpuinfo._get_cpu_info_from_dmesg())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cat_var_run_dmesg_boot())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_ibm_pa_features())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpuid())) self.assertEqual(21, len(cpuinfo._get_cpu_info_internal())) def test_get_cpu_info_from_lscpu(self): info = cpuinfo._get_cpu_info_from_lscpu() self.assertEqual('GenuineIntel', info['vendor_id_raw']) self.assertEqual('Intel(R) Pentium(R) CPU G640 @ 2.80GHz', info['brand_raw']) self.assertEqual('2.7937 GHz', info['hz_advertised_friendly']) self.assertEqual('2.7937 GHz', info['hz_actual_friendly']) self.assertEqual((2793652000, 0), info['hz_advertised']) self.assertEqual((2793652000, 0), info['hz_actual']) self.assertEqual(7, info['stepping']) self.assertEqual(42, info['model']) self.assertEqual(6, info['family']) self.assertEqual(32 * 1024, info['l1_instruction_cache_size']) self.assertEqual(32 * 1024, info['l1_data_cache_size']) self.assertEqual(256 * 1024, info['l2_cache_size']) self.assertEqual(3072 * 1024, info['l3_cache_size']) def test_get_cpu_info_from_dmesg(self): info = cpuinfo._get_cpu_info_from_dmesg() self.assertEqual('Intel(R) Pentium(R) CPU G640 @ 2.80GHz', info['brand_raw']) self.assertEqual('2.8000 GHz', info['hz_advertised_friendly']) self.assertEqual('2.8000 GHz', info['hz_actual_friendly']) self.assertEqual((2800000000, 0), info['hz_advertised']) self.assertEqual((2800000000, 0), info['hz_actual']) self.assertEqual(7, info['stepping']) self.assertEqual(42, info['model']) self.assertEqual(6, info['family']) def test_get_cpu_info_from_proc_cpuinfo(self): info = cpuinfo._get_cpu_info_from_proc_cpuinfo() self.assertEqual('GenuineIntel', info['vendor_id_raw']) self.assertEqual('Intel(R) Pentium(R) CPU G640 @ 2.80GHz', info['brand_raw']) self.assertEqual('2.8000 GHz', info['hz_advertised_friendly']) self.assertEqual('2.7937 GHz', info['hz_actual_friendly']) self.assertEqual((2800000000, 0), info['hz_advertised']) self.assertEqual((2793652000, 0), info['hz_actual']) self.assertEqual(3072 * 1024, info['l3_cache_size']) self.assertEqual(7, info['stepping']) self.assertEqual(42, info['model']) self.assertEqual(6, info['family']) self.assertEqual( ['apic', 'clflush', 'cmov', 'constant_tsc', 'cx16', 'cx8', 'de', 'fpu', 'fxsr', 'ht', 'hypervisor', 'lahf_lm', 'lm', 'mca', 'mce', 'mmx', 'msr', 'mtrr', 'nonstop_tsc', 'nopl', 'nx', 'pae', 'pat', 'pclmulqdq', 'pge', 'pni', 'popcnt', 'pse', 'pse36', 'rdtscp', 'rep_good', 'sep', 'sse', 'sse2', 'sse4_1', 'sse4_2', 'ssse3', 'syscall', 'tsc', 'vme', 'xsave', 'xtopology'] , info['flags'] ) def test_all(self): info = cpuinfo._get_cpu_info_internal() self.assertEqual('GenuineIntel', info['vendor_id_raw']) self.assertEqual('Intel(R) Pentium(R) CPU G640 @ 2.80GHz', info['brand_raw']) self.assertEqual('2.8000 GHz', info['hz_advertised_friendly']) self.assertEqual('2.7937 GHz', info['hz_actual_friendly']) self.assertEqual((2800000000, 0), info['hz_advertised']) self.assertEqual((2793652000, 0), info['hz_actual']) self.assertEqual('X86_64', info['arch']) self.assertEqual(64, info['bits']) self.assertEqual(2, info['count']) self.assertEqual('x86_64', info['arch_string_raw']) self.assertEqual(32 * 1024, info['l1_instruction_cache_size']) self.assertEqual(32 * 1024, info['l1_data_cache_size']) self.assertEqual(256 * 1024, info['l2_cache_size']) self.assertEqual(3072 * 1024, info['l3_cache_size']) self.assertEqual(7, info['stepping']) self.assertEqual(42, info['model']) self.assertEqual(6, info['family']) self.assertEqual( ['apic', 'clflush', 'cmov', 'constant_tsc', 'cx16', 'cx8', 'de', 'fpu', 'fxsr', 'ht', 'hypervisor', 'lahf_lm', 'lm', 'mca', 'mce', 'mmx', 'msr', 'mtrr', 'nonstop_tsc', 'nopl', 'nx', 'pae', 'pat', 'pclmulqdq', 'pge', 'pni', 'popcnt', 'pse', 'pse36', 'rdtscp', 'rep_good', 'sep', 'sse', 'sse2', 'sse4_1', 'sse4_2', 'ssse3', 'syscall', 'tsc', 'vme', 'xsave', 'xtopology'] , info['flags'] ) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/tests/test_linux_fedora_29_x86_64_ryzen_7.py0000664000175000017500000005761214325641176022632 0ustar00mattmatt import unittest from cpuinfo import * import helpers class MockDataSource(object): bits = '64bit' cpu_count = 8 is_windows = False arch_string_raw = 'x86_64' uname_string_raw = 'x86_64' can_cpuid = False @staticmethod def has_proc_cpuinfo(): return True @staticmethod def has_lscpu(): return True @staticmethod def has_sestatus(): return True @staticmethod def cat_proc_cpuinfo(): returncode = 0 output = r''' processor : 0 vendor_id : AuthenticAMD cpu family : 23 model : 8 model name : AMD Ryzen 7 2700X Eight-Core Processor stepping : 2 microcode : 0x6000626 cpu MHz : 3693.060 cache size : 512 KB physical id : 0 siblings : 8 core id : 0 cpu cores : 8 apicid : 0 initial apicid : 0 fpu : yes fpu_exception : yes cpuid level : 13 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid tsc_known_freq pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx rdrand hypervisor lahf_lm cmp_legacy cr8_legacy abm sse4a misalignsse 3dnowprefetch cpb ssbd vmmcall fsgsbase avx2 rdseed clflushopt arat bugs : fxsave_leak sysret_ss_attrs null_seg spectre_v1 spectre_v2 spec_store_bypass bogomips : 7386.12 TLB size : 2560 4K pages clflush size : 64 cache_alignment : 64 address sizes : 48 bits physical, 48 bits virtual power management: ''' return returncode, output @staticmethod def lscpu(): returncode = 0 output = r''' Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 8 On-line CPU(s) list: 0-7 Thread(s) per core: 1 Core(s) per socket: 8 Socket(s): 1 NUMA node(s): 1 Vendor ID: AuthenticAMD CPU family: 23 Model: 8 Model name: AMD Ryzen 7 2700X Eight-Core Processor Stepping: 2 CPU MHz: 3693.060 BogoMIPS: 7386.12 Hypervisor vendor: KVM Virtualization type: full L1d cache: 32K L1i cache: 64K L2 cache: 512K L3 cache: 16384K NUMA node0 CPU(s): 0-7 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid tsc_known_freq pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx rdrand hypervisor lahf_lm cmp_legacy cr8_legacy abm sse4a misalignsse 3dnowprefetch cpb ssbd vmmcall fsgsbase avx2 rdseed clflushopt arat ''' return returncode, output @staticmethod def sestatus_b(): returncode = 0 output = r''' SELinux status: enabled SELinuxfs mount: /sys/fs/selinux SELinux root directory: /etc/selinux Loaded policy name: targeted Current mode: enforcing Mode from config file: enforcing Policy MLS status: enabled Policy deny_unknown status: allowed Memory protection checking: actual (secure) Max kernel policy version: 31 Policy booleans: abrt_anon_write off abrt_handle_event off abrt_upload_watch_anon_write on antivirus_can_scan_system off antivirus_use_jit off auditadm_exec_content on authlogin_nsswitch_use_ldap off authlogin_radius off authlogin_yubikey off awstats_purge_apache_log_files off boinc_execmem on cdrecord_read_content off cluster_can_network_connect off cluster_manage_all_files off cluster_use_execmem off cobbler_anon_write off cobbler_can_network_connect off cobbler_use_cifs off cobbler_use_nfs off collectd_tcp_network_connect off colord_use_nfs off condor_tcp_network_connect off conman_can_network off conman_use_nfs off cron_can_relabel off cron_system_cronjob_use_shares off cron_userdomain_transition on cups_execmem off cvs_read_shadow off daemons_dump_core off daemons_enable_cluster_mode off daemons_use_tcp_wrapper off daemons_use_tty off dbadm_exec_content on dbadm_manage_user_files off dbadm_read_user_files off deny_execmem off deny_ptrace off dhcpc_exec_iptables off dhcpd_use_ldap off domain_can_mmap_files off domain_can_write_kmsg off domain_fd_use on domain_kernel_load_modules off entropyd_use_audio on exim_can_connect_db off exim_manage_user_files off exim_read_user_files off fcron_crond off fenced_can_network_connect off fenced_can_ssh off fips_mode on ftpd_anon_write off ftpd_connect_all_unreserved off ftpd_connect_db off ftpd_full_access off ftpd_use_cifs off ftpd_use_fusefs off ftpd_use_nfs off ftpd_use_passive_mode off git_cgi_enable_homedirs off git_cgi_use_cifs off git_cgi_use_nfs off git_session_bind_all_unreserved_ports off git_session_users off git_system_enable_homedirs off git_system_use_cifs off git_system_use_nfs off gitosis_can_sendmail off glance_api_can_network off glance_use_execmem off glance_use_fusefs off global_ssp off gluster_anon_write off gluster_export_all_ro off gluster_export_all_rw on gluster_use_execmem off gpg_web_anon_write off gssd_read_tmp on guest_exec_content on haproxy_connect_any off httpd_anon_write off httpd_builtin_scripting on httpd_can_check_spam off httpd_can_connect_ftp off httpd_can_connect_ldap off httpd_can_connect_mythtv off httpd_can_connect_zabbix off httpd_can_network_connect off httpd_can_network_connect_cobbler off httpd_can_network_connect_db off httpd_can_network_memcache off httpd_can_network_relay off httpd_can_sendmail off httpd_dbus_avahi off httpd_dbus_sssd off httpd_dontaudit_search_dirs off httpd_enable_cgi on httpd_enable_ftp_server off httpd_enable_homedirs off httpd_execmem off httpd_graceful_shutdown off httpd_manage_ipa off httpd_mod_auth_ntlm_winbind off httpd_mod_auth_pam off httpd_read_user_content off httpd_run_ipa off httpd_run_preupgrade off httpd_run_stickshift off httpd_serve_cobbler_files off httpd_setrlimit off httpd_ssi_exec off httpd_sys_script_anon_write off httpd_tmp_exec off httpd_tty_comm off httpd_unified off httpd_use_cifs off httpd_use_fusefs off httpd_use_gpg off httpd_use_nfs off httpd_use_openstack off httpd_use_sasl off httpd_verify_dns off icecast_use_any_tcp_ports off irc_use_any_tcp_ports off irssi_use_full_network off kdumpgui_run_bootloader off keepalived_connect_any off kerberos_enabled on ksmtuned_use_cifs off ksmtuned_use_nfs off logadm_exec_content on logging_syslogd_can_sendmail off logging_syslogd_run_nagios_plugins off logging_syslogd_use_tty on login_console_enabled on logrotate_read_inside_containers off logrotate_use_nfs off logwatch_can_network_connect_mail off lsmd_plugin_connect_any off mailman_use_fusefs off mcelog_client off mcelog_exec_scripts on mcelog_foreground off mcelog_server off minidlna_read_generic_user_content off mmap_low_allowed off mock_enable_homedirs off mount_anyfile on mozilla_plugin_bind_unreserved_ports off mozilla_plugin_can_network_connect on mozilla_plugin_use_bluejeans off mozilla_plugin_use_gps off mozilla_plugin_use_spice off mozilla_read_content off mpd_enable_homedirs off mpd_use_cifs off mpd_use_nfs off mplayer_execstack off mysql_connect_any off mysql_connect_http off nagios_run_pnp4nagios off nagios_run_sudo off nagios_use_nfs off named_tcp_bind_http_port off named_write_master_zones off neutron_can_network off nfs_export_all_ro on nfs_export_all_rw on nfsd_anon_write off nis_enabled off nscd_use_shm on openshift_use_nfs off openvpn_can_network_connect on openvpn_enable_homedirs on openvpn_run_unconfined off pcp_bind_all_unreserved_ports off pcp_read_generic_logs off pdns_can_network_connect_db off piranha_lvs_can_network_connect off polipo_connect_all_unreserved off polipo_session_bind_all_unreserved_ports off polipo_session_users off polipo_use_cifs off polipo_use_nfs off polyinstantiation_enabled off postfix_local_write_mail_spool on postgresql_can_rsync off postgresql_selinux_transmit_client_label off postgresql_selinux_unconfined_dbadm on postgresql_selinux_users_ddl on pppd_can_insmod off pppd_for_user off privoxy_connect_any on prosody_bind_http_port off puppetagent_manage_all_files off puppetmaster_use_db off racoon_read_shadow off radius_use_jit off redis_enable_notify off rpcd_use_fusefs off rsync_anon_write off rsync_client off rsync_export_all_ro off rsync_full_access off samba_create_home_dirs off samba_domain_controller off samba_enable_home_dirs off samba_export_all_ro off samba_export_all_rw off samba_load_libgfapi off samba_portmapper off samba_run_unconfined off samba_share_fusefs off samba_share_nfs off sanlock_enable_home_dirs off sanlock_use_fusefs off sanlock_use_nfs off sanlock_use_samba off saslauthd_read_shadow off secadm_exec_content on secure_mode off secure_mode_insmod off secure_mode_policyload off selinuxuser_direct_dri_enabled on selinuxuser_execheap off selinuxuser_execmod on selinuxuser_execstack on selinuxuser_mysql_connect_enabled off selinuxuser_ping on selinuxuser_postgresql_connect_enabled off selinuxuser_rw_noexattrfile on selinuxuser_share_music off selinuxuser_tcp_server off selinuxuser_udp_server off selinuxuser_use_ssh_chroot off sge_domain_can_network_connect off sge_use_nfs off smartmon_3ware off smbd_anon_write off spamassassin_can_network off spamd_enable_home_dirs on spamd_update_can_network off squid_connect_any on squid_use_tproxy off ssh_chroot_rw_homedirs off ssh_keysign off ssh_sysadm_login off ssh_use_tcpd off sslh_can_bind_any_port off sslh_can_connect_any_port off staff_exec_content on staff_use_svirt off swift_can_network off sysadm_exec_content on telepathy_connect_all_ports off telepathy_tcp_connect_generic_network_ports on tftp_anon_write off tftp_home_dir off tmpreaper_use_cifs off tmpreaper_use_nfs off tmpreaper_use_samba off tomcat_can_network_connect_db off tomcat_read_rpm_db off tomcat_use_execmem off tor_bind_all_unreserved_ports off tor_can_network_relay off tor_can_onion_services off unconfined_chrome_sandbox_transition on unconfined_login on unconfined_mozilla_plugin_transition on unprivuser_use_svirt off use_ecryptfs_home_dirs off use_fusefs_home_dirs off use_lpd_server off use_nfs_home_dirs off use_samba_home_dirs off use_virtualbox off user_exec_content on varnishd_connect_any off virt_read_qemu_ga_data off virt_rw_qemu_ga_data off virt_sandbox_share_apache_content off virt_sandbox_use_all_caps on virt_sandbox_use_audit on virt_sandbox_use_fusefs off virt_sandbox_use_mknod off virt_sandbox_use_netlink off virt_sandbox_use_sys_admin off virt_transition_userdomain off virt_use_comm off virt_use_execmem off virt_use_fusefs off virt_use_glusterd off virt_use_nfs off virt_use_pcscd off virt_use_rawip off virt_use_samba off virt_use_sanlock off virt_use_usb on virt_use_xserver off webadm_manage_user_files off webadm_read_user_files off wine_mmap_zero_ignore off xdm_bind_vnc_tcp_port off xdm_exec_bootloader off xdm_sysadm_login off xdm_write_home off xen_use_nfs off xend_run_blktap on xend_run_qemu on xguest_connect_network on xguest_exec_content on xguest_mount_media on xguest_use_bluetooth on xserver_clients_write_xshm off xserver_execmem off xserver_object_manager off zabbix_can_network off zabbix_run_sudo off zarafa_setrlimit off zebra_write_config off zoneminder_anon_write off zoneminder_run_sudo off ''' return returncode, output class Test_Linux_Fedora_29_X86_64_Ryzen_7(unittest.TestCase): def setUp(self): helpers.backup_data_source(cpuinfo) helpers.monkey_patch_data_source(cpuinfo, MockDataSource) def tearDown(self): helpers.restore_data_source(cpuinfo) ''' Make sure calls return the expected number of fields. ''' def test_returns(self): self.assertEqual(0, len(cpuinfo._get_cpu_info_from_registry())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpufreq_info())) self.assertEqual(14, len(cpuinfo._get_cpu_info_from_lscpu())) self.assertEqual(11, len(cpuinfo._get_cpu_info_from_proc_cpuinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysctl())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_kstat())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_dmesg())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cat_var_run_dmesg_boot())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_ibm_pa_features())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpuid())) self.assertEqual(21, len(cpuinfo._get_cpu_info_internal())) def test_get_cpu_info_from_lscpu(self): info = cpuinfo._get_cpu_info_from_lscpu() self.assertEqual('AuthenticAMD', info['vendor_id_raw']) self.assertEqual('AMD Ryzen 7 2700X Eight-Core Processor', info['brand_raw']) self.assertEqual('3.6931 GHz', info['hz_advertised_friendly']) self.assertEqual('3.6931 GHz', info['hz_actual_friendly']) self.assertEqual((3693060000, 0), info['hz_advertised']) self.assertEqual((3693060000, 0), info['hz_actual']) self.assertEqual(2, info['stepping']) self.assertEqual(8, info['model']) self.assertEqual(23, info['family']) self.assertEqual(64 * 1024, info['l1_instruction_cache_size']) self.assertEqual(32 * 1024, info['l1_data_cache_size']) self.assertEqual(512 * 1024, info['l2_cache_size']) self.assertEqual(16384 * 1024, info['l3_cache_size']) self.assertEqual( ['3dnowprefetch', 'abm', 'aes', 'apic', 'arat', 'avx', 'avx2', 'clflush', 'clflushopt', 'cmov', 'cmp_legacy', 'constant_tsc', 'cpb', 'cpuid', 'cr8_legacy', 'cx16', 'cx8', 'de', 'extd_apicid', 'fpu', 'fsgsbase', 'fxsr', 'fxsr_opt', 'ht', 'hypervisor', 'lahf_lm', 'lm', 'mca', 'mce', 'misalignsse', 'mmx', 'mmxext', 'movbe', 'msr', 'mtrr', 'nonstop_tsc', 'nopl', 'nx', 'pae', 'pat', 'pclmulqdq', 'pge', 'pni', 'popcnt', 'pse', 'pse36', 'rdrand', 'rdseed', 'rdtscp', 'rep_good', 'sep', 'ssbd', 'sse', 'sse2', 'sse4_1', 'sse4_2', 'sse4a', 'ssse3', 'syscall', 'tsc', 'tsc_known_freq', 'vme', 'vmmcall', 'x2apic', 'xsave'] , info['flags'] ) def test_get_cpu_info_from_proc_cpuinfo(self): info = cpuinfo._get_cpu_info_from_proc_cpuinfo() self.assertEqual('AuthenticAMD', info['vendor_id_raw']) self.assertEqual('AMD Ryzen 7 2700X Eight-Core Processor', info['brand_raw']) self.assertEqual('3.6931 GHz', info['hz_advertised_friendly']) self.assertEqual('3.6931 GHz', info['hz_actual_friendly']) self.assertEqual((3693060000, 0), info['hz_advertised']) self.assertEqual((3693060000, 0), info['hz_actual']) # FIXME: This is l2 cache size not l3 cache size self.assertEqual(512 * 1024, info['l3_cache_size']) self.assertEqual(2, info['stepping']) self.assertEqual(8, info['model']) self.assertEqual(23, info['family']) self.assertEqual( ['3dnowprefetch', 'abm', 'aes', 'apic', 'arat', 'avx', 'avx2', 'clflush', 'clflushopt', 'cmov', 'cmp_legacy', 'constant_tsc', 'cpb', 'cpuid', 'cr8_legacy', 'cx16', 'cx8', 'de', 'extd_apicid', 'fpu', 'fsgsbase', 'fxsr', 'fxsr_opt', 'ht', 'hypervisor', 'lahf_lm', 'lm', 'mca', 'mce', 'misalignsse', 'mmx', 'mmxext', 'movbe', 'msr', 'mtrr', 'nonstop_tsc', 'nopl', 'nx', 'pae', 'pat', 'pclmulqdq', 'pge', 'pni', 'popcnt', 'pse', 'pse36', 'rdrand', 'rdseed', 'rdtscp', 'rep_good', 'sep', 'ssbd', 'sse', 'sse2', 'sse4_1', 'sse4_2', 'sse4a', 'ssse3', 'syscall', 'tsc', 'tsc_known_freq', 'vme', 'vmmcall', 'x2apic', 'xsave'] , info['flags'] ) def test_all(self): info = cpuinfo._get_cpu_info_internal() self.assertEqual('AuthenticAMD', info['vendor_id_raw']) self.assertEqual('AMD Ryzen 7 2700X Eight-Core Processor', info['brand_raw']) self.assertEqual('3.6931 GHz', info['hz_advertised_friendly']) self.assertEqual('3.6931 GHz', info['hz_actual_friendly']) self.assertEqual((3693060000, 0), info['hz_advertised']) self.assertEqual((3693060000, 0), info['hz_actual']) self.assertEqual('X86_64', info['arch']) self.assertEqual(64, info['bits']) self.assertEqual(8, info['count']) self.assertEqual('x86_64', info['arch_string_raw']) self.assertEqual(64 * 1024, info['l1_instruction_cache_size']) self.assertEqual(32 * 1024, info['l1_data_cache_size']) self.assertEqual(512 * 1024, info['l2_cache_size']) # FIXME: This is l2 cache size not l3 cache size # it is wrong in /proc/cpuinfo self.assertEqual(512 * 1024, info['l3_cache_size']) self.assertEqual(2, info['stepping']) self.assertEqual(8, info['model']) self.assertEqual(23, info['family']) self.assertEqual( ['3dnowprefetch', 'abm', 'aes', 'apic', 'arat', 'avx', 'avx2', 'clflush', 'clflushopt', 'cmov', 'cmp_legacy', 'constant_tsc', 'cpb', 'cpuid', 'cr8_legacy', 'cx16', 'cx8', 'de', 'extd_apicid', 'fpu', 'fsgsbase', 'fxsr', 'fxsr_opt', 'ht', 'hypervisor', 'lahf_lm', 'lm', 'mca', 'mce', 'misalignsse', 'mmx', 'mmxext', 'movbe', 'msr', 'mtrr', 'nonstop_tsc', 'nopl', 'nx', 'pae', 'pat', 'pclmulqdq', 'pge', 'pni', 'popcnt', 'pse', 'pse36', 'rdrand', 'rdseed', 'rdtscp', 'rep_good', 'sep', 'ssbd', 'sse', 'sse2', 'sse4_1', 'sse4_2', 'sse4a', 'ssse3', 'syscall', 'tsc', 'tsc_known_freq', 'vme', 'vmmcall', 'x2apic', 'xsave'] , info['flags'] ) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/tests/test_linux_fedora_5_s390x.py0000664000175000017500000006513514325641176021016 0ustar00mattmatt import unittest from cpuinfo import * import helpers class MockDataSource(object): bits = '64bit' cpu_count = 4 is_windows = False arch_string_raw = 's390x' uname_string_raw = '' can_cpuid = False @staticmethod def has_proc_cpuinfo(): return True @staticmethod def has_dmesg(): return True @staticmethod def has_lscpu(): return True @staticmethod def cat_proc_cpuinfo(): returncode = 0 output = r''' vendor_id : IBM/S390 # processors : 4 bogomips per cpu: 2913.00 max thread id : 0 features : esan3 zarch stfle msa ldisp eimm dfp edat etf3eh highgprs te sie cache0 : level=1 type=Data scope=Private size=96K line_size=256 associativity=6 cache1 : level=1 type=Instruction scope=Private size=64K line_size=256 associativity=4 cache2 : level=2 type=Data scope=Private size=1024K line_size=256 associativity=8 cache3 : level=2 type=Instruction scope=Private size=1024K line_size=256 associativity=8 cache4 : level=3 type=Unified scope=Shared size=49152K line_size=256 associativity=12 cache5 : level=4 type=Unified scope=Shared size=393216K line_size=256 associativity=24 processor 0: version = FF, identification = 14C047, machine = 2827 processor 1: version = FF, identification = 14C047, machine = 2827 processor 2: version = FF, identification = 14C047, machine = 2827 processor 3: version = FF, identification = 14C047, machine = 2827 cpu number : 0 cpu MHz dynamic : 5504 cpu MHz static : 5504 cpu number : 1 cpu MHz dynamic : 5504 cpu MHz static : 5504 cpu number : 2 cpu MHz dynamic : 5504 cpu MHz static : 5504 cpu number : 3 cpu MHz dynamic : 5504 cpu MHz static : 5504 ''' return returncode, output @staticmethod def lscpu(): returncode = 0 output = r''' Architecture: s390x CPU op-mode(s): 32-bit, 64-bit Byte Order: Big Endian CPU(s): 4 On-line CPU(s) list: 0-3 Thread(s) per core: 1 Core(s) per socket: 1 Socket(s) per book: 1 Book(s) per drawer: 1 Drawer(s): 4 Vendor ID: IBM/S390 Machine type: 2827 CPU dynamic MHz: 5504 CPU static MHz: 5504 BogoMIPS: 2913.00 Hypervisor: z/VM 5.4.0 Hypervisor vendor: IBM Virtualization type: full Dispatching mode: horizontal L1d cache: 96K L1i cache: 64K L2d cache: 1024K L2i cache: 1024K L3 cache: 49152K L4 cache: 393216K Flags: esan3 zarch stfle msa ldisp eimm dfp etf3eh highgprs sie ''' return returncode, output @staticmethod def dmesg_a(): returncode = 0 output = r''' [623985.026158] 000003ffda1f9118 00e1526ff184ab35 00000000800008a0 000003ffda1f90f0 [623985.026161] 0000000080000740 0000000000000000 000002aa4b1cf0a0 000003ffaa476f30 [623985.026165] 000003ffaa428f58 000002aa4b1bf6b0 000003ffa9e22b9e 000003ffda1f8ee0 [623985.026175] User Code: 0000000080000828: c0f4ffffffc0 brcl 15,800007a8 [623985.026175] 000000008000082e: 0707 bcr 0,%r7 [623985.026175] #0000000080000830: a7f40001 brc 15,80000832 [623985.026175] >0000000080000834: 0707 bcr 0,%r7 [623985.026175] 0000000080000836: 0707 bcr 0,%r7 [623985.026175] 0000000080000838: eb7ff0380024 stmg %r7,%r15,56(%r15) [623985.026175] 000000008000083e: e3f0ff60ff71 lay %r15,-160(%r15) [623985.026175] 0000000080000844: b9040092 lgr %r9,%r2 [623985.026211] Last Breaking-Event-Address: [623985.026214] [<0000000080000830>] 0x80000830 [624418.306980] User process fault: interruption code 0038 ilc:3 in libstdc++.so.6.0.23[3ff9d000000+1b9000] [624418.306992] Failing address: 46726f6200005000 TEID: 46726f6200005800 [624418.306994] Fault in primary space mode while using user ASCE. [624418.306997] AS:0000000081d081c7 R3:0000000000000024 [624418.307003] CPU: 3 PID: 56744 Comm: try-catch-2.exe Not tainted 4.8.15-300.fc25.s390x #1 [624418.307005] Hardware name: IBM 2827 H43 400 (z/VM) [624418.307009] task: 00000000f74c1c80 task.stack: 00000000ab6f0000 [624418.307012] User PSW : 0705000180000000 000003ff9d0a7f58 [624418.307016] R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:1 AS:0 CC:0 PM:0 RI:0 EA:3 [624418.307016] User GPRS: 0000000000000000 46726f6200005465 0000000080003528 000003ff9d1bba00 [624418.307024] 000003fff8278e88 000003fff8278dc0 000000008000187a fffffffffffffffd [624418.307028] 000003ff00000000 000003fff8278e88 0000000080003528 000003ff9d1bba00 [624418.307032] 0000000080003428 000003ff9d172658 000003ff9d0a7f32 000003fff8278d20 [624418.307050] User Code: 000003ff9d0a7f4a: e310a0000004 lg %r1,0(%r10) [624418.307050] 000003ff9d0a7f50: b904003b lgr %r3,%r11 [624418.307050] #000003ff9d0a7f54: b904002a lgr %r2,%r10 [624418.307050] >000003ff9d0a7f58: e31010200004 lg %r1,32(%r1) [624418.307050] 000003ff9d0a7f5e: a7590001 lghi %r5,1 [624418.307050] 000003ff9d0a7f62: 4140f0a0 la %r4,160(%r15) [624418.307050] 000003ff9d0a7f66: 0de1 basr %r14,%r1 [624418.307050] 000003ff9d0a7f68: ec280009007c cgij %r2,0,8,3ff9d0a7f7a [624418.307061] Last Breaking-Event-Address: [624418.307065] [<000003ff9d0a7f32>] 0x3ff9d0a7f32 [624418.806616] User process fault: interruption code 0038 ilc:3 in libstdc++.so.6.0.23[3ffac780000+1b9000] [624418.806627] Failing address: 5465737473756000 TEID: 5465737473756800 [624418.806629] Fault in primary space mode while using user ASCE. [624418.806633] AS:00000000a44441c7 R3:0000000000000024 [624418.806638] CPU: 3 PID: 56971 Comm: try-catch-9.exe Not tainted 4.8.15-300.fc25.s390x #1 [624418.806641] Hardware name: IBM 2827 H43 400 (z/VM) [624418.806644] task: 0000000001a9b900 task.stack: 0000000082968000 [624418.806647] User PSW : 0705000180000000 000003ffac827f58 [624418.806650] R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:1 AS:0 CC:0 PM:0 RI:0 EA:3 [624418.806650] User GPRS: 0000000000000000 5465737473756974 00000000800032a4 000003ffac93ba00 [624418.806658] 000003ffdd4f8bb0 000003ffdd4f8ae8 0000000080001338 0000000000000000 [624418.806662] 000003ff00000000 000003ffdd4f8bb0 00000000800032a4 000003ffac93ba00 [624418.806666] 0000000087919e90 000003ffac8f2658 000003ffac827f32 000003ffdd4f8a48 [624418.806683] User Code: 000003ffac827f4a: e310a0000004 lg %r1,0(%r10) [624418.806683] 000003ffac827f50: b904003b lgr %r3,%r11 [624418.806683] #000003ffac827f54: b904002a lgr %r2,%r10 [624418.806683] >000003ffac827f58: e31010200004 lg %r1,32(%r1) [624418.806683] 000003ffac827f5e: a7590001 lghi %r5,1 [624418.806683] 000003ffac827f62: 4140f0a0 la %r4,160(%r15) [624418.806683] 000003ffac827f66: 0de1 basr %r14,%r1 [624418.806683] 000003ffac827f68: ec280009007c cgij %r2,0,8,3ffac827f7a [624418.806694] Last Breaking-Event-Address: [624418.806697] [<000003ffac827f32>] 0x3ffac827f32 [624457.542811] User process fault: interruption code 0038 ilc:3 in libstdc++.so.6.0.23[3ffbc080000+1b9000] [624457.542823] Failing address: 46726f6200005000 TEID: 46726f6200005800 [624457.542825] Fault in primary space mode while using user ASCE. [624457.542829] AS:0000000002e701c7 R3:0000000000000024 [624457.542834] CPU: 2 PID: 6763 Comm: try-catch-2.exe Not tainted 4.8.15-300.fc25.s390x #1 [624457.542837] Hardware name: IBM 2827 H43 400 (z/VM) [624457.542840] task: 00000000f7aa0000 task.stack: 0000000003530000 [624457.542844] User PSW : 0705000180000000 000003ffbc127f58 [624457.542847] R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:1 AS:0 CC:0 PM:0 RI:0 EA:3 [624457.542847] User GPRS: 0000000000000000 46726f6200005465 0000000080003528 000003ffbc23ba00 [624457.542856] 000003ffc14f8dd8 000003ffc14f8d10 000000008000187a fffffffffffffffd [624457.542859] 000003ff00000000 000003ffc14f8dd8 0000000080003528 000003ffbc23ba00 [624457.542863] 0000000080003428 000003ffbc1f2658 000003ffbc127f32 000003ffc14f8c70 [624457.542882] User Code: 000003ffbc127f4a: e310a0000004 lg %r1,0(%r10) [624457.542882] 000003ffbc127f50: b904003b lgr %r3,%r11 [624457.542882] #000003ffbc127f54: b904002a lgr %r2,%r10 [624457.542882] >000003ffbc127f58: e31010200004 lg %r1,32(%r1) [624457.542882] 000003ffbc127f5e: a7590001 lghi %r5,1 [624457.542882] 000003ffbc127f62: 4140f0a0 la %r4,160(%r15) [624457.542882] 000003ffbc127f66: 0de1 basr %r14,%r1 [624457.542882] 000003ffbc127f68: ec280009007c cgij %r2,0,8,3ffbc127f7a [624457.542893] Last Breaking-Event-Address: [624457.542896] [<000003ffbc127f32>] 0x3ffbc127f32 [624458.013783] User process fault: interruption code 0038 ilc:3 in libstdc++.so.6.0.23[3ff94f00000+1b9000] [624458.013795] Failing address: 5465737473756000 TEID: 5465737473756800 [624458.013797] Fault in primary space mode while using user ASCE. [624458.013801] AS:0000000004be41c7 R3:0000000000000024 [624458.013806] CPU: 1 PID: 6896 Comm: try-catch-9.exe Not tainted 4.8.15-300.fc25.s390x #1 [624458.013809] Hardware name: IBM 2827 H43 400 (z/VM) [624458.013812] task: 00000000f5b4b900 task.stack: 00000000061f4000 [624458.013815] User PSW : 0705000180000000 000003ff94fa7f58 [624458.013818] R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:1 AS:0 CC:0 PM:0 RI:0 EA:3 [624458.013818] User GPRS: 0000000000000000 5465737473756974 00000000800032a4 000003ff950bba00 [624458.013826] 000003ffd0df96f0 000003ffd0df9628 0000000080001338 0000000000000000 [624458.013830] 000003ff00000000 000003ffd0df96f0 00000000800032a4 000003ff950bba00 [624458.013834] 00000000a19d4e90 000003ff95072658 000003ff94fa7f32 000003ffd0df9588 [624458.013852] User Code: 000003ff94fa7f4a: e310a0000004 lg %r1,0(%r10) [624458.013852] 000003ff94fa7f50: b904003b lgr %r3,%r11 [624458.013852] #000003ff94fa7f54: b904002a lgr %r2,%r10 [624458.013852] >000003ff94fa7f58: e31010200004 lg %r1,32(%r1) [624458.013852] 000003ff94fa7f5e: a7590001 lghi %r5,1 [624458.013852] 000003ff94fa7f62: 4140f0a0 la %r4,160(%r15) [624458.013852] 000003ff94fa7f66: 0de1 basr %r14,%r1 [624458.013852] 000003ff94fa7f68: ec280009007c cgij %r2,0,8,3ff94fa7f7a [624458.013863] Last Breaking-Event-Address: [624458.013866] [<000003ff94fa7f32>] 0x3ff94fa7f32 [682281.933336] User process fault: interruption code 003b ilc:3 in cmsysTestProcess[2aa16200000+9000] [682281.933347] Failing address: 0000000000000000 TEID: 0000000000000400 [682281.933349] Fault in primary space mode while using user ASCE. [682281.933353] AS:00000000829e01c7 R3:0000000000000024 [682281.933358] CPU: 0 PID: 29755 Comm: cmsysTestProces Not tainted 4.8.15-300.fc25.s390x #1 [682281.933362] Hardware name: IBM 2827 H43 400 (z/VM) [682281.933365] task: 00000000f5f13900 task.stack: 00000000c2610000 [682281.933368] User PSW : 0705000180000000 000002aa162027a2 [682281.933371] R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:1 AS:0 CC:0 PM:0 RI:0 EA:3 [682281.933371] User GPRS: 0000000000000000 000003ff00000000 0000000000000000 0000000000000001 [682281.933380] 000000000000002e 000003ff7f848c88 000002aa16207430 000003ffe33ff0a0 [682281.933383] 000002aa1620769e 0000000000000000 000003ff7f848d70 000003ff7f848d68 [682281.933388] 000003ff7f928f58 000002aa16207df0 000002aa16202794 000003ffe33feb68 [682281.934367] User Code: 000002aa16202794: e350a0000004 lg %r5,0(%r10) [682281.934367] 000002aa1620279a: a749002e lghi %r4,46 [682281.934367] #000002aa1620279e: a7390001 lghi %r3,1 [682281.934367] >000002aa162027a2: e54c00040000 mvhi 4,0 [682281.934367] 000002aa162027a8: c02000002867 larl %r2,2aa16207876 [682281.934367] 000002aa162027ae: c0e5fffffabd brasl %r14,2aa16201d28 [682281.934367] 000002aa162027b4: e350b0000004 lg %r5,0(%r11) [682281.934367] 000002aa162027ba: a749002e lghi %r4,46 [682281.934379] Last Breaking-Event-Address: [682281.934382] [<000003ff7f6fccb8>] 0x3ff7f6fccb8 [682281.935888] User process fault: interruption code 003b ilc:3 in cmsysTestProcess[2aa36500000+9000] [682281.935896] Failing address: 0000000000000000 TEID: 0000000000000400 [682281.935900] Fault in primary space mode while using user ASCE. [682281.935910] AS:00000000ab3f01c7 R3:0000000000000024 [682281.935917] CPU: 0 PID: 29759 Comm: cmsysTestProces Not tainted 4.8.15-300.fc25.s390x #1 [682281.935940] Hardware name: IBM 2827 H43 400 (z/VM) [682281.935941] task: 0000000083025580 task.stack: 00000000bebf4000 [682281.935942] User PSW : 0705000180000000 000002aa365027a2 [682281.935943] R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:1 AS:0 CC:0 PM:0 RI:0 EA:3 [682281.935943] User GPRS: 0000000000000000 000003ff00000000 0000000000000000 0000000000000001 [682281.935946] 000000000000002e 000003ff9ce48c88 000002aa36507430 000003ffd60febe0 [682281.935947] 000002aa3650769e 0000000000000000 000003ff9ce48d70 000003ff9ce48d68 [682281.935948] 000003ff9cf28f58 000002aa36507df0 000002aa36502794 000003ffd60fe6a8 [682281.935954] User Code: 000002aa36502794: e350a0000004 lg %r5,0(%r10) [682281.935954] 000002aa3650279a: a749002e lghi %r4,46 [682281.935954] #000002aa3650279e: a7390001 lghi %r3,1 [682281.935954] >000002aa365027a2: e54c00040000 mvhi 4,0 [682281.935954] 000002aa365027a8: c02000002867 larl %r2,2aa36507876 [682281.935954] 000002aa365027ae: c0e5fffffabd brasl %r14,2aa36501d28 [682281.935954] 000002aa365027b4: e350b0000004 lg %r5,0(%r11) [682281.935954] 000002aa365027ba: a749002e lghi %r4,46 [682281.935964] Last Breaking-Event-Address: [682281.935965] [<000003ff9ccfccb8>] 0x3ff9ccfccb8 [682695.568959] User process fault: interruption code 0010 ilc:3 in Crash[1000000+1000] [682695.568971] Failing address: 0000000000000000 TEID: 0000000000000400 [682695.568973] Fault in primary space mode while using user ASCE. [682695.568977] AS:00000000549a41c7 R3:000000006654c007 S:0000000000000020 [682695.568983] CPU: 0 PID: 6485 Comm: Crash Not tainted 4.8.15-300.fc25.s390x #1 [682695.568986] Hardware name: IBM 2827 H43 400 (z/VM) [682695.568989] task: 00000000f81fb900 task.stack: 0000000004058000 [682695.568992] User PSW : 0705100180000000 0000000001000776 [682695.568995] R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:1 AS:0 CC:1 PM:0 RI:0 EA:3 [682695.568995] User GPRS: 0000000000000000 0000000000000000 0000000000000001 000003ffd4cfe438 [682695.569003] 000003ffd4cfe448 0090305969303276 0000000001000800 000003ffd4cfe420 [682695.569007] 0000000001000668 0000000000000000 000002aa3e31b1f0 000003ffd4cfe168 [682695.569011] 000003ff91328f58 000002aa3e3251f0 000003ff90d22b9e 000003ffd4cfe168 [682695.572673] User Code: 0000000001000766: b90400bf lgr %r11,%r15 [682695.572673] 000000000100076a: e548b0a00000 mvghi 160(%r11),0 [682695.572673] #0000000001000770: e310b0a00004 lg %r1,160(%r11) [682695.572673] >0000000001000776: e54c10000001 mvhi 0(%r1),1 [682695.572673] 000000000100077c: a7180000 lhi %r1,0 [682695.572673] 0000000001000780: b9140011 lgfr %r1,%r1 [682695.572673] 0000000001000784: b9040021 lgr %r2,%r1 [682695.572673] 0000000001000788: b3cd00b2 lgdr %r11,%f2 [682695.572686] Last Breaking-Event-Address: [682695.572690] [<000003ff90d22b9c>] 0x3ff90d22b9c [699521.918071] User process fault: interruption code 0004 ilc:3 in conftest[1000000+c5000] [699521.918083] Failing address: 00000000010c6000 TEID: 00000000010c6404 [699521.918085] Fault in primary space mode while using user ASCE. [699521.918089] AS:00000000a80d41c7 R3:00000000a462c007 S:000000008267e000 P:00000000918ff21d [699521.918095] CPU: 2 PID: 42951 Comm: conftest Not tainted 4.8.15-300.fc25.s390x #1 [699521.918098] Hardware name: IBM 2827 H43 400 (z/VM) [699521.918101] task: 00000000f4a41c80 task.stack: 0000000082ff0000 [699521.918104] User PSW : 0705000180000000 000000000100de62 [699521.918107] R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:1 AS:0 CC:0 PM:0 RI:0 EA:3 [699521.918107] User GPRS: fffffffffffffff0 0000000000000000 000003ffde67c020 0000000000000001 [699521.918116] 000003ffde67c0d8 000000000100e590 000000000100e638 000003ffde67c0c0 [699521.918120] 000000000100dca8 000002aa3f932170 0000000000000000 000002aa3f9d0e10 [699521.918124] 000000000100e590 000002aa3f9d1010 000000000100dce6 000003ffde67beb0 [699521.918140] User Code: 000000000100de54: a71affff ahi %r1,-1 [699521.918140] 000000000100de58: 8810001f srl %r1,31 [699521.918140] #000000000100de5c: c41f0005d5a6 strl %r1,10c89a8 [699521.918140] >000000000100de62: c42b0005c7ff stgrl %r2,10c6e60 [699521.918140] 000000000100de68: e310f0a00004 lg %r1,160(%r15) [699521.918140] 000000000100de6e: ec21000100d9 aghik %r2,%r1,1 [699521.918140] 000000000100de74: eb220003000d sllg %r2,%r2,3 [699521.918140] 000000000100de7a: e320f0a80008 ag %r2,168(%r15) [699521.918152] Last Breaking-Event-Address: [699521.918155] [<000000000100dce0>] 0x100dce0 [701836.544344] User process fault: interruption code 0004 ilc:3 in conftest[1000000+c5000] [701836.544354] Failing address: 00000000010c6000 TEID: 00000000010c6404 [701836.544357] Fault in primary space mode while using user ASCE. [701836.544360] AS:00000000ef6401c7 R3:00000000b52c0007 S:00000000a9721000 P:00000000ce7c021d [701836.544367] CPU: 3 PID: 48640 Comm: conftest Not tainted 4.8.15-300.fc25.s390x #1 [701836.544370] Hardware name: IBM 2827 H43 400 (z/VM) [701836.544374] task: 00000000f5b4b900 task.stack: 000000008287c000 [701836.544377] User PSW : 0705000180000000 000000000100de62 [701836.544380] R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:1 AS:0 CC:0 PM:0 RI:0 EA:3 [701836.544380] User GPRS: fffffffffffffff0 0000000000000000 000003ffeaf7bfa0 0000000000000001 [701836.544389] 000003ffeaf7c058 000000000100e590 000000000100e638 000003ffeaf7c040 [701836.544393] 000000000100dca8 000002aa48a418c0 0000000000000000 000002aa48a4b240 [701836.544397] 000000000100e590 000002aa48a52730 000000000100dce6 000003ffeaf7be30 [701836.544414] User Code: 000000000100de54: a71affff ahi %r1,-1 [701836.544414] 000000000100de58: 8810001f srl %r1,31 [701836.544414] #000000000100de5c: c41f0005d5a6 strl %r1,10c89a8 [701836.544414] >000000000100de62: c42b0005c7ff stgrl %r2,10c6e60 [701836.544414] 000000000100de68: e310f0a00004 lg %r1,160(%r15) [701836.544414] 000000000100de6e: ec21000100d9 aghik %r2,%r1,1 [701836.544414] 000000000100de74: eb220003000d sllg %r2,%r2,3 [701836.544414] 000000000100de7a: e320f0a80008 ag %r2,168(%r15) [701836.544427] Last Breaking-Event-Address: [701836.544429] [<000000000100dce0>] 0x100dce0 [702856.049112] User process fault: interruption code 0004 ilc:3 in conftest[1000000+c5000] [702856.049125] Failing address: 00000000010c6000 TEID: 00000000010c6404 [702856.049127] Fault in primary space mode while using user ASCE. [702856.049131] AS:00000000801581c7 R3:00000000a7da4007 S:00000000802e9000 P:00000000a540621d [702856.049138] CPU: 2 PID: 53342 Comm: conftest Not tainted 4.8.15-300.fc25.s390x #1 [702856.049141] Hardware name: IBM 2827 H43 400 (z/VM) [702856.049144] task: 00000000f5b49c80 task.stack: 00000000f3f70000 [702856.049147] User PSW : 0705000180000000 000000000100de62 [702856.049151] R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:1 AS:0 CC:0 PM:0 RI:0 EA:3 [702856.049151] User GPRS: fffffffffffffff0 0000000000000000 000003fff267b9b0 0000000000000001 [702856.049160] 000003fff267ba68 000000000100e590 000000000100e638 000003fff267ba50 [702856.049163] 000000000100dca8 000002aa1fc0f9b0 0000000000000000 000002aa1fced3e0 [702856.049168] 000000000100e590 000002aa1fceda20 000000000100dce6 000003fff267b840 [702856.049188] User Code: 000000000100de54: a71affff ahi %r1,-1 [702856.049188] 000000000100de58: 8810001f srl %r1,31 [702856.049188] #000000000100de5c: c41f0005d5a6 strl %r1,10c89a8 [702856.049188] >000000000100de62: c42b0005c7ff stgrl %r2,10c6e60 [702856.049188] 000000000100de68: e310f0a00004 lg %r1,160(%r15) [702856.049188] 000000000100de6e: ec21000100d9 aghik %r2,%r1,1 [702856.049188] 000000000100de74: eb220003000d sllg %r2,%r2,3 [702856.049188] 000000000100de7a: e320f0a80008 ag %r2,168(%r15) [702856.049200] Last Breaking-Event-Address: [702856.049203] [<000000000100dce0>] 0x100dce0 [703009.939101] User process fault: interruption code 0004 ilc:3 in conftest[1000000+c5000] [703009.939113] Failing address: 00000000010c6000 TEID: 00000000010c6404 [703009.939116] Fault in primary space mode while using user ASCE. [703009.939119] AS:0000000000dd41c7 R3:00000000014e8007 S:0000000000ea3000 P:00000000405c321d [703009.939126] CPU: 0 PID: 47870 Comm: conftest Not tainted 4.8.15-300.fc25.s390x #1 [703009.939129] Hardware name: IBM 2827 H43 400 (z/VM) [703009.939132] task: 0000000005645580 task.stack: 000000000c554000 [703009.939135] User PSW : 0705000180000000 000000000100de62 [703009.939139] R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:1 AS:0 CC:0 PM:0 RI:0 EA:3 [703009.939139] User GPRS: fffffffffffffff0 0000000000000000 000003fff327c090 0000000000000001 [703009.939147] 000003fff327c148 000000000100e590 000000000100e638 000003fff327c130 [703009.939151] 000000000100dca8 000002aa309f3570 0000000000000000 000002aa309ee380 [703009.939155] 000000000100e590 000002aa30a96c80 000000000100dce6 000003fff327bf20 [703009.939894] User Code: 000000000100de54: a71affff ahi %r1,-1 [703009.939894] 000000000100de58: 8810001f srl %r1,31 [703009.939894] #000000000100de5c: c41f0005d5a6 strl %r1,10c89a8 [703009.939894] >000000000100de62: c42b0005c7ff stgrl %r2,10c6e60 [703009.939894] 000000000100de68: e310f0a00004 lg %r1,160(%r15) [703009.939894] 000000000100de6e: ec21000100d9 aghik %r2,%r1,1 [703009.939894] 000000000100de74: eb220003000d sllg %r2,%r2,3 [703009.939894] 000000000100de7a: e320f0a80008 ag %r2,168(%r15) [703009.939931] Last Breaking-Event-Address: [703009.939936] [<000000000100dce0>] 0x100dce0 [703026.481842] User process fault: interruption code 0004 ilc:3 in conftest[1000000+c5000] [703026.481852] Failing address: 00000000010c6000 TEID: 00000000010c6404 [703026.481854] ''' return returncode, output class TestLinuxFedora_5_s390x(unittest.TestCase): def setUp(self): helpers.backup_data_source(cpuinfo) helpers.monkey_patch_data_source(cpuinfo, MockDataSource) def tearDown(self): helpers.restore_data_source(cpuinfo) ''' Make sure calls return the expected number of fields. ''' def test_returns(self): self.assertEqual(0, len(cpuinfo._get_cpu_info_from_registry())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpufreq_info())) self.assertEqual(10, len(cpuinfo._get_cpu_info_from_lscpu())) self.assertEqual(7, len(cpuinfo._get_cpu_info_from_proc_cpuinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysctl())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_kstat())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_dmesg())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cat_var_run_dmesg_boot())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_ibm_pa_features())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpuid())) self.assertEqual(17, len(cpuinfo._get_cpu_info_internal())) def test_get_cpu_info_from_lscpu(self): info = cpuinfo._get_cpu_info_from_lscpu() self.assertEqual('IBM/S390', info['vendor_id_raw']) #self.assertEqual('FIXME', info['brand']) self.assertEqual('5.5040 GHz', info['hz_advertised_friendly']) self.assertEqual('5.5040 GHz', info['hz_actual_friendly']) self.assertEqual((5504000000, 0), info['hz_advertised']) self.assertEqual((5504000000, 0), info['hz_actual']) #self.assertEqual(7, info['stepping']) #self.assertEqual(42, info['model']) #self.assertEqual(6, info['family']) self.assertEqual(64 * 1024, info['l1_instruction_cache_size']) self.assertEqual(96 * 1024, info['l1_data_cache_size']) self.assertEqual(1024 * 1024, info['l2_cache_size']) self.assertEqual(49152 * 1024, info['l3_cache_size']) self.assertEqual( ['dfp', 'eimm', 'esan3', 'etf3eh', 'highgprs', 'ldisp', 'msa', 'sie', 'stfle', 'zarch'] , info['flags'] ) def test_get_cpu_info_from_dmesg(self): info = cpuinfo._get_cpu_info_from_dmesg() #self.assertEqual('FIXME', info['brand']) def test_get_cpu_info_from_proc_cpuinfo(self): info = cpuinfo._get_cpu_info_from_proc_cpuinfo() self.assertEqual('IBM/S390', info['vendor_id_raw']) #self.assertEqual('FIXME', info['brand']) self.assertEqual('5.5040 GHz', info['hz_advertised_friendly']) self.assertEqual('5.5040 GHz', info['hz_actual_friendly']) self.assertEqual((5504000000, 0), info['hz_advertised']) self.assertEqual((5504000000, 0), info['hz_actual']) self.assertEqual(49152 * 1024, info['l3_cache_size']) #self.assertEqual(7, info['stepping']) #self.assertEqual(42, info['model']) #self.assertEqual(6, info['family']) self.assertEqual( ['dfp', 'edat', 'eimm', 'esan3', 'etf3eh', 'highgprs', 'ldisp', 'msa', 'sie', 'stfle', 'te', 'zarch'] , info['flags'] ) def test_all(self): info = cpuinfo._get_cpu_info_internal() self.assertEqual('IBM/S390', info['vendor_id_raw']) #self.assertEqual('FIXME', info['brand']) self.assertEqual('5.5040 GHz', info['hz_advertised_friendly']) self.assertEqual('5.5040 GHz', info['hz_actual_friendly']) self.assertEqual((5504000000, 0), info['hz_advertised']) self.assertEqual((5504000000, 0), info['hz_actual']) self.assertEqual('S390X', info['arch']) self.assertEqual(64, info['bits']) self.assertEqual(4, info['count']) self.assertEqual('s390x', info['arch_string_raw']) self.assertEqual(64 * 1024, info['l1_instruction_cache_size']) self.assertEqual(96 * 1024, info['l1_data_cache_size']) self.assertEqual(1024 * 1024, info['l2_cache_size']) self.assertEqual(49152 * 1024, info['l3_cache_size']) #self.assertEqual(7, info['stepping']) #self.assertEqual(42, info['model']) #self.assertEqual(6, info['family']) self.assertEqual( ['dfp', 'edat', 'eimm', 'esan3', 'etf3eh', 'highgprs', 'ldisp', 'msa', 'sie', 'stfle', 'te', 'zarch'], info['flags'] ) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/tests/test_linux_gentoo_2_2_x86_64.py0000664000175000017500000007035714325641176021341 0ustar00mattmatt import unittest from cpuinfo import * import helpers class MockDataSource(object): bits = '64bit' cpu_count = 2 is_windows = False arch_string_raw = 'x86_64' uname_string_raw = 'x86_64' can_cpuid = False @staticmethod def has_proc_cpuinfo(): return True @staticmethod def has_dmesg(): return True @staticmethod def has_lscpu(): return True @staticmethod def cat_proc_cpuinfo(): returncode = 0 output = r''' processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 42 model name : Intel(R) Pentium(R) CPU G640 @ 2.80GHz stepping : 7 cpu MHz : 2793.652 cache size : 3072 KB physical id : 0 siblings : 2 core id : 0 cpu cores : 2 apicid : 0 initial apicid : 0 fpu : yes fpu_exception : yes cpuid level : 13 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt xsave hypervisor lahf_lm bugs : bogomips : 5587.30 clflush size : 64 cache_alignment : 64 address sizes : 36 bits physical, 48 bits virtual power management: processor : 1 vendor_id : GenuineIntel cpu family : 6 model : 42 model name : Intel(R) Pentium(R) CPU G640 @ 2.80GHz stepping : 7 cpu MHz : 2793.652 cache size : 3072 KB physical id : 0 siblings : 2 core id : 1 cpu cores : 2 apicid : 1 initial apicid : 1 fpu : yes fpu_exception : yes cpuid level : 13 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt xsave hypervisor lahf_lm bugs : bogomips : 5587.30 clflush size : 64 cache_alignment : 64 address sizes : 36 bits physical, 48 bits virtual power management: ''' return returncode, output @staticmethod def dmesg_a(): returncode = 0 output = r''' =============================================================================== [ 0.000000] Linux version 4.5.2-aufs-r1 (root@jasmin) (gcc version 5.4.0 (Gentoo 5.4.0 p1.0, pie-0.6.5) ) #1 SMP Sun Jul 3 17:17:11 UTC 2016 [ 0.000000] Command line: BOOT_IMAGE=/isolinux/gentoo root=/dev/ram0 init=/linuxrc dokeymap aufs looptype=squashfs loop=/image.squashfs cdroot initrd=/isolinux/gentoo.xz console=tty1 [ 0.000000] KERNEL supported cpus: [ 0.000000] Intel GenuineIntel [ 0.000000] AMD AuthenticAMD [ 0.000000] Centaur CentaurHauls [ 0.000000] x86/fpu: Supporting XSAVE feature 0x01: 'x87 floating point registers' [ 0.000000] x86/fpu: Supporting XSAVE feature 0x02: 'SSE registers' [ 0.000000] x86/fpu: Enabled xstate features 0x3, context size is 576 bytes, using 'standard' format. [ 0.000000] x86/fpu: Using 'lazy' FPU context switches. [ 0.000000] e820: BIOS-provided physical RAM map: [ 0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable [ 0.000000] BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved [ 0.000000] BIOS-e820: [mem 0x0000000000100000-0x00000000dffeffff] usable [ 0.000000] BIOS-e820: [mem 0x00000000dfff0000-0x00000000dfffffff] ACPI data [ 0.000000] BIOS-e820: [mem 0x00000000fec00000-0x00000000fec00fff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000fee00000-0x00000000fee00fff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved [ 0.000000] BIOS-e820: [mem 0x0000000100000000-0x000000011fffffff] usable [ 0.000000] NX (Execute Disable) protection: active [ 0.000000] SMBIOS 2.5 present. [ 0.000000] DMI: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006 [ 0.000000] Hypervisor detected: KVM [ 0.000000] e820: update [mem 0x00000000-0x00000fff] usable ==> reserved [ 0.000000] e820: remove [mem 0x000a0000-0x000fffff] usable [ 0.000000] e820: last_pfn = 0x120000 max_arch_pfn = 0x400000000 [ 0.000000] MTRR default type: uncachable [ 0.000000] MTRR variable ranges disabled: [ 0.000000] x86/PAT: Configuration [0-7]: WB WC UC- UC WB WC UC- WT [ 0.000000] MTRR: Disabled [ 0.000000] CPU MTRRs all blank - virtualized system. [ 0.000000] e820: last_pfn = 0xdfff0 max_arch_pfn = 0x400000000 [ 0.000000] found SMP MP-table at [mem 0x0009fff0-0x0009ffff] mapped at [ffff88000009fff0] [ 0.000000] Base memory trampoline at [ffff880000099000] 99000 size 24576 [ 0.000000] BRK [0x13b4e000, 0x13b4efff] PGTABLE [ 0.000000] BRK [0x13b4f000, 0x13b4ffff] PGTABLE [ 0.000000] BRK [0x13b50000, 0x13b50fff] PGTABLE [ 0.000000] BRK [0x13b51000, 0x13b51fff] PGTABLE [ 0.000000] RAMDISK: [mem 0x7f894000-0x7fffffff] [ 0.000000] ACPI: Early table checksum verification disabled [ 0.000000] ACPI: RSDP 0x00000000000E0000 000024 (v02 VBOX ) [ 0.000000] ACPI: XSDT 0x00000000DFFF0030 00003C (v01 VBOX VBOXXSDT 00000001 ASL 00000061) [ 0.000000] ACPI: FACP 0x00000000DFFF00F0 0000F4 (v04 VBOX VBOXFACP 00000001 ASL 00000061) [ 0.000000] ACPI: DSDT 0x00000000DFFF0470 00210F (v01 VBOX VBOXBIOS 00000002 INTL 20160108) [ 0.000000] ACPI: FACS 0x00000000DFFF0200 000040 [ 0.000000] ACPI: FACS 0x00000000DFFF0200 000040 [ 0.000000] ACPI: APIC 0x00000000DFFF0240 00005C (v02 VBOX VBOXAPIC 00000001 ASL 00000061) [ 0.000000] ACPI: SSDT 0x00000000DFFF02A0 0001CC (v01 VBOX VBOXCPUT 00000002 INTL 20160108) [ 0.000000] ACPI: Local APIC address 0xfee00000 [ 0.000000] kvm-clock: Using msrs 4b564d01 and 4b564d00 [ 0.000000] kvm-clock: cpu 0, msr 1:1fffb001, primary cpu clock [ 0.000000] kvm-clock: using sched offset of 7895112535 cycles [ 0.000000] clocksource: kvm-clock: mask: 0xffffffffffffffff max_cycles: 0x1cd42e4dffb, max_idle_ns: 881590591483 ns [ 0.000000] Zone ranges: [ 0.000000] DMA [mem 0x0000000000001000-0x0000000000ffffff] [ 0.000000] DMA32 [mem 0x0000000001000000-0x00000000ffffffff] [ 0.000000] Normal [mem 0x0000000100000000-0x000000011fffffff] [ 0.000000] Movable zone start for each node [ 0.000000] Early memory node ranges [ 0.000000] node 0: [mem 0x0000000000001000-0x000000000009efff] [ 0.000000] node 0: [mem 0x0000000000100000-0x00000000dffeffff] [ 0.000000] node 0: [mem 0x0000000100000000-0x000000011fffffff] [ 0.000000] Initmem setup node 0 [mem 0x0000000000001000-0x000000011fffffff] [ 0.000000] On node 0 totalpages: 1048462 [ 0.000000] DMA zone: 56 pages used for memmap [ 0.000000] DMA zone: 21 pages reserved [ 0.000000] DMA zone: 3998 pages, LIFO batch:0 [ 0.000000] DMA32 zone: 12488 pages used for memmap [ 0.000000] DMA32 zone: 913392 pages, LIFO batch:31 [ 0.000000] Normal zone: 1792 pages used for memmap [ 0.000000] Normal zone: 131072 pages, LIFO batch:31 [ 0.000000] ACPI: PM-Timer IO Port: 0x4008 [ 0.000000] ACPI: Local APIC address 0xfee00000 [ 0.000000] IOAPIC[0]: apic_id 2, version 32, address 0xfec00000, GSI 0-23 [ 0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl) [ 0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level) [ 0.000000] ACPI: IRQ0 used by override. [ 0.000000] ACPI: IRQ9 used by override. [ 0.000000] Using ACPI (MADT) for SMP configuration information [ 0.000000] smpboot: Allowing 2 CPUs, 0 hotplug CPUs [ 0.000000] e820: [mem 0xe0000000-0xfebfffff] available for PCI devices [ 0.000000] Booting paravirtualized kernel on KVM [ 0.000000] clocksource: refined-jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1910969940391419 ns [ 0.000000] setup_percpu: NR_CPUS:64 nr_cpumask_bits:64 nr_cpu_ids:2 nr_node_ids:1 [ 0.000000] PERCPU: Embedded 32 pages/cpu @ffff88011fc00000 s90328 r8192 d32552 u1048576 [ 0.000000] pcpu-alloc: s90328 r8192 d32552 u1048576 alloc=1*2097152 [ 0.000000] pcpu-alloc: [0] 0 1 [ 0.000000] PV qspinlock hash table entries: 256 (order: 0, 4096 bytes) [ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 1034105 [ 0.000000] Kernel command line: BOOT_IMAGE=/isolinux/gentoo root=/dev/ram0 init=/linuxrc dokeymap aufs looptype=squashfs loop=/image.squashfs cdroot initrd=/isolinux/gentoo.xz console=tty1 [ 0.000000] PID hash table entries: 4096 (order: 3, 32768 bytes) [ 0.000000] Dentry cache hash table entries: 524288 (order: 10, 4194304 bytes) [ 0.000000] Inode-cache hash table entries: 262144 (order: 9, 2097152 bytes) [ 0.000000] Calgary: detecting Calgary via BIOS EBDA area [ 0.000000] Calgary: Unable to locate Rio Grande table in EBDA - bailing! [ 0.000000] Memory: 4026248K/4193848K available (5358K kernel code, 481K rwdata, 2712K rodata, 1016K init, 16188K bss, 167600K reserved, 0K cma-reserved) [ 0.000000] Hierarchical RCU implementation. [ 0.000000] Build-time adjustment of leaf fanout to 64. [ 0.000000] RCU restricting CPUs from NR_CPUS=64 to nr_cpu_ids=2. [ 0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=64, nr_cpu_ids=2 [ 0.000000] NR_IRQS:4352 nr_irqs:440 16 [ 0.000000] Console: colour VGA+ 80x25 [ 0.000000] console [tty1] enabled [ 0.000000] tsc: Detected 2793.652 MHz processor [ 0.141160] Calibrating delay loop (skipped) preset value.. 5587.30 BogoMIPS (lpj=2793652) [ 0.142104] pid_max: default: 32768 minimum: 301 [ 0.142638] ACPI: Core revision 20160108 [ 0.144223] ACPI: 2 ACPI AML tables successfully acquired and loaded [ 0.145332] Mount-cache hash table entries: 8192 (order: 4, 65536 bytes) [ 0.145866] Mountpoint-cache hash table entries: 8192 (order: 4, 65536 bytes) [ 0.147608] CPU: Physical Processor ID: 0 [ 0.148126] CPU: Processor Core ID: 0 [ 0.148586] mce: CPU supports 0 MCE banks [ 0.149092] Last level iTLB entries: 4KB 512, 2MB 8, 4MB 8 [ 0.149586] Last level dTLB entries: 4KB 512, 2MB 32, 4MB 32, 1GB 0 [ 0.152341] Freeing SMP alternatives memory: 24K (ffffffff92b78000 - ffffffff92b7e000) [ 0.163230] ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1 [ 0.265101] smpboot: CPU0: Intel(R) Pentium(R) CPU G640 @ 2.80GHz (family: 0x6, model: 0x2a, stepping: 0x7) [ 0.266299] Performance Events: unsupported p6 CPU model 42 no PMU driver, software events only. [ 0.267306] KVM setup paravirtual spinlock [ 0.267966] x86: Booting SMP configuration: [ 0.269313] .... node #0, CPUs: #1 [ 0.270050] kvm-clock: cpu 1, msr 1:1fffb041, secondary cpu clock [ 0.270195] mce: CPU supports 0 MCE banks [ 0.272308] x86: Booted up 1 node, 2 CPUs [ 0.274066] smpboot: Total of 2 processors activated (11174.60 BogoMIPS) [ 0.277750] devtmpfs: initialized [ 0.278904] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1911260446275000 ns [ 0.280007] NET: Registered protocol family 16 [ 0.282919] cpuidle: using governor ladder [ 0.287045] cpuidle: using governor menu [ 0.287596] ACPI: bus type PCI registered [ 0.288197] PCI: Using configuration type 1 for base access [ 0.296438] ACPI: Added _OSI(Module Device) [ 0.296920] ACPI: Added _OSI(Processor Device) [ 0.297365] ACPI: Added _OSI(3.0 _SCP Extensions) [ 0.297812] ACPI: Added _OSI(Processor Aggregator Device) [ 0.298811] ACPI: Executed 1 blocks of module-level executable AML code [ 0.301871] ACPI: Interpreter enabled [ 0.302325] ACPI: (supports S0 S5) [ 0.302733] ACPI: Using IOAPIC for interrupt routing [ 0.303373] PCI: Using host bridge windows from ACPI; if necessary, use "pci=nocrs" and report a bug [ 0.311397] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff]) [ 0.311943] acpi PNP0A03:00: _OSC: OS supports [ASPM ClockPM Segments MSI] [ 0.312695] acpi PNP0A03:00: _OSC failed (AE_NOT_FOUND); disabling ASPM [ 0.313427] acpi PNP0A03:00: fail to add MMCONFIG information, can't access extended PCI configuration space under this bridge. [ 0.314671] PCI host bridge to bus 0000:00 [ 0.315139] pci_bus 0000:00: root bus resource [io 0x0000-0x0cf7 window] [ 0.315651] pci_bus 0000:00: root bus resource [io 0x0d00-0xffff window] [ 0.316170] pci_bus 0000:00: root bus resource [mem 0x000a0000-0x000bffff window] [ 0.316921] pci_bus 0000:00: root bus resource [mem 0xe0000000-0xffdfffff window] [ 0.317667] pci_bus 0000:00: root bus resource [bus 00-ff] [ 0.318183] pci 0000:00:00.0: [8086:1237] type 00 class 0x060000 [ 0.318651] pci 0000:00:01.0: [8086:7000] type 00 class 0x060100 [ 0.319190] pci 0000:00:01.1: [8086:7111] type 00 class 0x01018a [ 0.319507] pci 0000:00:01.1: reg 0x20: [io 0xd000-0xd00f] [ 0.319637] pci 0000:00:01.1: legacy IDE quirk: reg 0x10: [io 0x01f0-0x01f7] [ 0.320177] pci 0000:00:01.1: legacy IDE quirk: reg 0x14: [io 0x03f6] [ 0.320691] pci 0000:00:01.1: legacy IDE quirk: reg 0x18: [io 0x0170-0x0177] [ 0.321218] pci 0000:00:01.1: legacy IDE quirk: reg 0x1c: [io 0x0376] [ 0.321916] pci 0000:00:02.0: [80ee:beef] type 00 class 0x030000 [ 0.331110] pci 0000:00:02.0: reg 0x10: [mem 0xe0000000-0xe0ffffff pref] [ 0.355210] pci 0000:00:03.0: [8086:100e] type 00 class 0x020000 [ 0.362376] pci 0000:00:03.0: reg 0x10: [mem 0xf0000000-0xf001ffff] [ 0.368405] pci 0000:00:03.0: reg 0x18: [io 0xd010-0xd017] [ 0.382823] pci 0000:00:04.0: [80ee:cafe] type 00 class 0x088000 [ 0.385993] pci 0000:00:04.0: reg 0x10: [io 0xd020-0xd03f] [ 0.390088] pci 0000:00:04.0: reg 0x14: [mem 0xf0400000-0xf07fffff] [ 0.396674] pci 0000:00:04.0: reg 0x18: [mem 0xf0800000-0xf0803fff pref] [ 0.408760] pci 0000:00:05.0: [8086:2415] type 00 class 0x040100 [ 0.408846] pci 0000:00:05.0: reg 0x10: [io 0xd100-0xd1ff] [ 0.408903] pci 0000:00:05.0: reg 0x14: [io 0xd200-0xd23f] [ 0.409378] pci 0000:00:06.0: [106b:003f] type 00 class 0x0c0310 [ 0.412327] pci 0000:00:06.0: reg 0x10: [mem 0xf0804000-0xf0804fff] [ 0.438003] pci 0000:00:07.0: [8086:7113] type 00 class 0x068000 [ 0.438389] pci 0000:00:07.0: quirk: [io 0x4000-0x403f] claimed by PIIX4 ACPI [ 0.439849] pci 0000:00:07.0: quirk: [io 0x4100-0x410f] claimed by PIIX4 SMB [ 0.440790] pci 0000:00:0d.0: [8086:2829] type 00 class 0x010601 [ 0.446112] pci 0000:00:0d.0: reg 0x10: [io 0xd240-0xd247] [ 0.453981] pci 0000:00:0d.0: reg 0x18: [io 0xd250-0xd257] [ 0.465205] pci 0000:00:0d.0: reg 0x20: [io 0xd260-0xd26f] [ 0.468499] pci 0000:00:0d.0: reg 0x24: [mem 0xf0806000-0xf0807fff] [ 0.473155] pci_bus 0000:00: on NUMA node 0 [ 0.474092] ACPI: PCI Interrupt Link [LNKA] (IRQs 5 9 10 *11) [ 0.476734] ACPI: PCI Interrupt Link [LNKB] (IRQs 5 9 10 *11) [ 0.478927] ACPI: PCI Interrupt Link [LNKC] (IRQs 5 9 *10 11) [ 0.480187] ACPI: PCI Interrupt Link [LNKD] (IRQs 5 *9 10 11) [ 0.483221] ACPI: Enabled 2 GPEs in block 00 to 07 [ 0.484401] vgaarb: setting as boot device: PCI:0000:00:02.0 [ 0.484962] vgaarb: device added: PCI:0000:00:02.0,decodes=io+mem,owns=io+mem,locks=none [ 0.486436] vgaarb: loaded [ 0.486866] vgaarb: bridge control possible 0000:00:02.0 [ 0.487529] SCSI subsystem initialized [ 0.488105] libata version 3.00 loaded. [ 0.488124] ACPI: bus type USB registered [ 0.488601] usbcore: registered new interface driver usbfs [ 0.489127] usbcore: registered new interface driver hub [ 0.489642] usbcore: registered new device driver usb [ 0.493140] PCI: Using ACPI for IRQ routing [ 0.493596] PCI: pci_cache_line_size set to 64 bytes [ 0.493741] e820: reserve RAM buffer [mem 0x0009fc00-0x0009ffff] [ 0.493748] e820: reserve RAM buffer [mem 0xdfff0000-0xdfffffff] [ 0.501262] clocksource: Switched to clocksource kvm-clock [ 0.501975] VFS: Disk quotas dquot_6.6.0 [ 0.502483] VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes) [ 0.515233] pnp: PnP ACPI init [ 0.515724] pnp 00:00: Plug and Play ACPI device, IDs PNP0303 (active) [ 0.515794] pnp 00:01: Plug and Play ACPI device, IDs PNP0f03 (active) [ 0.516395] pnp: PnP ACPI: found 2 devices [ 0.521420] clocksource: acpi_pm: mask: 0xffffff max_cycles: 0xffffff, max_idle_ns: 2085701024 ns [ 0.523924] pci_bus 0000:00: resource 4 [io 0x0000-0x0cf7 window] [ 0.523928] pci_bus 0000:00: resource 5 [io 0x0d00-0xffff window] [ 0.523930] pci_bus 0000:00: resource 6 [mem 0x000a0000-0x000bffff window] [ 0.523932] pci_bus 0000:00: resource 7 [mem 0xe0000000-0xffdfffff window] [ 0.526813] NET: Registered protocol family 2 [ 0.527577] TCP established hash table entries: 32768 (order: 6, 262144 bytes) [ 0.528532] TCP bind hash table entries: 32768 (order: 7, 524288 bytes) [ 0.529234] TCP: Hash tables configured (established 32768 bind 32768) [ 0.529765] UDP hash table entries: 2048 (order: 4, 65536 bytes) [ 0.530287] UDP-Lite hash table entries: 2048 (order: 4, 65536 bytes) [ 0.544043] NET: Registered protocol family 1 [ 0.544613] pci 0000:00:00.0: Limiting direct PCI/PCI transfers [ 0.545245] pci 0000:00:01.0: Activating ISA DMA hang workarounds [ 0.545791] pci 0000:00:02.0: Video device with shadowed ROM [ 0.547149] PCI: CLS 0 bytes, default 64 [ 0.547884] Trying to unpack rootfs image as initramfs... [ 1.394034] Freeing initrd memory: 7600K (ffff88007f894000 - ffff880080000000) [ 1.394891] PCI-DMA: Using software bounce buffering for IO (SWIOTLB) [ 1.395861] software IO TLB [mem 0xdbff0000-0xdfff0000] (64MB) mapped at [ffff8800dbff0000-ffff8800dffeffff] [ 1.397095] platform rtc_cmos: registered platform RTC device (no PNP device found) [ 1.397910] RAPL PMU detected, API unit is 2^-32 Joules, 3 fixed counters 10737418240 ms ovfl timer [ 1.398684] hw unit of domain pp0-core 2^-0 Joules [ 1.399166] hw unit of domain package 2^-0 Joules [ 1.399618] hw unit of domain pp1-gpu 2^-0 Joules [ 1.400492] futex hash table entries: 512 (order: 3, 32768 bytes) [ 1.401169] audit: initializing netlink subsys (disabled) [ 1.401668] audit: type=2000 audit(1488272619.420:1): initialized [ 1.402282] Initialise system trusted keyring [ 1.403474] squashfs: version 4.0 (2009/01/31) Phillip Lougher [ 1.404117] JFS: nTxBlock = 8192, nTxLock = 65536 [ 1.406745] SGI XFS with ACLs, security attributes, realtime, no debug enabled [ 1.408178] aufs 4.5-20160328 [ 1.418164] Key type asymmetric registered [ 1.418627] Asymmetric key parser 'x509' registered [ 1.419179] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 253) [ 1.419974] io scheduler noop registered [ 1.420429] io scheduler deadline registered (default) [ 1.421010] start plist test [ 1.422756] end plist test [ 1.422768] Running rhashtable test nelem=8, max_size=0, shrinking=0 [ 1.423312] Test 00: [ 1.425541] Adding 50000 keys [ 1.453370] Traversal complete: counted=50000, nelems=50000, entries=50000, table-jumps=0 [ 1.465493] Traversal complete: counted=50000, nelems=50000, entries=50000, table-jumps=0 [ 1.466339] Deleting 50000 keys [ 1.472526] Duration of test: 46526457 ns [ 1.473240] Test 01: [ 1.474878] Adding 50000 keys [ 1.487127] Traversal complete: counted=50000, nelems=50000, entries=50000, table-jumps=0 [ 1.496559] Traversal complete: counted=50000, nelems=50000, entries=50000, table-jumps=0 [ 1.497384] Deleting 50000 keys [ 1.506520] Duration of test: 31074162 ns [ 1.507191] Test 02: [ 1.509281] Adding 50000 keys [ 1.522531] Traversal complete: counted=50000, nelems=50000, entries=50000, table-jumps=0 [ 1.532936] Traversal complete: counted=50000, nelems=50000, entries=50000, table-jumps=0 [ 1.533744] Deleting 50000 keys [ 1.541847] Duration of test: 32005815 ns [ 1.543742] Test 03: [ 1.545394] Adding 50000 keys [ 1.560340] Traversal complete: counted=50000, nelems=50000, entries=50000, table-jumps=0 [ 1.568083] Traversal complete: counted=50000, nelems=50000, entries=50000, table-jumps=0 [ 1.568920] Deleting 50000 keys [ 1.578421] Duration of test: 32488444 ns [ 1.578926] Average test time: 35523719 [ 1.579370] Testing concurrent rhashtable access from 10 threads [ 1.649031] thread[6]: rhashtable_insert_fast failed [ 1.649033] thread[7]: rhashtable_insert_fast failed [ 1.649038] thread[9]: rhashtable_insert_fast failed [ 1.649039] thread[3]: rhashtable_insert_fast failed [ 1.649041] thread[8]: rhashtable_insert_fast failed [ 1.649043] thread[5]: rhashtable_insert_fast failed [ 1.649044] thread[1]: rhashtable_insert_fast failed [ 1.831026] Test failed: thread 1 returned: -12 [ 1.855279] Test failed: thread 3 returned: -12 [ 1.859276] Test failed: thread 5 returned: -12 [ 1.859887] Test failed: thread 6 returned: -12 [ 1.860379] Test failed: thread 7 returned: -12 [ 1.860838] Test failed: thread 8 returned: -12 [ 1.861335] Test failed: thread 9 returned: -12 [ 1.861782] Started 10 threads, 7 failed [ 1.862508] glob: 64 self-tests passed, 0 failed [ 1.863134] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled [ 1.863988] Linux agpgart interface v0.103 [ 1.864625] input: Power Button as /devices/LNXSYSTM:00/LNXPWRBN:00/input/input0 [ 1.865411] ACPI: Power Button [PWRF] [ 1.865899] input: Sleep Button as /devices/LNXSYSTM:00/LNXSLPBN:00/input/input1 [ 1.867173] ACPI: Sleep Button [SLPF] [ 1.868220] ACPI: Video Device [GFX0] (multi-head: yes rom: no post: no) [ 1.868877] input: Video Bus as /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A03:00/LNXVIDEO:00/input/input2 [ 1.870085] xenfs: not registering filesystem on non-xen platform [ 1.877055] brd: module loaded [ 1.879394] loop: module loaded [ 1.880002] usbcore: registered new interface driver hwa-rc [ 1.880518] usbcore: registered new interface driver i1480-dfu-usb [ 1.881078] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver [ 1.881591] ehci-pci: EHCI PCI platform driver [ 1.882074] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver [ 1.882586] uhci_hcd: USB Universal Host Controller Interface driver [ 1.883306] usbcore: registered new interface driver wusb-cbaf [ 1.883805] usbcore: registered new interface driver cdc_wdm [ 1.884348] i8042: PNP: PS/2 Controller [PNP0303:PS2K,PNP0f03:PS2M] at 0x60,0x64 irq 1,12 [ 1.885658] serio: i8042 KBD port at 0x60,0x64 irq 1 [ 1.886150] serio: i8042 AUX port at 0x60,0x64 irq 12 [ 1.887401] mousedev: PS/2 mouse d ''' return returncode, output @staticmethod def lscpu(): returncode = 0 output = r''' Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 2 On-line CPU(s) list: 0,1 Thread(s) per core: 1 Core(s) per socket: 2 Socket(s): 1 Vendor ID: GenuineIntel CPU family: 6 Model: 42 Model name: Intel(R) Pentium(R) CPU G640 @ 2.80GHz Stepping: 7 CPU MHz: 2793.652 BogoMIPS: 5587.30 Hypervisor vendor: KVM Virtualization type: full L1d cache: 32K L1i cache: 32K L2 cache: 256K L3 cache: 3072K Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt xsave hypervisor lahf_lm ''' return returncode, output class TestLinuxGentoo_2_2_X86_64(unittest.TestCase): def setUp(self): helpers.backup_data_source(cpuinfo) helpers.monkey_patch_data_source(cpuinfo, MockDataSource) def tearDown(self): helpers.restore_data_source(cpuinfo) ''' Make sure calls return the expected number of fields. ''' def test_returns(self): self.assertEqual(0, len(cpuinfo._get_cpu_info_from_registry())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpufreq_info())) self.assertEqual(14, len(cpuinfo._get_cpu_info_from_lscpu())) self.assertEqual(11, len(cpuinfo._get_cpu_info_from_proc_cpuinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysctl())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_kstat())) self.assertEqual(8, len(cpuinfo._get_cpu_info_from_dmesg())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cat_var_run_dmesg_boot())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_ibm_pa_features())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpuid())) self.assertEqual(21, len(cpuinfo._get_cpu_info_internal())) def test_get_cpu_info_from_lscpu(self): info = cpuinfo._get_cpu_info_from_lscpu() self.assertEqual('GenuineIntel', info['vendor_id_raw']) self.assertEqual('Intel(R) Pentium(R) CPU G640 @ 2.80GHz', info['brand_raw']) self.assertEqual('2.7937 GHz', info['hz_advertised_friendly']) self.assertEqual('2.7937 GHz', info['hz_actual_friendly']) self.assertEqual((2793652000, 0), info['hz_advertised']) self.assertEqual((2793652000, 0), info['hz_actual']) self.assertEqual(7, info['stepping']) self.assertEqual(42, info['model']) self.assertEqual(6, info['family']) self.assertEqual(32 * 1024, info['l1_instruction_cache_size']) self.assertEqual(32 * 1024, info['l1_data_cache_size']) self.assertEqual(256 * 1024, info['l2_cache_size']) self.assertEqual(3072 * 1024, info['l3_cache_size']) self.assertEqual( ['apic', 'clflush', 'cmov', 'constant_tsc', 'cx16', 'cx8', 'de', 'fpu', 'fxsr', 'ht', 'hypervisor', 'lahf_lm', 'lm', 'mca', 'mce', 'mmx', 'msr', 'mtrr', 'nonstop_tsc', 'nopl', 'nx', 'pae', 'pat', 'pclmulqdq', 'pge', 'pni', 'popcnt', 'pse', 'pse36', 'rdtscp', 'rep_good', 'sep', 'sse', 'sse2', 'sse4_1', 'sse4_2', 'ssse3', 'syscall', 'tsc', 'vme', 'xsave', 'xtopology'] , info['flags'] ) def test_get_cpu_info_from_dmesg(self): info = cpuinfo._get_cpu_info_from_dmesg() self.assertEqual('Intel(R) Pentium(R) CPU G640 @ 2.80GHz', info['brand_raw']) self.assertEqual('2.8000 GHz', info['hz_advertised_friendly']) self.assertEqual('2.8000 GHz', info['hz_actual_friendly']) self.assertEqual((2800000000, 0), info['hz_advertised']) self.assertEqual((2800000000, 0), info['hz_actual']) self.assertEqual(7, info['stepping']) self.assertEqual(42, info['model']) self.assertEqual(6, info['family']) def test_get_cpu_info_from_proc_cpuinfo(self): info = cpuinfo._get_cpu_info_from_proc_cpuinfo() self.assertEqual('GenuineIntel', info['vendor_id_raw']) self.assertEqual('Intel(R) Pentium(R) CPU G640 @ 2.80GHz', info['brand_raw']) self.assertEqual('2.8000 GHz', info['hz_advertised_friendly']) self.assertEqual('2.7937 GHz', info['hz_actual_friendly']) self.assertEqual((2800000000, 0), info['hz_advertised']) self.assertEqual((2793652000, 0), info['hz_actual']) self.assertEqual(3072 * 1024, info['l3_cache_size']) self.assertEqual(7, info['stepping']) self.assertEqual(42, info['model']) self.assertEqual(6, info['family']) self.assertEqual( ['apic', 'clflush', 'cmov', 'constant_tsc', 'cx16', 'cx8', 'de', 'fpu', 'fxsr', 'ht', 'hypervisor', 'lahf_lm', 'lm', 'mca', 'mce', 'mmx', 'msr', 'mtrr', 'nonstop_tsc', 'nopl', 'nx', 'pae', 'pat', 'pclmulqdq', 'pge', 'pni', 'popcnt', 'pse', 'pse36', 'rdtscp', 'rep_good', 'sep', 'sse', 'sse2', 'sse4_1', 'sse4_2', 'ssse3', 'syscall', 'tsc', 'vme', 'xsave', 'xtopology'] , info['flags'] ) def test_all(self): info = cpuinfo._get_cpu_info_internal() self.assertEqual('GenuineIntel', info['vendor_id_raw']) self.assertEqual('Intel(R) Pentium(R) CPU G640 @ 2.80GHz', info['brand_raw']) self.assertEqual('2.8000 GHz', info['hz_advertised_friendly']) self.assertEqual('2.7937 GHz', info['hz_actual_friendly']) self.assertEqual((2800000000, 0), info['hz_advertised']) self.assertEqual((2793652000, 0), info['hz_actual']) self.assertEqual('X86_64', info['arch']) self.assertEqual(64, info['bits']) self.assertEqual(2, info['count']) self.assertEqual('x86_64', info['arch_string_raw']) self.assertEqual(32 * 1024, info['l1_instruction_cache_size']) self.assertEqual(32 * 1024, info['l1_data_cache_size']) self.assertEqual(256 * 1024, info['l2_cache_size']) self.assertEqual(3072 * 1024, info['l3_cache_size']) self.assertEqual(7, info['stepping']) self.assertEqual(42, info['model']) self.assertEqual(6, info['family']) self.assertEqual( ['apic', 'clflush', 'cmov', 'constant_tsc', 'cx16', 'cx8', 'de', 'fpu', 'fxsr', 'ht', 'hypervisor', 'lahf_lm', 'lm', 'mca', 'mce', 'mmx', 'msr', 'mtrr', 'nonstop_tsc', 'nopl', 'nx', 'pae', 'pat', 'pclmulqdq', 'pge', 'pni', 'popcnt', 'pse', 'pse36', 'rdtscp', 'rep_good', 'sep', 'sse', 'sse2', 'sse4_1', 'sse4_2', 'ssse3', 'syscall', 'tsc', 'vme', 'xsave', 'xtopology'] , info['flags'] ) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/tests/test_linux_mips64el_loongson3A3000.py0000664000175000017500000001403114325641176022421 0ustar00mattmatt import unittest from cpuinfo import * import helpers class MockDataSource(object): bits = '64bit' cpu_count = 4 is_windows = False arch_string_raw = 'mips64' uname_string_raw = '' can_cpuid = False @staticmethod def has_proc_cpuinfo(): return True @staticmethod def has_lscpu(): return True @staticmethod def cat_proc_cpuinfo(): returncode = 0 output = r''' system type : generic-loongson-machine machine : Unknown processor : 0 cpu model : ICT Loongson-3 V0.13 FPU V0.1 model name : ICT Loongson-3A R3 (Loongson-3A3000) @ 1449MHz BogoMIPS : 2887.52 wait instruction : yes microsecond timers : yes tlb_entries : 1088 extra interrupt vector : no hardware watchpoint : yes, count: 0, address/irw mask: [] isa : mips1 mips2 mips3 mips4 mips5 mips32r1 mips32r2 mips64r1 mips64r2 ASEs implemented : vz shadow register sets : 1 kscratch registers : 6 package : 0 core : 0 VCED exceptions : not available VCEI exceptions : not available processor : 1 cpu model : ICT Loongson-3 V0.13 FPU V0.1 model name : ICT Loongson-3A R3 (Loongson-3A3000) @ 1449MHz BogoMIPS : 2902.61 wait instruction : yes microsecond timers : yes tlb_entries : 1088 extra interrupt vector : no hardware watchpoint : yes, count: 0, address/irw mask: [] isa : mips1 mips2 mips3 mips4 mips5 mips32r1 mips32r2 mips64r1 mips64r2 ASEs implemented : vz shadow register sets : 1 kscratch registers : 6 package : 0 core : 1 VCED exceptions : not available VCEI exceptions : not available processor : 2 cpu model : ICT Loongson-3 V0.13 FPU V0.1 model name : ICT Loongson-3A R3 (Loongson-3A3000) @ 1449MHz BogoMIPS : 2902.61 wait instruction : yes microsecond timers : yes tlb_entries : 1088 extra interrupt vector : no hardware watchpoint : yes, count: 0, address/irw mask: [] isa : mips1 mips2 mips3 mips4 mips5 mips32r1 mips32r2 mips64r1 mips64r2 ASEs implemented : vz shadow register sets : 1 kscratch registers : 6 package : 0 core : 2 VCED exceptions : not available VCEI exceptions : not available processor : 3 cpu model : ICT Loongson-3 V0.13 FPU V0.1 model name : ICT Loongson-3A R3 (Loongson-3A3000) @ 1449MHz BogoMIPS : 2887.52 wait instruction : yes microsecond timers : yes tlb_entries : 1088 extra interrupt vector : no hardware watchpoint : yes, count: 0, address/irw mask: [] isa : mips1 mips2 mips3 mips4 mips5 mips32r1 mips32r2 mips64r1 mips64r2 ASEs implemented : vz shadow register sets : 1 kscratch registers : 6 package : 0 core : 3 VCED exceptions : not available VCEI exceptions : not available ''' return returncode, output @staticmethod def lscpu(): returncode = 0 output = r''' Architecture: mips64 Byte Order: Little Endian CPU(s): 4 On-line CPU(s) list: 0-3 Thread(s) per core: 1 Core(s) per socket: 4 Socket(s): 1 NUMA node(s): 1 Model name: ICT Loongson-3A R3 (Loongson-3A3000) @ 1449MHz BogoMIPS: 2887.52 L1d cache: 64K L1i cache: 64K L2 cache: 256K L3 cache: 2048K NUMA node0 CPU(s): 0-3 ''' return returncode, output class TestLinux_mips64el_Loongson3A3000(unittest.TestCase): def setUp(self): helpers.backup_data_source(cpuinfo) helpers.monkey_patch_data_source(cpuinfo, MockDataSource) def tearDown(self): helpers.restore_data_source(cpuinfo) ''' Make sure calls return the expected number of fields. ''' def test_returns(self): self.assertEqual(0, len(cpuinfo._get_cpu_info_from_registry())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpufreq_info())) self.assertEqual(5, len(cpuinfo._get_cpu_info_from_lscpu())) self.assertEqual(6, len(cpuinfo._get_cpu_info_from_proc_cpuinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysctl())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_kstat())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_dmesg())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cat_var_run_dmesg_boot())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_ibm_pa_features())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpuid())) self.assertEqual(17, len(cpuinfo._get_cpu_info_internal())) def test_get_cpu_info_from_lscpu(self): info = cpuinfo._get_cpu_info_from_lscpu() self.assertEqual('ICT Loongson-3A R3 (Loongson-3A3000) @ 1449MHz', info['brand_raw']) self.assertEqual(65536, info['l1_data_cache_size']) self.assertEqual(65536, info['l1_instruction_cache_size']) self.assertEqual(262144, info['l2_cache_size']) self.assertEqual(2097152, info['l3_cache_size']) def test_get_cpu_info_from_proc_cpuinfo(self): info = cpuinfo._get_cpu_info_from_proc_cpuinfo() self.assertEqual('ICT Loongson-3A R3 (Loongson-3A3000) @ 1449MHz', info['brand_raw']) self.assertEqual('1.4490 GHz', info['hz_advertised_friendly']) self.assertEqual('1.4490 GHz', info['hz_actual_friendly']) self.assertEqual((1449000000, 0), info['hz_advertised']) self.assertEqual((1449000000, 0), info['hz_actual']) self.assertEqual(['vz'], info['flags']) def test_all(self): info = cpuinfo._get_cpu_info_internal() self.assertEqual('ICT Loongson-3A R3 (Loongson-3A3000) @ 1449MHz', info['brand_raw']) self.assertEqual('MIPS_64', info['arch']) self.assertEqual(64, info['bits']) self.assertEqual(4, info['count']) self.assertEqual('mips64', info['arch_string_raw']) self.assertEqual(['vz'], info['flags']) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/tests/test_linux_odroid_c2_aarch64.py0000664000175000017500000001646514325641176021542 0ustar00mattmatt import unittest from cpuinfo import * import helpers class MockDataSource(object): bits = '64bit' cpu_count = 4 is_windows = False arch_string_raw = 'aarch64' uname_string_raw = 'x86_64' can_cpuid = False @staticmethod def has_proc_cpuinfo(): return True @staticmethod def has_lscpu(): return True @staticmethod def has_cpufreq_info(): return True @staticmethod def cat_proc_cpuinfo(): returncode = 0 output = r''' processor : 0 BogoMIPS : 2.00 Features : fp asimd crc32 CPU implementer : 0x41 CPU architecture: 8 CPU variant : 0x0 CPU part : 0xd03 CPU revision : 4 processor : 1 BogoMIPS : 2.00 Features : fp asimd crc32 CPU implementer : 0x41 CPU architecture: 8 CPU variant : 0x0 CPU part : 0xd03 CPU revision : 4 processor : 2 BogoMIPS : 2.00 Features : fp asimd crc32 CPU implementer : 0x41 CPU architecture: 8 CPU variant : 0x0 CPU part : 0xd03 CPU revision : 4 processor : 3 BogoMIPS : 2.00 Features : fp asimd crc32 CPU implementer : 0x41 CPU architecture: 8 CPU variant : 0x0 CPU part : 0xd03 CPU revision : 4 Hardware : ODROID-C2 Revision : 020c ''' return returncode, output @staticmethod def lscpu(): returncode = 0 output = r''' Architecture: aarch64 Byte Order: Little Endian CPU(s): 4 On-line CPU(s) list: 0-3 Thread(s) per core: 1 Core(s) per socket: 1 Socket(s): 4 CPU max MHz: 1536.0000 CPU min MHz: 100.0000 ''' return returncode, output @staticmethod def cpufreq_info(): returncode = 0 output = r''' cpufrequtils 008: cpufreq-info (C) Dominik Brodowski 2004-2009 Report errors and bugs to cpufreq@vger.kernel.org, please. analyzing CPU 0: driver: meson_cpufreq CPUs which run at the same hardware frequency: 0 1 2 3 CPUs which need to have their frequency coordinated by software: 0 1 2 3 maximum transition latency: 200 us. hardware limits: 100.0 MHz - 1.54 GHz available frequency steps: 100.0 MHz, 250 MHz, 500 MHz, 1000 MHz, 1.30 GHz, 1.54 GHz available cpufreq governors: hotplug, interactive, conservative, ondemand, userspace, powersave, performance current policy: frequency should be within 100.0 MHz and 1.54 GHz. The governor "interactive" may decide which speed to use within this range. current CPU frequency is 1.54 GHz. cpufreq stats: 100.0 MHz:0.00%, 250 MHz:0.00%, 500 MHz:0.00%, 1000 MHz:0.00%, 1.30 GHz:0.00%, 1.54 GHz:100.00% (439) analyzing CPU 1: driver: meson_cpufreq CPUs which run at the same hardware frequency: 0 1 2 3 CPUs which need to have their frequency coordinated by software: 0 1 2 3 maximum transition latency: 200 us. hardware limits: 100.0 MHz - 1.54 GHz available frequency steps: 100.0 MHz, 250 MHz, 500 MHz, 1000 MHz, 1.30 GHz, 1.54 GHz available cpufreq governors: hotplug, interactive, conservative, ondemand, userspace, powersave, performance current policy: frequency should be within 100.0 MHz and 1.54 GHz. The governor "interactive" may decide which speed to use within this range. current CPU frequency is 1.54 GHz. cpufreq stats: 100.0 MHz:0.00%, 250 MHz:0.00%, 500 MHz:0.00%, 1000 MHz:0.00%, 1.30 GHz:0.00%, 1.54 GHz:100.00% (439) analyzing CPU 2: driver: meson_cpufreq CPUs which run at the same hardware frequency: 0 1 2 3 CPUs which need to have their frequency coordinated by software: 0 1 2 3 maximum transition latency: 200 us. hardware limits: 100.0 MHz - 1.54 GHz available frequency steps: 100.0 MHz, 250 MHz, 500 MHz, 1000 MHz, 1.30 GHz, 1.54 GHz available cpufreq governors: hotplug, interactive, conservative, ondemand, userspace, powersave, performance current policy: frequency should be within 100.0 MHz and 1.54 GHz. The governor "interactive" may decide which speed to use within this range. current CPU frequency is 1.54 GHz. cpufreq stats: 100.0 MHz:0.00%, 250 MHz:0.00%, 500 MHz:0.00%, 1000 MHz:0.00%, 1.30 GHz:0.00%, 1.54 GHz:100.00% (439) analyzing CPU 3: driver: meson_cpufreq CPUs which run at the same hardware frequency: 0 1 2 3 CPUs which need to have their frequency coordinated by software: 0 1 2 3 maximum transition latency: 200 us. hardware limits: 100.0 MHz - 1.54 GHz available frequency steps: 100.0 MHz, 250 MHz, 500 MHz, 1000 MHz, 1.30 GHz, 1.54 GHz available cpufreq governors: hotplug, interactive, conservative, ondemand, userspace, powersave, performance current policy: frequency should be within 100.0 MHz and 1.54 GHz. The governor "interactive" may decide which speed to use within this range. current CPU frequency is 1.54 GHz. cpufreq stats: 100.0 MHz:0.00%, 250 MHz:0.00%, 500 MHz:0.00%, 1000 MHz:0.00%, 1.30 GHz:0.00%, 1.54 GHz:100.00% (439) ''' return returncode, output class TestLinux_Odroid_C2_Aarch_64(unittest.TestCase): def setUp(self): helpers.backup_data_source(cpuinfo) helpers.monkey_patch_data_source(cpuinfo, MockDataSource) def tearDown(self): helpers.restore_data_source(cpuinfo) ''' Make sure calls return the expected number of fields. ''' def test_returns(self): self.assertEqual(0, len(cpuinfo._get_cpu_info_from_registry())) self.assertEqual(4, len(cpuinfo._get_cpu_info_from_cpufreq_info())) self.assertEqual(4, len(cpuinfo._get_cpu_info_from_lscpu())) self.assertEqual(2, len(cpuinfo._get_cpu_info_from_proc_cpuinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysctl())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_kstat())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_dmesg())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cat_var_run_dmesg_boot())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_ibm_pa_features())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpuid())) self.assertEqual(13, len(cpuinfo._get_cpu_info_internal())) def test_get_cpu_info_from_cpufreq_info(self): info = cpuinfo._get_cpu_info_from_cpufreq_info() self.assertEqual('1.5400 GHz', info['hz_advertised_friendly']) self.assertEqual('1.5400 GHz', info['hz_actual_friendly']) self.assertEqual((1540000000, 0), info['hz_advertised']) self.assertEqual((1540000000, 0), info['hz_actual']) def test_get_cpu_info_from_lscpu(self): info = cpuinfo._get_cpu_info_from_lscpu() self.assertEqual('1.5360 GHz', info['hz_advertised_friendly']) self.assertEqual('1.5360 GHz', info['hz_actual_friendly']) self.assertEqual((1536000000, 0), info['hz_advertised']) self.assertEqual((1536000000, 0), info['hz_actual']) def test_get_cpu_info_from_proc_cpuinfo(self): info = cpuinfo._get_cpu_info_from_proc_cpuinfo() self.assertEqual('ODROID-C2', info['hardware_raw']) self.assertEqual( ['asimd', 'crc32', 'fp'], info['flags'] ) def test_all(self): info = cpuinfo._get_cpu_info_internal() self.assertEqual('ODROID-C2', info['hardware_raw']) self.assertEqual('1.5400 GHz', info['hz_advertised_friendly']) self.assertEqual('1.5400 GHz', info['hz_actual_friendly']) self.assertEqual((1540000000, 0), info['hz_advertised']) self.assertEqual((1540000000, 0), info['hz_actual']) self.assertEqual('ARM_8', info['arch']) self.assertEqual(64, info['bits']) self.assertEqual(4, info['count']) self.assertEqual('aarch64', info['arch_string_raw']) self.assertEqual( ['asimd', 'crc32', 'fp'], info['flags'] ) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/tests/test_linux_odroid_xu3_arm_32.py0000664000175000017500000003137414325641176021604 0ustar00mattmatt import unittest from cpuinfo import * import helpers class MockDataSource(object): bits = '32bit' cpu_count = 8 is_windows = False arch_string_raw = 'armv7l' uname_string_raw = '' can_cpuid = False @staticmethod def has_proc_cpuinfo(): return True @staticmethod def has_lscpu(): return True @staticmethod def has_cpufreq_info(): return True @staticmethod def cat_proc_cpuinfo(): returncode = 0 output = r''' processor : 0 model name : ARMv7 Processor rev 3 (v7l) BogoMIPS : 84.00 Features : swp half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x0 CPU part : 0xc07 CPU revision : 3 processor : 1 model name : ARMv7 Processor rev 3 (v7l) BogoMIPS : 84.00 Features : swp half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x0 CPU part : 0xc07 CPU revision : 3 processor : 2 model name : ARMv7 Processor rev 3 (v7l) BogoMIPS : 84.00 Features : swp half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x0 CPU part : 0xc07 CPU revision : 3 processor : 3 model name : ARMv7 Processor rev 3 (v7l) BogoMIPS : 84.00 Features : swp half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x0 CPU part : 0xc07 CPU revision : 3 processor : 4 model name : ARMv7 Processor rev 3 (v7l) BogoMIPS : 36.00 Features : swp half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x2 CPU part : 0xc0f CPU revision : 3 processor : 5 model name : ARMv7 Processor rev 3 (v7l) BogoMIPS : 36.00 Features : swp half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x2 CPU part : 0xc0f CPU revision : 3 processor : 6 model name : ARMv7 Processor rev 3 (v7l) BogoMIPS : 36.00 Features : swp half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x2 CPU part : 0xc0f CPU revision : 3 processor : 7 model name : ARMv7 Processor rev 3 (v7l) BogoMIPS : 36.00 Features : swp half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x2 CPU part : 0xc0f CPU revision : 3 Hardware : ODROID-XU3 Revision : 0100 Serial : 0000000000000000 ''' return returncode, output @staticmethod def lscpu(): returncode = 0 output = r''' Architecture: armv7l Byte Order: Little Endian CPU(s): 8 On-line CPU(s) list: 0-7 Thread(s) per core: 1 Core(s) per socket: 4 Socket(s): 2 Model name: ARMv7 Processor rev 3 (v7l) CPU max MHz: 1400.0000 CPU min MHz: 200.0000 ''' return returncode, output @staticmethod def cpufreq_info(): returncode = 0 output = r''' cpufrequtils 008: cpufreq-info (C) Dominik Brodowski 2004-2009 Report errors and bugs to cpufreq@vger.kernel.org, please. analyzing CPU 0: driver: exynos_cpufreq CPUs which run at the same hardware frequency: 0 1 2 3 CPUs which need to have their frequency coordinated by software: 0 1 2 3 maximum transition latency: 100.0 us. hardware limits: 200 MHz - 1.40 GHz available cpufreq governors: interactive, conservative, ondemand, powersave, performance current policy: frequency should be within 200 MHz and 1.40 GHz. The governor "interactive" may decide which speed to use within this range. current CPU frequency is 1.40 GHz (asserted by call to hardware). cpufreq stats: 1.40 GHz:33.77%, 1.30 GHz:0.04%, 1.20 GHz:0.03%, 1.10 GHz:0.02%, 1000 MHz:0.03%, 900 MHz:0.04%, 800 MHz:0.06%, 700 MHz:0.10%, 600 MHz:0.13%, 500 MHz:0.19%, 400 MHz:0.31%, 300 MHz:2.09%, 200 MHz:63.20% (880901) analyzing CPU 1: driver: exynos_cpufreq CPUs which run at the same hardware frequency: 0 1 2 3 CPUs which need to have their frequency coordinated by software: 0 1 2 3 maximum transition latency: 100.0 us. hardware limits: 200 MHz - 1.40 GHz available cpufreq governors: interactive, conservative, ondemand, powersave, performance current policy: frequency should be within 200 MHz and 1.40 GHz. The governor "interactive" may decide which speed to use within this range. current CPU frequency is 1.40 GHz (asserted by call to hardware). cpufreq stats: 1.40 GHz:33.77%, 1.30 GHz:0.04%, 1.20 GHz:0.03%, 1.10 GHz:0.02%, 1000 MHz:0.03%, 900 MHz:0.04%, 800 MHz:0.06%, 700 MHz:0.10%, 600 MHz:0.13%, 500 MHz:0.19%, 400 MHz:0.31%, 300 MHz:2.09%, 200 MHz:63.20% (880901) analyzing CPU 2: driver: exynos_cpufreq CPUs which run at the same hardware frequency: 0 1 2 3 CPUs which need to have their frequency coordinated by software: 0 1 2 3 maximum transition latency: 100.0 us. hardware limits: 200 MHz - 1.40 GHz available cpufreq governors: interactive, conservative, ondemand, powersave, performance current policy: frequency should be within 200 MHz and 1.40 GHz. The governor "interactive" may decide which speed to use within this range. current CPU frequency is 1.40 GHz (asserted by call to hardware). cpufreq stats: 1.40 GHz:33.77%, 1.30 GHz:0.04%, 1.20 GHz:0.03%, 1.10 GHz:0.02%, 1000 MHz:0.03%, 900 MHz:0.04%, 800 MHz:0.06%, 700 MHz:0.10%, 600 MHz:0.13%, 500 MHz:0.19%, 400 MHz:0.31%, 300 MHz:2.09%, 200 MHz:63.20% (880901) analyzing CPU 3: driver: exynos_cpufreq CPUs which run at the same hardware frequency: 0 1 2 3 CPUs which need to have their frequency coordinated by software: 0 1 2 3 maximum transition latency: 100.0 us. hardware limits: 200 MHz - 1.40 GHz available cpufreq governors: interactive, conservative, ondemand, powersave, performance current policy: frequency should be within 200 MHz and 1.40 GHz. The governor "interactive" may decide which speed to use within this range. current CPU frequency is 1.40 GHz (asserted by call to hardware). cpufreq stats: 1.40 GHz:33.77%, 1.30 GHz:0.04%, 1.20 GHz:0.03%, 1.10 GHz:0.02%, 1000 MHz:0.03%, 900 MHz:0.04%, 800 MHz:0.06%, 700 MHz:0.10%, 600 MHz:0.13%, 500 MHz:0.19%, 400 MHz:0.31%, 300 MHz:2.09%, 200 MHz:63.20% (880901) analyzing CPU 4: driver: exynos_cpufreq CPUs which run at the same hardware frequency: 4 5 6 7 CPUs which need to have their frequency coordinated by software: 4 5 6 7 maximum transition latency: 100.0 us. hardware limits: 200 MHz - 2.00 GHz available cpufreq governors: interactive, conservative, ondemand, powersave, performance current policy: frequency should be within 200 MHz and 2.00 GHz. The governor "interactive" may decide which speed to use within this range. current CPU frequency is 2.00 GHz (asserted by call to hardware). cpufreq stats: 2.00 GHz:22.57%, 1.90 GHz:0.02%, 1.80 GHz:0.01%, 1.70 GHz:0.02%, 1.60 GHz:0.09%, 1.50 GHz:0.11%, 1.40 GHz:0.01%, 1.30 GHz:0.00%, 1.20 GHz:0.01%, 1.10 GHz:0.00%, 1000 MHz:0.00%, 900 MHz:0.13%, 800 MHz:0.00%, 700 MHz:0.01%, 600 MHz:0.01%, 500 MHz:0.03%, 400 MHz:0.14%, 300 MHz:0.18%, 200 MHz:76.65% (316653) analyzing CPU 5: driver: exynos_cpufreq CPUs which run at the same hardware frequency: 4 5 6 7 CPUs which need to have their frequency coordinated by software: 4 5 6 7 maximum transition latency: 100.0 us. hardware limits: 200 MHz - 2.00 GHz available cpufreq governors: interactive, conservative, ondemand, powersave, performance current policy: frequency should be within 200 MHz and 2.00 GHz. The governor "interactive" may decide which speed to use within this range. current CPU frequency is 2.00 GHz (asserted by call to hardware). cpufreq stats: 2.00 GHz:22.57%, 1.90 GHz:0.02%, 1.80 GHz:0.01%, 1.70 GHz:0.02%, 1.60 GHz:0.09%, 1.50 GHz:0.11%, 1.40 GHz:0.01%, 1.30 GHz:0.00%, 1.20 GHz:0.01%, 1.10 GHz:0.00%, 1000 MHz:0.00%, 900 MHz:0.13%, 800 MHz:0.00%, 700 MHz:0.01%, 600 MHz:0.01%, 500 MHz:0.03%, 400 MHz:0.14%, 300 MHz:0.18%, 200 MHz:76.65% (316653) analyzing CPU 6: driver: exynos_cpufreq CPUs which run at the same hardware frequency: 4 5 6 7 CPUs which need to have their frequency coordinated by software: 4 5 6 7 maximum transition latency: 100.0 us. hardware limits: 200 MHz - 2.00 GHz available cpufreq governors: interactive, conservative, ondemand, powersave, performance current policy: frequency should be within 200 MHz and 2.00 GHz. The governor "interactive" may decide which speed to use within this range. current CPU frequency is 2.00 GHz (asserted by call to hardware). cpufreq stats: 2.00 GHz:22.57%, 1.90 GHz:0.02%, 1.80 GHz:0.01%, 1.70 GHz:0.02%, 1.60 GHz:0.09%, 1.50 GHz:0.11%, 1.40 GHz:0.01%, 1.30 GHz:0.00%, 1.20 GHz:0.01%, 1.10 GHz:0.00%, 1000 MHz:0.00%, 900 MHz:0.13%, 800 MHz:0.00%, 700 MHz:0.01%, 600 MHz:0.01%, 500 MHz:0.03%, 400 MHz:0.14%, 300 MHz:0.18%, 200 MHz:76.65% (316653) analyzing CPU 7: driver: exynos_cpufreq CPUs which run at the same hardware frequency: 4 5 6 7 CPUs which need to have their frequency coordinated by software: 4 5 6 7 maximum transition latency: 100.0 us. hardware limits: 200 MHz - 2.00 GHz available cpufreq governors: interactive, conservative, ondemand, powersave, performance current policy: frequency should be within 200 MHz and 2.00 GHz. The governor "interactive" may decide which speed to use within this range. current CPU frequency is 2.00 GHz (asserted by call to hardware). cpufreq stats: 2.00 GHz:22.57%, 1.90 GHz:0.02%, 1.80 GHz:0.01%, 1.70 GHz:0.02%, 1.60 GHz:0.09%, 1.50 GHz:0.11%, 1.40 GHz:0.01%, 1.30 GHz:0.00%, 1.20 GHz:0.01%, 1.10 GHz:0.00%, 1000 MHz:0.00%, 900 MHz:0.13%, 800 MHz:0.00%, 700 MHz:0.01%, 600 MHz:0.01%, 500 MHz:0.03%, 400 MHz:0.14%, 300 MHz:0.18%, 200 MHz:76.65% (316653) ''' return returncode, output class TestLinux_Odroid_XU3_arm_32(unittest.TestCase): def setUp(self): helpers.backup_data_source(cpuinfo) helpers.monkey_patch_data_source(cpuinfo, MockDataSource) def tearDown(self): helpers.restore_data_source(cpuinfo) ''' Make sure calls return the expected number of fields. ''' def test_returns(self): self.assertEqual(0, len(cpuinfo._get_cpu_info_from_registry())) self.assertEqual(4, len(cpuinfo._get_cpu_info_from_cpufreq_info())) self.assertEqual(5, len(cpuinfo._get_cpu_info_from_lscpu())) self.assertEqual(3, len(cpuinfo._get_cpu_info_from_proc_cpuinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysctl())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_kstat())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_dmesg())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cat_var_run_dmesg_boot())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_ibm_pa_features())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpuid())) self.assertEqual(14, len(cpuinfo._get_cpu_info_internal())) def test_get_cpu_info_from_cpufreq_info(self): info = cpuinfo._get_cpu_info_from_cpufreq_info() self.assertEqual('1.4000 GHz', info['hz_advertised_friendly']) self.assertEqual('1.4000 GHz', info['hz_actual_friendly']) self.assertEqual((1400000000, 0), info['hz_advertised']) self.assertEqual((1400000000, 0), info['hz_actual']) def test_get_cpu_info_from_lscpu(self): info = cpuinfo._get_cpu_info_from_lscpu() self.assertEqual('ARMv7 Processor rev 3 (v7l)', info['brand_raw']) self.assertEqual('1.4000 GHz', info['hz_advertised_friendly']) self.assertEqual('1.4000 GHz', info['hz_actual_friendly']) self.assertEqual((1400000000, 0), info['hz_advertised']) self.assertEqual((1400000000, 0), info['hz_actual']) def test_get_cpu_info_from_proc_cpuinfo(self): info = cpuinfo._get_cpu_info_from_proc_cpuinfo() self.assertEqual('ARMv7 Processor rev 3 (v7l)', info['brand_raw']) self.assertEqual('ODROID-XU3', info['hardware_raw']) self.assertEqual( ['edsp', 'fastmult', 'half', 'idiva', 'idivt', 'neon', 'swp', 'thumb', 'tls', 'vfp', 'vfpv3', 'vfpv4' ], info['flags'] ) def test_all(self): info = cpuinfo._get_cpu_info_internal() self.assertEqual('ARMv7 Processor rev 3 (v7l)', info['brand_raw']) self.assertEqual('ODROID-XU3', info['hardware_raw']) self.assertEqual('1.4000 GHz', info['hz_advertised_friendly']) self.assertEqual('1.4000 GHz', info['hz_actual_friendly']) self.assertEqual((1400000000, 0), info['hz_advertised']) self.assertEqual((1400000000, 0), info['hz_actual']) self.assertEqual('ARM_7', info['arch']) self.assertEqual(32, info['bits']) self.assertEqual(8, info['count']) self.assertEqual('armv7l', info['arch_string_raw']) self.assertEqual( ['edsp', 'fastmult', 'half', 'idiva', 'idivt', 'neon', 'swp', 'thumb', 'tls', 'vfp', 'vfpv3', 'vfpv4' ], info['flags'] ) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/tests/test_linux_raspberry_pi_model_b_arm.py0000664000175000017500000000675414325641176023407 0ustar00mattmatt import unittest from cpuinfo import * import helpers class MockDataSource(object): bits = '32bit' cpu_count = 1 is_windows = False arch_string_raw = 'armv6l' uname_string_raw = '' @staticmethod def has_proc_cpuinfo(): return True @staticmethod def has_lscpu(): return True @staticmethod def cat_proc_cpuinfo(): returncode = 0 output = r''' Processor : ARMv6-compatible processor rev 7 (v6l) BogoMIPS : 697.95 Features : swp half thumb fastmult vfp edsp java tls CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x0 CPU part : 0xb76 CPU revision : 7 Hardware : BCM2708 Revision : 000d Serial : 0000000066564a8f ''' return returncode, output @staticmethod def lscpu(): returncode = 0 output = r''' Architecture: armv6l Byte Order: Little Endian CPU(s): 1 On-line CPU(s) list: 0 Thread(s) per core: 1 Core(s) per socket: 1 Socket(s): 1 CPU max MHz: 700.0000 CPU min MHz: 700.0000 ''' return returncode, output class TestLinux_RaspberryPiModelB(unittest.TestCase): def setUp(self): helpers.backup_data_source(cpuinfo) helpers.monkey_patch_data_source(cpuinfo, MockDataSource) def tearDown(self): helpers.restore_data_source(cpuinfo) ''' Make sure calls return the expected number of fields. ''' def test_returns(self): self.assertEqual(0, len(cpuinfo._get_cpu_info_from_registry())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpufreq_info())) self.assertEqual(4, len(cpuinfo._get_cpu_info_from_lscpu())) self.assertEqual(3, len(cpuinfo._get_cpu_info_from_proc_cpuinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysctl())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_kstat())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_dmesg())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cat_var_run_dmesg_boot())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_ibm_pa_features())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpuid())) self.assertEqual(14, len(cpuinfo._get_cpu_info_internal())) def test_get_cpu_info_from_lscpu(self): info = cpuinfo._get_cpu_info_from_lscpu() self.assertEqual('700.0000 MHz', info['hz_advertised_friendly']) self.assertEqual('700.0000 MHz', info['hz_actual_friendly']) self.assertEqual((700000000, 0), info['hz_advertised']) self.assertEqual((700000000, 0), info['hz_actual']) def test_get_cpu_info_from_proc_cpuinfo(self): info = cpuinfo._get_cpu_info_from_proc_cpuinfo() self.assertEqual('BCM2708', info['hardware_raw']) self.assertEqual('ARMv6-compatible processor rev 7 (v6l)', info['brand_raw']) self.assertEqual( ['edsp', 'fastmult', 'half', 'java', 'swp', 'thumb', 'tls', 'vfp'] , info['flags'] ) def test_all(self): info = cpuinfo._get_cpu_info_internal() self.assertEqual('BCM2708', info['hardware_raw']) self.assertEqual('ARMv6-compatible processor rev 7 (v6l)', info['brand_raw']) self.assertEqual('700.0000 MHz', info['hz_advertised_friendly']) self.assertEqual('700.0000 MHz', info['hz_actual_friendly']) self.assertEqual((700000000, 0), info['hz_advertised']) self.assertEqual((700000000, 0), info['hz_actual']) self.assertEqual('ARM_7', info['arch']) self.assertEqual(32, info['bits']) self.assertEqual(1, info['count']) self.assertEqual('armv6l', info['arch_string_raw']) self.assertEqual( ['edsp', 'fastmult', 'half', 'java', 'swp', 'thumb', 'tls', 'vfp'] , info['flags'] ) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/tests/test_linux_rhel_7_3_ppc64le.py0000664000175000017500000006371314325641176021323 0ustar00mattmatt import unittest from cpuinfo import * import helpers class MockDataSource(object): bits = '64bit' cpu_count = 16 is_windows = False arch_string_raw = 'ppc64le' uname_string_raw = '' can_cpuid = False @staticmethod def has_proc_cpuinfo(): return True @staticmethod def has_dmesg(): return True @staticmethod def has_lscpu(): return True @staticmethod def has_ibm_pa_features(): return True @staticmethod def ibm_pa_features(): returncode = 0 output = r''' /proc/device-tree/cpus/PowerPC,POWER7@1/ibm,pa-features 3ff60006 c08000c7 ''' return returncode, output @staticmethod def cat_proc_cpuinfo(): returncode = 0 output = r''' processor : 0 cpu : POWER8E (raw), altivec supported clock : 3425.000000MHz revision : 2.1 (pvr 004b 0201) processor : 1 cpu : POWER8E (raw), altivec supported clock : 3425.000000MHz revision : 2.1 (pvr 004b 0201) processor : 2 cpu : POWER8E (raw), altivec supported clock : 3425.000000MHz revision : 2.1 (pvr 004b 0201) processor : 3 cpu : POWER8E (raw), altivec supported clock : 3425.000000MHz revision : 2.1 (pvr 004b 0201) processor : 4 cpu : POWER8E (raw), altivec supported clock : 3425.000000MHz revision : 2.1 (pvr 004b 0201) processor : 5 cpu : POWER8E (raw), altivec supported clock : 3425.000000MHz revision : 2.1 (pvr 004b 0201) processor : 6 cpu : POWER8E (raw), altivec supported clock : 3425.000000MHz revision : 2.1 (pvr 004b 0201) processor : 7 cpu : POWER8E (raw), altivec supported clock : 3425.000000MHz revision : 2.1 (pvr 004b 0201) processor : 8 cpu : POWER8E (raw), altivec supported clock : 3425.000000MHz revision : 2.1 (pvr 004b 0201) processor : 9 cpu : POWER8E (raw), altivec supported clock : 3425.000000MHz revision : 2.1 (pvr 004b 0201) processor : 10 cpu : POWER8E (raw), altivec supported clock : 3425.000000MHz revision : 2.1 (pvr 004b 0201) processor : 11 cpu : POWER8E (raw), altivec supported clock : 3425.000000MHz revision : 2.1 (pvr 004b 0201) processor : 12 cpu : POWER8E (raw), altivec supported clock : 3425.000000MHz revision : 2.1 (pvr 004b 0201) processor : 13 cpu : POWER8E (raw), altivec supported clock : 3425.000000MHz revision : 2.1 (pvr 004b 0201) processor : 14 cpu : POWER8E (raw), altivec supported clock : 3425.000000MHz revision : 2.1 (pvr 004b 0201) processor : 15 cpu : POWER8E (raw), altivec supported clock : 3425.000000MHz revision : 2.1 (pvr 004b 0201) timebase : 512000000 platform : pSeries model : IBM pSeries (emulated by qemu) machine : CHRP IBM pSeries (emulated by qemu) ''' return returncode, output @staticmethod def dmesg_a(): returncode = 0 output = r''' [3269512.154534] convolution_var[11236]: unhandled signal 4 at 00003fff6c390004 nip 00003fff6c390004 lr 00003fff9a648d58 code 30001 [3269512.234818] convolution_var[11344]: unhandled signal 5 at 00003fff84390000 nip 00003fff84390000 lr 00003fffb2217ce0 code 30001 [3269512.234823] convolution_var[11347]: unhandled signal 11 at 0000000000000304 nip 00003fff8439001c lr 00003fffb2217ce0 code 30001 [3269512.292530] convolution_var[11435]: unhandled signal 11 at 0000000000000304 nip 00003fff565d001c lr 00003fff84457ce0 code 30001 [3269512.553601] convolution_var[11518]: unhandled signal 11 at 00003fff61278b68 nip 00003fff61278b68 lr 00003fff8f0d7ce0 code 30002 [3269515.267175] convolution_var[11623]: unhandled signal 5 at 00003fff70450000 nip 00003fff70450000 lr 00003fff9e2d7ce0 code 30001 [3269515.278982] convolution_var[11704]: unhandled signal 11 at 00003fff5e028b68 nip 00003fff5e028b68 lr 00003fff8be87ce0 code 30002 [3269516.050175] convolution_var[11803]: unhandled signal 4 at 00003fff73890008 nip 00003fff73890008 lr 00003fffa1717ce0 code 30001 [3269516.494489] convolution_var[11917]: unhandled signal 11 at 00003fff4c588b48 nip 00003fff4c588b48 lr 00003fff7a3e7ce0 code 30002 [3269516.494496] convolution_var[11918]: unhandled signal 11 at 00003fff4c588b98 nip 00003fff4c588b98 lr 00003fff7a3e7ce0 code 30002 [3269517.347386] convolution_var[12040]: unhandled signal 4 at 00003fff7c530000 nip 00003fff7c530000 lr 00003fffaa3b7ce0 code 30001 [3269517.494333] convolution_var[12299]: unhandled signal 4 at 00003fff88fe0008 nip 00003fff88fe0008 lr 00003fffb6e67ce0 code 30001 [3269517.494347] convolution_var[12301]: unhandled signal 5 at 00003fff88fe0100 nip 00003fff88fe0100 lr 00003fffb6e67ce0 code 30001 [3269517.515814] convolution_var[12120]: unhandled signal 4 at 00003fff6fbd0004 nip 00003fff6fbd0004 lr 00003fff9da57ce0 code 30001 [3269517.516110] convolution_var[12121]: unhandled signal 4 at 00003fff6fbd00c8 nip 00003fff6fbd00c8 lr 00003fff9da57ce0 code 30001 [3269520.521582] _exception: 10 callbacks suppressed [3269520.521591] convolution_var[12805]: unhandled signal 5 at 00003fff53c70000 nip 00003fff53c70000 lr 00003fff81af7ce0 code 30001 [3269528.348091] convolution_var[12977]: unhandled signal 4 at 00003fff51190008 nip 00003fff51190008 lr 00003fff7f017ce0 code 30001 [3269528.490362] convolution_var[13076]: unhandled signal 5 at 00003fff77e80000 nip 00003fff77e80000 lr 00003fffa5d07ce0 code 30001 [3269528.529240] convolution_var[13168]: unhandled signal 4 at 00003fff5cf70018 nip 00003fff5cf70018 lr 00003fff8adf7ce0 code 30001 [3269528.529260] convolution_var[13165]: unhandled signal 5 at 00003fff5cf70000 nip 00003fff5cf70000 lr 00003fff8adf7ce0 code 30001 [3269528.582530] convolution_var[13249]: unhandled signal 5 at 00003fff58660000 nip 00003fff58660000 lr 00003fff864e7ce0 code 30001 [3269528.582599] convolution_var[13242]: unhandled signal 5 at 00003fff586600c0 nip 00003fff586600c0 lr 00003fff864e7ce0 code 30001 [3269528.754904] convolution_var[13330]: unhandled signal 4 at 00003fff6c870018 nip 00003fff6c870018 lr 00003fff9a6f7ce0 code 30001 [3269528.754911] convolution_var[13328]: unhandled signal 5 at 00003fff6c870000 nip 00003fff6c870000 lr 00003fff9a6f7ce0 code 30001 [3269529.063266] convolution_var[13411]: unhandled signal 5 at 00003fff88e00000 nip 00003fff88e00000 lr 00003fffb6c87ce0 code 30001 [3269539.946696] _exception: 8 callbacks suppressed [3269539.946703] convolution_tes[14002]: unhandled signal 11 at 0000000000005359 nip 00003fff4a2b0008 lr 00003fff4a2b0004 code 30001 [3269540.270205] convolution_tes[14014]: unhandled signal 11 at 000000000000535a nip 00003fff5d8f0000 lr 00003fff8bba8d58 code 30001 [3269540.370546] convolution_tes[14007]: unhandled signal 4 at 00003fff4e3d0000 nip 00003fff4e3d0000 lr 00003fff7c688d58 code 30001 [3269540.410762] convolution_tes[14057]: unhandled signal 4 at 00003fff6e140004 nip 00003fff6e140004 lr 00003fff9c3f8d58 code 30001 [3269540.426502] convolution_tes[14034]: unhandled signal 11 at 0000000000005359 nip 00003fff5fd10008 lr 00003fff5fd10004 code 30001 [3269540.702543] convolution_tes[14059]: unhandled signal 11 at 00003fff63518b50 nip 00003fff63518b50 lr 00003fff91628d58 code 30002 [3269542.514020] convolution_tes[14155]: unhandled signal 11 at 0000000000005357 nip 00003fff63c40008 lr 00003fff63c40004 code 30001 [3269542.879959] convolution_tes[14889]: unhandled signal 5 at 00003fff87610030 nip 00003fff87610030 lr 00003fffb5497ce0 code 30001 [3269543.056385] convolution_tes[14979]: unhandled signal 5 at 00003fff85bf0030 nip 00003fff85bf0030 lr 00003fffb3a77ce0 code 30001 [3269543.106248] convolution_tes[14809]: unhandled signal 11 at 0000000000006354 nip 00003fff78930008 lr 00003fff78930004 code 30001 [3269549.407969] _exception: 4 callbacks suppressed [3269549.407976] convolution_dim[15825]: unhandled signal 4 at 00003fff656201b0 nip 00003fff656201b0 lr 00003fff934a7ce0 code 30001 [3269549.407989] convolution_dim[15821]: unhandled signal 4 at 00003fff65620008 nip 00003fff65620008 lr 00003fff934a7ce0 code 30001 [3269549.691129] convolution_dim[15792]: unhandled signal 11 at 00003fff5b49535c nip 00003fff5b49535c lr 00003fff5af90004 code 30002 [3269553.222974] copy_test_cpu[16296]: unhandled signal 4 at 00003fff96790004 nip 00003fff96790004 lr 00003fffb0a38d58 code 30001 [3269553.346577] pad_test_cpu_pa[16409]: unhandled signal 4 at 00003fff5d7a0000 nip 00003fff5d7a0000 lr 00003fff8b627ce0 code 30001 [3269556.099815] params_test_cpu[16532]: unhandled signal 4 at 00003fff7d8b0008 nip 00003fff7d8b0008 lr 00003fffab737ce0 code 30001 [3269556.192880] prng_test_cpu_p[16637]: unhandled signal 11 at 00003fff7f178b48 nip 00003fff7f178b48 lr 00003fffacfd7ce0 code 30002 [3269556.870898] reshape_test_cp[16728]: unhandled signal 11 at 00003fff7b048b48 nip 00003fff7b048b48 lr 00003fffa8ea7ce0 code 30002 [3269556.903001] reshape_test_cp[16795]: unhandled signal 11 at 00003fff7c708b48 nip 00003fff7c708b48 lr 00003fffaa567ce0 code 30002 [3269557.003338] dot_operation_t[16891]: unhandled signal 4 at 00003fff66c70000 nip 00003fff66c70000 lr 00003fff94af7ce0 code 30001 [3269557.370482] reduce_test_cpu[16967]: unhandled signal 5 at 00003fff857a0000 nip 00003fff857a0000 lr 00003fffb3a37ce0 code 30001 [3269557.880800] dynamic_ops_tes[17047]: unhandled signal 5 at 00003fff73650000 nip 00003fff73650000 lr 00003fffa14d7ce0 code 30001 [3269560.308483] replay_test_cpu[17146]: unhandled signal 11 at 0000000000000100 nip 00003fff79300004 lr 00003fffa7187ce0 code 30001 [3269560.367931] dot_operation_s[17227]: unhandled signal 4 at 00003fff699e0000 nip 00003fff699e0000 lr 00003fff97867ce0 code 30001 [3269562.120943] slice_test_cpu_[17324]: unhandled signal 4 at 00003fff7fa10008 nip 00003fff7fa10008 lr 00003fffad897ce0 code 30001 [3269562.219657] slice_test_cpu_[17390]: unhandled signal 4 at 00003fff5a4d0008 nip 00003fff5a4d0008 lr 00003fff88357ce0 code 30001 [3269562.955471] vector_ops_redu[17512]: unhandled signal 11 at 00003fff57778b48 nip 00003fff57778b48 lr 00003fff855d7ce0 code 30002 [3269563.076629] multidimensiona[17593]: unhandled signal 5 at 00003fff57870004 nip 00003fff57870004 lr 00003fff856f7ce0 code 30001 [3269563.221596] slice_test_cpu_[17676]: unhandled signal 4 at 00003fff4cee0008 nip 00003fff4cee0008 lr 00003fff7adb7ce0 code 30001 [3269563.698994] reshape_motion_[17773]: unhandled signal 11 at 00003fff70e08b98 nip 00003fff70e08b98 lr 00003fff9ec67ce0 code 30002 [3269564.681067] select_test_cpu[17872]: unhandled signal 11 at 00003fff5ba08b48 nip 00003fff5ba08b48 lr 00003fff89867ce0 code 30002 [3269564.777619] scalar_computat[17953]: unhandled signal 4 at 00003fff6d3b0008 nip 00003fff6d3b0008 lr 00003fff9b237ce0 code 30001 [3269564.790486] scalar_computat[18034]: unhandled signal 5 at 00003fff83610000 nip 00003fff83610000 lr 00003fffb1497ce0 code 30001 [3269565.287122] scalar_computat[18115]: unhandled signal 11 at 00003fff86588b48 nip 00003fff86588b48 lr 00003fffb43e7ce0 code 30002 [3269569.216594] scalar_computat[18241]: unhandled signal 5 at 00003fff5b360004 nip 00003fff5b360004 lr 00003fff891e7ce0 code 30001 [3269569.621130] scalar_computat[18346]: unhandled signal 5 at 00003fff82d70004 nip 00003fff82d70004 lr 00003fffb0bf7ce0 code 30001 [3269569.710500] scalar_computat[18427]: unhandled signal 5 at 00003fff4b4f0000 nip 00003fff4b4f0000 lr 00003fff79377ce0 code 30001 [3269569.876037] scalar_computat[18514]: unhandled signal 5 at 00003fff76050000 nip 00003fff76050000 lr 00003fffa3ed7ce0 code 30001 [3269569.898662] scalar_computat[18606]: unhandled signal 11 at 00003fff7d7f8b48 nip 00003fff7d7f8b48 lr 00003fffab657ce0 code 30002 [3269570.506464] scalar_computat[18691]: unhandled signal 5 at 00003fff716a0000 nip 00003fff716a0000 lr 00003fff9f527ce0 code 30001 [3269570.599202] scalar_computat[18774]: unhandled signal 5 at 00003fff64410000 nip 00003fff64410000 lr 00003fff92297ce0 code 30001 [3269572.942730] scalar_computat[18867]: unhandled signal 5 at 00003fff77d30000 nip 00003fff77d30000 lr 00003fffa5bb7ce0 code 30001 [3269576.610680] scalar_computat[18966]: unhandled signal 5 at 00003fff87c00000 nip 00003fff87c00000 lr 00003fffb5a87ce0 code 30001 [3269576.708070] scalar_computat[19047]: unhandled signal 11 at 000000000000100c nip 000000000000100c lr 00003fff52a80008 code 30001 [3269581.598515] scalar_computat[19139]: unhandled signal 5 at 00003fff54490000 nip 00003fff54490000 lr 00003fff82317ce0 code 30001 [3269582.171060] scalar_computat[19237]: unhandled signal 4 at 00003fff68110008 nip 00003fff68110008 lr 00003fff95f97ce0 code 30001 [3269583.009677] scalar_computat[19337]: unhandled signal 4 at 00003fff67130008 nip 00003fff67130008 lr 00003fff94fb7ce0 code 30001 [3269583.292630] slice_test_cpu_[19413]: unhandled signal 4 at 00003fff6f110000 nip 00003fff6f110000 lr 00003fff9cf97ce0 code 30001 [3269583.448451] slice_test_cpu_[19497]: unhandled signal 4 at 00003fff7eac0000 nip 00003fff7eac0000 lr 00003fffac947ce0 code 30001 [3269584.161867] slice_test_cpu_[19598]: unhandled signal 4 at 00003fff78720000 nip 00003fff78720000 lr 00003fffa65a7ce0 code 30001 [3269584.600430] slice_test_cpu_[19679]: unhandled signal 5 at 00003fff6c510004 nip 00003fff6c510004 lr 00003fff9a397ce0 code 30001 [3269586.198292] slice_test_cpu_[19769]: unhandled signal 5 at 00003fff60dc0004 nip 00003fff60dc0004 lr 00003fff8ec47ce0 code 30001 [3269587.335554] slice_test_cpu_[19868]: unhandled signal 4 at 00003fff7c460008 nip 00003fff7c460008 lr 00003fffaa3a7ce0 code 30001 [3269587.337351] slice_test_cpu_[19945]: unhandled signal 4 at 00003fff4cf50008 nip 00003fff4cf50008 lr 00003fff7aea7ce0 code 30001 [3269587.812645] slice_test_cpu_[20039]: unhandled signal 5 at 00003fff60c60000 nip 00003fff60c60000 lr 00003fff8eae7ce0 code 30001 [3269593.957612] slice_test_cpu_[20237]: unhandled signal 5 at 00003fff6bc10000 nip 00003fff6bc10000 lr 00003fff99a97ce0 code 30001 [3269594.113130] slice_test_cpu_[20327]: unhandled signal 5 at 00003fff50680000 nip 00003fff50680000 lr 00003fff7e507ce0 code 30001 [3269594.478182] slice_test_cpu_[20451]: unhandled signal 5 at 00003fff49ed0004 nip 00003fff49ed0004 lr 00003fff77d57ce0 code 30001 [3269594.480120] slice_test_cpu_[20534]: unhandled signal 5 at 00003fff864f0000 nip 00003fff864f0000 lr 00003fffb4377ce0 code 30001 [3269594.910096] slice_test_cpu_[20641]: unhandled signal 5 at 00003fff71b90004 nip 00003fff71b90004 lr 00003fff9fa17ce0 code 30001 [3269595.075412] slice_test_cpu_[20742]: unhandled signal 5 at 00003fff6e850004 nip 00003fff6e850004 lr 00003fff9c6d7ce0 code 30001 [3269595.201874] slice_test_cpu_[20823]: unhandled signal 5 at 00003fff860c0000 nip 00003fff860c0000 lr 00003fffb3f47ce0 code 30001 [3269595.376406] slice_test_cpu_[20905]: unhandled signal 5 at 00003fff840d0000 nip 00003fff840d0000 lr 00003fffb1f57ce0 code 30001 [3269595.392470] slice_test_cpu_[20980]: unhandled signal 4 at 00003fff590b0000 nip 00003fff590b0000 lr 00003fff86f37ce0 code 30001 [3269595.956190] slice_test_cpu_[21073]: unhandled signal 4 at 00003fff4f540000 nip 00003fff4f540000 lr 00003fff7d3c7ce0 code 30001 [3269599.193940] _exception: 4 callbacks suppressed [3269599.193949] reshape_test_cp[21584]: unhandled signal 4 at 00003fff81e20000 nip 00003fff81e20000 lr 00003fffafca7ce0 code 30001 [3269599.216800] slice_test_cpu_[21665]: unhandled signal 4 at 00003fff69f70000 nip 00003fff69f70000 lr 00003fff97e67ce0 code 30001 [3269599.445597] reshape_test_cp[21746]: unhandled signal 4 at 00003fff78d40000 nip 00003fff78d40000 lr 00003fffa6bc7ce0 code 30001 [3269602.512667] reshape_test_cp[21841]: unhandled signal 11 at 00003fff52e88b48 nip 00003fff52e88b48 lr 00003fff80ce7ce0 code 30002 [3269602.605673] reshape_test_cp[21936]: unhandled signal 11 at 00003fff54a68b48 nip 00003fff54a68b48 lr 00003fff828c7ce0 code 30002 [3269603.484456] reshape_test_cp[22051]: unhandled signal 11 at 00003fff5b038b50 nip 00003fff5b038b50 lr 00003fff5b010004 code 30002 [3269603.644983] reshape_test_cp[22144]: unhandled signal 4 at 00003fff73370000 nip 00003fff73370000 lr 00003fffa11f7ce0 code 30001 [3269603.695153] reshape_test_cp[22225]: unhandled signal 11 at 00003fff80e08b48 nip 00003fff80e08b48 lr 00003fffaec67ce0 code 30002 [3269603.856123] reshape_test_cp[22306]: unhandled signal 4 at 00003fff684e0000 nip 00003fff684e0000 lr 00003fff96367ce0 code 30001 [3269604.061299] reshape_test_cp[22396]: unhandled signal 11 at 0000000000006354 nip 00003fff51890008 lr 00003fff51890004 code 30001 [3269604.457348] reshape_test_cp[22478]: unhandled signal 4 at 00003fff72eb0000 nip 00003fff72eb0000 lr 00003fffa0d37ce0 code 30001 [3269604.642991] reshape_test_cp[22559]: unhandled signal 11 at 0000000000006354 nip 00003fff61d20008 lr 00003fff61d20004 code 30001 [3269605.527665] reshape_test_cp[22658]: unhandled signal 4 at 00003fff713e0000 nip 00003fff713e0000 lr 00003fff9f267ce0 code 30001 [3269605.976692] reshape_test_cp[22748]: unhandled signal 11 at 00003fff87608b48 nip 00003fff87608b48 lr 00003fffb5467ce0 code 30002 [3269605.992050] reshape_test_cp[22829]: unhandled signal 11 at 00003fff518c8b50 nip 00003fff518c8b50 lr 00003fff518a0004 code 30002 [3269608.472197] reshape_test_cp[22919]: unhandled signal 11 at 00003fff79bb8b48 nip 00003fff79bb8b48 lr 00003fffa7a17ce0 code 30002 [3269611.248566] reshape_test_cp[23045]: unhandled signal 11 at 0000000000006354 nip 00003fff81aa0008 lr 00003fff81aa0004 code 30001 [3269611.412038] reshape_test_cp[23138]: unhandled signal 11 at 0000000000006354 nip 00003fff80170008 lr 00003fff80170004 code 30001 [3269612.034633] reshape_test_cp[23249]: unhandled signal 4 at 00003fff79bb0000 nip 00003fff79bb0000 lr 00003fffa7a37ce0 code 30001 [3269612.349955] reshape_test_cp[23341]: unhandled signal 11 at 00003fff65c68b48 nip 00003fff65c68b48 lr 00003fff93ac7ce0 code 30002 [3269612.369781] reshape_test_cp[23424]: unhandled signal 11 at 0000000000006354 nip 00003fff7f190008 lr 00003fff7f190004 code 30001 [3269612.496757] reshape_test_cp[23587]: unhandled signal 4 at 00003fff81db0008 nip 00003fff81db0008 lr 00003fffafc37ce0 code 30001 [3269612.631287] reshape_test_cp[23693]: unhandled signal 11 at 00003fff6db38b50 nip 00003fff6db38b50 lr 00003fff6db10004 code 30002 [3269612.639145] reshape_test_cp[23677]: unhandled signal 11 at 0000000000006354 nip 00003fff49750008 lr 00003fff49750004 code 30001 [3269612.935010] reshape_test_cp[23932]: unhandled signal 4 at 00003fff7ef00000 nip 00003fff7ef00000 lr 00003fffacd87ce0 code 30001 [3269613.204962] reshape_test_cp[24005]: unhandled signal 11 at 0000000000006354 nip 00003fff6e890008 lr 00003fff6e890004 code 30001 [3269622.226190] _exception: 1 callbacks suppressed [3269622.226199] reduce_test_cpu[24212]: unhandled signal 5 at 00003fff563f0000 nip 00003fff563f0000 lr 00003fff84277ce0 code 30001 [3269622.452519] reduce_test_cpu[24314]: unhandled signal 11 at 00003fff7d7943e1 nip 00003fff5c780008 lr 00003fff8a607ce0 code 30002 [3269622.733732] reduce_test_cpu[24394]: unhandled signal 5 at 00003fff4c8e0000 nip 00003fff4c8e0000 lr 00003fff7a767ce0 code 30001 [3269622.965474] reduce_test_cpu[24489]: unhandled signal 11 at 00003fff4e1c8b48 nip 00003fff4e1c8b48 lr 00003fff7c027ce0 code 30002 [3269623.056180] reduce_test_cpu[24570]: unhandled signal 11 at 00003fff85a18b48 nip 00003fff85a18b48 lr 00003fffb3877ce0 code 30002 [3269623.126112] reduce_test_cpu[24651]: unhandled signal 5 at 00003fff73240000 nip 00003fff73240000 lr 00003fffa10c7ce0 code 30001 [3269623.346425] reduce_test_cpu[24742]: unhandled signal 11 at 00003fff708d8b48 nip 00003fff708d8b48 lr 00003fff9e737ce0 code 30002 [3269623.850463] reduce_test_cpu[24823]: unhandled signal 5 at 00003fff72f70000 nip 00003fff72f70000 lr 00003fffa0df7ce0 code 30001 [3269627.974103] reduce_test_cpu[24992]: unhandled signal 4 at 00003fff72600000 nip 00003fff72600000 lr 00003fffa0487ce0 code 30001 [3269628.219758] reduce_test_cpu[25085]: unhandled signal 11 at c0000005b700c08b nip 00003fff7b570004 lr 00003fffa94f7ce0 code 30001 [3269628.255963] reduce_test_cpu[25161]: unhandled signal 5 at 00003fff4acc0000 nip 00003fff4acc0000 lr 00003fff78b47ce0 code 30001 [3269628.304725] reduce_test_cpu[25236]: unhandled signal 5 at 00003fff69bc0000 nip 00003fff69bc0000 lr 00003fff97a47ce0 code 30001 [3269628.397040] reduce_test_cpu[25324]: unhandled signal 5 at 00003fff81880000 nip 00003fff81880000 lr 00003fffaf707ce0 code 30001 [3269628.463472] reduce_test_cpu[25410]: unhandled signal 4 at 00003fff648b0008 nip 00003fff648b0008 lr 00003fff92737ce0 code 30001 [3269629.249223] reduce_test_cpu[25560]: unhandled signal 11 at 00003fff6c718b48 nip 00003fff6c718b48 lr 00003fff9a577ce0 code 30002 [3269629.249869] reduce_test_cpu[25491]: unhandled signal 4 at 00003fff4fe20000 nip 00003fff4fe20000 lr 00003fff7e267ce0 code 30001 [3269629.291868] reduce_test_cpu[25653]: unhandled signal 5 at 00003fff593c0000 nip 00003fff593c0000 lr 00003fff87247ce0 code 30001 [3269629.316239] reduce_test_cpu[25736]: unhandled signal 4 at 00003fff4af30000 nip 00003fff4af30000 lr 00003fff78db7ce0 code 30001 [3269633.231330] _exception: 1 callbacks suppressed [3269633.231337] reduce_test_cpu[25990]: unhandled signal 11 at 00003fff4f0c8b48 nip 00003fff4f0c8b48 lr 00003fff7cf27ce0 code 30002 [3269633.323894] reduce_test_cpu[26070]: unhandled signal 11 at 00003fff53008b48 nip 00003fff53008b48 lr 00003fff80e67ce0 code 30002 [3269633.551347] reduce_test_cpu[26161]: unhandled signal 11 at 00003fff9f4143e1 nip 00003fff7ec00008 lr 00003fffaca87ce0 code 30002 [3269633.600659] reduce_test_cpu[26234]: unhandled signal 5 at 00003fff88dd0000 nip 00003fff88dd0000 lr 00003fffb6c57ce0 code 30001 [3269633.639976] reduce_test_cpu[26323]: unhandled signal 11 at 00003fff6d2e8b48 nip 00003fff6d2e8b48 lr 00003fff9b147ce0 code 30002 [3269633.944369] reduce_test_cpu[26488]: unhandled signal 11 at 00003fff80b58b48 nip 00003fff80b58b48 lr 00003fffae9b7ce0 code 30002 [3269634.096959] reduce_test_cpu[26650]: unhandled signal 5 at 00003fff5f520000 nip 00003fff5f520000 lr 00003fff8d3a7ce0 code 30001 [3269634.098910] reduce_test_cpu[26407]: unhandled signal 5 at 00003fff4cfd0000 nip 00003fff4cfd0000 lr 00003fff7b417ce0 code 30001 [3269634.138050] reduce_test_cpu[26728]: unhandled signal 5 at 00003fff51e10000 nip 00003fff51e10000 lr 00003fff7fc97ce0 code 30001 [3269634.198210] reduce_test_cpu[26799]: unhandled signal 11 at 00003fff52758b48 nip 00003fff52758b48 lr 00003fff805b7ce0 code 30002 [3269641.876559] _exception: 2 callbacks suppressed [3269641.876568] reduce_test_cpu[27004]: unhandled signal 5 at 00003fff67700000 nip 00003fff67700000 lr 00003fff95587ce0 code 30001 [3269641.881005] reduce_test_cpu[27043]: unhandled signal 11 at c0000005eefe008b nip 00003fff59770004 lr 00003fff876f7ce0 code 30001 [3269642.639571] reduce_test_cpu[27183]: unhandled signal 5 at 00003fff7f4f0000 nip 00003fff7f4f0000 lr 00003fffad377ce0 code 30001 [3269644.519379] reduce_test_cpu[27296]: unhandled signal 5 at 00003fff60340000 nip 00003fff60340000 lr 00003fff8e1c7ce0 code 30001 [3269644.778430] reduce_test_cpu[27378]: unhandled signal 5 at 00003fff4eb40000 nip 00003fff4eb40000 lr 00003fff7ca67ce0 code 30001 [3269645.284242] reduce_test_cpu[27473]: unhandled signal 5 at 00003fff74ec0000 nip 00003fff74ec0000 lr 00003fffa2d47ce0 code 30001 [3269645.538095] reduce_test_cpu[27555]: unhandled signal 5 at 00003fff84c80000 nip 00003fff84c80000 lr 00003fffb2b07ce0 code 30001 [3269647.309798] reduce_test_cpu[27649]: unhandled signal 5 at 00003fff82a30000 nip 00003fff82a30000 lr 00003fffb08b7ce0 code 30001 [ ''' return returncode, output @staticmethod def lscpu(): returncode = 0 output = r''' Architecture: ppc64le Byte Order: Little Endian CPU(s): 16 On-line CPU(s) list: 0-15 Thread(s) per core: 1 Core(s) per socket: 16 Socket(s): 1 NUMA node(s): 1 Model: 2.1 (pvr 004b 0201) Model name: POWER8E (raw), altivec supported L1d cache: 64K L1i cache: 32K NUMA node0 CPU(s): 0-15 ''' return returncode, output class TestLinuxRHEL_7_3_ppc64le(unittest.TestCase): def setUp(self): helpers.backup_data_source(cpuinfo) helpers.monkey_patch_data_source(cpuinfo, MockDataSource) def tearDown(self): helpers.restore_data_source(cpuinfo) ''' Make sure calls return the expected number of fields. ''' def test_returns(self): self.assertEqual(0, len(cpuinfo._get_cpu_info_from_registry())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpufreq_info())) self.assertEqual(3, len(cpuinfo._get_cpu_info_from_lscpu())) self.assertEqual(5, len(cpuinfo._get_cpu_info_from_proc_cpuinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysctl())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_kstat())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_dmesg())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cat_var_run_dmesg_boot())) self.assertEqual(1, len(cpuinfo._get_cpu_info_from_ibm_pa_features())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpuid())) self.assertEqual(15, len(cpuinfo._get_cpu_info_internal())) def test_get_cpu_info_from_lscpu(self): info = cpuinfo._get_cpu_info_from_lscpu() self.assertEqual(32 * 1024, info['l1_instruction_cache_size']) self.assertEqual(64 * 1024, info['l1_data_cache_size']) self.assertEqual('POWER8E (raw), altivec supported', info['brand_raw']) def test_get_cpu_info_from_ibm_pa_features(self): info = cpuinfo._get_cpu_info_from_ibm_pa_features() self.assertEqual( ['dss_2.02', 'dss_2.05', 'dss_2.06', 'fpu', 'lsd_in_dscr', 'ppr', 'slb', 'sso_2.06', 'ugr_in_dscr'], info['flags'] ) def test_get_cpu_info_from_proc_cpuinfo(self): info = cpuinfo._get_cpu_info_from_proc_cpuinfo() self.assertEqual('POWER8E (raw), altivec supported', info['brand_raw']) self.assertEqual('3.4250 GHz', info['hz_advertised_friendly']) self.assertEqual('3.4250 GHz', info['hz_actual_friendly']) self.assertEqual((3425000000, 0), info['hz_advertised']) self.assertEqual((3425000000, 0), info['hz_actual']) def test_all(self): info = cpuinfo._get_cpu_info_internal() self.assertEqual('POWER8E (raw), altivec supported', info['brand_raw']) self.assertEqual('3.4250 GHz', info['hz_advertised_friendly']) self.assertEqual('3.4250 GHz', info['hz_actual_friendly']) self.assertEqual((3425000000, 0), info['hz_advertised']) self.assertEqual((3425000000, 0), info['hz_actual']) self.assertEqual('PPC_64', info['arch']) self.assertEqual(32 * 1024, info['l1_instruction_cache_size']) self.assertEqual(64 * 1024, info['l1_data_cache_size']) self.assertEqual(64, info['bits']) self.assertEqual(16, info['count']) self.assertEqual('ppc64le', info['arch_string_raw']) self.assertEqual( ['dss_2.02', 'dss_2.05', 'dss_2.06', 'fpu', 'lsd_in_dscr', 'ppr', 'slb', 'sso_2.06', 'ugr_in_dscr'], info['flags'] ) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/tests/test_linux_ubuntu_16_04_x86_64.py0000664000175000017500000007331114325641176021530 0ustar00mattmatt import unittest from cpuinfo import * import helpers class MockDataSource(object): bits = '64bit' cpu_count = 2 is_windows = False arch_string_raw = 'x86_64' uname_string_raw = 'x86_64' can_cpuid = False @staticmethod def has_proc_cpuinfo(): return True @staticmethod def has_lscpu(): return True @staticmethod def has_dmesg(): return True @staticmethod def cat_proc_cpuinfo(): returncode = 0 output = r''' processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 42 model name : Intel(R) Pentium(R) CPU G640 @ 2.80GHz stepping : 7 microcode : 0x29 cpu MHz : 1901.375 cache size : 3072 KB physical id : 0 siblings : 2 core id : 0 cpu cores : 2 apicid : 0 initial apicid : 0 fpu : yes fpu_exception : yes cpuid level : 13 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 popcnt tsc_deadline_timer xsave lahf_lm epb tpr_shadow vnmi flexpriority ept vpid xsaveopt dtherm arat pln pts bugs : bogomips : 5587.32 clflush size : 64 cache_alignment : 64 address sizes : 36 bits physical, 48 bits virtual power management: processor : 1 vendor_id : GenuineIntel cpu family : 6 model : 42 model name : Intel(R) Pentium(R) CPU G640 @ 2.80GHz stepping : 7 microcode : 0x29 cpu MHz : 2070.796 cache size : 3072 KB physical id : 0 siblings : 2 core id : 1 cpu cores : 2 apicid : 2 initial apicid : 2 fpu : yes fpu_exception : yes cpuid level : 13 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 popcnt tsc_deadline_timer xsave lahf_lm epb tpr_shadow vnmi flexpriority ept vpid xsaveopt dtherm arat pln pts bugs : bogomips : 5587.32 clflush size : 64 cache_alignment : 64 address sizes : 36 bits physical, 48 bits virtual power management: ''' return returncode, output @staticmethod def lscpu(): returncode = 0 output = r''' Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 2 On-line CPU(s) list: 0,1 Thread(s) per core: 1 Core(s) per socket: 2 Socket(s): 1 NUMA node(s): 1 Vendor ID: GenuineIntel CPU family: 6 Model: 42 Model name: Intel(R) Pentium(R) CPU G640 @ 2.80GHz Stepping: 7 CPU MHz: 2070.796 CPU max MHz: 2800.0000 CPU min MHz: 1600.0000 BogoMIPS: 5587.32 Virtualization: VT-x L1d cache: 32K L1i cache: 32K L2 cache: 256K L3 cache: 3072K NUMA node0 CPU(s): 0,1 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 popcnt tsc_deadline_timer xsave lahf_lm epb tpr_shadow vnmi flexpriority ept vpid xsaveopt dtherm arat pln pts ''' return returncode, output @staticmethod def dmesg_a(): returncode = 0 output = r''' [ 0.000000] microcode: CPU0 microcode updated early to revision 0x29, date = 2013-06-12 [ 0.000000] Initializing cgroup subsys cpuset [ 0.000000] Initializing cgroup subsys cpu [ 0.000000] Initializing cgroup subsys cpuacct [ 0.000000] Linux version 4.4.0-64-generic (buildd@lgw01-56) (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4) ) #85-Ubuntu SMP Mon Feb 20 11:50:30 UTC 2017 (Ubuntu 4.4.0-64.85-generic 4.4.44) [ 0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-4.4.0-64-generic root=UUID=9112213a-3570-4904-8969-d5aab8825f6b ro quiet splash vt.handoff=7 [ 0.000000] KERNEL supported cpus: [ 0.000000] Intel GenuineIntel [ 0.000000] AMD AuthenticAMD [ 0.000000] Centaur CentaurHauls [ 0.000000] x86/fpu: Supporting XSAVE feature 0x01: 'x87 floating point registers' [ 0.000000] x86/fpu: Supporting XSAVE feature 0x02: 'SSE registers' [ 0.000000] x86/fpu: Enabled xstate features 0x3, context size is 576 bytes, using 'standard' format. [ 0.000000] x86/fpu: Using 'eager' FPU context switches. [ 0.000000] e820: BIOS-provided physical RAM map: [ 0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009d7ff] usable [ 0.000000] BIOS-e820: [mem 0x000000000009d800-0x000000000009ffff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000000e0000-0x00000000000fffff] reserved [ 0.000000] BIOS-e820: [mem 0x0000000000100000-0x000000001fffffff] usable [ 0.000000] BIOS-e820: [mem 0x0000000020000000-0x00000000201fffff] reserved [ 0.000000] BIOS-e820: [mem 0x0000000020200000-0x000000003fffffff] usable [ 0.000000] BIOS-e820: [mem 0x0000000040000000-0x00000000401fffff] reserved [ 0.000000] BIOS-e820: [mem 0x0000000040200000-0x00000000d878dfff] usable [ 0.000000] BIOS-e820: [mem 0x00000000d878e000-0x00000000d8792fff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000d8793000-0x00000000d8796fff] usable [ 0.000000] BIOS-e820: [mem 0x00000000d8797000-0x00000000d8db1fff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000d8db2000-0x00000000d9018fff] ACPI NVS [ 0.000000] BIOS-e820: [mem 0x00000000d9019000-0x00000000d9024fff] ACPI data [ 0.000000] BIOS-e820: [mem 0x00000000d9025000-0x00000000d9031fff] ACPI NVS [ 0.000000] BIOS-e820: [mem 0x00000000d9032000-0x00000000d9036fff] ACPI data [ 0.000000] BIOS-e820: [mem 0x00000000d9037000-0x00000000d9079fff] ACPI NVS [ 0.000000] BIOS-e820: [mem 0x00000000d907a000-0x00000000d9d3dfff] usable [ 0.000000] BIOS-e820: [mem 0x00000000d9d3e000-0x00000000d9ff1fff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000d9ff2000-0x00000000d9ffffff] usable [ 0.000000] BIOS-e820: [mem 0x00000000db000000-0x00000000df1fffff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000f8000000-0x00000000fbffffff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000fec00000-0x00000000fec00fff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000fed00000-0x00000000fed03fff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000fed1c000-0x00000000fed1ffff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000fee00000-0x00000000fee00fff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000ff000000-0x00000000ffffffff] reserved [ 0.000000] BIOS-e820: [mem 0x0000000100000000-0x000000041fdfffff] usable [ 0.000000] NX (Execute Disable) protection: active [ 0.000000] SMBIOS 2.7 present. [ 0.000000] DMI: Hewlett-Packard s5-1224/2ADA, BIOS 7.11 04/28/2012 [ 0.000000] e820: update [mem 0x00000000-0x00000fff] usable ==> reserved [ 0.000000] e820: remove [mem 0x000a0000-0x000fffff] usable [ 0.000000] e820: last_pfn = 0x41fe00 max_arch_pfn = 0x400000000 [ 0.000000] MTRR default type: uncachable [ 0.000000] MTRR fixed ranges enabled: [ 0.000000] 00000-9FFFF write-back [ 0.000000] A0000-BFFFF uncachable [ 0.000000] C0000-CFFFF write-protect [ 0.000000] D0000-E7FFF uncachable [ 0.000000] E8000-FFFFF write-protect [ 0.000000] MTRR variable ranges enabled: [ 0.000000] 0 base 000000000 mask C00000000 write-back [ 0.000000] 1 base 400000000 mask FE0000000 write-back [ 0.000000] 2 base 0E0000000 mask FE0000000 uncachable [ 0.000000] 3 base 0DC000000 mask FFC000000 uncachable [ 0.000000] 4 base 0DB000000 mask FFF000000 uncachable [ 0.000000] 5 base 41FE00000 mask FFFE00000 uncachable [ 0.000000] 6 disabled [ 0.000000] 7 disabled [ 0.000000] 8 disabled [ 0.000000] 9 disabled [ 0.000000] x86/PAT: Configuration [0-7]: WB WC UC- UC WB WC UC- WT [ 0.000000] original variable MTRRs [ 0.000000] reg 0, base: 0GB, range: 16GB, type WB [ 0.000000] reg 1, base: 16GB, range: 512MB, type WB [ 0.000000] reg 2, base: 3584MB, range: 512MB, type UC [ 0.000000] reg 3, base: 3520MB, range: 64MB, type UC [ 0.000000] reg 4, base: 3504MB, range: 16MB, type UC [ 0.000000] reg 5, base: 16894MB, range: 2MB, type UC [ 0.000000] total RAM covered: 16302M [ 0.000000] Found optimal setting for mtrr clean up [ 0.000000] gran_size: 64K chunk_size: 128M num_reg: 9 lose cover RAM: 0G [ 0.000000] New variable MTRRs [ 0.000000] reg 0, base: 0GB, range: 2GB, type WB [ 0.000000] reg 1, base: 2GB, range: 1GB, type WB [ 0.000000] reg 2, base: 3GB, range: 512MB, type WB [ 0.000000] reg 3, base: 3504MB, range: 16MB, type UC [ 0.000000] reg 4, base: 3520MB, range: 64MB, type UC [ 0.000000] reg 5, base: 4GB, range: 4GB, type WB [ 0.000000] reg 6, base: 8GB, range: 8GB, type WB [ 0.000000] reg 7, base: 16GB, range: 512MB, type WB [ 0.000000] reg 8, base: 16894MB, range: 2MB, type UC [ 0.000000] e820: update [mem 0xdb000000-0xffffffff] usable ==> reserved [ 0.000000] e820: last_pfn = 0xda000 max_arch_pfn = 0x400000000 [ 0.000000] found SMP MP-table at [mem 0x000fcc40-0x000fcc4f] mapped at [ffff8800000fcc40] [ 0.000000] Scanning 1 areas for low memory corruption [ 0.000000] Base memory trampoline at [ffff880000097000] 97000 size 24576 [ 0.000000] reserving inaccessible SNB gfx pages [ 0.000000] BRK [0x0220c000, 0x0220cfff] PGTABLE [ 0.000000] BRK [0x0220d000, 0x0220dfff] PGTABLE [ 0.000000] BRK [0x0220e000, 0x0220efff] PGTABLE [ 0.000000] BRK [0x0220f000, 0x0220ffff] PGTABLE [ 0.000000] BRK [0x02210000, 0x02210fff] PGTABLE [ 0.000000] BRK [0x02211000, 0x02211fff] PGTABLE [ 0.000000] RAMDISK: [mem 0x337fe000-0x35bf6fff] [ 0.000000] ACPI: Early table checksum verification disabled [ 0.000000] ACPI: RSDP 0x00000000000F0450 000024 (v02 HPQOEM) [ 0.000000] ACPI: XSDT 0x00000000D9019078 00006C (v01 HPQOEM SLIC-CPC 01072009 AMI 00010013) [ 0.000000] ACPI: FACP 0x00000000D90227B8 0000F4 (v04 HPQOEM SLIC-CPC 01072009 AMI 00010013) [ 0.000000] ACPI: DSDT 0x00000000D9019170 009645 (v02 HPQOEM SLIC-CPC 00000711 INTL 20051117) [ 0.000000] ACPI: FACS 0x00000000D9030F80 000040 [ 0.000000] ACPI: APIC 0x00000000D90228B0 000062 (v03 HPQOEM SLIC-CPC 01072009 AMI 00010013) [ 0.000000] ACPI: MCFG 0x00000000D9022918 00003C (v01 HPQOEM SLIC-CPC 01072009 MSFT 00000097) [ 0.000000] ACPI: SLIC 0x00000000D9022958 000176 (v01 HPQOEM SLIC-CPC 01072009 AMI 00010013) [ 0.000000] ACPI: HPET 0x00000000D9022AD0 000038 (v01 HPQOEM SLIC-CPC 01072009 AMI. 00000005) [ 0.000000] ACPI: SSDT 0x00000000D9022B08 00036D (v01 HPQOEM SLIC-CPC 00001000 INTL 20091112) [ 0.000000] ACPI: SSDT 0x00000000D9022E78 0008E4 (v01 HPQOEM SLIC-CPC 00003000 INTL 20051117) [ 0.000000] ACPI: SSDT 0x00000000D9023760 000A92 (v01 HPQOEM SLIC-CPC 00003000 INTL 20051117) [ 0.000000] ACPI: DBGP 0x00000000D90241F8 000034 (v01 HPQOEM SLIC-CPC 01072009 AMI 00010013) [ 0.000000] ACPI: Local APIC address 0xfee00000 [ 0.000000] No NUMA configuration found [ 0.000000] Faking a node at [mem 0x0000000000000000-0x000000041fdfffff] [ 0.000000] NODE_DATA(0) allocated [mem 0x41fdea000-0x41fdeefff] [ 0.000000] Zone ranges: [ 0.000000] DMA [mem 0x0000000000001000-0x0000000000ffffff] [ 0.000000] DMA32 [mem 0x0000000001000000-0x00000000ffffffff] [ 0.000000] Normal [mem 0x0000000100000000-0x000000041fdfffff] [ 0.000000] Device empty [ 0.000000] Movable zone start for each node [ 0.000000] Early memory node ranges [ 0.000000] node 0: [mem 0x0000000000001000-0x000000000009cfff] [ 0.000000] node 0: [mem 0x0000000000100000-0x000000001fffffff] [ 0.000000] node 0: [mem 0x0000000020200000-0x000000003fffffff] [ 0.000000] node 0: [mem 0x0000000040200000-0x00000000d878dfff] [ 0.000000] node 0: [mem 0x00000000d8793000-0x00000000d8796fff] [ 0.000000] node 0: [mem 0x00000000d907a000-0x00000000d9d3dfff] [ 0.000000] node 0: [mem 0x00000000d9ff2000-0x00000000d9ffffff] [ 0.000000] node 0: [mem 0x0000000100000000-0x000000041fdfffff] [ 0.000000] Initmem setup node 0 [mem 0x0000000000001000-0x000000041fdfffff] [ 0.000000] On node 0 totalpages: 4165120 [ 0.000000] DMA zone: 64 pages used for memmap [ 0.000000] DMA zone: 156 pages reserved [ 0.000000] DMA zone: 3996 pages, LIFO batch:0 [ 0.000000] DMA32 zone: 13826 pages used for memmap [ 0.000000] DMA32 zone: 884836 pages, LIFO batch:31 [ 0.000000] Normal zone: 51192 pages used for memmap [ 0.000000] Normal zone: 3276288 pages, LIFO batch:31 [ 0.000000] Reserving Intel graphics stolen memory at 0xdb200000-0xdf1fffff [ 0.000000] ACPI: PM-Timer IO Port: 0x408 [ 0.000000] ACPI: Local APIC address 0xfee00000 [ 0.000000] ACPI: LAPIC_NMI (acpi_id[0xff] high edge lint[0x1]) [ 0.000000] IOAPIC[0]: apic_id 2, version 32, address 0xfec00000, GSI 0-23 [ 0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl) [ 0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level) [ 0.000000] ACPI: IRQ0 used by override. [ 0.000000] ACPI: IRQ9 used by override. [ 0.000000] Using ACPI (MADT) for SMP configuration information [ 0.000000] ACPI: HPET id: 0x8086a701 base: 0xfed00000 [ 0.000000] smpboot: Allowing 2 CPUs, 0 hotplug CPUs [ 0.000000] PM: Registered nosave memory: [mem 0x00000000-0x00000fff] [ 0.000000] PM: Registered nosave memory: [mem 0x0009d000-0x0009dfff] [ 0.000000] PM: Registered nosave memory: [mem 0x0009e000-0x0009ffff] [ 0.000000] PM: Registered nosave memory: [mem 0x000a0000-0x000dffff] [ 0.000000] PM: Registered nosave memory: [mem 0x000e0000-0x000fffff] [ 0.000000] PM: Registered nosave memory: [mem 0x20000000-0x201fffff] [ 0.000000] PM: Registered nosave memory: [mem 0x40000000-0x401fffff] [ 0.000000] PM: Registered nosave memory: [mem 0xd878e000-0xd8792fff] [ 0.000000] PM: Registered nosave memory: [mem 0xd8797000-0xd8db1fff] [ 0.000000] PM: Registered nosave memory: [mem 0xd8db2000-0xd9018fff] [ 0.000000] PM: Registered nosave memory: [mem 0xd9019000-0xd9024fff] [ 0.000000] PM: Registered nosave memory: [mem 0xd9025000-0xd9031fff] [ 0.000000] PM: Registered nosave memory: [mem 0xd9032000-0xd9036fff] [ 0.000000] PM: Registered nosave memory: [mem 0xd9037000-0xd9079fff] [ 0.000000] PM: Registered nosave memory: [mem 0xd9d3e000-0xd9ff1fff] [ 0.000000] PM: Registered nosave memory: [mem 0xda000000-0xdaffffff] [ 0.000000] PM: Registered nosave memory: [mem 0xdb000000-0xdf1fffff] [ 0.000000] PM: Registered nosave memory: [mem 0xdf200000-0xf7ffffff] [ 0.000000] PM: Registered nosave memory: [mem 0xf8000000-0xfbffffff] [ 0.000000] PM: Registered nosave memory: [mem 0xfc000000-0xfebfffff] [ 0.000000] PM: Registered nosave memory: [mem 0xfec00000-0xfec00fff] [ 0.000000] PM: Registered nosave memory: [mem 0xfec01000-0xfecfffff] [ 0.000000] PM: Registered nosave memory: [mem 0xfed00000-0xfed03fff] [ 0.000000] PM: Registered nosave memory: [mem 0xfed04000-0xfed1bfff] [ 0.000000] PM: Registered nosave memory: [mem 0xfed1c000-0xfed1ffff] [ 0.000000] PM: Registered nosave memory: [mem 0xfed20000-0xfedfffff] [ 0.000000] PM: Registered nosave memory: [mem 0xfee00000-0xfee00fff] [ 0.000000] PM: Registered nosave memory: [mem 0xfee01000-0xfeffffff] [ 0.000000] PM: Registered nosave memory: [mem 0xff000000-0xffffffff] [ 0.000000] e820: [mem 0xdf200000-0xf7ffffff] available for PCI devices [ 0.000000] Booting paravirtualized kernel on bare hardware [ 0.000000] clocksource: refined-jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645519600211568 ns [ 0.000000] setup_percpu: NR_CPUS:512 nr_cpumask_bits:512 nr_cpu_ids:2 nr_node_ids:1 [ 0.000000] PERCPU: Embedded 33 pages/cpu @ffff88041fa00000 s98264 r8192 d28712 u1048576 [ 0.000000] pcpu-alloc: s98264 r8192 d28712 u1048576 alloc=1*2097152 [ 0.000000] pcpu-alloc: [0] 0 1 [ 0.000000] Built 1 zonelists in Node order, mobility grouping on. Total pages: 4099882 [ 0.000000] Policy zone: Normal [ 0.000000] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-4.4.0-64-generic root=UUID=9112213a-3570-4904-8969-d5aab8825f6b ro quiet splash vt.handoff=7 [ 0.000000] PID hash table entries: 4096 (order: 3, 32768 bytes) [ 0.000000] Calgary: detecting Calgary via BIOS EBDA area [ 0.000000] Calgary: Unable to locate Rio Grande table in EBDA - bailing! [ 0.000000] Memory: 16275716K/16660480K available (8452K kernel code, 1293K rwdata, 3980K rodata, 1488K init, 1316K bss, 384764K reserved, 0K cma-reserved) [ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1 [ 0.000000] Hierarchical RCU implementation. [ 0.000000] Build-time adjustment of leaf fanout to 64. [ 0.000000] RCU restricting CPUs from NR_CPUS=512 to nr_cpu_ids=2. [ 0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=64, nr_cpu_ids=2 [ 0.000000] NR_IRQS:33024 nr_irqs:440 16 [ 0.000000] vt handoff: transparent VT on vt#7 [ 0.000000] Console: colour dummy device 80x25 [ 0.000000] console [tty0] enabled [ 0.000000] clocksource: hpet: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 133484882848 ns [ 0.000000] hpet clockevent registered [ 0.000000] tsc: Fast TSC calibration using PIT [ 0.000000] tsc: Detected 2793.634 MHz processor [ 0.000031] Calibrating delay loop (skipped), value calculated using timer frequency.. 5587.26 BogoMIPS (lpj=11174536) [ 0.000033] pid_max: default: 32768 minimum: 301 [ 0.000038] ACPI: Core revision 20150930 [ 0.005982] ACPI: 4 ACPI AML tables successfully acquired and loaded [ 0.005999] Security Framework initialized [ 0.006001] Yama: becoming mindful. [ 0.006015] AppArmor: AppArmor initialized [ 0.006874] Dentry cache hash table entries: 2097152 (order: 12, 16777216 bytes) [ 0.009794] Inode-cache hash table entries: 1048576 (order: 11, 8388608 bytes) [ 0.011066] Mount-cache hash table entries: 32768 (order: 6, 262144 bytes) [ 0.011082] Mountpoint-cache hash table entries: 32768 (order: 6, 262144 bytes) [ 0.011317] Initializing cgroup subsys io [ 0.011320] Initializing cgroup subsys memory [ 0.011326] Initializing cgroup subsys devices [ 0.011328] Initializing cgroup subsys freezer [ 0.011330] Initializing cgroup subsys net_cls [ 0.011332] Initializing cgroup subsys perf_event [ 0.011334] Initializing cgroup subsys net_prio [ 0.011337] Initializing cgroup subsys hugetlb [ 0.011338] Initializing cgroup subsys pids [ 0.011357] CPU: Physical Processor ID: 0 [ 0.011358] CPU: Processor Core ID: 0 [ 0.011362] ENERGY_PERF_BIAS: Set to 'normal', was 'performance' [ 0.011363] ENERGY_PERF_BIAS: View and update with x86_energy_perf_policy(8) [ 0.011365] mce: CPU supports 7 MCE banks [ 0.011375] CPU0: Thermal monitoring enabled (TM1) [ 0.011381] process: using mwait in idle threads [ 0.011384] Last level iTLB entries: 4KB 512, 2MB 8, 4MB 8 [ 0.011384] Last level dTLB entries: 4KB 512, 2MB 32, 4MB 32, 1GB 0 [ 0.011758] Freeing SMP alternatives memory: 32K (ffffffff820b9000 - ffffffff820c1000) [ 0.015837] ftrace: allocating 32123 entries in 126 pages [ 0.029893] smpboot: APIC(0) Converting physical 0 to logical package 0 [ 0.029895] smpboot: Max logical packages: 1 [ 0.030318] ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1 [ 0.070006] TSC deadline timer enabled [ 0.070009] smpboot: CPU0: Intel(R) Pentium(R) CPU G640 @ 2.80GHz (family: 0x6, model: 0x2a, stepping: 0x7) [ 0.070028] Performance Events: PEBS fmt1+, 16-deep LBR, SandyBridge events, full-width counters, Intel PMU driver. [ 0.070047] ... version: 3 [ 0.070048] ... bit width: 48 [ 0.070049] ... generic registers: 8 [ 0.070050] ... value mask: 0000ffffffffffff [ 0.070051] ... max period: 00007fffffffffff [ 0.070051] ... fixed-purpose events: 3 [ 0.070052] ... event mask: 00000007000000ff [ 0.070751] x86: Booting SMP configuration: [ 0.070752] .... node #0, CPUs: #1 [ 0.071267] microcode: CPU1 microcode updated early to revision 0x29, date = 2013-06-12 [ 0.073348] x86: Booted up 1 node, 2 CPUs [ 0.073351] smpboot: Total of 2 processors activated (11174.53 BogoMIPS) [ 0.073388] NMI watchdog: enabled on all CPUs, permanently consumes one hw-PMU counter. [ 0.074762] devtmpfs: initialized [ 0.078897] evm: security.selinux [ 0.078899] evm: security.SMACK64 [ 0.078899] evm: security.SMACK64EXEC [ 0.078900] evm: security.SMACK64TRANSMUTE [ 0.078901] evm: security.SMACK64MMAP [ 0.078902] evm: security.ima [ 0.078903] evm: security.capability [ 0.078959] PM: Registering ACPI NVS region [mem 0xd8db2000-0xd9018fff] (2519040 bytes) [ 0.078988] PM: Registering ACPI NVS region [mem 0xd9025000-0xd9031fff] (53248 bytes) [ 0.078990] PM: Registering ACPI NVS region [mem 0xd9037000-0xd9079fff] (274432 bytes) [ 0.079062] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns [ 0.079131] pinctrl core: initialized pinctrl subsystem [ 0.079239] RTC time: 18:18:42, date: 03/01/17 [ 0.079337] NET: Registered protocol family 16 [ 0.090637] cpuidle: using governor ladder [ 0.097353] cpuidle: using governor menu [ 0.097358] PCCT header not found. [ 0.097447] ACPI FADT declares the system doesn't support PCIe ASPM, so disable it [ 0.097448] ACPI: bus type PCI registered [ 0.097450] acpiphp: ACPI Hot Plug PCI Controller Driver version: 0.5 [ 0.097510] PCI: MMCONFIG for domain 0000 [bus 00-3f] at [mem 0xf8000000-0xfbffffff] (base 0xf8000000) [ 0.097512] PCI: MMCONFIG at [mem 0xf8000000-0xfbffffff] reserved in E820 [ 0.097522] PCI: Using configuration type 1 for base access [ 0.097611] NMI watchdog: enabled on all CPUs, permanently consumes one hw-PMU counter. [ 0.097618] core: PMU erratum BJ122, BV98, HSD29 workaround disabled, HT off [ 0.109668] ACPI: Added _OSI(Module Device) [ 0.109670] ACPI: Added _OSI(Processor Device) [ 0.109671] ACPI: Added _OSI(3.0 _SCP Extensions) [ 0.109672] ACPI: Added _OSI(Processor Aggregator Device) [ 0.111896] ACPI: Executed 1 blocks of module-level executable AML code [ 0.114009] ACPI: Dynamic OEM Table Load: [ 0.114015] ACPI: SSDT 0xFFFF88040D710000 00083B (v01 PmRef Cpu0Cst 00003001 INTL 20051117) [ 0.114446] ACPI: Dynamic OEM Table Load: [ 0.114450] ACPI: SSDT 0xFFFF88040D02A000 000303 (v01 PmRef ApIst 00003000 INTL 20051117) [ 0.114826] ACPI: Dynamic OEM Table Load: [ 0.114829] ACPI: SSDT 0xFFFF88040D63AC00 000119 (v01 PmRef ApCst 00003000 INTL 20051117) [ 0.115263] ACPI: Interpreter enabled [ 0.115279] ACPI: (supports S0 S3 S4 S5) [ 0.115280] ACPI: Using IOAPIC for interrupt routing [ 0.115303] PCI: Using host bridge windows from ACPI; if necessary, use "pci=nocrs" and report a bug [ 0.120695] ACPI: Power Resource [FN00] (off) [ 0.120766] ACPI: Power Resource [FN01] (off) [ 0.120834] ACPI: Power Resource [FN02] (off) [ 0.120902] ACPI: Power Resource [FN03] (off) [ 0.120970] ACPI: Power Resource [FN04] (off) [ 0.121440] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-3e]) [ 0.121445] acpi PNP0A08:00: _OSC: OS supports [ExtendedConfig ASPM ClockPM Segments MSI] [ 0.121548] \_SB_.PCI0:_OSC invalid UUID [ 0.121549] _OSC request data:1 1f 0 [ 0.121553] acpi PNP0A08:00: _OSC failed (AE_ERROR); disabling ASPM [ 0.121947] PCI host bridge to bus 0000:00 [ 0.121950] pci_bus 0000:00: root bus resource [io 0x0000-0x0cf7 window] [ 0.121951] pci_bus 0000:00: root bus resource [io 0x0d00-0xffff window] ''' return returncode, output class TestLinuxUbuntu_16_04_X86_64(unittest.TestCase): def setUp(self): helpers.backup_data_source(cpuinfo) helpers.monkey_patch_data_source(cpuinfo, MockDataSource) def tearDown(self): helpers.restore_data_source(cpuinfo) ''' Make sure calls return the expected number of fields. ''' def test_returns(self): self.assertEqual(0, len(cpuinfo._get_cpu_info_from_registry())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpufreq_info())) self.assertEqual(14, len(cpuinfo._get_cpu_info_from_lscpu())) self.assertEqual(11, len(cpuinfo._get_cpu_info_from_proc_cpuinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysctl())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_kstat())) self.assertEqual(8, len(cpuinfo._get_cpu_info_from_dmesg())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cat_var_run_dmesg_boot())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_ibm_pa_features())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpuid())) self.assertEqual(21, len(cpuinfo._get_cpu_info_internal())) def test_get_cpu_info_from_lscpu(self): info = cpuinfo._get_cpu_info_from_lscpu() self.assertEqual('GenuineIntel', info['vendor_id_raw']) self.assertEqual('Intel(R) Pentium(R) CPU G640 @ 2.80GHz', info['brand_raw']) self.assertEqual('2.0708 GHz', info['hz_advertised_friendly']) self.assertEqual('2.0708 GHz', info['hz_actual_friendly']) self.assertEqual((2070796000, 0), info['hz_advertised']) self.assertEqual((2070796000, 0), info['hz_actual']) self.assertEqual(7, info['stepping']) self.assertEqual(42, info['model']) self.assertEqual(6, info['family']) self.assertEqual(32 * 1024, info['l1_instruction_cache_size']) self.assertEqual(32 * 1024, info['l1_data_cache_size']) self.assertEqual(256 * 1024, info['l2_cache_size']) self.assertEqual(3072 * 1024, info['l3_cache_size']) self.assertEqual( ['acpi', 'aperfmperf', 'apic', 'arat', 'arch_perfmon', 'bts', 'clflush', 'cmov', 'constant_tsc', 'cx16', 'cx8', 'de', 'ds_cpl', 'dtes64', 'dtherm', 'dts', 'eagerfpu', 'epb', 'ept', 'est', 'flexpriority', 'fpu', 'fxsr', 'ht', 'lahf_lm', 'lm', 'mca', 'mce', 'mmx', 'monitor', 'msr', 'mtrr', 'nonstop_tsc', 'nopl', 'nx', 'pae', 'pat', 'pbe', 'pcid', 'pclmulqdq', 'pdcm', 'pebs', 'pge', 'pln', 'pni', 'popcnt', 'pse', 'pse36', 'pts', 'rdtscp', 'rep_good', 'sep', 'ss', 'sse', 'sse2', 'sse4_1', 'sse4_2', 'ssse3', 'syscall', 'tm', 'tm2', 'tpr_shadow', 'tsc', 'tsc_deadline_timer', 'vme', 'vmx', 'vnmi', 'vpid', 'xsave', 'xsaveopt', 'xtopology', 'xtpr'] , info['flags'] ) def test_get_cpu_info_from_dmesg(self): info = cpuinfo._get_cpu_info_from_dmesg() self.assertEqual('Intel(R) Pentium(R) CPU G640 @ 2.80GHz', info['brand_raw']) self.assertEqual('2.8000 GHz', info['hz_advertised_friendly']) self.assertEqual('2.8000 GHz', info['hz_actual_friendly']) self.assertEqual((2800000000, 0), info['hz_advertised']) self.assertEqual((2800000000, 0), info['hz_actual']) self.assertEqual(7, info['stepping']) self.assertEqual(42, info['model']) self.assertEqual(6, info['family']) def test_get_cpu_info_from_proc_cpuinfo(self): info = cpuinfo._get_cpu_info_from_proc_cpuinfo() self.assertEqual('GenuineIntel', info['vendor_id_raw']) self.assertEqual('Intel(R) Pentium(R) CPU G640 @ 2.80GHz', info['brand_raw']) self.assertEqual('2.8000 GHz', info['hz_advertised_friendly']) self.assertEqual('1.9014 GHz', info['hz_actual_friendly']) self.assertEqual((2800000000, 0), info['hz_advertised']) self.assertEqual((1901375000, 0), info['hz_actual']) self.assertEqual(3072 * 1024, info['l3_cache_size']) self.assertEqual(7, info['stepping']) self.assertEqual(42, info['model']) self.assertEqual(6, info['family']) self.assertEqual( ['acpi', 'aperfmperf', 'apic', 'arat', 'arch_perfmon', 'bts', 'clflush', 'cmov', 'constant_tsc', 'cx16', 'cx8', 'de', 'ds_cpl', 'dtes64', 'dtherm', 'dts', 'eagerfpu', 'epb', 'ept', 'est', 'flexpriority', 'fpu', 'fxsr', 'ht', 'lahf_lm', 'lm', 'mca', 'mce', 'mmx', 'monitor', 'msr', 'mtrr', 'nonstop_tsc', 'nopl', 'nx', 'pae', 'pat', 'pbe', 'pcid', 'pclmulqdq', 'pdcm', 'pebs', 'pge', 'pln', 'pni', 'popcnt', 'pse', 'pse36', 'pts', 'rdtscp', 'rep_good', 'sep', 'ss', 'sse', 'sse2', 'sse4_1', 'sse4_2', 'ssse3', 'syscall', 'tm', 'tm2', 'tpr_shadow', 'tsc', 'tsc_deadline_timer', 'vme', 'vmx', 'vnmi', 'vpid', 'xsave', 'xsaveopt', 'xtopology', 'xtpr'] , info['flags'] ) def test_all(self): info = cpuinfo._get_cpu_info_internal() self.assertEqual('GenuineIntel', info['vendor_id_raw']) self.assertEqual('Intel(R) Pentium(R) CPU G640 @ 2.80GHz', info['brand_raw']) self.assertEqual('2.8000 GHz', info['hz_advertised_friendly']) self.assertEqual('1.9014 GHz', info['hz_actual_friendly']) self.assertEqual((2800000000, 0), info['hz_advertised']) self.assertEqual((1901375000, 0), info['hz_actual']) self.assertEqual('X86_64', info['arch']) self.assertEqual(64, info['bits']) self.assertEqual(2, info['count']) self.assertEqual('x86_64', info['arch_string_raw']) self.assertEqual(32 * 1024, info['l1_instruction_cache_size']) self.assertEqual(32 * 1024, info['l1_data_cache_size']) self.assertEqual(256 * 1024, info['l2_cache_size']) self.assertEqual(3072 * 1024, info['l3_cache_size']) self.assertEqual(7, info['stepping']) self.assertEqual(42, info['model']) self.assertEqual(6, info['family']) self.assertEqual( ['acpi', 'aperfmperf', 'apic', 'arat', 'arch_perfmon', 'bts', 'clflush', 'cmov', 'constant_tsc', 'cx16', 'cx8', 'de', 'ds_cpl', 'dtes64', 'dtherm', 'dts', 'eagerfpu', 'epb', 'ept', 'est', 'flexpriority', 'fpu', 'fxsr', 'ht', 'lahf_lm', 'lm', 'mca', 'mce', 'mmx', 'monitor', 'msr', 'mtrr', 'nonstop_tsc', 'nopl', 'nx', 'pae', 'pat', 'pbe', 'pcid', 'pclmulqdq', 'pdcm', 'pebs', 'pge', 'pln', 'pni', 'popcnt', 'pse', 'pse36', 'pts', 'rdtscp', 'rep_good', 'sep', 'ss', 'sse', 'sse2', 'sse4_1', 'sse4_2', 'ssse3', 'syscall', 'tm', 'tm2', 'tpr_shadow', 'tsc', 'tsc_deadline_timer', 'vme', 'vmx', 'vnmi', 'vpid', 'xsave', 'xsaveopt', 'xtopology', 'xtpr'] , info['flags'] ) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/tests/test_linux_ubuntu_21_04_riscv64.py0000664000175000017500000000707214325641176022067 0ustar00mattmatt import unittest from cpuinfo import * import helpers class MockDataSource(object): bits = '64bit' cpu_count = 4 is_windows = False arch_string_raw = 'riscv64' uname_string_raw = 'riscv64' can_cpuid = False @staticmethod def has_proc_cpuinfo(): return True @staticmethod def has_dmesg(): return True @staticmethod def has_lscpu(): return True @staticmethod def has_ibm_pa_features(): return False @staticmethod def cat_proc_cpuinfo(): returncode = 0 output = r''' processor : 0 hart : 2 isa : rv64imafdc mmu : sv39 uarch : sifive,u74-mc processor : 1 hart : 1 isa : rv64imafdc mmu : sv39 uarch : sifive,u74-mc processor : 2 hart : 3 isa : rv64imafdc mmu : sv39 uarch : sifive,u74-mc processor : 3 hart : 4 isa : rv64imafdc mmu : sv39 uarch : sifive,u74-mc ''' return returncode, output @staticmethod def dmesg_a(): returncode = 1 output = r''' dmesg: read kernel buffer failed: Operation not permitted ''' return returncode, output @staticmethod def lscpu(): returncode = 0 output = r''' Architecture: riscv64 Byte Order: Little Endian CPU(s): 4 On-line CPU(s) list: 0-3 Thread(s) per core: 4 Core(s) per socket: 1 Socket(s): 1 L1d cache: 32 KiB L1i cache: 32 KiB L2 cache: 2 MiB ''' return returncode, output class TestLinuxUbuntu_21_04_riscv64(unittest.TestCase): def setUp(self): helpers.backup_data_source(cpuinfo) helpers.monkey_patch_data_source(cpuinfo, MockDataSource) def tearDown(self): helpers.restore_data_source(cpuinfo) ''' Make sure calls return the expected number of fields. ''' def test_returns(self): self.assertEqual(0, len(cpuinfo._get_cpu_info_from_registry())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpufreq_info())) self.assertEqual(3, len(cpuinfo._get_cpu_info_from_lscpu())) self.assertEqual(1, len(cpuinfo._get_cpu_info_from_proc_cpuinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysctl())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_kstat())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_dmesg())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cat_var_run_dmesg_boot())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_ibm_pa_features())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpuid())) self.assertEqual(11, len(cpuinfo._get_cpu_info_internal())) def test_get_cpu_info_from_lscpu(self): info = cpuinfo._get_cpu_info_from_lscpu() self.assertEqual(32 * 1024, info['l1_instruction_cache_size']) self.assertEqual(32 * 1024, info['l1_data_cache_size']) self.assertEqual(2 * 1024 * 1024, info['l2_cache_size']) self.assertEqual(3, len(info)) def test_get_cpu_info_from_proc_cpuinfo(self): info = cpuinfo._get_cpu_info_from_proc_cpuinfo() self.assertEqual('sifive,u74-mc', info['brand_raw']) self.assertEqual(1, len(info)) def test_all(self): info = cpuinfo._get_cpu_info_internal() self.assertEqual('sifive,u74-mc', info['brand_raw']) self.assertEqual('RISCV_64', info['arch']) self.assertEqual(64, info['bits']) self.assertEqual(4, info['count']) self.assertEqual(32 * 1024, info['l1_instruction_cache_size']) self.assertEqual(32 * 1024, info['l1_data_cache_size']) self.assertEqual(2 * 1024 * 1024, info['l2_cache_size']) self.assertEqual('riscv64', info['arch_string_raw']) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/tests/test_linux_ubuntu_22_04_x86_64.py0000664000175000017500000010126514325641176021525 0ustar00mattmatt import unittest from cpuinfo import * import helpers class MockDataSource(object): bits = '64bit' cpu_count = 16 is_windows = False arch_string_raw = 'x86_64' uname_string_raw = 'x86_64' can_cpuid = False @staticmethod def has_proc_cpuinfo(): return True @staticmethod def has_lscpu(): return True @staticmethod def cat_proc_cpuinfo(): returncode = 0 output = r''' processor : 0 vendor_id : AuthenticAMD cpu family : 23 model : 8 model name : AMD Ryzen 7 2700X Eight-Core Processor stepping : 2 microcode : 0x800820d cpu MHz : 2200.000 cache size : 512 KB physical id : 0 siblings : 16 core id : 0 cpu cores : 8 apicid : 0 initial apicid : 0 fpu : yes fpu_exception : yes cpuid level : 13 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb hw_pstate ssbd ibpb vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt sha_ni xsaveopt xsavec xgetbv1 xsaves clzero irperf xsaveerptr arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif overflow_recov succor smca sme sev sev_es bugs : sysret_ss_attrs null_seg spectre_v1 spectre_v2 spec_store_bypass retbleed bogomips : 7386.22 TLB size : 2560 4K pages clflush size : 64 cache_alignment : 64 address sizes : 43 bits physical, 48 bits virtual power management: ts ttp tm hwpstate eff_freq_ro [13] [14] processor : 1 vendor_id : AuthenticAMD cpu family : 23 model : 8 model name : AMD Ryzen 7 2700X Eight-Core Processor stepping : 2 microcode : 0x800820d cpu MHz : 2200.000 cache size : 512 KB physical id : 0 siblings : 16 core id : 0 cpu cores : 8 apicid : 1 initial apicid : 1 fpu : yes fpu_exception : yes cpuid level : 13 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb hw_pstate ssbd ibpb vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt sha_ni xsaveopt xsavec xgetbv1 xsaves clzero irperf xsaveerptr arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif overflow_recov succor smca sme sev sev_es bugs : sysret_ss_attrs null_seg spectre_v1 spectre_v2 spec_store_bypass retbleed bogomips : 7386.22 TLB size : 2560 4K pages clflush size : 64 cache_alignment : 64 address sizes : 43 bits physical, 48 bits virtual power management: ts ttp tm hwpstate eff_freq_ro [13] [14] processor : 2 vendor_id : AuthenticAMD cpu family : 23 model : 8 model name : AMD Ryzen 7 2700X Eight-Core Processor stepping : 2 microcode : 0x800820d cpu MHz : 2200.000 cache size : 512 KB physical id : 0 siblings : 16 core id : 1 cpu cores : 8 apicid : 2 initial apicid : 2 fpu : yes fpu_exception : yes cpuid level : 13 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb hw_pstate ssbd ibpb vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt sha_ni xsaveopt xsavec xgetbv1 xsaves clzero irperf xsaveerptr arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif overflow_recov succor smca sme sev sev_es bugs : sysret_ss_attrs null_seg spectre_v1 spectre_v2 spec_store_bypass retbleed bogomips : 7386.22 TLB size : 2560 4K pages clflush size : 64 cache_alignment : 64 address sizes : 43 bits physical, 48 bits virtual power management: ts ttp tm hwpstate eff_freq_ro [13] [14] processor : 3 vendor_id : AuthenticAMD cpu family : 23 model : 8 model name : AMD Ryzen 7 2700X Eight-Core Processor stepping : 2 microcode : 0x800820d cpu MHz : 2200.000 cache size : 512 KB physical id : 0 siblings : 16 core id : 1 cpu cores : 8 apicid : 3 initial apicid : 3 fpu : yes fpu_exception : yes cpuid level : 13 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb hw_pstate ssbd ibpb vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt sha_ni xsaveopt xsavec xgetbv1 xsaves clzero irperf xsaveerptr arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif overflow_recov succor smca sme sev sev_es bugs : sysret_ss_attrs null_seg spectre_v1 spectre_v2 spec_store_bypass retbleed bogomips : 7386.22 TLB size : 2560 4K pages clflush size : 64 cache_alignment : 64 address sizes : 43 bits physical, 48 bits virtual power management: ts ttp tm hwpstate eff_freq_ro [13] [14] processor : 4 vendor_id : AuthenticAMD cpu family : 23 model : 8 model name : AMD Ryzen 7 2700X Eight-Core Processor stepping : 2 microcode : 0x800820d cpu MHz : 3200.000 cache size : 512 KB physical id : 0 siblings : 16 core id : 2 cpu cores : 8 apicid : 4 initial apicid : 4 fpu : yes fpu_exception : yes cpuid level : 13 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb hw_pstate ssbd ibpb vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt sha_ni xsaveopt xsavec xgetbv1 xsaves clzero irperf xsaveerptr arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif overflow_recov succor smca sme sev sev_es bugs : sysret_ss_attrs null_seg spectre_v1 spectre_v2 spec_store_bypass retbleed bogomips : 7386.22 TLB size : 2560 4K pages clflush size : 64 cache_alignment : 64 address sizes : 43 bits physical, 48 bits virtual power management: ts ttp tm hwpstate eff_freq_ro [13] [14] processor : 5 vendor_id : AuthenticAMD cpu family : 23 model : 8 model name : AMD Ryzen 7 2700X Eight-Core Processor stepping : 2 microcode : 0x800820d cpu MHz : 2200.000 cache size : 512 KB physical id : 0 siblings : 16 core id : 2 cpu cores : 8 apicid : 5 initial apicid : 5 fpu : yes fpu_exception : yes cpuid level : 13 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb hw_pstate ssbd ibpb vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt sha_ni xsaveopt xsavec xgetbv1 xsaves clzero irperf xsaveerptr arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif overflow_recov succor smca sme sev sev_es bugs : sysret_ss_attrs null_seg spectre_v1 spectre_v2 spec_store_bypass retbleed bogomips : 7386.22 TLB size : 2560 4K pages clflush size : 64 cache_alignment : 64 address sizes : 43 bits physical, 48 bits virtual power management: ts ttp tm hwpstate eff_freq_ro [13] [14] processor : 6 vendor_id : AuthenticAMD cpu family : 23 model : 8 model name : AMD Ryzen 7 2700X Eight-Core Processor stepping : 2 microcode : 0x800820d cpu MHz : 2200.000 cache size : 512 KB physical id : 0 siblings : 16 core id : 3 cpu cores : 8 apicid : 6 initial apicid : 6 fpu : yes fpu_exception : yes cpuid level : 13 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb hw_pstate ssbd ibpb vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt sha_ni xsaveopt xsavec xgetbv1 xsaves clzero irperf xsaveerptr arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif overflow_recov succor smca sme sev sev_es bugs : sysret_ss_attrs null_seg spectre_v1 spectre_v2 spec_store_bypass retbleed bogomips : 7386.22 TLB size : 2560 4K pages clflush size : 64 cache_alignment : 64 address sizes : 43 bits physical, 48 bits virtual power management: ts ttp tm hwpstate eff_freq_ro [13] [14] processor : 7 vendor_id : AuthenticAMD cpu family : 23 model : 8 model name : AMD Ryzen 7 2700X Eight-Core Processor stepping : 2 microcode : 0x800820d cpu MHz : 2200.000 cache size : 512 KB physical id : 0 siblings : 16 core id : 3 cpu cores : 8 apicid : 7 initial apicid : 7 fpu : yes fpu_exception : yes cpuid level : 13 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb hw_pstate ssbd ibpb vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt sha_ni xsaveopt xsavec xgetbv1 xsaves clzero irperf xsaveerptr arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif overflow_recov succor smca sme sev sev_es bugs : sysret_ss_attrs null_seg spectre_v1 spectre_v2 spec_store_bypass retbleed bogomips : 7386.22 TLB size : 2560 4K pages clflush size : 64 cache_alignment : 64 address sizes : 43 bits physical, 48 bits virtual power management: ts ttp tm hwpstate eff_freq_ro [13] [14] processor : 8 vendor_id : AuthenticAMD cpu family : 23 model : 8 model name : AMD Ryzen 7 2700X Eight-Core Processor stepping : 2 microcode : 0x800820d cpu MHz : 2200.000 cache size : 512 KB physical id : 0 siblings : 16 core id : 4 cpu cores : 8 apicid : 8 initial apicid : 8 fpu : yes fpu_exception : yes cpuid level : 13 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb hw_pstate ssbd ibpb vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt sha_ni xsaveopt xsavec xgetbv1 xsaves clzero irperf xsaveerptr arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif overflow_recov succor smca sme sev sev_es bugs : sysret_ss_attrs null_seg spectre_v1 spectre_v2 spec_store_bypass retbleed bogomips : 7386.22 TLB size : 2560 4K pages clflush size : 64 cache_alignment : 64 address sizes : 43 bits physical, 48 bits virtual power management: ts ttp tm hwpstate eff_freq_ro [13] [14] processor : 9 vendor_id : AuthenticAMD cpu family : 23 model : 8 model name : AMD Ryzen 7 2700X Eight-Core Processor stepping : 2 microcode : 0x800820d cpu MHz : 3700.000 cache size : 512 KB physical id : 0 siblings : 16 core id : 4 cpu cores : 8 apicid : 9 initial apicid : 9 fpu : yes fpu_exception : yes cpuid level : 13 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb hw_pstate ssbd ibpb vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt sha_ni xsaveopt xsavec xgetbv1 xsaves clzero irperf xsaveerptr arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif overflow_recov succor smca sme sev sev_es bugs : sysret_ss_attrs null_seg spectre_v1 spectre_v2 spec_store_bypass retbleed bogomips : 7386.22 TLB size : 2560 4K pages clflush size : 64 cache_alignment : 64 address sizes : 43 bits physical, 48 bits virtual power management: ts ttp tm hwpstate eff_freq_ro [13] [14] processor : 10 vendor_id : AuthenticAMD cpu family : 23 model : 8 model name : AMD Ryzen 7 2700X Eight-Core Processor stepping : 2 microcode : 0x800820d cpu MHz : 1980.565 cache size : 512 KB physical id : 0 siblings : 16 core id : 5 cpu cores : 8 apicid : 10 initial apicid : 10 fpu : yes fpu_exception : yes cpuid level : 13 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb hw_pstate ssbd ibpb vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt sha_ni xsaveopt xsavec xgetbv1 xsaves clzero irperf xsaveerptr arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif overflow_recov succor smca sme sev sev_es bugs : sysret_ss_attrs null_seg spectre_v1 spectre_v2 spec_store_bypass retbleed bogomips : 7386.22 TLB size : 2560 4K pages clflush size : 64 cache_alignment : 64 address sizes : 43 bits physical, 48 bits virtual power management: ts ttp tm hwpstate eff_freq_ro [13] [14] processor : 11 vendor_id : AuthenticAMD cpu family : 23 model : 8 model name : AMD Ryzen 7 2700X Eight-Core Processor stepping : 2 microcode : 0x800820d cpu MHz : 2200.000 cache size : 512 KB physical id : 0 siblings : 16 core id : 5 cpu cores : 8 apicid : 11 initial apicid : 11 fpu : yes fpu_exception : yes cpuid level : 13 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb hw_pstate ssbd ibpb vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt sha_ni xsaveopt xsavec xgetbv1 xsaves clzero irperf xsaveerptr arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif overflow_recov succor smca sme sev sev_es bugs : sysret_ss_attrs null_seg spectre_v1 spectre_v2 spec_store_bypass retbleed bogomips : 7386.22 TLB size : 2560 4K pages clflush size : 64 cache_alignment : 64 address sizes : 43 bits physical, 48 bits virtual power management: ts ttp tm hwpstate eff_freq_ro [13] [14] processor : 12 vendor_id : AuthenticAMD cpu family : 23 model : 8 model name : AMD Ryzen 7 2700X Eight-Core Processor stepping : 2 microcode : 0x800820d cpu MHz : 2200.000 cache size : 512 KB physical id : 0 siblings : 16 core id : 6 cpu cores : 8 apicid : 12 initial apicid : 12 fpu : yes fpu_exception : yes cpuid level : 13 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb hw_pstate ssbd ibpb vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt sha_ni xsaveopt xsavec xgetbv1 xsaves clzero irperf xsaveerptr arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif overflow_recov succor smca sme sev sev_es bugs : sysret_ss_attrs null_seg spectre_v1 spectre_v2 spec_store_bypass retbleed bogomips : 7386.22 TLB size : 2560 4K pages clflush size : 64 cache_alignment : 64 address sizes : 43 bits physical, 48 bits virtual power management: ts ttp tm hwpstate eff_freq_ro [13] [14] processor : 13 vendor_id : AuthenticAMD cpu family : 23 model : 8 model name : AMD Ryzen 7 2700X Eight-Core Processor stepping : 2 microcode : 0x800820d cpu MHz : 2200.000 cache size : 512 KB physical id : 0 siblings : 16 core id : 6 cpu cores : 8 apicid : 13 initial apicid : 13 fpu : yes fpu_exception : yes cpuid level : 13 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb hw_pstate ssbd ibpb vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt sha_ni xsaveopt xsavec xgetbv1 xsaves clzero irperf xsaveerptr arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif overflow_recov succor smca sme sev sev_es bugs : sysret_ss_attrs null_seg spectre_v1 spectre_v2 spec_store_bypass retbleed bogomips : 7386.22 TLB size : 2560 4K pages clflush size : 64 cache_alignment : 64 address sizes : 43 bits physical, 48 bits virtual power management: ts ttp tm hwpstate eff_freq_ro [13] [14] processor : 14 vendor_id : AuthenticAMD cpu family : 23 model : 8 model name : AMD Ryzen 7 2700X Eight-Core Processor stepping : 2 microcode : 0x800820d cpu MHz : 2200.000 cache size : 512 KB physical id : 0 siblings : 16 core id : 7 cpu cores : 8 apicid : 14 initial apicid : 14 fpu : yes fpu_exception : yes cpuid level : 13 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb hw_pstate ssbd ibpb vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt sha_ni xsaveopt xsavec xgetbv1 xsaves clzero irperf xsaveerptr arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif overflow_recov succor smca sme sev sev_es bugs : sysret_ss_attrs null_seg spectre_v1 spectre_v2 spec_store_bypass retbleed bogomips : 7386.22 TLB size : 2560 4K pages clflush size : 64 cache_alignment : 64 address sizes : 43 bits physical, 48 bits virtual power management: ts ttp tm hwpstate eff_freq_ro [13] [14] processor : 15 vendor_id : AuthenticAMD cpu family : 23 model : 8 model name : AMD Ryzen 7 2700X Eight-Core Processor stepping : 2 microcode : 0x800820d cpu MHz : 2200.000 cache size : 512 KB physical id : 0 siblings : 16 core id : 7 cpu cores : 8 apicid : 15 initial apicid : 15 fpu : yes fpu_exception : yes cpuid level : 13 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb hw_pstate ssbd ibpb vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt sha_ni xsaveopt xsavec xgetbv1 xsaves clzero irperf xsaveerptr arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif overflow_recov succor smca sme sev sev_es bugs : sysret_ss_attrs null_seg spectre_v1 spectre_v2 spec_store_bypass retbleed bogomips : 7386.22 TLB size : 2560 4K pages clflush size : 64 cache_alignment : 64 address sizes : 43 bits physical, 48 bits virtual power management: ts ttp tm hwpstate eff_freq_ro [13] [14] ''' return returncode, output @staticmethod def lscpu(): returncode = 0 output = r''' Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Address sizes: 43 bits physical, 48 bits virtual Byte Order: Little Endian CPU(s): 16 On-line CPU(s) list: 0-15 Vendor ID: AuthenticAMD Model name: AMD Ryzen 7 2700X Eight-Core Processor CPU family: 23 Model: 8 Thread(s) per core: 2 Core(s) per socket: 8 Socket(s): 1 Stepping: 2 Frequency boost: enabled CPU max MHz: 3700.0000 CPU min MHz: 2200.0000 BogoMIPS: 7386.22 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb hw_pstate ssbd ibpb vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt sha_ni xsaveopt xsavec xgetbv1 xsaves clzero irperf xsaveerptr arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif overflow_recov succor smca sme sev sev_es Virtualization: AMD-V L1d cache: 256 KiB (8 instances) L1i cache: 512 KiB (8 instances) L2 cache: 4 MiB (8 instances) L3 cache: 16 MiB (2 instances) NUMA node(s): 1 NUMA node0 CPU(s): 0-15 Vulnerability Itlb multihit: Not affected Vulnerability L1tf: Not affected Vulnerability Mds: Not affected Vulnerability Meltdown: Not affected Vulnerability Mmio stale data: Not affected Vulnerability Retbleed: Mitigation; untrained return thunk; SMT vulnerable Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization Vulnerability Spectre v2: Mitigation; Retpolines, IBPB conditional, STIBP disabled, RSB filling Vulnerability Srbds: Not affected Vulnerability Tsx async abort: Not affected ''' return returncode, output class TestLinuxUbuntu_22_04_X86_64(unittest.TestCase): def setUp(self): helpers.backup_data_source(cpuinfo) helpers.monkey_patch_data_source(cpuinfo, MockDataSource) def tearDown(self): helpers.restore_data_source(cpuinfo) ''' Make sure calls return the expected number of fields. ''' def test_returns(self): self.assertEqual(0, len(cpuinfo._get_cpu_info_from_registry())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpufreq_info())) self.assertEqual(14, len(cpuinfo._get_cpu_info_from_lscpu())) self.assertEqual(11, len(cpuinfo._get_cpu_info_from_proc_cpuinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysctl())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_kstat())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_dmesg())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cat_var_run_dmesg_boot())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_ibm_pa_features())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpuid())) self.assertEqual(21, len(cpuinfo._get_cpu_info_internal())) def test_get_cpu_info_from_lscpu(self): info = cpuinfo._get_cpu_info_from_lscpu() self.assertEqual('AuthenticAMD', info['vendor_id_raw']) self.assertEqual('AMD Ryzen 7 2700X Eight-Core Processor', info['brand_raw']) self.assertEqual('3.7000 GHz', info['hz_advertised_friendly']) self.assertEqual('3.7000 GHz', info['hz_actual_friendly']) self.assertEqual((3700000000, 0), info['hz_advertised']) self.assertEqual((3700000000, 0), info['hz_actual']) self.assertEqual(2, info['stepping']) self.assertEqual(8, info['model']) self.assertEqual(23, info['family']) 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(16 * 1024 * 1024, info['l3_cache_size']) self.assertEqual( ['3dnowprefetch', 'abm', 'adx', 'aes', 'aperfmperf', 'apic', 'arat', 'avic', 'avx', 'avx2', 'bmi1', 'bmi2', 'bpext', 'clflush', 'clflushopt', 'clzero', 'cmov', 'cmp_legacy', 'constant_tsc', 'cpb', 'cpuid', 'cr8_legacy', 'cx16', 'cx8', 'de', 'decodeassists', 'extapic', 'extd_apicid', 'f16c', 'flushbyasid', 'fma', 'fpu', 'fsgsbase', 'fxsr', 'fxsr_opt', 'ht', 'hw_pstate', 'ibpb', 'irperf', 'lahf_lm', 'lbrv', 'lm', 'mca', 'mce', 'misalignsse', 'mmx', 'mmxext', 'monitor', 'movbe', 'msr', 'mtrr', 'mwaitx', 'nonstop_tsc', 'nopl', 'npt', 'nrip_save', 'nx', 'osvw', 'overflow_recov', 'pae', 'pat', 'pausefilter', 'pclmulqdq', 'pdpe1gb', 'perfctr_core', 'perfctr_llc', 'perfctr_nb', 'pfthreshold', 'pge', 'pni', 'popcnt', 'pse', 'pse36', 'rapl', 'rdrand', 'rdseed', 'rdtscp', 'rep_good', 'sep', 'sev', 'sev_es', 'sha_ni', 'skinit', 'smap', 'smca', 'sme', 'smep', 'ssbd', 'sse', 'sse2', 'sse4_1', 'sse4_2', 'sse4a', 'ssse3', 'succor', 'svm', 'svm_lock', 'syscall', 'tce', 'topoext', 'tsc', 'tsc_scale', 'v_vmsave_vmload', 'vgif', 'vmcb_clean', 'vme', 'vmmcall', 'wdt', 'xgetbv1', 'xsave', 'xsavec', 'xsaveerptr', 'xsaveopt', 'xsaves'] , info['flags'] ) def test_get_cpu_info_from_proc_cpuinfo(self): info = cpuinfo._get_cpu_info_from_proc_cpuinfo() self.assertEqual('AuthenticAMD', info['vendor_id_raw']) self.assertEqual('AMD Ryzen 7 2700X Eight-Core Processor', info['brand_raw']) self.assertEqual('2.2000 GHz', info['hz_advertised_friendly']) self.assertEqual('2.2000 GHz', info['hz_actual_friendly']) self.assertEqual((2200000000, 0), info['hz_advertised']) self.assertEqual((2200000000, 0), info['hz_actual']) self.assertEqual(512 * 1024, info['l3_cache_size']) self.assertEqual(2, info['stepping']) self.assertEqual(8, info['model']) self.assertEqual(23, info['family']) self.assertEqual( ['3dnowprefetch', 'abm', 'adx', 'aes', 'aperfmperf', 'apic', 'arat', 'avic', 'avx', 'avx2', 'bmi1', 'bmi2', 'bpext', 'clflush', 'clflushopt', 'clzero', 'cmov', 'cmp_legacy', 'constant_tsc', 'cpb', 'cpuid', 'cr8_legacy', 'cx16', 'cx8', 'de', 'decodeassists', 'extapic', 'extd_apicid', 'f16c', 'flushbyasid', 'fma', 'fpu', 'fsgsbase', 'fxsr', 'fxsr_opt', 'ht', 'hw_pstate', 'ibpb', 'irperf', 'lahf_lm', 'lbrv', 'lm', 'mca', 'mce', 'misalignsse', 'mmx', 'mmxext', 'monitor', 'movbe', 'msr', 'mtrr', 'mwaitx', 'nonstop_tsc', 'nopl', 'npt', 'nrip_save', 'nx', 'osvw', 'overflow_recov', 'pae', 'pat', 'pausefilter', 'pclmulqdq', 'pdpe1gb', 'perfctr_core', 'perfctr_llc', 'perfctr_nb', 'pfthreshold', 'pge', 'pni', 'popcnt', 'pse', 'pse36', 'rapl', 'rdrand', 'rdseed', 'rdtscp', 'rep_good', 'sep', 'sev', 'sev_es', 'sha_ni', 'skinit', 'smap', 'smca', 'sme', 'smep', 'ssbd', 'sse', 'sse2', 'sse4_1', 'sse4_2', 'sse4a', 'ssse3', 'succor', 'svm', 'svm_lock', 'syscall', 'tce', 'topoext', 'tsc', 'tsc_scale', 'v_vmsave_vmload', 'vgif', 'vmcb_clean', 'vme', 'vmmcall', 'wdt', 'xgetbv1', 'xsave', 'xsavec', 'xsaveerptr', 'xsaveopt', 'xsaves'] , info['flags'] ) def test_all(self): info = cpuinfo._get_cpu_info_internal() self.assertEqual('AuthenticAMD', info['vendor_id_raw']) self.assertEqual('AMD Ryzen 7 2700X Eight-Core Processor', info['brand_raw']) self.assertEqual('2.2000 GHz', info['hz_advertised_friendly']) self.assertEqual('2.2000 GHz', info['hz_actual_friendly']) self.assertEqual((2200000000, 0), info['hz_advertised']) self.assertEqual((2200000000, 0), info['hz_actual']) self.assertEqual('X86_64', info['arch']) self.assertEqual(64, info['bits']) self.assertEqual(16, info['count']) self.assertEqual('x86_64', info['arch_string_raw']) 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(2, info['stepping']) self.assertEqual(8, info['model']) self.assertEqual(23, info['family']) self.assertEqual( ['3dnowprefetch', 'abm', 'adx', 'aes', 'aperfmperf', 'apic', 'arat', 'avic', 'avx', 'avx2', 'bmi1', 'bmi2', 'bpext', 'clflush', 'clflushopt', 'clzero', 'cmov', 'cmp_legacy', 'constant_tsc', 'cpb', 'cpuid', 'cr8_legacy', 'cx16', 'cx8', 'de', 'decodeassists', 'extapic', 'extd_apicid', 'f16c', 'flushbyasid', 'fma', 'fpu', 'fsgsbase', 'fxsr', 'fxsr_opt', 'ht', 'hw_pstate', 'ibpb', 'irperf', 'lahf_lm', 'lbrv', 'lm', 'mca', 'mce', 'misalignsse', 'mmx', 'mmxext', 'monitor', 'movbe', 'msr', 'mtrr', 'mwaitx', 'nonstop_tsc', 'nopl', 'npt', 'nrip_save', 'nx', 'osvw', 'overflow_recov', 'pae', 'pat', 'pausefilter', 'pclmulqdq', 'pdpe1gb', 'perfctr_core', 'perfctr_llc', 'perfctr_nb', 'pfthreshold', 'pge', 'pni', 'popcnt', 'pse', 'pse36', 'rapl', 'rdrand', 'rdseed', 'rdtscp', 'rep_good', 'sep', 'sev', 'sev_es', 'sha_ni', 'skinit', 'smap', 'smca', 'sme', 'smep', 'ssbd', 'sse', 'sse2', 'sse4_1', 'sse4_2', 'sse4a', 'ssse3', 'succor', 'svm', 'svm_lock', 'syscall', 'tce', 'topoext', 'tsc', 'tsc_scale', 'v_vmsave_vmload', 'vgif', 'vmcb_clean', 'vme', 'vmmcall', 'wdt', 'xgetbv1', 'xsave', 'xsavec', 'xsaveerptr', 'xsaveopt', 'xsaves'] , info['flags'] ) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/tests/test_open_indiana_5_11_x86_64_ryzen_7.py0000664000175000017500000001076414325641176023007 0ustar00mattmatt import unittest from cpuinfo import * import helpers class MockDataSource(object): bits = '32bit' cpu_count = 8 is_windows = False arch_string_raw = 'i86pc' uname_string_raw = 'i386' can_cpuid = False @staticmethod def has_isainfo(): return True @staticmethod def has_kstat(): return True @staticmethod def isainfo_vb(): returncode = 0 output = r''' 64-bit amd64 applications rdseed avx2 rdrand avx xsave pclmulqdq aes movbe sse4.2 sse4.1 ssse3 amd_lzcnt popcnt amd_sse4a tscp ahf cx16 sse3 sse2 sse fxsr amd_mmx mmx cmov amd_sysc cx8 tsc fpu ''' return returncode, output @staticmethod def kstat_m_cpu_info(): returncode = 0 output = r''' module: cpu_info instance: 0 name: cpu_info0 class: misc brand AMD Ryzen 7 2700X Eight-Core Processor cache_id 0 chip_id 0 clock_MHz 3693 clog_id 0 core_id 0 cpu_type i386 crtime 22.539390752 current_clock_Hz 3692643590 current_cstate 1 family 23 fpu_type i387 compatible implementation x86 (chipid 0x0 AuthenticAMD 800F82 family 23 model 8 step 2 clock 3693 MHz) model 8 ncore_per_chip 8 ncpu_per_chip 8 pg_id 1 pkg_core_id 0 snaptime 120.971135132 socket_type Unknown state on-line state_begin 1553482276 stepping 2 supported_frequencies_Hz 3692643590 supported_max_cstates 0 vendor_id AuthenticAMD ''' return returncode, output class TestOpenIndiana_5_11_Ryzen_7(unittest.TestCase): def setUp(self): helpers.backup_data_source(cpuinfo) helpers.monkey_patch_data_source(cpuinfo, MockDataSource) def tearDown(self): helpers.restore_data_source(cpuinfo) ''' Make sure calls return the expected number of fields. ''' def test_returns(self): self.assertEqual(0, len(cpuinfo._get_cpu_info_from_registry())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpufreq_info())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_lscpu())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_proc_cpuinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysctl())) self.assertEqual(10, len(cpuinfo._get_cpu_info_from_kstat())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_dmesg())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cat_var_run_dmesg_boot())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_ibm_pa_features())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpuid())) self.assertEqual(17, len(cpuinfo._get_cpu_info_internal())) def test_get_cpu_info_from_kstat(self): info = cpuinfo._get_cpu_info_from_kstat() self.assertEqual('AuthenticAMD', info['vendor_id_raw']) self.assertEqual('AMD Ryzen 7 2700X Eight-Core Processor', info['brand_raw']) self.assertEqual('3.6930 GHz', info['hz_advertised_friendly']) self.assertEqual('3.6926 GHz', info['hz_actual_friendly']) self.assertEqual((3693000000, 0), info['hz_advertised']) self.assertEqual((3692643590, 0), info['hz_actual']) self.assertEqual(2, info['stepping']) self.assertEqual(8, info['model']) self.assertEqual(23, info['family']) self.assertEqual( ['amd_mmx', 'amd_sysc', 'cmov', 'cx8', 'fpu', 'mmx', 'tsc'] , info['flags'] ) def test_all(self): info = cpuinfo._get_cpu_info_internal() self.assertEqual('AuthenticAMD', info['vendor_id_raw']) self.assertEqual('AMD Ryzen 7 2700X Eight-Core Processor', info['brand_raw']) self.assertEqual('3.6930 GHz', info['hz_advertised_friendly']) self.assertEqual('3.6926 GHz', info['hz_actual_friendly']) self.assertEqual((3693000000, 0), info['hz_advertised']) self.assertEqual((3692643590, 0), info['hz_actual']) self.assertEqual('X86_32', info['arch']) self.assertEqual(32, info['bits']) self.assertEqual(8, info['count']) self.assertEqual('i86pc', info['arch_string_raw']) self.assertEqual(2, info['stepping']) self.assertEqual(8, info['model']) self.assertEqual(23, info['family']) self.assertEqual( ['amd_mmx', 'amd_sysc', 'cmov', 'cx8', 'fpu', 'mmx', 'tsc'] , info['flags'] ) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/tests/test_osx_10_12_x86_64.py0000664000175000017500000001414314325641176017567 0ustar00mattmatt # OS X 10.12 Sierra # Darwin version 16 import unittest from cpuinfo import * import helpers class MockDataSource(object): bits = '64bit' cpu_count = 4 is_windows = False arch_string_raw = 'x86_64' uname_string_raw = 'x86_64' can_cpuid = False @staticmethod def has_sysctl(): return True @staticmethod def sysctl_machdep_cpu_hw_cpufrequency(): returncode = 0 output = r''' machdep.cpu.tsc_ccc.denominator: 0 machdep.cpu.tsc_ccc.numerator: 0 machdep.cpu.thread_count: 4 machdep.cpu.core_count: 2 machdep.cpu.address_bits.virtual: 48 machdep.cpu.address_bits.physical: 36 machdep.cpu.tlb.shared: 512 machdep.cpu.tlb.data.large: 32 machdep.cpu.tlb.data.small: 64 machdep.cpu.tlb.inst.large: 8 machdep.cpu.tlb.inst.small: 64 machdep.cpu.cache.size: 256 machdep.cpu.cache.L2_associativity: 8 machdep.cpu.cache.linesize: 64 machdep.cpu.arch_perf.fixed_width: 48 machdep.cpu.arch_perf.fixed_number: 3 machdep.cpu.arch_perf.events: 0 machdep.cpu.arch_perf.events_number: 7 machdep.cpu.arch_perf.width: 48 machdep.cpu.arch_perf.number: 4 machdep.cpu.arch_perf.version: 3 machdep.cpu.xsave.extended_state1: 1 0 0 0 machdep.cpu.xsave.extended_state: 7 832 832 0 machdep.cpu.thermal.energy_policy: 1 machdep.cpu.thermal.hardware_feedback: 0 machdep.cpu.thermal.package_thermal_intr: 1 machdep.cpu.thermal.fine_grain_clock_mod: 1 machdep.cpu.thermal.core_power_limits: 1 machdep.cpu.thermal.ACNT_MCNT: 1 machdep.cpu.thermal.thresholds: 2 machdep.cpu.thermal.invariant_APIC_timer: 1 machdep.cpu.thermal.dynamic_acceleration: 1 machdep.cpu.thermal.sensor: 1 machdep.cpu.mwait.sub_Cstates: 135456 machdep.cpu.mwait.extensions: 3 machdep.cpu.mwait.linesize_max: 64 machdep.cpu.mwait.linesize_min: 64 machdep.cpu.processor_flag: 4 machdep.cpu.microcode_version: 40 machdep.cpu.cores_per_package: 8 machdep.cpu.logical_per_package: 16 machdep.cpu.extfeatures: SYSCALL XD EM64T LAHF RDTSCP TSCI machdep.cpu.features: FPU VME DE PSE TSC MSR PAE MCE CX8 APIC SEP MTRR PGE MCA CMOV PAT PSE36 CLFSH DS ACPI MMX FXSR SSE SSE2 SS HTT TM PBE SSE3 PCLMULQDQ DTES64 MON DSCPL VMX SMX EST TM2 SSSE3 CX16 TPR PDCM SSE4.1 SSE4.2 x2APIC POPCNT AES PCID XSAVE OSXSAVE TSCTMR AVX1.0 machdep.cpu.brand: 0 machdep.cpu.signature: 132775 machdep.cpu.extfeature_bits: 4967106816 machdep.cpu.feature_bits: 2286390448420027391 machdep.cpu.stepping: 7 machdep.cpu.extfamily: 0 machdep.cpu.extmodel: 2 machdep.cpu.model: 42 machdep.cpu.family: 6 machdep.cpu.brand_string: Intel(R) Core(TM) i5-2557M CPU @ 1.70GHz machdep.cpu.vendor: GenuineIntel machdep.cpu.max_ext: 2147483656 machdep.cpu.max_basic: 13 hw.cpufrequency: 1700000000 ''' return returncode, output class TestOSX_10_12(unittest.TestCase): def setUp(self): helpers.backup_data_source(cpuinfo) helpers.monkey_patch_data_source(cpuinfo, MockDataSource) def tearDown(self): helpers.restore_data_source(cpuinfo) ''' Make sure calls return the expected number of fields. ''' def test_returns(self): self.assertEqual(0, len(cpuinfo._get_cpu_info_from_registry())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpufreq_info())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_lscpu())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_proc_cpuinfo())) self.assertEqual(11, len(cpuinfo._get_cpu_info_from_sysctl())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_kstat())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_dmesg())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cat_var_run_dmesg_boot())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_ibm_pa_features())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpuid())) self.assertEqual(18, len(cpuinfo._get_cpu_info_internal())) def test_get_cpu_info_from_sysctl(self): info = cpuinfo._get_cpu_info_from_sysctl() self.assertEqual('GenuineIntel', info['vendor_id_raw']) self.assertEqual('Intel(R) Core(TM) i5-2557M CPU @ 1.70GHz', info['brand_raw']) self.assertEqual('1.7000 GHz', info['hz_advertised_friendly']) self.assertEqual('1.7000 GHz', info['hz_actual_friendly']) self.assertEqual((1700000000, 0), info['hz_advertised']) self.assertEqual((1700000000, 0), info['hz_actual']) self.assertEqual(256 * 1024, info['l2_cache_size']) self.assertEqual(7, info['stepping']) self.assertEqual(42, info['model']) self.assertEqual(6, info['family']) self.assertEqual( ['acpi', 'aes', 'apic', 'avx1.0', 'clfsh', 'cmov', 'cx16', 'cx8', 'de', 'ds', 'dscpl', 'dtes64', 'em64t', 'est', 'fpu', 'fxsr', 'htt', 'lahf', 'mca', 'mce', 'mmx', 'mon', 'msr', 'mtrr', 'osxsave', 'pae', 'pat', 'pbe', 'pcid', 'pclmulqdq', 'pdcm', 'pge', 'popcnt', 'pse', 'pse36', 'rdtscp', 'sep', 'smx', 'ss', 'sse', 'sse2', 'sse3', 'sse4.1', 'sse4.2', 'ssse3', 'syscall', 'tm', 'tm2', 'tpr', 'tsc', 'tsci', 'tsctmr', 'vme', 'vmx', 'x2apic', 'xd', 'xsave'] , info['flags'] ) def test_all(self): info = cpuinfo._get_cpu_info_internal() self.assertEqual('GenuineIntel', info['vendor_id_raw']) self.assertEqual('Intel(R) Core(TM) i5-2557M CPU @ 1.70GHz', info['brand_raw']) self.assertEqual('1.7000 GHz', info['hz_advertised_friendly']) self.assertEqual('1.7000 GHz', info['hz_actual_friendly']) self.assertEqual((1700000000, 0), info['hz_advertised']) self.assertEqual((1700000000, 0), info['hz_actual']) self.assertEqual('X86_64', info['arch']) self.assertEqual(64, info['bits']) self.assertEqual(4, info['count']) self.assertEqual('x86_64', info['arch_string_raw']) self.assertEqual(256 * 1024, info['l2_cache_size']) self.assertEqual(7, info['stepping']) self.assertEqual(42, info['model']) self.assertEqual(6, info['family']) self.assertEqual( ['acpi', 'aes', 'apic', 'avx1.0', 'clfsh', 'cmov', 'cx16', 'cx8', 'de', 'ds', 'dscpl', 'dtes64', 'em64t', 'est', 'fpu', 'fxsr', 'htt', 'lahf', 'mca', 'mce', 'mmx', 'mon', 'msr', 'mtrr', 'osxsave', 'pae', 'pat', 'pbe', 'pcid', 'pclmulqdq', 'pdcm', 'pge', 'popcnt', 'pse', 'pse36', 'rdtscp', 'sep', 'smx', 'ss', 'sse', 'sse2', 'sse3', 'sse4.1', 'sse4.2', 'ssse3', 'syscall', 'tm', 'tm2', 'tpr', 'tsc', 'tsci', 'tsctmr', 'vme', 'vmx', 'x2apic', 'xd', 'xsave'] , info['flags'] ) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/tests/test_osx_10_9_x86_64.py0000664000175000017500000001153414325641176017516 0ustar00mattmatt # OS X 10.9 Mavericks # Darwin version 13 import unittest from cpuinfo import * import helpers class MockDataSource(object): bits = '64bit' cpu_count = 4 is_windows = False arch_string_raw = 'x86_64' uname_string_raw = 'x86_64' can_cpuid = False @staticmethod def has_sysctl(): return True @staticmethod def sysctl_machdep_cpu_hw_cpufrequency(): returncode = 0 output = r''' machdep.cpu.max_basic: 5 machdep.cpu.max_ext: 2147483656 machdep.cpu.vendor: GenuineIntel machdep.cpu.brand_string: Intel(R) Core(TM) i5-4440 CPU @ 3.10GHz machdep.cpu.family: 6 machdep.cpu.model: 58 machdep.cpu.extmodel: 3 machdep.cpu.extfamily: 0 machdep.cpu.stepping: 9 machdep.cpu.feature_bits: 395049983 2147484161 machdep.cpu.leaf7_feature_bits: 832 machdep.cpu.extfeature_bits: 672139264 1 machdep.cpu.signature: 198313 machdep.cpu.brand: 0 machdep.cpu.features: FPU VME DE PSE TSC MSR PAE MCE CX8 APIC SEP MTRR PGE MCA CMOV PAT PSE36 CLFSH MMX FXSR SSE SSE2 HTT SSE3 SSSE3 VMM machdep.cpu.leaf7_features: ENFSTRG BMI2 AVX2 machdep.cpu.extfeatures: SYSCALL XD EM64T LAHF RDTSCP machdep.cpu.logical_per_package: 4 machdep.cpu.cores_per_package: 4 machdep.cpu.microcode_version: 25 machdep.cpu.processor_flag: 1 machdep.cpu.mwait.linesize_min: 0 machdep.cpu.mwait.linesize_max: 0 machdep.cpu.mwait.extensions: 3 machdep.cpu.mwait.sub_Cstates: 0 machdep.cpu.cache.linesize: 64 machdep.cpu.cache.L2_associativity: 8 machdep.cpu.cache.size: 256 machdep.cpu.tlb.inst.large: 8 machdep.cpu.tlb.data.small: 64 machdep.cpu.tlb.data.small_level1: 128 machdep.cpu.tlb.shared: 1024 machdep.cpu.address_bits.physical: 39 machdep.cpu.address_bits.virtual: 48 machdep.cpu.core_count: 4 machdep.cpu.thread_count: 4 hw.cpufrequency: 2890000000 ''' return returncode, output class TestOSX_10_9(unittest.TestCase): def setUp(self): helpers.backup_data_source(cpuinfo) helpers.monkey_patch_data_source(cpuinfo, MockDataSource) def tearDown(self): helpers.restore_data_source(cpuinfo) ''' Make sure calls return the expected number of fields. ''' def test_returns(self): self.assertEqual(0, len(cpuinfo._get_cpu_info_from_registry())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpufreq_info())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_lscpu())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_proc_cpuinfo())) self.assertEqual(11, len(cpuinfo._get_cpu_info_from_sysctl())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_kstat())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_dmesg())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cat_var_run_dmesg_boot())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_ibm_pa_features())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpuid())) self.assertEqual(18, len(cpuinfo._get_cpu_info_internal())) def test_get_cpu_info_from_sysctl(self): info = cpuinfo._get_cpu_info_from_sysctl() self.assertEqual('GenuineIntel', info['vendor_id_raw']) self.assertEqual('Intel(R) Core(TM) i5-4440 CPU @ 3.10GHz', info['brand_raw']) self.assertEqual('3.1000 GHz', info['hz_advertised_friendly']) self.assertEqual('2.8900 GHz', info['hz_actual_friendly']) self.assertEqual((3100000000, 0), info['hz_advertised']) self.assertEqual((2890000000, 0), info['hz_actual']) self.assertEqual(256 * 1024, info['l2_cache_size']) self.assertEqual(9, info['stepping']) self.assertEqual(58, info['model']) self.assertEqual(6, info['family']) self.assertEqual( ['apic', 'avx2', 'bmi2', 'clfsh', 'cmov', 'cx8', 'de', 'em64t', 'enfstrg', 'fpu', 'fxsr', 'htt', 'lahf', 'mca', 'mce', 'mmx', 'msr', 'mtrr', 'pae', 'pat', 'pge', 'pse', 'pse36', 'rdtscp', 'sep', 'sse', 'sse2', 'sse3', 'ssse3', 'syscall', 'tsc', 'vme', 'vmm', 'xd', ] , info['flags'] ) def test_all(self): info = cpuinfo._get_cpu_info_internal() self.assertEqual('GenuineIntel', info['vendor_id_raw']) self.assertEqual('Intel(R) Core(TM) i5-4440 CPU @ 3.10GHz', info['brand_raw']) self.assertEqual('3.1000 GHz', info['hz_advertised_friendly']) self.assertEqual('2.8900 GHz', info['hz_actual_friendly']) self.assertEqual((3100000000, 0), info['hz_advertised']) self.assertEqual((2890000000, 0), info['hz_actual']) self.assertEqual('X86_64', info['arch']) self.assertEqual(64, info['bits']) self.assertEqual(4, info['count']) self.assertEqual('x86_64', info['arch_string_raw']) self.assertEqual(256 * 1024, info['l2_cache_size']) self.assertEqual(9, info['stepping']) self.assertEqual(58, info['model']) self.assertEqual(6, info['family']) self.assertEqual( ['apic', 'avx2', 'bmi2', 'clfsh', 'cmov', 'cx8', 'de', 'em64t', 'enfstrg', 'fpu', 'fxsr', 'htt', 'lahf', 'mca', 'mce', 'mmx', 'msr', 'mtrr', 'pae', 'pat', 'pge', 'pse', 'pse36', 'rdtscp', 'sep', 'sse', 'sse2', 'sse3', 'ssse3', 'syscall', 'tsc', 'vme', 'vmm', 'xd', ] , info['flags'] ) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/tests/test_parse_cpu_string.py0000664000175000017500000001337514325641176020513 0ustar00mattmatt import unittest from cpuinfo import * import helpers class TestParseCPUString(unittest.TestCase): def test_to_decimal_string(self): self.assertEqual('2.8', cpuinfo._to_decimal_string('2.80')) self.assertEqual('2.0', cpuinfo._to_decimal_string('2')) self.assertEqual('3.0', cpuinfo._to_decimal_string(3)) self.assertEqual('6.5', cpuinfo._to_decimal_string(6.5)) self.assertEqual('7.002', cpuinfo._to_decimal_string(7.002)) self.assertEqual('4.00000000001', cpuinfo._to_decimal_string('4.00000000001')) self.assertEqual('5.0', cpuinfo._to_decimal_string('5.000000000000')) self.assertEqual('0.0', cpuinfo._to_decimal_string('invalid')) self.assertEqual('0.0', cpuinfo._to_decimal_string('8.778.9')) self.assertEqual('0.0', cpuinfo._to_decimal_string('')) self.assertEqual('0.0', cpuinfo._to_decimal_string(None)) def test_hz_short_to_full(self): self.assertEqual((2800000000, 0), cpuinfo._hz_short_to_full('2.8', 9)) self.assertEqual((1200000, 0), cpuinfo._hz_short_to_full('1.2', 6)) self.assertEqual((3200000000, 0), cpuinfo._hz_short_to_full('3.2', 9)) self.assertEqual((9001200000, 0), cpuinfo._hz_short_to_full('9001.2', 6)) self.assertEqual((0, 0), cpuinfo._hz_short_to_full('0.0', 0)) self.assertEqual((2, 87), cpuinfo._hz_short_to_full('2.87', 0)) self.assertEqual((0, 0), cpuinfo._hz_short_to_full('invalid', 0)) self.assertEqual((0, 0), cpuinfo._hz_short_to_full('8.778.9', 0)) self.assertEqual((0, 0), cpuinfo._hz_short_to_full('', 0)) self.assertEqual((0, 0), cpuinfo._hz_short_to_full(None, 0)) def test_hz_friendly_to_full(self): self.assertEqual((2800000000, 0), cpuinfo._hz_friendly_to_full('2.80GHz')) self.assertEqual((1200000, 0), cpuinfo._hz_friendly_to_full('1.20 mHz')) self.assertEqual((3693150000, 0), cpuinfo._hz_friendly_to_full('3693.15-MHz')) self.assertEqual((12000000000, 0), cpuinfo._hz_friendly_to_full('12 GHz')) self.assertEqual((2, 6), cpuinfo._hz_friendly_to_full('2.6 Hz')) self.assertEqual((0, 0), cpuinfo._hz_friendly_to_full('0 Hz')) self.assertEqual((0, 0), cpuinfo._hz_friendly_to_full('invalid')) self.assertEqual((0, 0), cpuinfo._hz_friendly_to_full('8.778.9')) self.assertEqual((0, 0), cpuinfo._hz_friendly_to_full('')) self.assertEqual((0, 0), cpuinfo._hz_friendly_to_full(None)) def test_hz_short_to_friendly(self): self.assertEqual('2.8000 GHz', cpuinfo._hz_short_to_friendly('2.8', 9)) self.assertEqual('1.2000 MHz', cpuinfo._hz_short_to_friendly('1.2', 6)) self.assertEqual('3.2000 GHz', cpuinfo._hz_short_to_friendly('3.2', 9)) self.assertEqual('1.3000 Hz', cpuinfo._hz_short_to_friendly('1.3', 0)) self.assertEqual('0.0000 Hz', cpuinfo._hz_short_to_friendly('0.0', 0)) self.assertEqual('0.0000 Hz', cpuinfo._hz_short_to_friendly('invalid', 0)) self.assertEqual('0.0000 Hz', cpuinfo._hz_short_to_friendly('8.778.9', 0)) self.assertEqual('0.0000 Hz', cpuinfo._hz_short_to_friendly('', 0)) self.assertEqual('0.0000 Hz', cpuinfo._hz_short_to_friendly(None, 0)) def test_parse_cpu_brand_string(self): hz, scale = cpuinfo._parse_cpu_brand_string('Intel(R) Pentium(R) CPU G640 @ 2.80GHz') self.assertEqual((hz, scale), ('2.8', 9)) hz, scale = cpuinfo._parse_cpu_brand_string('Intel(R) Pentium(R) CPU @ 1.20MHz') self.assertEqual((hz, scale), ('1.2', 6)) # NOTE: No @ symbol hz, scale = cpuinfo._parse_cpu_brand_string('Intel(R) Pentium(R) D CPU 3.20GHz') self.assertEqual((hz, scale), ('3.2', 9)) # NOTE: No @ symbol and no Hz hz, scale = cpuinfo._parse_cpu_brand_string('AMD Ryzen 7 2700X Eight-Core Processor') self.assertEqual((hz, scale), ('0.0', 0)) def test_parse_cpu_brand_string_dx(self): hz, scale, brand, vendor_id, stepping, model, family = \ cpuinfo._parse_cpu_brand_string_dx("Intel(R) Pentium(R) CPU G640 @ 2.80GHz (fam: 06, model: 2a, stepping: 07)") self.assertEqual('Intel(R) Pentium(R) CPU G640 @ 2.80GHz', brand) self.assertEqual((hz, scale), ('2.8', 9)) self.assertEqual((vendor_id, stepping, model, family), (None, 7, 42, 6)) hz, scale, brand, vendor_id, stepping, model, family = \ cpuinfo._parse_cpu_brand_string_dx("Intel(R) Pentium(R) CPU G640 @ 2.80GHz (family: 0x6, model: 0x2a, stepping: 0x7)") self.assertEqual('Intel(R) Pentium(R) CPU G640 @ 2.80GHz', brand) self.assertEqual((hz, scale), ('2.8', 9)) self.assertEqual((vendor_id, stepping, model, family), (None, 7, 42, 6)) hz, scale, brand, vendor_id, stepping, model, family = \ cpuinfo._parse_cpu_brand_string_dx("Intel(R) Core(TM) i7 CPU 870 @ 2.93GHz") self.assertEqual("Intel(R) Core(TM) i7 CPU 870 @ 2.93GHz", brand) self.assertEqual((hz, scale), ('2.93', 9)) self.assertEqual((vendor_id, stepping, model, family), (None, None, None, None)) hz, scale, brand, vendor_id, stepping, model, family = \ cpuinfo._parse_cpu_brand_string_dx("Intel(R) Pentium(R) CPU G640 @ 2.80GHz (2793.73-MHz K8-class CPU)") self.assertEqual("Intel(R) Pentium(R) CPU G640 @ 2.80GHz", brand) self.assertEqual((hz, scale), ('2.8', 9)) self.assertEqual((vendor_id, stepping, model, family), (None, None, None, None)) # NOTE: No @ symbol hz, scale, brand, vendor_id, stepping, model, family = \ cpuinfo._parse_cpu_brand_string_dx("Intel(R) Pentium(R) D CPU 3.20GHz") self.assertEqual("Intel(R) Pentium(R) D CPU 3.20GHz", brand) self.assertEqual((hz, scale), ('3.2', 9)) self.assertEqual((vendor_id, stepping, model, family), (None, None, None, None)) # NOTE: No @ symbol and no Hz hz, scale, brand, vendor_id, stepping, model, family = \ cpuinfo._parse_cpu_brand_string_dx("AMD Ryzen 7 2700X Eight-Core Processor (3693.15-MHz K8-class CPU) (fam: 06, model: 2a, stepping: 07)") self.assertEqual("AMD Ryzen 7 2700X Eight-Core Processor", brand) self.assertEqual((hz, scale), ('3693.15', 6)) self.assertEqual((vendor_id, stepping, model, family), (None, 7, 42, 6)) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/tests/test_parse_errors.py0000664000175000017500000000604214325641176017643 0ustar00mattmatt import unittest from cpuinfo import * import helpers class MockDataSource(object): bits = '64bit' cpu_count = 1 is_windows = True arch_string_raw = 'x86_64' uname_string_raw = 'x86_64' can_cpuid = False @staticmethod def has_proc_cpuinfo(): return True @staticmethod def has_dmesg(): return True @staticmethod def has_var_run_dmesg_boot(): return True @staticmethod def has_cpufreq_info(): return True @staticmethod def has_sestatus(): return True @staticmethod def has_sysctl(): return True @staticmethod def has_isainfo(): return True @staticmethod def has_kstat(): return True @staticmethod def has_sysinfo(): return True @staticmethod def cat_proc_cpuinfo(): return 0, "" @staticmethod def cpufreq_info(): return 0, "" @staticmethod def sestatus_b(): return 0, "" @staticmethod def dmesg_a(): return 0, "" @staticmethod def cat_var_run_dmesg_boot(): return 0, "" @staticmethod def sysctl_machdep_cpu_hw_cpufrequency(): return 0, "" @staticmethod def isainfo_vb(): return 0, "" @staticmethod def kstat_m_cpu_info(): return 0, "" @staticmethod def sysinfo_cpu(): return 0, "" @staticmethod def winreg_processor_brand(): return {} @staticmethod def winreg_vendor_id_raw(): return {} @staticmethod def winreg_arch_string_raw(): return {} @staticmethod def winreg_hz_actual(): return {} @staticmethod def winreg_feature_bits(): return {} class TestParseErrors(unittest.TestCase): def setUp(self): helpers.backup_data_source(cpuinfo) helpers.monkey_patch_data_source(cpuinfo, MockDataSource) def tearDown(self): helpers.restore_data_source(cpuinfo) ''' Make sure calls return the expected number of fields. ''' def test_returns(self): self.assertEqual(0, len(cpuinfo._get_cpu_info_from_registry())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpufreq_info())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_lscpu())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_proc_cpuinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysctl())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_kstat())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_dmesg())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cat_var_run_dmesg_boot())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_ibm_pa_features())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpuid())) def test_all(self): self.assertEqual({}, cpuinfo._get_cpu_info_from_registry()) self.assertEqual({}, cpuinfo._get_cpu_info_from_proc_cpuinfo()) self.assertEqual({}, cpuinfo._get_cpu_info_from_sysctl()) self.assertEqual({}, cpuinfo._get_cpu_info_from_kstat()) self.assertEqual({}, cpuinfo._get_cpu_info_from_dmesg()) self.assertEqual({}, cpuinfo._get_cpu_info_from_cat_var_run_dmesg_boot()) self.assertEqual({}, cpuinfo._get_cpu_info_from_sysinfo()) #self.assertEqual({}, cpuinfo._get_cpu_info_from_cpuid()) #self.assertEqual({}, cpuinfo._get_cpu_info_internal()) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/tests/test_pcbsd_10_x86_64.py0000664000175000017500000000741514325641176017553 0ustar00mattmatt import unittest from cpuinfo import * import helpers class MockDataSource(object): bits = '64bit' cpu_count = 1 is_windows = False arch_string_raw = 'amd64' uname_string_raw = 'x86_64' can_cpuid = False @staticmethod def has_dmesg(): return True @staticmethod def dmesg_a(): retcode = 0 output = r'''Copyright (c) 1992-2014 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. FreeBSD is a registered trademark of The FreeBSD Foundation. FreeBSD 10.0-RELEASE-p17 #0: Tue Sep 16 14:33:46 UTC 2014 root@amd64-builder.pcbsd.org:/usr/obj/usr/src/sys/GENERIC amd64 FreeBSD clang version 3.3 (tags/RELEASE_33/final 183502) 20130610 CPU: Intel(R) Core(TM) i5-4440 CPU @ 3.10GHz (2993.39-MHz K8-class CPU) Origin = "GenuineIntel" Id = 0x306c3 Family = 0x6 Model = 0x3c Stepping = 3 Features=0x78bfbff Features2=0x209 AMD Features=0x28100800 AMD Features2=0x1 TSC: P-state invariant ''' return retcode, output class TestPCBSD(unittest.TestCase): def setUp(self): helpers.backup_data_source(cpuinfo) helpers.monkey_patch_data_source(cpuinfo, MockDataSource) def tearDown(self): helpers.restore_data_source(cpuinfo) ''' Make sure calls return the expected number of fields. ''' def test_returns(self): self.assertEqual(0, len(cpuinfo._get_cpu_info_from_registry())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpufreq_info())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_lscpu())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_proc_cpuinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysctl())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_kstat())) self.assertEqual(6, len(cpuinfo._get_cpu_info_from_dmesg())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cat_var_run_dmesg_boot())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_ibm_pa_features())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpuid())) self.assertEqual(13, len(cpuinfo._get_cpu_info_internal())) def test_get_cpu_info_from_dmesg(self): info = cpuinfo._get_cpu_info_from_dmesg() self.assertEqual('Intel(R) Core(TM) i5-4440 CPU @ 3.10GHz', info['brand_raw']) self.assertEqual('3.1000 GHz', info['hz_advertised_friendly']) self.assertEqual('3.1000 GHz', info['hz_actual_friendly']) self.assertEqual((3100000000, 0), info['hz_advertised']) self.assertEqual((3100000000, 0), info['hz_actual']) self.assertEqual( ['apic', 'clflush', 'cmov', 'cx8', 'de', 'fpu', 'fxsr', 'lahf', 'lm', 'mca', 'mce', 'mmx', 'mon', 'msr', 'mtrr', 'nx', 'pae', 'pat', 'pge', 'pse', 'pse36', 'rdtscp', 'sep', 'sse', 'sse2', 'sse3', 'ssse3', 'syscall', 'tsc', 'vme'] , info['flags'] ) def test_all(self): info = cpuinfo._get_cpu_info_internal() self.assertEqual('Intel(R) Core(TM) i5-4440 CPU @ 3.10GHz', info['brand_raw']) self.assertEqual('3.1000 GHz', info['hz_advertised_friendly']) self.assertEqual('3.1000 GHz', info['hz_actual_friendly']) self.assertEqual((3100000000, 0), info['hz_advertised']) self.assertEqual((3100000000, 0), info['hz_actual']) self.assertEqual('X86_64', info['arch']) self.assertEqual(64, info['bits']) self.assertEqual(1, info['count']) self.assertEqual('amd64', info['arch_string_raw']) self.assertEqual( ['apic', 'clflush', 'cmov', 'cx8', 'de', 'fpu', 'fxsr', 'lahf', 'lm', 'mca', 'mce', 'mmx', 'mon', 'msr', 'mtrr', 'nx', 'pae', 'pat', 'pge', 'pse', 'pse36', 'rdtscp', 'sep', 'sse', 'sse2', 'sse3', 'ssse3', 'syscall', 'tsc', 'vme'] , info['flags'] ) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/tests/test_selinux.py0000664000175000017500000000525014325641176016624 0ustar00mattmatt import unittest from cpuinfo import * import helpers class MockDataSource_enforcing(object): @staticmethod def has_sestatus(): return True @staticmethod def sestatus_b(): returncode = 0 output = r''' SELinux status: enabled SELinuxfs mount: /sys/fs/selinux SELinux root directory: /etc/selinux Loaded policy name: targeted Current mode: enforcing Mode from config file: enforcing Policy MLS status: enabled Policy deny_unknown status: allowed Memory protection checking: actual (secure) Max kernel policy version: 31 ''' return returncode, output class MockDataSource_not_enforcing(object): @staticmethod def has_sestatus(): return True @staticmethod def sestatus_b(): returncode = 0 output = r''' SELinux status: enabled SELinuxfs mount: /sys/fs/selinux SELinux root directory: /etc/selinux Loaded policy name: targeted Current mode: eating Mode from config file: enforcing Policy MLS status: enabled Policy deny_unknown status: allowed Memory protection checking: actual (secure) Max kernel policy version: 31 ''' return returncode, output class MockDataSource_exec_mem_and_heap(object): @staticmethod def has_sestatus(): return True @staticmethod def sestatus_b(): returncode = 0 output = r''' allow_execheap on allow_execmem on ''' return returncode, output class MockDataSource_no_exec_mem_and_heap(object): @staticmethod def has_sestatus(): return True @staticmethod def sestatus_b(): returncode = 0 output = r''' allow_execheap off allow_execmem off ''' return returncode, output class TestSELinux(unittest.TestCase): def setUp(self): helpers.backup_data_source(cpuinfo) self.trace = Trace(False, False) def tearDown(self): helpers.restore_data_source(cpuinfo) def test_enforcing(self): helpers.monkey_patch_data_source(cpuinfo, MockDataSource_enforcing) self.assertEqual(True, cpuinfo._is_selinux_enforcing(self.trace)) def test_not_enforcing(self): helpers.monkey_patch_data_source(cpuinfo, MockDataSource_not_enforcing) self.assertEqual(False, cpuinfo._is_selinux_enforcing(self.trace)) def test_exec_mem_and_heap(self): helpers.monkey_patch_data_source(cpuinfo, MockDataSource_exec_mem_and_heap) self.assertEqual(False, cpuinfo._is_selinux_enforcing(self.trace)) def test_no_exec_mem_and_heap(self): helpers.monkey_patch_data_source(cpuinfo, MockDataSource_no_exec_mem_and_heap) self.assertEqual(True, cpuinfo._is_selinux_enforcing(self.trace)) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/tests/test_solaris_11_x86_32.py0000664000175000017500000001153214325641176020123 0ustar00mattmatt import unittest from cpuinfo import * import helpers class MockDataSource(object): bits = '32bit' cpu_count = 4 is_windows = False arch_string_raw = 'i86pc' uname_string_raw = 'x86_32' can_cpuid = False @staticmethod def has_isainfo(): return True @staticmethod def has_kstat(): return True @staticmethod def isainfo_vb(): returncode = 0 output = r''' 64-bit amd64 applications ssse3 tscp ahf sse3 sse2 sse fxsr mmx cmov amd_sysc cx8 tsc fpu ''' return returncode, output @staticmethod def kstat_m_cpu_info(): returncode = 0 output = r''' module: cpu_info instance: 0 name: cpu_info0 class: misc brand Intel(r) Core(tm) i7 CPU 870 @ 2.93GHz cache_id 0 chip_id 0 clock_MHz 2931 clog_id 0 core_id 0 cpu_type i386 crtime 20.105018108 cstates_count 519253:519254 cstates_nsec 3370827137067:327348735595 current_clock_Hz 2930505167 current_cstate 0 current_pstate 0 family 6 fpu_type i387 compatible implementation x86 (chipid 0x0 GenuineIntel 106E5 family 6 model 30 step 5 clock 2933 MHz) max_ncpu_per_chip 4 max_ncpu_per_core 1 max_pwrcap 0 model 30 ncore_per_chip 4 ncpu_per_chip 4 pg_id 1 pkg_core_id 0 pstates_count null pstates_nsec null snaptime 3678.092364544 socket_type Unknown state on-line state_begin 1435089171 stepping 5 supported_frequencies_Hz 2930505167 supported_max_cstates 1 supported_max_pstates 0 vendor_id GenuineIntel ''' return returncode, output class TestSolaris_11(unittest.TestCase): def setUp(self): helpers.backup_data_source(cpuinfo) helpers.monkey_patch_data_source(cpuinfo, MockDataSource) def tearDown(self): helpers.restore_data_source(cpuinfo) ''' Make sure calls return the expected number of fields. ''' def test_returns(self): self.assertEqual(0, len(cpuinfo._get_cpu_info_from_registry())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpufreq_info())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_lscpu())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_proc_cpuinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysctl())) self.assertEqual(10, len(cpuinfo._get_cpu_info_from_kstat())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_dmesg())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cat_var_run_dmesg_boot())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_ibm_pa_features())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpuid())) self.assertEqual(17, len(cpuinfo._get_cpu_info_internal())) def test_get_cpu_info_from_kstat(self): info = cpuinfo._get_cpu_info_from_kstat() self.assertEqual('GenuineIntel', info['vendor_id_raw']) self.assertEqual('Intel(r) Core(tm) i7 CPU 870 @ 2.93GHz', info['brand_raw']) self.assertEqual('2.9310 GHz', info['hz_advertised_friendly']) self.assertEqual('2.9305 GHz', info['hz_actual_friendly']) self.assertEqual((2931000000, 0), info['hz_advertised']) self.assertEqual((2930505167, 0), info['hz_actual']) self.assertEqual(5, info['stepping']) self.assertEqual(30, info['model']) self.assertEqual(6, info['family']) self.assertEqual( ['ahf', 'amd_sysc', 'cmov', 'cx8', 'fpu', 'fxsr', 'mmx', 'sse', 'sse2', 'sse3', 'ssse3', 'tsc', 'tscp'] , info['flags'] ) def test_all(self): info = cpuinfo._get_cpu_info_internal() self.assertEqual('GenuineIntel', info['vendor_id_raw']) self.assertEqual('Intel(r) Core(tm) i7 CPU 870 @ 2.93GHz', info['brand_raw']) self.assertEqual('2.9310 GHz', info['hz_advertised_friendly']) self.assertEqual('2.9305 GHz', info['hz_actual_friendly']) self.assertEqual((2931000000, 0), info['hz_advertised']) self.assertEqual((2930505167, 0), info['hz_actual']) self.assertEqual('X86_32', info['arch']) self.assertEqual(32, info['bits']) self.assertEqual(4, info['count']) self.assertEqual('i86pc', info['arch_string_raw']) self.assertEqual(5, info['stepping']) self.assertEqual(30, info['model']) self.assertEqual(6, info['family']) self.assertEqual( ['ahf', 'amd_sysc', 'cmov', 'cx8', 'fpu', 'fxsr', 'mmx', 'sse', 'sse2', 'sse3', 'ssse3', 'tsc', 'tscp'] , info['flags'] ) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/tests/test_true_os_18_x86_64_ryzen_7.py0000664000175000017500000001126214325641176021620 0ustar00mattmatt import unittest from cpuinfo import * import helpers class MockDataSource(object): bits = '64bit' cpu_count = 8 is_windows = False arch_string_raw = 'amd64' uname_string_raw = 'amd64' can_cpuid = False @staticmethod def has_dmesg(): return True @staticmethod def dmesg_a(): retcode = 0 output = r'''Copyright (c) 1992-2018 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. FreeBSD is a registered trademark of The FreeBSD Foundation. FreeBSD 12.0-CURRENT #26 fa797a5a3(trueos-stable-18.03): Mon Mar 26 00:24:47 UTC 2018 root@chimera:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64 FreeBSD clang version 6.0.0 (branches/release_60 324090) (based on LLVM 6.0.0) VT(vga): text 80x25 CPU: AMD Ryzen 7 2700X Eight-Core Processor (3693.15-MHz K8-class CPU) Origin="AuthenticAMD" Id=0x800f82 Family=0x17 Model=0x8 Stepping=2 Features=0x1783fbff Features2=0x5ed82203 AMD Features=0x2a500800 AMD Features2=0x1f3 Structured Extended Features=0x40021 TSC: P-state invariant ''' return retcode, output class TestTrueOS_18_X86_64_Ryzen7(unittest.TestCase): def setUp(self): helpers.backup_data_source(cpuinfo) helpers.monkey_patch_data_source(cpuinfo, MockDataSource) def tearDown(self): helpers.restore_data_source(cpuinfo) ''' Make sure calls return the expected number of fields. ''' def test_returns(self): self.assertEqual(0, len(cpuinfo._get_cpu_info_from_registry())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpufreq_info())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_lscpu())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_proc_cpuinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysctl())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_kstat())) self.assertEqual(10, len(cpuinfo._get_cpu_info_from_dmesg())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cat_var_run_dmesg_boot())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_ibm_pa_features())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpuid())) self.assertEqual(17, len(cpuinfo._get_cpu_info_internal())) def test_get_cpu_info_from_dmesg(self): info = cpuinfo._get_cpu_info_from_dmesg() self.assertEqual('AuthenticAMD', info['vendor_id_raw']) self.assertEqual('AMD Ryzen 7 2700X Eight-Core Processor', info['brand_raw']) self.assertEqual('3.6932 GHz', info['hz_advertised_friendly']) self.assertEqual('3.6932 GHz', info['hz_actual_friendly']) self.assertEqual((3693150000, 0), info['hz_advertised']) self.assertEqual((3693150000, 0), info['hz_actual']) self.assertEqual(2, info['stepping']) self.assertEqual(8, info['model']) self.assertEqual(23, info['family']) self.assertEqual( ['abm', 'aesni', 'apic', 'avx', 'cmov', 'cmp', 'cr8', 'cx16', 'cx8', 'de', 'ffxsr', 'fpu', 'fxsr', 'htt', 'lahf', 'lm', 'mas', 'mca', 'mce', 'mmx', 'mmx+', 'movbe', 'msr', 'mtrr', 'nx', 'osxsave', 'pae', 'pat', 'pclmulqdq', 'pge', 'popcnt', 'prefetch', 'pse', 'pse36', 'rdrand', 'rdtscp', 'sep', 'sse', 'sse2', 'sse3', 'sse4.1', 'sse4.2', 'sse4a', 'ssse3', 'syscall', 'tsc', 'vme', 'xsave'] , info['flags'] ) def test_all(self): info = cpuinfo._get_cpu_info_internal() self.assertEqual('AuthenticAMD', info['vendor_id_raw']) self.assertEqual('AMD Ryzen 7 2700X Eight-Core Processor', info['brand_raw']) self.assertEqual('3.6932 GHz', info['hz_advertised_friendly']) self.assertEqual('3.6932 GHz', info['hz_actual_friendly']) self.assertEqual((3693150000, 0), info['hz_advertised']) self.assertEqual((3693150000, 0), info['hz_actual']) self.assertEqual('X86_64', info['arch']) self.assertEqual(64, info['bits']) self.assertEqual(8, info['count']) self.assertEqual('amd64', info['arch_string_raw']) self.assertEqual(2, info['stepping']) self.assertEqual(8, info['model']) self.assertEqual(23, info['family']) self.assertEqual( ['abm', 'aesni', 'apic', 'avx', 'cmov', 'cmp', 'cr8', 'cx16', 'cx8', 'de', 'ffxsr', 'fpu', 'fxsr', 'htt', 'lahf', 'lm', 'mas', 'mca', 'mce', 'mmx', 'mmx+', 'movbe', 'msr', 'mtrr', 'nx', 'osxsave', 'pae', 'pat', 'pclmulqdq', 'pge', 'popcnt', 'prefetch', 'pse', 'pse36', 'rdrand', 'rdtscp', 'sep', 'sse', 'sse2', 'sse3', 'sse4.1', 'sse4.2', 'sse4a', 'ssse3', 'syscall', 'tsc', 'vme', 'xsave'] , info['flags'] ) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/tests/test_windows_10_x86_64.py0000664000175000017500000001626014325641176020150 0ustar00mattmatt import unittest from cpuinfo import * import helpers class MockDataSource(object): bits = '64bit' cpu_count = 4 is_windows = True arch_string_raw = 'AMD64' uname_string_raw = 'Intel64 Family 6 Model 69 Stepping 1, GenuineIntel' can_cpuid = True @staticmethod def has_wmic(): return True @staticmethod def wmic_cpu(): returncode = 0 output = r''' Caption=Intel64 Family 6 Model 69 Stepping 1 CurrentClockSpeed=2494 Description=Intel64 Family 6 Model 69 Stepping 1 L2CacheSize=512 L3CacheSize=3072 Manufacturer=GenuineIntel Name=Intel(R) Core(TM) i5-4300U CPU @ 1.90GHz ''' return returncode, output @staticmethod def winreg_processor_brand(): return 'Intel(R) Core(TM) i5-4300U CPU @ 1.90GHz' @staticmethod def winreg_vendor_id_raw(): return 'GenuineIntel' @staticmethod def winreg_arch_string_raw(): return 'AMD64' @staticmethod def winreg_hz_actual(): return 2494 @staticmethod def winreg_feature_bits(): return 1025196031 class TestWindows_10_X86_64(unittest.TestCase): def setUp(self): cpuinfo.CAN_CALL_CPUID_IN_SUBPROCESS = False helpers.backup_data_source(cpuinfo) helpers.monkey_patch_data_source(cpuinfo, MockDataSource) helpers.backup_cpuid(cpuinfo) helpers.monkey_patch_cpuid(cpuinfo, 2494000000, [ # max_extension_support 0x80000008, # get_cache 0x1006040, # get_info 0x40651, # get_processor_brand 0x65746e49, 0x2952286c, 0x726f4320, 0x4d542865, 0x35692029, 0x3033342d, 0x43205530, 0x40205550, 0x392e3120, 0x7a484730, 0x0, 0x0, # get_vendor_id 0x756e6547, 0x6c65746e, 0x49656e69, # get_flags 0xbfebfbff, 0x7ffafbff, 0x27ab, 0x0, 0x0, 0x21, ]) def tearDown(self): helpers.restore_data_source(cpuinfo) helpers.restore_cpuid(cpuinfo) cpuinfo.CAN_CALL_CPUID_IN_SUBPROCESS = True ''' Make sure calls return the expected number of fields. ''' def test_returns(self): self.assertEqual(11, len(cpuinfo._get_cpu_info_from_wmic())); self.assertEqual(7, len(cpuinfo._get_cpu_info_from_registry())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpufreq_info())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_lscpu())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_proc_cpuinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysctl())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_kstat())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_dmesg())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cat_var_run_dmesg_boot())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_ibm_pa_features())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysinfo())) self.assertEqual(13, len(cpuinfo._get_cpu_info_from_cpuid())) self.assertEqual(3, len(cpuinfo._get_cpu_info_from_platform_uname())) self.assertEqual(21, len(cpuinfo._get_cpu_info_internal())) def test_get_cpu_info_from_cpuid(self): info = cpuinfo._get_cpu_info_from_cpuid() self.assertEqual('GenuineIntel', info['vendor_id_raw']) self.assertEqual('Intel(R) Core(TM) i5-4300U CPU @ 1.90GHz', info['brand_raw']) #self.assertEqual('2.4940 GHz', info['hz_advertised_friendly']) self.assertEqual('2.4940 GHz', info['hz_actual_friendly']) #self.assertEqual((2494000000, 0), info['hz_advertised']) self.assertEqual((2494000000, 0), info['hz_actual']) self.assertEqual(1, info['stepping']) self.assertEqual(69, info['model']) self.assertEqual(6, info['family']) self.assertEqual(64 * 1024, info['l2_cache_size']) self.assertEqual(256, info['l2_cache_line_size']) self.assertEqual(6, info['l2_cache_associativity']) self.assertEqual( ['abm', 'acpi', 'aes', 'apic', 'avx', 'avx2', 'bmi1', 'bmi2', 'clflush', 'cmov', 'cx16', 'cx8', 'de', 'ds_cpl', 'dtes64', 'dts', 'erms', 'est', 'f16c', 'fma', 'fpu', 'fxsr', 'ht', 'invpcid', 'lahf_lm', 'mca', 'mce', 'mmx', 'monitor', 'movbe', 'msr', 'mtrr', 'osxsave', 'pae', 'pat', 'pbe', 'pcid', 'pclmulqdq', 'pdcm', 'pge', 'pni', 'popcnt', 'pse', 'pse36', 'rdrnd', 'sep', 'smep', 'smx', 'ss', 'sse', 'sse2', 'sse4_1', 'sse4_2', 'ssse3', 'tm', 'tm2', 'tsc', 'tscdeadline', 'vme', 'vmx', 'x2apic', 'xsave', 'xtpr'] , info['flags'] ) def test_get_cpu_info_from_platform_uname(self): info = cpuinfo._get_cpu_info_from_platform_uname() self.assertEqual(1, info['stepping']) self.assertEqual(69, info['model']) self.assertEqual(6, info['family']) def test_get_cpu_info_from_wmic(self): info = cpuinfo._get_cpu_info_from_wmic() self.assertEqual('GenuineIntel', info['vendor_id_raw']) self.assertEqual('Intel(R) Core(TM) i5-4300U CPU @ 1.90GHz', info['brand_raw']) self.assertEqual('1.9000 GHz', info['hz_advertised_friendly']) self.assertEqual('2.4940 GHz', info['hz_actual_friendly']) self.assertEqual((1900000000, 0), info['hz_advertised']) self.assertEqual((2494000000, 0), info['hz_actual']) self.assertEqual(1, info['stepping']) self.assertEqual(69, info['model']) self.assertEqual(6, info['family']) self.assertEqual(512 * 1024, info['l2_cache_size']) self.assertEqual(3072 * 1024, info['l3_cache_size']) def test_get_cpu_info_from_registry(self): info = cpuinfo._get_cpu_info_from_registry() self.assertEqual('GenuineIntel', info['vendor_id_raw']) self.assertEqual('Intel(R) Core(TM) i5-4300U CPU @ 1.90GHz', info['brand_raw']) self.assertEqual('1.9000 GHz', info['hz_advertised_friendly']) self.assertEqual('2.4940 GHz', info['hz_actual_friendly']) self.assertEqual((1900000000, 0), info['hz_advertised']) self.assertEqual((2494000000, 0), info['hz_actual']) self.assertEqual( ['3dnow', 'acpi', 'clflush', 'cmov', 'de', 'dts', 'fxsr', 'ia64', 'mca', 'mce', 'mmx', 'msr', 'mtrr', 'pse', 'sep', 'serial', 'ss', 'sse', 'sse2', 'tm', 'tsc'] , info['flags'] ) def test_all(self): info = cpuinfo._get_cpu_info_internal() self.assertEqual('GenuineIntel', info['vendor_id_raw']) self.assertEqual('Intel(R) Core(TM) i5-4300U CPU @ 1.90GHz', info['brand_raw']) self.assertEqual('1.9000 GHz', info['hz_advertised_friendly']) self.assertEqual('2.4940 GHz', info['hz_actual_friendly']) self.assertEqual((1900000000, 0), info['hz_advertised']) self.assertEqual((2494000000, 0), info['hz_actual']) self.assertEqual('X86_64', info['arch']) self.assertEqual(64, info['bits']) self.assertEqual(4, info['count']) self.assertEqual('AMD64', info['arch_string_raw']) self.assertEqual(1, info['stepping']) self.assertEqual(69, info['model']) self.assertEqual(6, info['family']) self.assertEqual(512 * 1024, info['l2_cache_size']) self.assertEqual(3072 * 1024, info['l3_cache_size']) self.assertEqual(6, info['l2_cache_associativity']) self.assertEqual(256, info['l2_cache_line_size']) self.assertEqual( ['3dnow', 'abm', 'acpi', 'aes', 'apic', 'avx', 'avx2', 'bmi1', 'bmi2', 'clflush', 'cmov', 'cx16', 'cx8', 'de', 'ds_cpl', 'dtes64', 'dts', 'erms', 'est', 'f16c', 'fma', 'fpu', 'fxsr', 'ht', 'ia64', 'invpcid', 'lahf_lm', 'mca', 'mce', 'mmx', 'monitor', 'movbe', 'msr', 'mtrr', 'osxsave', 'pae', 'pat', 'pbe', 'pcid', 'pclmulqdq', 'pdcm', 'pge', 'pni', 'popcnt', 'pse', 'pse36', 'rdrnd', 'sep', 'serial', 'smep', 'smx', 'ss', 'sse', 'sse2', 'sse4_1', 'sse4_2', 'ssse3', 'tm', 'tm2', 'tsc', 'tscdeadline', 'vme', 'vmx', 'x2apic', 'xsave', 'xtpr'] , info['flags'] ) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/tests/test_windows_10_x86_64_ryzen_7.py0000664000175000017500000001447714325641176021635 0ustar00mattmatt import unittest from cpuinfo import * import helpers class MockDataSource(object): bits = '64bit' cpu_count = 16 is_windows = True arch_string_raw = 'AMD64' uname_string_raw = 'AMD64 Family 23 Model 8 Stepping 2, AuthenticAMD' can_cpuid = True @staticmethod def winreg_processor_brand(): return 'AMD Ryzen 7 2700X Eight-Core Processor ' @staticmethod def winreg_vendor_id_raw(): return 'AuthenticAMD' @staticmethod def winreg_arch_string_raw(): return 'AMD64' @staticmethod def winreg_hz_actual(): return 3693 @staticmethod def winreg_feature_bits(): return 1010515455 class TestWindows_10_X86_64_Ryzen7(unittest.TestCase): def setUp(self): cpuinfo.CAN_CALL_CPUID_IN_SUBPROCESS = False helpers.backup_data_source(cpuinfo) helpers.monkey_patch_data_source(cpuinfo, MockDataSource) helpers.backup_cpuid(cpuinfo) helpers.monkey_patch_cpuid(cpuinfo, 3693000000, [ # get_max_extension_support 0x8000001f, # get_cache 0x2006140, # get_info 0x800f82, # get_processor_brand 0x20444d41, 0x657a7952, 0x2037206e, 0x30303732, 0x69452058, 0x2d746867, 0x65726f43, 0x6f725020, 0x73736563, 0x2020726f, 0x20202020, 0x202020, # get_vendor_id 0x68747541, 0x444d4163, 0x69746e65, # get_flags 0x178bfbff, 0x7ed8320b, 0x209c01a9, 0x0, 0x20000000, 0x35c233ff, ]) def tearDown(self): helpers.restore_data_source(cpuinfo) helpers.restore_cpuid(cpuinfo) cpuinfo.CAN_CALL_CPUID_IN_SUBPROCESS = True ''' Make sure calls return the expected number of fields. ''' def test_returns(self): self.assertEqual(0, len(cpuinfo._get_cpu_info_from_wmic())); self.assertEqual(7, len(cpuinfo._get_cpu_info_from_registry())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpufreq_info())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_lscpu())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_proc_cpuinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysctl())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_kstat())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_dmesg())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cat_var_run_dmesg_boot())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_ibm_pa_features())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysinfo())) self.assertEqual(11, len(cpuinfo._get_cpu_info_from_cpuid())) self.assertEqual(3, len(cpuinfo._get_cpu_info_from_platform_uname())) self.assertEqual(20, len(cpuinfo._get_cpu_info_internal())) def test_get_cpu_info_from_cpuid(self): info = cpuinfo._get_cpu_info_from_cpuid() self.assertEqual('AuthenticAMD', info['vendor_id_raw']) self.assertEqual('AMD Ryzen 7 2700X Eight-Core Processor', info['brand_raw']) #self.assertEqual('3.6930 GHz', info['hz_advertised_friendly']) self.assertEqual('3.6930 GHz', info['hz_actual_friendly']) #self.assertEqual((3693000000, 0), info['hz_advertised']) self.assertEqual((3693000000, 0), info['hz_actual']) self.assertEqual(2, info['stepping']) self.assertEqual(8, info['model']) self.assertEqual(23, info['family']) self.assertEqual(64 * 1024, info['l2_cache_size']) self.assertEqual(512, info['l2_cache_line_size']) self.assertEqual(6, info['l2_cache_associativity']) self.assertEqual( ['3dnowprefetch', 'abm', 'adx', 'aes', 'apic', 'avx', 'avx2', 'bmi1', 'bmi2', 'clflush', 'clflushopt', 'cmov', 'cmp_legacy', 'cr8_legacy', 'cx16', 'cx8', 'dbx', 'de', 'extapic', 'f16c', 'fma', 'fpu', 'fxsr', 'ht', 'lahf_lm', 'lm', 'mca', 'mce', 'misalignsse', 'mmx', 'monitor', 'movbe', 'msr', 'mtrr', 'osvw', 'osxsave', 'pae', 'pat', 'pci_l2i', 'pclmulqdq', 'perfctr_core', 'perfctr_nb', 'pge', 'pni', 'popcnt', 'pse', 'pse36', 'rdrnd', 'rdseed', 'sep', 'sha', 'skinit', 'smap', 'smep', 'sse', 'sse2', 'sse4_1', 'sse4_2', 'sse4a', 'ssse3', 'svm', 'tce', 'topoext', 'tsc', 'vme', 'wdt', 'xsave'] , info['flags'] ) def test_get_cpu_info_from_platform_uname(self): info = cpuinfo._get_cpu_info_from_platform_uname() self.assertEqual(2, info['stepping']) self.assertEqual(8, info['model']) self.assertEqual(23, info['family']) def test_get_cpu_info_from_registry(self): info = cpuinfo._get_cpu_info_from_registry() self.assertEqual('AuthenticAMD', info['vendor_id_raw']) self.assertEqual('AMD Ryzen 7 2700X Eight-Core Processor', info['brand_raw']) self.assertEqual('3.6930 GHz', info['hz_advertised_friendly']) self.assertEqual('3.6930 GHz', info['hz_actual_friendly']) self.assertEqual((3693000000, 0), info['hz_advertised']) self.assertEqual((3693000000, 0), info['hz_actual']) self.assertEqual( ['3dnow', 'clflush', 'cmov', 'de', 'dts', 'fxsr', 'ia64', 'mca', 'mmx', 'msr', 'mtrr', 'pse', 'sep', 'sepamd', 'serial', 'ss', 'sse', 'sse2', 'tm', 'tsc'] , info['flags'] ) def test_all(self): info = cpuinfo._get_cpu_info_internal() self.assertEqual('AuthenticAMD', info['vendor_id_raw']) self.assertEqual('AMD Ryzen 7 2700X Eight-Core Processor', info['brand_raw']) self.assertEqual('3.6930 GHz', info['hz_advertised_friendly']) self.assertEqual('3.6930 GHz', info['hz_actual_friendly']) self.assertEqual((3693000000, 0), info['hz_advertised']) self.assertEqual((3693000000, 0), info['hz_actual']) self.assertEqual('X86_64', info['arch']) self.assertEqual(64, info['bits']) self.assertEqual(16, info['count']) self.assertEqual('AMD64', info['arch_string_raw']) self.assertEqual(2, info['stepping']) self.assertEqual(8, info['model']) self.assertEqual(23, info['family']) self.assertEqual(64 * 1024, info['l2_cache_size']) self.assertEqual(6, info['l2_cache_associativity']) self.assertEqual(512, info['l2_cache_line_size']) self.assertEqual( ['3dnow', '3dnowprefetch', 'abm', 'adx', 'aes', 'apic', 'avx', 'avx2', 'bmi1', 'bmi2', 'clflush', 'clflushopt', 'cmov', 'cmp_legacy', 'cr8_legacy', 'cx16', 'cx8', 'dbx', 'de', 'dts', 'extapic', 'f16c', 'fma', 'fpu', 'fxsr', 'ht', 'ia64', 'lahf_lm', 'lm', 'mca', 'mce', 'misalignsse', 'mmx', 'monitor', 'movbe', 'msr', 'mtrr', 'osvw', 'osxsave', 'pae', 'pat', 'pci_l2i', 'pclmulqdq', 'perfctr_core', 'perfctr_nb', 'pge', 'pni', 'popcnt', 'pse', 'pse36', 'rdrnd', 'rdseed', 'sep', 'sepamd', 'serial', 'sha', 'skinit', 'smap', 'smep', 'ss', 'sse', 'sse2', 'sse4_1', 'sse4_2', 'sse4a', 'ssse3', 'svm', 'tce', 'tm', 'topoext', 'tsc', 'vme', 'wdt', 'xsave'] , info['flags'] ) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1666663038.0 py-cpuinfo-9.0.0/tests/test_windows_8_x86_64.py0000664000175000017500000001552414325641176020101 0ustar00mattmatt import unittest from cpuinfo import * import helpers class MockDataSource(object): bits = '64bit' cpu_count = 4 is_windows = True arch_string_raw = 'AMD64' uname_string_raw = 'AMD64 Family 6 Model 30 Stepping 5, GenuineIntel' can_cpuid = True @staticmethod def has_wmic(): return True @staticmethod def wmic_cpu(): returncode = 0 output = r''' Caption=Intel64 Family 6 Model 30 Stepping 5 CurrentClockSpeed=2933 Description=Intel64 Family 6 Model 30 Stepping 5 L2CacheSize=256 L3CacheSize=8192 Manufacturer=GenuineIntel Name=Intel(R) Core(TM) i7 CPU 870 @ 2.93GHz ''' return returncode, output @staticmethod def winreg_processor_brand(): return 'Intel(R) Core(TM) i7 CPU 870 @ 2.93GHz' @staticmethod def winreg_vendor_id_raw(): return 'GenuineIntel' @staticmethod def winreg_arch_string_raw(): return 'AMD64' @staticmethod def winreg_hz_actual(): return 2933 @staticmethod def winreg_feature_bits(): return 756629502 class TestWindows_8_X86_64(unittest.TestCase): def setUp(self): cpuinfo.CAN_CALL_CPUID_IN_SUBPROCESS = False helpers.backup_data_source(cpuinfo) helpers.monkey_patch_data_source(cpuinfo, MockDataSource) helpers.backup_cpuid(cpuinfo) helpers.monkey_patch_cpuid(cpuinfo, 2930000000, [ # max_extension_support 0x80000008, # get_cache 0x1006040, # get_info 0x106e5, # get_processor_brand 0x65746e49, 0x2952286c, 0x726f4320, 0x4d542865, 0x37692029, 0x55504320, 0x20202020, 0x20202020, 0x30373820, 0x20402020, 0x33392e32, 0x7a4847, # get_vendor_id 0x756e6547, 0x6c65746e, 0x49656e69, # get_flags 0xbfebfbff, 0x98e3fd, 0x0, 0x0, 0x0, 0x1, ]) def tearDown(self): helpers.restore_data_source(cpuinfo) helpers.restore_cpuid(cpuinfo) cpuinfo.CAN_CALL_CPUID_IN_SUBPROCESS = True ''' Make sure calls return the expected number of fields. ''' def test_returns(self): self.assertEqual(11, len(cpuinfo._get_cpu_info_from_wmic())); self.assertEqual(7, len(cpuinfo._get_cpu_info_from_registry())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cpufreq_info())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_lscpu())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_proc_cpuinfo())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysctl())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_kstat())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_dmesg())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_cat_var_run_dmesg_boot())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_ibm_pa_features())) self.assertEqual(0, len(cpuinfo._get_cpu_info_from_sysinfo())) self.assertEqual(13, len(cpuinfo._get_cpu_info_from_cpuid())) self.assertEqual(3, len(cpuinfo._get_cpu_info_from_platform_uname())) self.assertEqual(21, len(cpuinfo._get_cpu_info_internal())) def test_get_cpu_info_from_cpuid(self): info = cpuinfo._get_cpu_info_from_cpuid() self.assertEqual('GenuineIntel', info['vendor_id_raw']) self.assertEqual('Intel(R) Core(TM) i7 CPU 870 @ 2.93GHz', info['brand_raw']) #self.assertEqual('2.9300 GHz', info['hz_advertised_friendly']) self.assertEqual('2.9300 GHz', info['hz_actual_friendly']) #self.assertEqual((2930000000, 0), info['hz_advertised']) self.assertEqual((2930000000, 0), info['hz_actual']) self.assertEqual(5, info['stepping']) self.assertEqual(30, info['model']) self.assertEqual(6, info['family']) self.assertEqual(64 * 1024, info['l2_cache_size']) self.assertEqual(256, info['l2_cache_line_size']) self.assertEqual(6, info['l2_cache_associativity']) self.assertEqual( ['acpi', 'apic', 'clflush', 'cmov', 'cx16', 'cx8', 'de', 'ds_cpl', 'dtes64', 'dts', 'est', 'fpu', 'fxsr', 'ht', 'lahf_lm', 'mca', 'mce', 'mmx', 'monitor', 'msr', 'mtrr', 'pae', 'pat', 'pbe', 'pdcm', 'pge', 'pni', 'popcnt', 'pse', 'pse36', 'sep', 'smx', 'ss', 'sse', 'sse2', 'sse4_1', 'sse4_2', 'ssse3', 'tm', 'tm2', 'tsc', 'vme', 'vmx', 'xtpr'] , info['flags'] ) def test_get_cpu_info_from_platform_uname(self): info = cpuinfo._get_cpu_info_from_platform_uname() self.assertEqual(5, info['stepping']) self.assertEqual(30, info['model']) self.assertEqual(6, info['family']) def test_get_cpu_info_from_wmic(self): info = cpuinfo._get_cpu_info_from_wmic() self.assertEqual('GenuineIntel', info['vendor_id_raw']) self.assertEqual('Intel(R) Core(TM) i7 CPU 870 @ 2.93GHz', info['brand_raw']) self.assertEqual('2.9300 GHz', info['hz_advertised_friendly']) self.assertEqual('2.9330 GHz', info['hz_actual_friendly']) self.assertEqual((2930000000, 0), info['hz_advertised']) self.assertEqual((2933000000, 0), info['hz_actual']) self.assertEqual(5, info['stepping']) self.assertEqual(30, info['model']) self.assertEqual(6, info['family']) self.assertEqual(256 * 1024, info['l2_cache_size']) self.assertEqual(8192 * 1024, info['l3_cache_size']) def test_get_cpu_info_from_registry(self): info = cpuinfo._get_cpu_info_from_registry() self.assertEqual('GenuineIntel', info['vendor_id_raw']) self.assertEqual('Intel(R) Core(TM) i7 CPU 870 @ 2.93GHz', info['brand_raw']) self.assertEqual('2.9300 GHz', info['hz_advertised_friendly']) self.assertEqual('2.9330 GHz', info['hz_actual_friendly']) self.assertEqual((2930000000, 0), info['hz_advertised']) self.assertEqual((2933000000, 0), info['hz_actual']) self.assertEqual( ['acpi', 'clflush', 'cmov', 'de', 'dts', 'fxsr', 'ia64', 'mce', 'mmx', 'msr', 'mtrr', 'sep', 'serial', 'ss', 'sse', 'sse2', 'tm', 'tsc'] , info['flags'] ) def test_all(self): info = cpuinfo._get_cpu_info_internal() self.assertEqual('GenuineIntel', info['vendor_id_raw']) self.assertEqual('Intel(R) Core(TM) i7 CPU 870 @ 2.93GHz', info['brand_raw']) self.assertEqual('2.9300 GHz', info['hz_advertised_friendly']) self.assertEqual('2.9330 GHz', info['hz_actual_friendly']) self.assertEqual((2930000000, 0), info['hz_advertised']) self.assertEqual((2933000000, 0), info['hz_actual']) self.assertEqual('X86_64', info['arch']) self.assertEqual(64, info['bits']) self.assertEqual(4, info['count']) self.assertEqual('AMD64', info['arch_string_raw']) self.assertEqual(5, info['stepping']) self.assertEqual(30, info['model']) self.assertEqual(6, info['family']) self.assertEqual(256 * 1024, info['l2_cache_size']) self.assertEqual(8192 * 1024, info['l3_cache_size']) self.assertEqual(6, info['l2_cache_associativity']) self.assertEqual(256, info['l2_cache_line_size']) self.assertEqual( ['acpi', 'apic', 'clflush', 'cmov', 'cx16', 'cx8', 'de', 'ds_cpl', 'dtes64', 'dts', 'est', 'fpu', 'fxsr', 'ht', 'ia64', 'lahf_lm', 'mca', 'mce', 'mmx', 'monitor', 'msr', 'mtrr', 'pae', 'pat', 'pbe', 'pdcm', 'pge', 'pni', 'popcnt', 'pse', 'pse36', 'sep', 'serial', 'smx', 'ss', 'sse', 'sse2', 'sse4_1', 'sse4_2', 'ssse3', 'tm', 'tm2', 'tsc', 'vme', 'vmx', 'xtpr'] , info['flags'] )