class PowerDomainSet

Defined at line 499 of file ../../zircon/kernel/lib/power-management/include/lib/power-management/energy-model.h

Maintains an array of ref pointers to the power domains in the system. This is used for both the

power domain registry storage and processor-local caches of the power domain set. Processor-local

caches avoid cross-processor and central lock contention when consulting a snapshot of the system

power domains during sensitive scheduling operations.

Public Members

static const size_t kMaxPowerDomains

Public Methods

zx::result<PowerDomainSet> Create (std::span<const power_domain_config_ffi> domain_configs)

Creates a PowerDomainSet from a span of FFI domain configurations.

Validates domain configs, determines system-wide peak rate normalization,

creates an EnergyModel for each domain, binds to the corresponding

PDevPowerLevelController, and constructs the PowerDomain instances.

Defined at line 216 of file ../../zircon/kernel/lib/power-management/energy-model.cc

zx::result<PowerDomainSet> Create (std::span<const power_domain_config_ffi> domain_configs)

Creates a PowerDomainSet from a span of FFI domain configurations.

Validates domain configs, determines system-wide peak rate normalization,

creates an EnergyModel for each domain, binds to the corresponding

PDevPowerLevelController, and constructs the PowerDomain instances.

Defined at line 358 of file ../../zircon/kernel/lib/power-management/energy-model.cc

void PowerDomainSet ()

Defined at line 505 of file ../../zircon/kernel/lib/power-management/include/lib/power-management/energy-model.h

void PowerDomainSet (const PowerDomainSet & )

Defined at line 506 of file ../../zircon/kernel/lib/power-management/include/lib/power-management/energy-model.h

PowerDomainSet & operator= (const PowerDomainSet & )

Defined at line 507 of file ../../zircon/kernel/lib/power-management/include/lib/power-management/energy-model.h

void PowerDomainSet (PowerDomainSet && )

Defined at line 508 of file ../../zircon/kernel/lib/power-management/include/lib/power-management/energy-model.h

PowerDomainSet & operator= (PowerDomainSet && )

Defined at line 509 of file ../../zircon/kernel/lib/power-management/include/lib/power-management/energy-model.h

void ~PowerDomainSet ()

Defined at line 510 of file ../../zircon/kernel/lib/power-management/include/lib/power-management/energy-model.h

zx::result<PowerDomainSet> Create (std::span<const fbl::RefPtr<PowerDomain>> domains)

Creates a PowerDomainSet from a span of PowerDomain references.

Validates that domain count is

<

= kMaxPowerDomains, all pointers are non-null,

each domain has a non-zero CPU mask, and no two domains share a domain ID or

have intersecting CPU masks.

Defined at line 516 of file ../../zircon/kernel/lib/power-management/include/lib/power-management/energy-model.h

zx::result<PowerDomainSet> Create (std::span<const fbl::RefPtr<PowerDomain>> domains)

Creates a PowerDomainSet from a span of PowerDomain references.

Validates that domain count is

<

= kMaxPowerDomains, all pointers are non-null,

each domain has a non-zero CPU mask, and no two domains share a domain ID or

have intersecting CPU masks.

Defined at line 516 of file ../../zircon/kernel/lib/power-management/include/lib/power-management/energy-model.h

zx::result<PowerDomainSet> Create (std::initializer_list<fbl::RefPtr<PowerDomain>> domains)

Defined at line 538 of file ../../zircon/kernel/lib/power-management/include/lib/power-management/energy-model.h

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

Creates a PowerDomainSet with the given PowerDomain as its only entry for testing.

Defined at line 550 of file ../../zircon/kernel/lib/power-management/include/lib/power-management/energy-model.h

PowerDomain * FindByDomainId (uint32_t domain_id)

Returns a borrowed pointer to the power domain with the given id, or nullptr if there isn't

one. Returns a raw pointer to avoid unnecessary ref count changes in contexts where the set is

guaranteed not to change and maintain the lifetime of its power domain elements.

Defined at line 557 of file ../../zircon/kernel/lib/power-management/include/lib/power-management/energy-model.h

PowerDomain * FindByCpuNum (uint32_t cpu_num)

Returns a borrowed pointer to the power domain for the given CPU id, or nullptr if there isn't

one. Returns a raw pointer to avoid unnecessary ref count changes in contexts where the set is

guaranteed not to change and maintain the lifetime of its power domain elements.

Defined at line 569 of file ../../zircon/kernel/lib/power-management/include/lib/power-management/energy-model.h

uint64_t LookupActivePowerCoefficient (uint32_t cpu_num, ProcessingRate processing_rate)

Looks up the active power coefficient for the given CPU operating at the given processing rate.

Returns 0 if there is no power domain for the given CPU or if there is no active power level

that lower bounds the given processing rate.

Defined at line 583 of file ../../zircon/kernel/lib/power-management/include/lib/power-management/energy-model.h

uint64_t LookupPowerCost (uint32_t cpu_num, ProcessingRate processing_rate)

Defined at line 593 of file ../../zircon/kernel/lib/power-management/include/lib/power-management/energy-model.h

std::optional<uint8_t> LookupPowerLevel (uint32_t cpu_num, ProcessingRate processing_rate)

Defined at line 603 of file ../../zircon/kernel/lib/power-management/include/lib/power-management/energy-model.h

Utilization LookupTotalNormalizedUtilization (uint32_t cpu_num)

Defined at line 613 of file ../../zircon/kernel/lib/power-management/include/lib/power-management/energy-model.h

template <typename Visitor>
void Visit (Visitor && visitor)

Visits each non-empty power domain element with the given callable.

Defined at line 622 of file ../../zircon/kernel/lib/power-management/include/lib/power-management/energy-model.h

const ArrayType & domains ()

Returns a const reference to the underlying power domain array.

Defined at line 636 of file ../../zircon/kernel/lib/power-management/include/lib/power-management/energy-model.h

size_t count ()

Returns the count of non-empty array elements.

Defined at line 639 of file ../../zircon/kernel/lib/power-management/include/lib/power-management/energy-model.h

bool is_empty ()

Returns true if all of the array elements are empty.

Defined at line 645 of file ../../zircon/kernel/lib/power-management/include/lib/power-management/energy-model.h

Friends

void PowerDomainSet (PowerDomainSet & aPowerDomainSet & b)