change caps of the constant
This commit is contained in:
parent
365e688cec
commit
dcfbf40dbf
|
@ -103,7 +103,7 @@ void freeCPUTimes(double *cpu_times) {
|
|||
*/
|
||||
import "C"
|
||||
|
||||
const MAXCPUTIMESLEN = C.MAXCPU * C.CPUSTATES
|
||||
const maxCPUTimesLen = C.MAXCPU * C.CPUSTATES
|
||||
|
||||
type statCollector struct {
|
||||
cpu *prometheus.CounterVec
|
||||
|
@ -152,12 +152,12 @@ func (c *statCollector) Update(ch chan<- prometheus.Metric) (err error) {
|
|||
return errors.New("could not retrieve CPU times")
|
||||
}
|
||||
defer C.freeCPUTimes(cpuTimesC)
|
||||
if cpuTimesLength > MAXCPUTIMESLEN {
|
||||
if cpuTimesLength > maxCPUTimesLen {
|
||||
return errors.New("more CPU's than MAXCPU?")
|
||||
}
|
||||
|
||||
// Convert C.double array to Go array (https://github.com/golang/go/wiki/cgo#turning-c-arrays-into-go-slices).
|
||||
cpuTimes := (*[MAXCPUTIMESLEN]C.double)(unsafe.Pointer(cpuTimesC))[:cpuTimesLength:cpuTimesLength]
|
||||
cpuTimes := (*[maxCPUTimesLen]C.double)(unsafe.Pointer(cpuTimesC))[:cpuTimesLength:cpuTimesLength]
|
||||
|
||||
for cpu := 0; cpu < int(ncpu); cpu++ {
|
||||
base_idx := C.CPUSTATES * cpu
|
||||
|
|
Loading…
Reference in New Issue