3 À<×eú ã @ s‚ d dl Z ddlmZ ddlT d dlZd dlT d dlmZ d dl j Z d dlZd dlZej jƒ ZddgZdd gZG d d„ dejƒZdS )é Né )Úbase)Ú*)ÚcommandsZbase_reachable_timeZretrans_timez /run/sysctl.dz /etc/sysctl.dc s€ e Zd ZdZ‡ fdd„Zdd„ Zdd„ Zdd „ Zd d„ Ze j fdd „Zdd„ Zdd„ Z dd„ Zdd„ Zdd„ Zddd„Z‡ ZS )ÚSysctlPluginaI `sysctl`:: Sets various kernel parameters at runtime. + This plug-in is used for applying custom `sysctl` settings and should only be used to change system settings that are not covered by other *TuneD* plug-ins. If the settings are covered by other *TuneD* plug-ins, use those plug-ins instead. + The syntax for this plug-in is `_key_=_value_`, where `_key_` is the same as the key name provided by the `sysctl` utility. + .Adjusting the kernel runtime kernel.sched_min_granularity_ns value ==== ---- [sysctl] kernel.sched_min_granularity_ns=3000000 ---- ==== c s$ t t| ƒj||Ž d| _tƒ | _d S )NT)Úsuperr Ú__init__Z_has_dynamic_optionsr Ú_cmd)ÚselfÚargsÚkwargs)Ú __class__© ú#/usr/lib/python3.6/plugin_sysctl.pyr * s zSysctlPlugin.__init__c C sh d|_ d|_| j|jƒ}| jj|i ƒ|_t|jƒdkr\tj dƒ | j |ƒ i |_| jj|ƒ |j|_ d S )NFTr z0recovering old sysctl settings from previous run)Z_has_dynamic_tuningZ_has_static_tuningÚ_storage_keyÚnameÚ_storageÚgetÚ_sysctl_originalÚlenÚlogÚinfoÚ_instance_unapply_staticÚunsetZoptionsÚ_sysctl)r ÚinstanceÚstorage_keyr r r Ú_instance_init/ s zSysctlPlugin._instance_initc C s | j |jƒ}| jj|ƒ d S )N)r r r r )r r r r r r Ú_instance_cleanup? s zSysctlPlugin._instance_cleanupc C sÄ xzt |jjƒ ƒD ]h\}}| j|ƒ}|d kr:tjd| ƒ q| jj| jj |ƒƒ}| j ||ƒ}|d k r||j|<