Your IP : 18.191.84.179


Current Path : /usr/lib/python3.6/site-packages/tuned/plugins/__pycache__/
Upload File :
Current File : //usr/lib/python3.6/site-packages/tuned/plugins/__pycache__/plugin_acpi.cpython-36.pyc

3

�<�e�	�@sXddlmZddlTddlZddlZddlZddlmZej	j
�ZGdd�dej�Z
dS)�)�base)�*�N)�ACPI_DIRcsveZdZdZ�fdd�Zedd��Zdd�Zdd	�Zed
d��Z	edd
��Z
ed�dd��Ze
d�ddd��Z�ZS)�
ACPIPlugina>
	`acpi`::

	Configures the ACPI driver.
	+
	The only currently supported option is
	[option]`platform_profile`, which sets the ACPI
	platform profile sysfs attribute,
	a generic power/performance preference API for other drivers.
	Multiple profiles can be specified, separated by `|`.
	The first available profile is selected.
	+
	--
	.Selecting a platform profile
	====
	----
	[acpi]
	platform_profile=balanced|low-power
	----
	Using this option, *TuneD* will try to set the platform profile
	to `balanced`. If that fails, it will try to set it to `low-power`.
	====
	--
	cstt|�j||�dS)N)�superr�__init__)�self�args�kwargs)�	__class__��!/usr/lib/python3.6/plugin_acpi.pyr$szACPIPlugin.__init__cCsddiS)N�platform_profiler
)�clsr
r
r�_get_config_options'szACPIPlugin._get_config_optionscCsd|_d|_dS)NTF)Z_has_static_tuningZ_has_dynamic_tuning)r	�instancer
r
r�_instance_init+szACPIPlugin._instance_initcCsdS)Nr
)r	rr
r
r�_instance_cleanup/szACPIPlugin._instance_cleanupcCstjjtd�S)NZplatform_profile_choices)�os�path�joinr)rr
r
r�_platform_profile_choices_path2sz)ACPIPlugin._platform_profile_choices_pathcCstjjtd�S)Nr)rrrr)rr
r
r�_platform_profile_path6sz!ACPIPlugin._platform_profile_pathrcCs�tjj|j��stjd�dSdd�|jd�D�}t|jj	|j
��j��}xZ|D]R}||kr�|s�tjd|�|jj|j�||r�t
jgndd�|Stjd|�qPWtjd	�dS)
Nz5ACPI platform_profile is not supported on this systemcSsg|]}|j��qSr
)�strip)�.0�profiler
r
r�
<listcomp>?sz4ACPIPlugin._set_platform_profile.<locals>.<listcomp>�|z Setting platform_profile to '%s'F)Zno_errorz+Requested platform_profile '%s' unavailablezDFailed to set platform_profile. Is the value in the profile correct?)rr�isfiler�log�debug�split�set�_cmd�	read_filer�infoZ
write_to_file�errno�ENOENT�warn�error)r	ZprofilesZsim�removeZavail_profilesrr
r
r�_set_platform_profile:s


z ACPIPlugin._set_platform_profileFcCs2tjj|j��stjd�dS|jj|j��j�S)Nz5ACPI platform_profile is not supported on this system)	rrrrr r!r$r%r)r	Zignore_missingr
r
r�_get_platform_profileLs
z ACPIPlugin._get_platform_profile)F)�__name__�
__module__�__qualname__�__doc__r�classmethodrrrrrZcommand_setr,Zcommand_getr-�
__classcell__r
r
)rrrsr)�rZ
decoratorsrr'Z
tuned.logsZtunedZtuned.constsrZlogs�getr ZPluginrr
r
r
r�<module>s


?>