class PowerState

Defined at line 49 of file ../../zircon/kernel/lib/power-management/include/lib/power-management/power-state.h

PowerState encapsulates the current power level, power domain, and energy model for an individual

processor.

Instances of PowerState are not safe for concurrent use and must be protected by an external lock

associated with the owning processor.

Public Methods

PowerDomainSet UpdatePowerDomainSet (PowerDomainSet power_domain_set, uint32_t cpu_num)

Updates the power domain set and associates this power state with the domain in the set

matching the given CPU number. Returns the previous power domain set.

Defined at line 21 of file ../../zircon/kernel/lib/power-management/power-state.cc

std::optional<PowerLevelUpdateRequest> RequestTransition (uint32_t cpu_num, uint8_t active_power_level)

Posts a request to transition the power domain associated with this power state to a given

active power level from the current energy model.

Ignored when no domain is set. Asserts that the requested power level is an active power level.

`cpu_num` is the CPU associated with this power state.

`level` is the desired power level.

Defined at line 50 of file ../../zircon/kernel/lib/power-management/power-state.cc

void PowerState ()

Defined at line 51 of file ../../zircon/kernel/lib/power-management/include/lib/power-management/power-state.h

bool is_enabled ()

Returns true if the power domain is set.

Defined at line 54 of file ../../zircon/kernel/lib/power-management/include/lib/power-management/power-state.h

const fbl::RefPtr<PowerDomain> & domain ()

Domain the PowerState is being modeled after. Returns nullptr is there is

no power domain configured for processor owning this power state.

Defined at line 58 of file ../../zircon/kernel/lib/power-management/include/lib/power-management/power-state.h

std::optional<uint32_t> domain_id ()

Returns the id of the domain this power state belongs to.

Defined at line 61 of file ../../zircon/kernel/lib/power-management/include/lib/power-management/power-state.h

bool is_serving ()

Returns whether the domain's controller is serving requests. Returns false if there is no

domain.

Defined at line 70 of file ../../zircon/kernel/lib/power-management/include/lib/power-management/power-state.h

bool scheduler_control_enabled ()

Returns whether the kernel scheduler should send power level update requests through the

control interface to handle utilization changes.

Defined at line 74 of file ../../zircon/kernel/lib/power-management/include/lib/power-management/power-state.h

std::optional<uint8_t> active_power_level ()

Returns the active power level when device is not idle.

Defined at line 79 of file ../../zircon/kernel/lib/power-management/include/lib/power-management/power-state.h

std::optional<uint8_t> desired_active_power_level ()

Returns the active power level the device is in the processo of transitioning to.

Defined at line 82 of file ../../zircon/kernel/lib/power-management/include/lib/power-management/power-state.h

std::optional<uint8_t> max_idle_power_level ()

Returns the maximum (i.e. highest power, lowest latency) idle power level.

Defined at line 87 of file ../../zircon/kernel/lib/power-management/include/lib/power-management/power-state.h

zx::result<> UpdateActivePowerLevel (uint8_t active_power_level)

Updates the active power level of this power state. Typically called in response to the power

level controller completing a power level transition request.

Defined at line 87 of file ../../zircon/kernel/lib/power-management/power-state.cc

uint64_t active_power_coefficient_nw ()

Returns the power coefficient of the current active power level. Returns zero if there is no

active power level or no domain is set.

Defined at line 96 of file ../../zircon/kernel/lib/power-management/include/lib/power-management/power-state.h

uint64_t max_idle_power_coefficient_nw ()

Returns the power coefficient of the maximum idle power level. Returns zero if there is no

idle power level or no domain is set.

Defined at line 105 of file ../../zircon/kernel/lib/power-management/include/lib/power-management/power-state.h

std::optional<ControlInterface> max_idle_power_level_interface ()

Returns the control interface of the maximum idle power level. Returns nullopt if there is no

idle power level or no domain is set.

Defined at line 114 of file ../../zircon/kernel/lib/power-management/include/lib/power-management/power-state.h

bool IsValidActivePowerLevel (uint8_t power_level)

Returns true if the given power level is valid active power level.

Defined at line 122 of file ../../zircon/kernel/lib/power-management/include/lib/power-management/power-state.h

ProcessingRate max_processing_rate ()

Returns the processing rate of the fastest power level in this domain.

Defined at line 131 of file ../../zircon/kernel/lib/power-management/include/lib/power-management/power-state.h

ProcessingRate active_processing_rate ()

Returns the processing rate of the current active power level. Returns zero if there is no

active power level or no domain is set.

Defined at line 140 of file ../../zircon/kernel/lib/power-management/include/lib/power-management/power-state.h

ProcessingRate preceding_active_processing_rate ()

Returns the processing rate of the preceding active power level (i.e. the

lower bound of the current active power level). Returns zero if there is no

preceding active power level, no active power level is set, or no domain

is set.

Defined at line 151 of file ../../zircon/kernel/lib/power-management/include/lib/power-management/power-state.h

std::optional<uint8_t> target_active_power_level ()

Returns the targeted active power level (the in-flight desired level if set,

otherwise the current active level).

Defined at line 163 of file ../../zircon/kernel/lib/power-management/include/lib/power-management/power-state.h

ProcessingRate target_processing_rate ()

Returns the processing rate of the targeted active power level (the in-flight

desired level if set, otherwise the current active level).

Defined at line 170 of file ../../zircon/kernel/lib/power-management/include/lib/power-management/power-state.h

ProcessingRate preceding_target_processing_rate ()

Returns the processing rate of the active power level immediately preceding

the targeted active power level (i.e. the lower bound of the targeted active

power level).

Defined at line 182 of file ../../zircon/kernel/lib/power-management/include/lib/power-management/power-state.h

bool has_preceding_target_power_level ()

Returns true if the targeted active power level has an active power level

preceding it (i.e. is not the lowest active power level).

Defined at line 196 of file ../../zircon/kernel/lib/power-management/include/lib/power-management/power-state.h

Utilization normalized_utilization ()

Returns the current utilization of the processor.

Defined at line 206 of file ../../zircon/kernel/lib/power-management/include/lib/power-management/power-state.h

Utilization total_normalized_utilization ()

Returns the total normalized utilization of the domain this processor belongs to.

Defined at line 209 of file ../../zircon/kernel/lib/power-management/include/lib/power-management/power-state.h

const PowerDomainSet & power_domain_set ()

Defined at line 220 of file ../../zircon/kernel/lib/power-management/include/lib/power-management/power-state.h

Utilization UpdateUtilization (Utilization utilization_delta)

Update the utilization of this processor and the total utilization of its domain.

Defined at line 238 of file ../../zircon/kernel/lib/power-management/include/lib/power-management/power-state.h