a Á]›i.P ã @ s( d dl mZmZ d dlmZ d dlmZmZmZ d dl m Z mZmZm Z d dlmZ d dlmZ d dlZd dlZd dlZd dlZd dlZe ¡ ZdZd Zd ZdZdZd ZdZdZ e eedœZ!G dd„ deƒZ"G dd„ dej#ƒZ$G dd„ dej#ƒZ%G dd„ de&ƒZ'G dd„ de&ƒZ(G dd„ dej)j*ƒZ+dS )é )ÚexportsÚlogs)Úcommands)ÚPPD_CONFIG_FILEÚPPD_BASE_PROFILE_FILEÚPPD_API_COMPATIBILITY)Ú PPDConfigÚPPD_PERFORMANCEÚPPD_BALANCEDÚPPD_POWER_SAVER)ÚEnum)ÚRandomNÚtunedz-/sys/devices/system/cpu/intel_pstate/no_turboz4/sys/bus/platform/devices/thinkpad_acpi/dytc_lapmodeÚunknownzorg.freedesktop.UPowerz/org/freedesktop/UPowerz#/sys/firmware/acpi/platform_profile)z low-powerZbalancedZperformancec @ s e Zd ZdZdZdZdZdS )ÚPerformanceDegradedz7 Possible reasons for performance degradation. Ú zlap-detectedzhigh-operating-temperatureN)Ú__name__Ú __module__Ú__qualname__Ú__doc__ÚNONEÚLAP_DETECTEDÚHIGH_OPERATING_TEMPERATURE© r r ú8/usr/lib/python3.9/site-packages/tuned/ppd/controller.pyr ! s r c s( e Zd ZdZ‡ fdd„Zdd„ Z‡ ZS )ÚPerformanceDegradedEventHandlerz= Event handler for checking performance degradation. c s t t| ƒ ¡ || _|| _d S ©N)Úsuperr Ú__init__Ú_controllerÚ_path)ÚselfÚ controllerÚpath©Ú __class__r r r . s z(PerformanceDegradedEventHandler.__init__c C s |j | jkrd S | j ¡ d S r )Úpathnamer r Úcheck_performance_degraded©r! Zeventr r r Úprocess_IN_MODIFY3 s z1PerformanceDegradedEventHandler.process_IN_MODIFY)r r r r r r) Ú __classcell__r r r$ r r * s r c sD e Zd ZdZdZ‡ fdd„Zdd„ Zdd„ Zd d „ Zdd„ Z ‡ Z S ) ÚPlatformProfileEventHandlera Event handler for switching PPD profiles based on the ACPI platform profile This handler should only invoke a PPD profile change if the change of the file at PLATFORM_PROFILE_PATH comes from within the kernel (e.g., when the user presses Fn-L on a Thinkpad laptop). This is currently detected as the file being modified without being opened before. gš™™™™™¹?c s$ t t| ƒ ¡ || _d| _d| _d S )NFr )r r+ r r Ú _file_openÚ_last_close©r! r" r$ r r r F s z$PlatformProfileEventHandler.__init__c C s |j tkrd S d| _d| _d S )NTr )r&