|
|
@ -5,6 +5,7 @@ package cpu
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"errors"
|
|
|
|
"fmt"
|
|
|
|
"fmt"
|
|
|
|
"strconv"
|
|
|
|
"strconv"
|
|
|
|
"strings"
|
|
|
|
"strings"
|
|
|
@ -152,6 +153,10 @@ func perCPUTimes(machLib *common.Library) ([]TimesStat, error) {
|
|
|
|
return nil, fmt.Errorf("host_processor_info error=%d", status)
|
|
|
|
return nil, fmt.Errorf("host_processor_info error=%d", status)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if cpuload == nil {
|
|
|
|
|
|
|
|
return nil, errors.New("host_processor_info returned nil cpuload")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
defer vmDeallocate(machTaskSelf(), uintptr(unsafe.Pointer(cpuload)), uintptr(ncpu))
|
|
|
|
defer vmDeallocate(machTaskSelf(), uintptr(unsafe.Pointer(cpuload)), uintptr(ncpu))
|
|
|
|
|
|
|
|
|
|
|
|
ret := []TimesStat{}
|
|
|
|
ret := []TimesStat{}
|
|
|
|