mirror of
https://github.com/morgan9e/macos-stats
synced 2026-04-14 00:04:15 +09:00
feat: added CPU temperature for Apple Silicon
This commit is contained in:
@@ -66,9 +66,9 @@ public class CPU: Module {
|
||||
self.processReader = ProcessReader()
|
||||
self.limitReader = LimitReader(popup: true)
|
||||
self.averageReader = AverageReader(popup: true)
|
||||
self.temperatureReader = TemperatureReader(popup: true)
|
||||
|
||||
#if arch(x86_64)
|
||||
self.temperatureReader = TemperatureReader(popup: true)
|
||||
self.frequencyReader = FrequencyReader(popup: true)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -244,6 +244,20 @@ public class TemperatureReader: Reader<Double> {
|
||||
temperature = value
|
||||
} else if let value = SMC.shared.getValue("TC0H"), value < 110 {
|
||||
temperature = value
|
||||
} else {
|
||||
#if arch(arm64)
|
||||
var total: Double = 0
|
||||
var counter: Double = 0
|
||||
["Tp09", "Tp0T", "Tp01", "Tp05", "Tp0D", "Tp0H", "Tp0L", "Tp0P", "Tp0X", "Tp0b", ].forEach { (key: String) in
|
||||
if let value = SMC.shared.getValue(key) {
|
||||
total += value
|
||||
counter += 1
|
||||
}
|
||||
}
|
||||
if total != 0 && counter != 0 {
|
||||
temperature = total / counter
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
self.callback(temperature)
|
||||
|
||||
Reference in New Issue
Block a user