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

Support hmc client to get energy consumption from IBM System Z #1030

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jiangphcn
Copy link
Contributor

The purpose of this PR Support is to support external power source: HMC referred in #644.

Starting IBM Z 16, LPAR level power metrics is exposed and available. The golang zhmclient package is enhanced and open-sourced in zhmcclient/golang-zhmcclient@6bb10a7.

Current PR is using such API to provide power consumption calculation for applications running in IBM System Z.

"k8s.io/klog/v2"

"github.com/sustainable-computing-io/kepler/pkg/power/components/source"
"github.com/zhmcclient/golang-zhmcclient/pkg/zhmcclient"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we have any CI case for this?

if err != nil {
klog.V(1).Infof("Error getting energy data: %v", err.Message)
}
klog.V(1).Infof("Get energy data successfully")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems will lead to many logs?


func (r *PowerHMC) GetNodeComponentsEnergy() map[int]source.NodeComponentsEnergy {
pkgEnergy, _ := r.GetLiveEnergyFromLpar()
pkgEnergy = pkgEnergy * 3
Copy link
Contributor

@rootfs rootfs Nov 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is *3 for? can you leave a comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is aimed to align with defaultSamplePeriodSec = 3 used in the kepler. Still try to finalize it and then leave explanation in the comment.

func (r *PowerHMC) GetPlatformEnergy() map[string]float64 {
pkgEnergy, _ := r.GetLiveEnergyFromLpar()
platformEnergies := make(map[string]float64)
platformEnergies[hmcSensorID] = float64(pkgEnergy) * 3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is lpar energy at the platform level or pkg level? if it is a platform level energy source, we can probably skip getting pkg energy

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess there is no pkg concept in z platform

@jiangphcn can we have a doc describe the relationship between z and x86 concept difference so we know what energy mapping to existing defined variables to give a clear picture?

Copy link

stale bot commented Jan 1, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Jan 1, 2024
@SamYuan1990 SamYuan1990 removed the wontfix This will not be worked on label Jan 3, 2024
Signed-off-by: Peng Hui Jiang <jiangph@cn.ibm.com>
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

Successfully merging this pull request may close these issues.

None yet

4 participants