This commit is contained in:
Ingo Oppermann
2023-04-11 15:04:31 +02:00
parent 0e73a0fdf3
commit aef1b7c9a2
116 changed files with 1731 additions and 454 deletions

View File

@@ -2,6 +2,7 @@ package psutil
import (
"context"
"errors"
"fmt"
"io"
"io/fs"
@@ -284,6 +285,10 @@ func (u *util) cpuTimes() (*cpuTimesStat, error) {
return nil, err
}
if len(times) == 0 {
return nil, errors.New("cpu.Times() returned an empty slice")
}
s := &cpuTimesStat{
total: cpuTotal(&times[0]),
system: times[0].System,