|
|
@ -47,9 +47,10 @@ import "C"
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
"errors"
|
|
|
|
"fmt"
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"unsafe"
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/go-kit/log"
|
|
|
|
"github.com/go-kit/log"
|
|
|
|
"github.com/prometheus/client_golang/prometheus"
|
|
|
|
"github.com/prometheus/client_golang/prometheus"
|
|
|
|
"unsafe"
|
|
|
|
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
type thermCollector struct {
|
|
|
|
type thermCollector struct {
|
|
|
@ -118,7 +119,9 @@ func (c *thermCollector) Update(ch chan<- prometheus.Metric) error {
|
|
|
|
func fetchCPUPowerStatus() (map[string]int, error) {
|
|
|
|
func fetchCPUPowerStatus() (map[string]int, error) {
|
|
|
|
cfDictRef, _ := C.FetchThermal()
|
|
|
|
cfDictRef, _ := C.FetchThermal()
|
|
|
|
defer func() {
|
|
|
|
defer func() {
|
|
|
|
C.CFRelease(C.CFTypeRef(cfDictRef.ref))
|
|
|
|
if cfDictRef.ref != 0x0 {
|
|
|
|
|
|
|
|
C.CFRelease(C.CFTypeRef(cfDictRef.ref))
|
|
|
|
|
|
|
|
}
|
|
|
|
}()
|
|
|
|
}()
|
|
|
|
|
|
|
|
|
|
|
|
if C.kIOReturnNotFound == cfDictRef.ret {
|
|
|
|
if C.kIOReturnNotFound == cfDictRef.ret {
|
|
|
|