Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
kargh committed Jan 19, 2023
1 parent d9e3e7e commit 68eec87
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cpu/cpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,14 @@ func calculateAllBusy(t1, t2 []TimesStat) ([]float64, error) {
func calculateAllBusyMode(t1, t2 []TimesStat) (TimesStat, error) {
// Make sure the CPU measurements have the same length.
if len(t1) != len(t2) {
return nil, fmt.Errorf(
return _, fmt.Errorf(
"received two CPU counts: %d != %d",
len(t1), len(t2),
)
}

//ret := make([]TimesStat, len(t1))
ret := []TimesStat
ret := TimesStat
for i, t := range t2 {
ret,_ = UsedTime(t1[i], t)
}
Expand Down Expand Up @@ -267,7 +267,7 @@ func percentUsedFromLastCallWithContext(ctx context.Context, percpu bool) ([]flo
func percentUsedFromLastCallWithContextMode(ctx context.Context, percpu bool) (TimesStat, error) {
cpuTimes, err := TimesWithContext(ctx, percpu)
if err != nil {
return nil, err
return _, err
}
lastCPUPercent.Lock()
defer lastCPUPercent.Unlock()
Expand All @@ -281,7 +281,7 @@ func percentUsedFromLastCallWithContextMode(ctx context.Context, percpu bool) (T
}

if lastTimes == nil {
return nil, fmt.Errorf("error getting times for cpu percent. lastTimes was nil")
return _, fmt.Errorf("error getting times for cpu percent. lastTimes was nil")
}
return calculateAllBusyMode(lastTimes, cpuTimes)
}

0 comments on commit 68eec87

Please sign in to comment.