Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What does the API "getSystemConsumedEnergy" get? #891

Open
baihe-liu opened this issue Dec 13, 2024 · 2 comments
Open

What does the API "getSystemConsumedEnergy" get? #891

baihe-liu opened this issue Dec 13, 2024 · 2 comments

Comments

@baihe-liu
Copy link

I'm trying to use pcm API to get energy consumption, my platform is Tiger Lake.
Could you please tell me what does system consumed energy means in the function "getSystemConsumedEnergy"?

template <class CounterStateType>
uint64 getSystemConsumedEnergy(const CounterStateType& before, const CounterStateType& after)
{
    return after.systemEnergyStatus - before.systemEnergyStatus;
}

I found SystemCounterState.systemEnergyStatus will only be updated by reading from MSR in function PCM::getALLCounterStates
And I got different result using SystemCounterState from 'getSystemCounterState' and 'getALLCounterStates'

================== Energy Consumption by getSystemCounterState  ==================  
[Energy_Monitor] getConsumedJoules: 14.5959 Joules
[Energy_Monitor] getConsumedJoules(0): 10.5076 Joules
[Energy_Monitor] getConsumedJoules(1): 0.000549316 Joules
[Energy_Monitor] getDRAMConsumedJoules: 0 Joules
[Energy_Monitor] getSystemConsumedJoules: 0 Joules
================== Energy Consumption by getALLCounterStates  ==================
[Energy_Monitor] getConsumedJoules: 14.5959 Joules
[Energy_Monitor] getConsumedJoules(0): 0 Joules
[Energy_Monitor] getConsumedJoules(1): 0 Joules
[Energy_Monitor] getDRAMConsumedJoules: 0 Joules
[Energy_Monitor] getSystemConsumedJoules: 7.3775 Joules

The system consumed joules is less that package consumed joules, what does the system consist of?
Thank you.

@rdementi
Copy link
Contributor

Hi,

the value the system energy metric is retrieved from the MSR_PLATFORM_ENERGY_COUNTER register (Intel Software Developer Manual www.intel.com/sdm):
image

Platform vendor and BIOS communicate the system energy value to the CPU MSR register. Could you please also share the output of pcm utility? Here is a sample output from an HP laptop (the platform and BIOS vendor is HP):

image

The metrics of interest are "SYS energy", "CPU energy", "PP0 energy" and "PP1 energy"

@rdementi
Copy link
Contributor

I checked that the "SYS energy" PCM value on my HP laptop is close to the power meter reading at the wall.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants