MCPcopy
hub / github.com/prometheus/node_exporter / Value

Method Value

collector/sysctl_bsd.go:62–88  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

60}
61
62func (b bsdSysctl) Value() (float64, error) {
63 var tmp32 uint32
64 var tmp64 uint64
65 var tmpf64 float64
66 var err error
67
68 switch b.dataType {
69 case bsdSysctlTypeUint32:
70 tmp32, err = unix.SysctlUint32(b.mib)
71 tmpf64 = float64(tmp32)
72 case bsdSysctlTypeUint64:
73 tmp64, err = unix.SysctlUint64(b.mib)
74 tmpf64 = float64(tmp64)
75 case bsdSysctlTypeCLong:
76 tmpf64, err = b.getCLong()
77 }
78
79 if err != nil {
80 return 0, err
81 }
82
83 if b.conversion != nil {
84 return b.conversion(tmpf64), nil
85 }
86
87 return tmpf64, nil
88}
89
90func (b bsdSysctl) getCLong() (float64, error) {
91 raw, err := unix.SysctlRaw(b.mib)

Callers 10

collectSocketsMethod · 0.80
collectTimersMethod · 0.80
getSessionMethod · 0.80
UpdateMethod · 0.80
UpdateMethod · 0.80
UpdateMethod · 0.80
UpdateMethod · 0.80

Calls 1

getCLongMethod · 0.95

Tested by

no test coverage detected