diff --git a/pkg/kubelet/winstats/perfcounter_nodestats.go b/pkg/kubelet/winstats/perfcounter_nodestats.go index be4948b637f..329bd608214 100644 --- a/pkg/kubelet/winstats/perfcounter_nodestats.go +++ b/pkg/kubelet/winstats/perfcounter_nodestats.go @@ -207,7 +207,7 @@ func (p *perfCounterNodeStatsClient) convertCPUValue(cpuCores int, cpuValue uint } func (p *perfCounterNodeStatsClient) getCPUUsageNanoCores() uint64 { - cpuUsageNanoCores := (p.cpuUsageCoreNanoSecondsCache.latestValue - p.cpuUsageCoreNanoSecondsCache.previousValue) * uint64(time.Second / time.Nanosecond) / uint64(defaultCachePeriod) + cpuUsageNanoCores := (p.cpuUsageCoreNanoSecondsCache.latestValue - p.cpuUsageCoreNanoSecondsCache.previousValue) * uint64(time.Second/time.Nanosecond) / uint64(defaultCachePeriod) return cpuUsageNanoCores } diff --git a/pkg/kubelet/winstats/winstats_test.go b/pkg/kubelet/winstats/winstats_test.go index 9f4e41573ea..c74598ba3b7 100644 --- a/pkg/kubelet/winstats/winstats_test.go +++ b/pkg/kubelet/winstats/winstats_test.go @@ -151,7 +151,7 @@ func TestConvertCPUValue(t *testing.T) { func TestGetCPUUsageNanoCores(t *testing.T) { p := perfCounterNodeStatsClient{} p.cpuUsageCoreNanoSecondsCache = cpuUsageCoreNanoSecondsCache{ - latestValue: uint64(5000000000), + latestValue: uint64(5000000000), previousValue: uint64(2000000000), } cpuUsageNanoCores := p.getCPUUsageNanoCores()