parent
f9a6850c1a
commit
9a7fdba3f9
3 changed files with 27 additions and 21 deletions
|
|
@ -20,10 +20,13 @@ BADBLOCKS_REGEX = re.compile(
|
|||
)
|
||||
BADBLOCKS_RESULTS_REGEX = re.compile(r'^(.*?)\x08.*\x08(.*)')
|
||||
BADBLOCKS_SKIP_REGEX = re.compile(r'^(Checking|\[)', re.IGNORECASE)
|
||||
CPU_TEMP_COOLING_DELTA = 20
|
||||
CPU_TEMP_CRITICAL = 100
|
||||
CPU_TEMP_IDLE_HIGH = 85
|
||||
CPU_TEMP_LOW_THRESHOLD = 50
|
||||
CPU_TEMPS = {
|
||||
'Cooling Delta': 25,
|
||||
'Cooling Low Cutoff': 50,
|
||||
'Critical': 100,
|
||||
'Idle Delta': 25,
|
||||
'Idle High': 80,
|
||||
}
|
||||
CPU_TEST_MINUTES = 7
|
||||
IO_GRAPH_WIDTH = 40
|
||||
IO_ALT_TEST_SIZE_FACTOR = 0.01
|
||||
|
|
|
|||
|
|
@ -8,12 +8,7 @@ import subprocess
|
|||
from typing import TextIO
|
||||
|
||||
from wk import exe
|
||||
from wk.cfg.hw import (
|
||||
CPU_TEMP_COOLING_DELTA,
|
||||
CPU_TEMP_CRITICAL,
|
||||
CPU_TEMP_IDLE_HIGH,
|
||||
CPU_TEMP_LOW_THRESHOLD,
|
||||
)
|
||||
from wk.cfg.hw import CPU_TEMPS
|
||||
from wk.os.mac import set_fans as macos_set_fans
|
||||
from wk.std import PLATFORM
|
||||
from wk.ui import ansi
|
||||
|
|
@ -33,35 +28,43 @@ def check_cooling_results(sensors, test_object) -> None:
|
|||
test_object.report.append(ansi.color_string('Temps', 'BLUE'))
|
||||
|
||||
# Check temps
|
||||
if max_temp > CPU_TEMP_CRITICAL:
|
||||
if max_temp > CPU_TEMPS['Critical']:
|
||||
test_object.failed = True
|
||||
test_object.set_status('Failed')
|
||||
test_object.report.extend([
|
||||
ansi.color_string(
|
||||
f' WARNING: Critical CPU temp of {CPU_TEMP_CRITICAL} exceeded.',
|
||||
f' WARNING: Critical CPU temp of {CPU_TEMPS["Critical"]} exceeded.',
|
||||
'RED',
|
||||
),
|
||||
'',
|
||||
])
|
||||
elif idle_temp >= CPU_TEMP_IDLE_HIGH:
|
||||
elif idle_temp >= CPU_TEMPS['Idle High']:
|
||||
test_object.failed = True
|
||||
test_object.set_status('Failed')
|
||||
test_object.report.extend([
|
||||
ansi.color_string(
|
||||
f' WARNING: Max idle temp of {CPU_TEMP_IDLE_HIGH} exceeded.',
|
||||
f' WARNING: Max idle temp of {CPU_TEMPS["Idle High"]} exceeded.',
|
||||
'YELLOW',
|
||||
),
|
||||
'',
|
||||
])
|
||||
elif (
|
||||
cooldown_temp <= CPU_TEMP_LOW_THRESHOLD
|
||||
or abs(max_temp - cooldown_temp) >= CPU_TEMP_COOLING_DELTA
|
||||
cooldown_temp <= CPU_TEMPS['Cooling Low Cutoff']
|
||||
or max_temp - cooldown_temp >= CPU_TEMPS['Cooling Delta']
|
||||
):
|
||||
test_object.passed = True
|
||||
test_object.set_status('Passed')
|
||||
else:
|
||||
test_object.passed = False
|
||||
test_object.set_status('Unknown')
|
||||
if cooldown_temp - idle_temp >= CPU_TEMPS['Idle Delta']:
|
||||
test_object.report.extend([
|
||||
ansi.color_string(
|
||||
f' WARNING: Cooldown temp at least {CPU_TEMPS["Idle Delta"]}° over idle.',
|
||||
'YELLOW',
|
||||
),
|
||||
'',
|
||||
])
|
||||
|
||||
# Build report
|
||||
report_labels = ['Idle']
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ from subprocess import CalledProcessError
|
|||
from threading import Thread
|
||||
from typing import Any
|
||||
|
||||
from wk.cfg.hw import CPU_TEMP_CRITICAL, SMC_IDS, TEMP_COLORS
|
||||
from wk.cfg.hw import CPU_TEMPS, SMC_IDS, TEMP_COLORS
|
||||
from wk.exe import run_program, start_thread
|
||||
from wk.io import non_clobber_path
|
||||
from wk.std import PLATFORM, sleep
|
||||
|
|
@ -51,7 +51,7 @@ class Sensors():
|
|||
source_data['Temps'] = []
|
||||
|
||||
def cpu_reached_critical_temp(self) -> bool:
|
||||
"""Check if CPU reached CPU_TEMP_CRITICAL, returns bool."""
|
||||
"""Check if CPU exceeded critical temp, returns bool."""
|
||||
for section, adapters in self.data.items():
|
||||
if not section.startswith('CPU'):
|
||||
# Limit to CPU temps
|
||||
|
|
@ -60,7 +60,7 @@ class Sensors():
|
|||
# Ugly section
|
||||
for sources in adapters.values():
|
||||
for source_data in sources.values():
|
||||
if source_data.get('Max', -1) > CPU_TEMP_CRITICAL:
|
||||
if source_data.get('Max', -1) > CPU_TEMPS['Critical']:
|
||||
return True
|
||||
|
||||
# Didn't return above so temps are within the threshold
|
||||
|
|
@ -246,7 +246,7 @@ class Sensors():
|
|||
|
||||
# Raise exception if thermal limit reached
|
||||
if exit_on_thermal_limit and section == 'CPUTemps':
|
||||
if source_data['Current'] > CPU_TEMP_CRITICAL:
|
||||
if source_data['Current'] > CPU_TEMPS['Critical']:
|
||||
raise ThermalLimitReachedError('CPU temps reached limit')
|
||||
|
||||
def update_sensor_data_macos(
|
||||
|
|
@ -273,7 +273,7 @@ class Sensors():
|
|||
|
||||
# Raise exception if thermal limit reached
|
||||
if exit_on_thermal_limit and section == 'CPUTemps':
|
||||
if source_data['Current'] > CPU_TEMP_CRITICAL:
|
||||
if source_data['Current'] > CPU_TEMPS['Critical']:
|
||||
raise ThermalLimitReachedError('CPU temps reached limit')
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue