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 9b82f25 commit 3d60803
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/collector/metric/node_metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,10 @@ func (ne *NodeMetrics) UpdateDynEnergy() {
func (ne *NodeMetrics) CalcDynEnergy(component, id string) {
total := ne.getAbsoluteEnergyStatCollection(component).Stat[id].Delta
klog.V(5).Infof("Energy stat: %v (%s)", ne.getIdleEnergyStatCollection(component).Stat, id)
idle := ne.getIdleEnergyStatCollection(component).Stat[id].Delta
idle := uint64(0)
if idleStat, found := ne.getIdleEnergyStatCollection(component).Stat[id]; found {
idle = idleStat.Delta
}
dyn := calcDynEnergy(total, idle)
ne.getDynEnergyStatCollection(component).SetDeltaStat(id, dyn)
}
Expand Down

0 comments on commit 3d60803

Please sign in to comment.