Skip to content

Commit 6251cc7

Browse files
authored
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 <[email protected]>
1 parent 29c97c2 commit 6251cc7

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

collector/cpu_openbsd.go

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,6 @@ import (
2525
"golang.org/x/sys/unix"
2626
)
2727

28-
type clockinfo struct {
29-
hz int32
30-
tick int32
31-
tickadj int32
32-
stathz int32
33-
profhz int32
34-
}
35-
3628
const (
3729
CP_USER = iota
3830
CP_NICE
@@ -72,8 +64,8 @@ func (c *cpuCollector) Update(ch chan<- prometheus.Metric) (err error) {
7264
if err != nil {
7365
return err
7466
}
75-
clock := *(*clockinfo)(unsafe.Pointer(&clockb[0]))
76-
hz := float64(clock.stathz)
67+
clock := *(*unix.Clockinfo)(unsafe.Pointer(&clockb[0]))
68+
hz := float64(clock.Stathz)
7769

7870
ncpus, err := unix.SysctlUint32("hw.ncpu")
7971
if err != nil {

0 commit comments

Comments
 (0)