cpu_temperature

package
v0.0.0-...-9994f1b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2025 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Overview

Copyright 2023 The Chromium Authors Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

Copyright 2023 The Chromium Authors Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

Copyright 2023 The Chromium Authors Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

Index

Constants

View Source
const ThermalZone = "x86_pkg_temp"

ThermalZone /* It is a platform related constants */

View Source
const ThermalZoneDir = "/sys/class/thermal"

ThermalZoneDir /* It is a platform related constants */

View Source
const ThermalZonePrefix = "thermal_zone"

ThermalZonePrefix /* It is a platform related constants */

View Source
const ThermalZoneTemp = "temp"

ThermalZoneTemp /* It is a platform related constants */

View Source
const ThermalZoneType = "type"

ThermalZoneType /* It is a platform related constants */

Variables

This section is empty.

Functions

This section is empty.

Types

type CPUTemperatureOrchestrator

type CPUTemperatureOrchestrator struct {
	// contains filtered or unexported fields
}

CPUTemperatureOrchestrator keep the history of cpu temperature queue and then use the queue to calculate the average temperature.

func NewOrchestrator

func NewOrchestrator(temperature ICPUTemperature, capacity int) *CPUTemperatureOrchestrator

NewOrchestrator create a new CPUTemperatureOrchestrator

func (*CPUTemperatureOrchestrator) GetAverageCPUTemperature

func (c *CPUTemperatureOrchestrator) GetAverageCPUTemperature() float32

GetAverageCPUTemperature get the average temperature according the temperature queue.

func (*CPUTemperatureOrchestrator) Observe

func (c *CPUTemperatureOrchestrator) Observe()

Observe implement the `Observable` interface. Let the `Monitor` to observe the cpu temperature.

type FilePathCPUTemperature

type FilePathCPUTemperature struct {
	// contains filtered or unexported fields
}

func (*FilePathCPUTemperature) GetCurrentCPUTemperature

func (c *FilePathCPUTemperature) GetCurrentCPUTemperature() (float32, error)

GetCurrentCPUTemperature Get the current temperature of CPU

type ICPUTemperature

type ICPUTemperature interface {
	// GetCurrentCPUTemperature Get the current temperature of CPU
	GetCurrentCPUTemperature() (float32, error)
}

ICPUTemperature is the interface that provides what functions we can use. The main idea is for different platform to implement their own logic.

func NewCPUTemperature

func NewCPUTemperature() (ICPUTemperature, error)

NewCPUTemperature to create an instance that implement the ICPUTemperature interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL