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 ¶
const ThermalZone = "x86_pkg_temp"
ThermalZone /* It is a platform related constants */
const ThermalZoneDir = "/sys/class/thermal"
ThermalZoneDir /* It is a platform related constants */
const ThermalZonePrefix = "thermal_zone"
ThermalZonePrefix /* It is a platform related constants */
const ThermalZoneTemp = "temp"
ThermalZoneTemp /* It is a platform related constants */
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.