Skip to content

Commit

Permalink
handle unset idle collection
Browse files Browse the repository at this point in the history
Signed-off-by: Sunyanan Choochotkaew <[email protected]>
  • Loading branch information
sunya-ch committed Aug 24, 2023
1 parent 0d645b7 commit ac33b56
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
14 changes: 9 additions & 5 deletions pkg/collector/metric/node_metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"github.com/sustainable-computing-io/kepler/pkg/config"
"github.com/sustainable-computing-io/kepler/pkg/power/accelerator/gpu"
qat "github.com/sustainable-computing-io/kepler/pkg/power/accelerator/qat/source"
"github.com/sustainable-computing-io/kepler/pkg/power/components"
"github.com/sustainable-computing-io/kepler/pkg/power/components/source"
)

Expand Down Expand Up @@ -345,15 +346,18 @@ func (ne *NodeMetrics) SetNodeGPUEnergy(gpuEnergy []uint32, isIdleEnergy bool) {
}

func (ne *NodeMetrics) UpdateIdleEnergyWithMinValue() {
ne.CalcIdleEnergy(CORE)
ne.CalcIdleEnergy(DRAM)
ne.CalcIdleEnergy(UNCORE)
ne.CalcIdleEnergy(PKG)
// gpu metric
if config.EnabledGPU && gpu.IsGPUCollectionSupported() {
ne.CalcIdleEnergy(GPU)
}
ne.CalcIdleEnergy(PLATFORM)

if components.IsSystemCollectionSupported() {
ne.CalcIdleEnergy(CORE)
ne.CalcIdleEnergy(DRAM)
ne.CalcIdleEnergy(UNCORE)
ne.CalcIdleEnergy(PKG)
ne.CalcIdleEnergy(PLATFORM)
}
// reset
ne.FoundNewIdleState = false
}
Expand Down
10 changes: 5 additions & 5 deletions pkg/collector/node_energy_collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ func (c *Collector) updateNodeAvgCPUFrequency(wg *sync.WaitGroup) {
// updateNodeIdleEnergy calculates the node idle energy consumption based on the minimum power consumption when real-time system power metrics are accessible.
// When the node power model estimator is utilized, the idle power is updated with the estimated power considering minimal resource utilization.
func (c *Collector) updateNodeIdleEnergy() {
if components.IsSystemCollectionSupported() {
// the idle energy is only updated if we find the node using less resources than previously observed
// TODO: Use regression to estimate the idle power when real-time system power metrics are available, instead of relying on the minimum power consumption.
c.NodeMetrics.UpdateIdleEnergyWithMinValue()
} else {
// the idle energy is only updated if we find the node using less resources than previously observed
// TODO: Use regression to estimate the idle power when real-time system power metrics are available, instead of relying on the minimum power consumption.
c.NodeMetrics.UpdateIdleEnergyWithMinValue()
if !components.IsSystemCollectionSupported() {
// if power collection on components is not supported, try using estimator to update idle energy
if model.IsNodeComponentPowerModelEnabled() {
nodeComponentsEnergy := model.GetNodeComponentPowers(&c.NodeMetrics, idlePower)
// the node components power model returns gauge mentrics
Expand Down

0 comments on commit ac33b56

Please sign in to comment.