cpuinfo#

Classes#

Trace

DataSource

ASM

CPUID

Functions#

_program_paths(program_name)

_run_and_get_stdout(command[, pipe_command])

_read_windows_registry_key(key_name, field_name)

_check_arch()

_obj_to_b64(thing)

_b64_to_obj(thing)

_utf_to_str(input)

_copy_new_fields(info, new_info)

_get_field_actual(cant_be_number, raw_string, field_names)

_get_field(cant_be_number, raw_string, convert_to, ...)

_to_decimal_string(ticks)

_hz_short_to_full(ticks, scale)

_hz_friendly_to_full(hz_string)

_hz_short_to_friendly(ticks, scale)

_to_friendly_bytes(input)

_friendly_bytes_to_int(friendly_bytes)

_parse_cpu_brand_string(cpu_string)

_parse_cpu_brand_string_dx(cpu_string)

_parse_dmesg_output(output)

_parse_arch(arch_string_raw)

_is_bit_set(reg, bit)

_is_selinux_enforcing(trace)

_filter_dict_keys_with_empty_values(info[, ...])

_get_cpu_info_from_cpuid_actual()

Warning! This function has the potential to crash the Python runtime.

_get_cpu_info_from_cpuid_subprocess_wrapper(queue)

_get_cpu_info_from_cpuid()

Returns the CPU info gathered by querying the X86 cpuid register in a new process.

_get_cpu_info_from_proc_cpuinfo()

Returns the CPU info gathered from /proc/cpuinfo.

_get_cpu_info_from_cpufreq_info()

Returns the CPU info gathered from cpufreq-info.

_get_cpu_info_from_lscpu()

Returns the CPU info gathered from lscpu.

_get_cpu_info_from_dmesg()

Returns the CPU info gathered from dmesg.

_get_cpu_info_from_ibm_pa_features()

Returns the CPU info gathered from lsprop /proc/device-tree/cpus/*/ibm,pa-features

_get_cpu_info_from_cat_var_run_dmesg_boot()

Returns the CPU info gathered from /var/run/dmesg.boot.

_get_cpu_info_from_sysctl()

Returns the CPU info gathered from sysctl.

_get_cpu_info_from_sysinfo()

Returns the CPU info gathered from sysinfo.

_get_cpu_info_from_sysinfo_v1()

Returns the CPU info gathered from sysinfo.

_get_cpu_info_from_sysinfo_v2()

Returns the CPU info gathered from sysinfo.

_get_cpu_info_from_wmic()

Returns the CPU info gathered from WMI.

_get_cpu_info_from_registry()

Returns the CPU info gathered from the Windows Registry.

_get_cpu_info_from_kstat()

Returns the CPU info gathered from isainfo and kstat.

_get_cpu_info_from_platform_uname()

_get_cpu_info_internal()

Returns the CPU info by using the best sources of information for your OS.

get_cpu_info_json()

Returns the CPU info by using the best sources of information for your OS.

get_cpu_info()

Returns the CPU info by using the best sources of information for your OS.

main()

Attributes#

CPUINFO_VERSION

CPUINFO_VERSION_STRING

CAN_CALL_CPUID_IN_SUBPROCESS

g_trace

deprecated

CPUINFO_VERSION = (9, 0, 0)#
CPUINFO_VERSION_STRING#
CAN_CALL_CPUID_IN_SUBPROCESS = True#
g_trace#
class Trace(is_active, is_stored_in_string)#

Bases: object

header(msg)#
success()#
fail(msg)#
command_header(msg)#
command_output(msg, output)#
keys(keys, info, new_info)#
write(msg)#
to_dict(info, is_fail)#
class DataSource#

Bases: object

bits#
cpu_count#
is_windows#
arch_string_raw#
uname_string_raw#
can_cpuid = True#
static has_proc_cpuinfo()#
static has_dmesg()#
static has_var_run_dmesg_boot()#
static has_cpufreq_info()#
static has_sestatus()#
static has_sysctl()#
static has_isainfo()#
static has_kstat()#
static has_sysinfo()#
static has_lscpu()#
static has_ibm_pa_features()#
static has_wmic()#
static cat_proc_cpuinfo()#
static cpufreq_info()#
static sestatus_b()#
static dmesg_a()#
static cat_var_run_dmesg_boot()#
static sysctl_machdep_cpu_hw_cpufrequency()#
static isainfo_vb()#
static kstat_m_cpu_info()#
static sysinfo_cpu()#
static lscpu()#
static ibm_pa_features()#
static wmic_cpu()#
static winreg_processor_brand()#
static winreg_vendor_id_raw()#
static winreg_arch_string_raw()#
static winreg_hz_actual()#
static winreg_feature_bits()#
_program_paths(program_name)#
_run_and_get_stdout(command, pipe_command=None)#
_read_windows_registry_key(key_name, field_name)#
_check_arch()#
_obj_to_b64(thing)#
_b64_to_obj(thing)#
_utf_to_str(input)#
_copy_new_fields(info, new_info)#
_get_field_actual(cant_be_number, raw_string, field_names)#
_get_field(cant_be_number, raw_string, convert_to, default_value, *field_names)#
_to_decimal_string(ticks)#
_hz_short_to_full(ticks, scale)#
_hz_friendly_to_full(hz_string)#
_hz_short_to_friendly(ticks, scale)#
_to_friendly_bytes(input)#
_friendly_bytes_to_int(friendly_bytes)#
_parse_cpu_brand_string(cpu_string)#
_parse_cpu_brand_string_dx(cpu_string)#
_parse_dmesg_output(output)#
_parse_arch(arch_string_raw)#
_is_bit_set(reg, bit)#
_is_selinux_enforcing(trace)#
_filter_dict_keys_with_empty_values(info, acceptable_values={})#
class ASM(restype=None, argtypes=(), machine_code=[])#

Bases: object

compile()#
run()#
free()#
class CPUID(trace=None)#

Bases: object

_asm_func(restype=None, argtypes=(), machine_code=[])#
_run_asm(*machine_code)#
get_vendor_id()#
get_info()#
get_max_extension_support()#
get_flags(max_extension_support)#
get_processor_brand(max_extension_support)#
get_cache(max_extension_support)#
get_ticks_func()#
get_raw_hz()#
_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.

_get_cpu_info_from_cpuid_subprocess_wrapper(queue)#
_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.

_get_cpu_info_from_proc_cpuinfo()#

Returns the CPU info gathered from /proc/cpuinfo. Returns {} if /proc/cpuinfo is not found.

_get_cpu_info_from_cpufreq_info()#

Returns the CPU info gathered from cpufreq-info. Returns {} if cpufreq-info is not found.

_get_cpu_info_from_lscpu()#

Returns the CPU info gathered from lscpu. Returns {} if lscpu is not found.

_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.

_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.

_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.

_get_cpu_info_from_sysctl()#

Returns the CPU info gathered from sysctl. Returns {} if sysctl is not found.

_get_cpu_info_from_sysinfo()#

Returns the CPU info gathered from sysinfo. Returns {} if sysinfo is not found.

_get_cpu_info_from_sysinfo_v1()#

Returns the CPU info gathered from sysinfo. Returns {} if sysinfo is not found.

_get_cpu_info_from_sysinfo_v2()#

Returns the CPU info gathered from sysinfo. Returns {} if sysinfo is not found.

_get_cpu_info_from_wmic()#

Returns the CPU info gathered from WMI. Returns {} if not on Windows, or wmic is not installed.

_get_cpu_info_from_registry()#

Returns the CPU info gathered from the Windows Registry. Returns {} if not on Windows.

_get_cpu_info_from_kstat()#

Returns the CPU info gathered from isainfo and kstat. Returns {} if isainfo or kstat are not found.

_get_cpu_info_from_platform_uname()#
_get_cpu_info_internal()#

Returns the CPU info by using the best sources of information for your OS. Returns {} if nothing is found.

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

get_cpu_info()#

Returns the CPU info by using the best sources of information for your OS. Returns the result in a dict

main()#
deprecated#