Vendor psutils and remove neko
This commit is contained in:
37
plugins/system/ps/load/load_darwin.go
Normal file
37
plugins/system/ps/load/load_darwin.go
Normal file
@@ -0,0 +1,37 @@
|
||||
// +build darwin
|
||||
|
||||
package load
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
common "github.com/shirou/gopsutil/common"
|
||||
)
|
||||
|
||||
func LoadAvg() (*LoadAvgStat, error) {
|
||||
values, err := common.DoSysctrl("vm.loadavg")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
load1, err := strconv.ParseFloat(values[0], 64)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
load5, err := strconv.ParseFloat(values[1], 64)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
load15, err := strconv.ParseFloat(values[2], 64)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
ret := &LoadAvgStat{
|
||||
Load1: float64(load1),
|
||||
Load5: float64(load5),
|
||||
Load15: float64(load15),
|
||||
}
|
||||
|
||||
return ret, nil
|
||||
}
|
||||
Reference in New Issue
Block a user