Power / Energy

Example

General power information:

julia> power = LIKWID.Power.get_power_info()
LIKWID.PowerInfo
├ baseFrequency: 3300.0 MHz
├ minFrequency: 1200.0 MHz
├ turbo: TurboBoost()
├ hasRAPL: true
├ powerUnit: 125000.0
├ timeUnit: 976.0
├ uncoreMinFreq: 1200.0 MHz
├ uncoreMaxFreq: 2400.0 MHz
├ perfBias: 6
└ domains: ... (5 elements)

julia> power.domains
(PowerDomain(PKG, ...), PowerDomain(PP0, ...), PowerDomain(PP1, ...), PowerDomain(DRAM, ...), PowerDomain(PLATFORM, ...))

julia> first(power.domains)
LIKWID.PowerDomain
├ id: 0
├ type: PKG
├ supportFlags: 27
├ energyUnit: 6.103515625e-5
├ tdp: 1.65e8
├ minPower: 6.8e7
├ maxPower: 1.65e8
├ maxTimeWindow: 31232.0
├ supportInfo: true
├ supportStatus: true
├ supportPerf: true
├ supportPolicy: false
└ supportLimit: true

Energy measurement:

julia> LIKWID.Power.measure(; cpuid=0, domainid=0) do
        sleep(1)
       end
29.9920654296875 μJ

julia> LIKWID.Power.measure(; cpuid=0, domainid=0) do
        sum(sin(rand()) for _ in 1:1_000_000)
       end
0.5574951171875 μJ

(Note that the example requires that the first (perhaps only) Julia thread is pinned to the CPU thread with id 0.)

Index

Functions

LIKWID.Power.initFunction

Initialize power measurements for the given CPU. Returns the RAPL status, i.e. false (no RAPL) or true (RAPL working).

source
LIKWID.Power.get_powerFunction
get_power(p_start::Integer, p_stop::Integer, domainid::Integer)

Calculate the μJ from the values retrieved by start_power() and stop_power().

source
LIKWID.Power.measureFunction
measure(f; cpuid::Integer=0, domainid::Integer)

Measure / calculate the energy for the given cpuid and domainid over the execution of the function f using Power.start_power, Power.stop_power, etc. under the hood. Automatically initializes and finalizes the power module.

Examples

julia> LIKWID.Power.measure(; cpuid=0, domainid=0) do
           sleep(1)
       end
15.13702392578125 μJ
source

Types