Skip to content

Commit

Permalink
Do not hand define struct clockinfo here. Instead use the version from (
Browse files Browse the repository at this point in the history
#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>
  • Loading branch information
cjeker authored May 11, 2023
1 parent 29c97c2 commit 6251cc7
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions collector/cpu_openbsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 6251cc7

Please sign in to comment.