Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
VihasMakwana committed Nov 26, 2024
1 parent f0d2015 commit 45028a5
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions metric/cpu/metrics_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,18 @@ func Get(_ resolve.Resolver) (CPUMetrics, error) {
// For CPU core {i}, idleRawData[i], kernelRawData[i], and userRawData[i] correspond to the idle time, kernel time, and user time, respectively.

// values returned by counter are in 100-ns intervals. Hence, convert it to millisecond.
idleTimeMs := time.Duration(idleRawData[i].RawValue.FirstValue*100) / time.Millisecond
kernelTimeMs := time.Duration(kernelRawData[i].RawValue.FirstValue*100) / time.Millisecond
userTimeMs := time.Duration(userRawData[i].RawValue.FirstValue*100) / time.Millisecond
idleTime := time.Duration(idleRawData[i].RawValue.FirstValue*100) / time.Millisecond
kernelTime := time.Duration(kernelRawData[i].RawValue.FirstValue*100) / time.Millisecond
userTime := time.Duration(userRawData[i].RawValue.FirstValue*100) / time.Millisecond

globalMetrics.list[i].Idle = opt.UintWith(uint64(idleTimeMs))
globalMetrics.list[i].Sys = opt.UintWith(uint64(kernelTimeMs))
globalMetrics.list[i].User = opt.UintWith(uint64(userTimeMs))
globalMetrics.list[i].Idle = opt.UintWith(uint64(idleTime))
globalMetrics.list[i].Sys = opt.UintWith(uint64(kernelTime))
globalMetrics.list[i].User = opt.UintWith(uint64(userTime))

// add the per-cpu time to track the total time spent by system
idle += idleTimeMs
kernel += kernelTimeMs
user += userTimeMs
idle += idleTime
kernel += kernelTime
user += userTime
}

globalMetrics.totals.Idle = opt.UintWith(uint64(idle))
Expand Down

0 comments on commit 45028a5

Please sign in to comment.