Browse Source

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>
pull/2688/head
Claudio Jeker 2 years ago committed by GitHub
parent
commit
6251cc7b6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      collector/cpu_openbsd.go

12
collector/cpu_openbsd.go

@ -25,14 +25,6 @@ import (
"golang.org/x/sys/unix"
)
type clockinfo struct {
hz int32
tick int32
tickadj int32
stathz int32
profhz int32
}
const (
CP_USER = iota
CP_NICE
@ -72,8 +64,8 @@ func (c *cpuCollector) Update(ch chan<- prometheus.Metric) (err error) {
if err != nil {
return err
}
clock := *(*clockinfo)(unsafe.Pointer(&clockb[0]))
hz := float64(clock.stathz)
clock := *(*unix.Clockinfo)(unsafe.Pointer(&clockb[0]))
hz := float64(clock.Stathz)
ncpus, err := unix.SysctlUint32("hw.ncpu")
if err != nil {

Loading…
Cancel
Save