crash.types.cpu module

The crash.types.cpu module offers helpers to work with the state of CPUs.

class crash.types.cpu.TypesCPUClass[source]

Bases: object

A state holder class for handling CPUs. Not meant to be instantiated.

cpus_online

A list of the IDs of all online CPUs.

Type:

list of int

cpus_possible

A list of the IDs of all possible CPUs.

Type:

list of int

cpus_online: List[int] = []
cpus_possible: List[int] = []
classmethod setup_online_mask(symbol: Symbol) None[source]

Translate the cpu_online_mask bitmap into a list of online CPU numbers.

Meant to be used as a SymbolCallback.

Parameters:

symbol – The symbol for cpu_online_mask or __cpu_online_mask, depending on kernel version.

classmethod setup_possible_mask(cpu_mask: Symbol) None[source]

Translate the cpu_possible_mask bitmap into a list of possible CPU numbers.

Meant to be used as a SymbolCallback.

Parameters:

cpu_mask – The symbol for cpu_possible_mask or __cpu_possible_mask, depending on kernel version.

crash.types.cpu.for_each_online_cpu() Iterable[int][source]

Yield CPU numbers of all online CPUs

Yields:

int – Number of an online CPU location

crash.types.cpu.for_each_possible_cpu() Iterable[int][source]

Yield CPU numbers of all possible CPUs

Yields:

int – Number of a possible CPU location

crash.types.cpu.highest_online_cpu_nr() int[source]

Return The highest online CPU number

Returns:

The highest online CPU number

Return type:

int

crash.types.cpu.highest_possible_cpu_nr() int[source]

Return The highest possible CPU number

Returns:

The highest possible CPU number

Return type:

int