mirror of
https://github.com/prometheus/node_exporter.git
synced 2024-12-26 14:09:47 -08:00
Do not hand define struct clockinfo here. Instead use the version from (#2663)
x/sys/unix. The clockinfo struct was altered beginning of 2021 and this code was not adjusted. Signed-off-by: Claudio Jeker <claudio@openbsd.org>
This commit is contained in:
parent
29c97c2197
commit
6251cc7b6c
|
@ -25,14 +25,6 @@ import (
|
||||||
"golang.org/x/sys/unix"
|
"golang.org/x/sys/unix"
|
||||||
)
|
)
|
||||||
|
|
||||||
type clockinfo struct {
|
|
||||||
hz int32
|
|
||||||
tick int32
|
|
||||||
tickadj int32
|
|
||||||
stathz int32
|
|
||||||
profhz int32
|
|
||||||
}
|
|
||||||
|
|
||||||
const (
|
const (
|
||||||
CP_USER = iota
|
CP_USER = iota
|
||||||
CP_NICE
|
CP_NICE
|
||||||
|
@ -72,8 +64,8 @@ func (c *cpuCollector) Update(ch chan<- prometheus.Metric) (err error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
clock := *(*clockinfo)(unsafe.Pointer(&clockb[0]))
|
clock := *(*unix.Clockinfo)(unsafe.Pointer(&clockb[0]))
|
||||||
hz := float64(clock.stathz)
|
hz := float64(clock.Stathz)
|
||||||
|
|
||||||
ncpus, err := unix.SysctlUint32("hw.ncpu")
|
ncpus, err := unix.SysctlUint32("hw.ncpu")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue