mirror of
https://github.com/prometheus/node_exporter.git
synced 2025-02-02 08:42:31 -08:00
cpu_darwin.go: s/cpu_ticks/cpuTicks/g
This commit is contained in:
parent
b05c7d8dab
commit
b3e7420a27
|
@ -91,17 +91,17 @@ func (c *statCollector) Update(ch chan<- prometheus.Metric) error {
|
||||||
|
|
||||||
// the body of struct processor_cpu_load_info
|
// the body of struct processor_cpu_load_info
|
||||||
// aka processor_cpu_load_info_data_t
|
// aka processor_cpu_load_info_data_t
|
||||||
var cpu_ticks [C.CPU_STATE_MAX]uint32
|
var cpuTicks [C.CPU_STATE_MAX]uint32
|
||||||
|
|
||||||
// copy the cpuload array to a []byte buffer
|
// copy the cpuload array to a []byte buffer
|
||||||
// where we can binary.Read the data
|
// where we can binary.Read the data
|
||||||
size := int(ncpu) * binary.Size(cpu_ticks)
|
size := int(ncpu) * binary.Size(cpuTicks)
|
||||||
buf := (*[1 << 30]byte)(unsafe.Pointer(cpuload))[:size:size]
|
buf := (*[1 << 30]byte)(unsafe.Pointer(cpuload))[:size:size]
|
||||||
|
|
||||||
bbuf := bytes.NewBuffer(buf)
|
bbuf := bytes.NewBuffer(buf)
|
||||||
|
|
||||||
for i := 0; i < int(ncpu); i++ {
|
for i := 0; i < int(ncpu); i++ {
|
||||||
err := binary.Read(bbuf, binary.LittleEndian, &cpu_ticks)
|
err := binary.Read(bbuf, binary.LittleEndian, &cpuTicks)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -111,7 +111,7 @@ func (c *statCollector) Update(ch chan<- prometheus.Metric) error {
|
||||||
"nice": C.CPU_STATE_NICE,
|
"nice": C.CPU_STATE_NICE,
|
||||||
"idle": C.CPU_STATE_IDLE,
|
"idle": C.CPU_STATE_IDLE,
|
||||||
} {
|
} {
|
||||||
ch <- prometheus.MustNewConstMetric(c.cpu, prometheus.CounterValue, float64(cpu_ticks[v])/ClocksPerSec, "cpu"+strconv.Itoa(i), k)
|
ch <- prometheus.MustNewConstMetric(c.cpu, prometheus.CounterValue, float64(cpuTicks[v])/ClocksPerSec, "cpu"+strconv.Itoa(i), k)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in a new issue