class PowerDomainSet

Defined at line 474 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 205 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 347 of file ../../zircon/kernel/lib/power-management/energy-model.cc

void PowerDomainSet ()

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

void PowerDomainSet (const PowerDomainSet & )

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

PowerDomainSet & operator= (const PowerDomainSet & )

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

void PowerDomainSet (PowerDomainSet && )

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

PowerDomainSet & operator= (PowerDomainSet && )

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

void ~PowerDomainSet ()

Defined at line 485 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 491 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 491 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 513 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 525 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 532 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 544 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 558 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 568 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 578 of file ../../zircon/kernel/lib/power-management/include/lib/power-management/energy-model.h

Utilization LookupTotalNormalizedUtilization (uint32_t cpu_num)

Defined at line 588 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 597 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 611 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 614 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 620 of file ../../zircon/kernel/lib/power-management/include/lib/power-management/energy-model.h

Friends

void PowerDomainSet (PowerDomainSet & aPowerDomainSet & b)