Your IP : 18.191.171.86


Current Path : /usr/lib/python3.6/site-packages/tuned/monitors/__pycache__/
Upload File :
Current File : //usr/lib/python3.6/site-packages/tuned/monitors/__pycache__/base.cpython-36.opt-1.pyc

3

�<�ej�@s,ddlZejj�ZdgZGdd�de�ZdS)�N�Monitorc@s�eZdZdZedd��Zedd��Zedd��Zedd	��Zed
d��Z	edd
��Z
edd��Zedd��Zedd��Z
d&dd�Zdd�Zdd�Zedd��Zejdd��Zdd�Zd d!�Zd"d#�Zd$d%�ZdS)'rz�
	Base class for all monitors.

	Monitors provide data about the running system to Plugin objects, which use the data
	to tune system parameters.

	Following methods require reimplementation:
	  - _init_available_devices(cls)
	  - update(cls)
	cCsLd|_t�|_t�|_t�|_i|_|j�d|_tjddj	|j��dS)NFTzavailable devices: %sz, )
�_class_initialized�set�
_instances�_available_devices�_updating_devices�_load�_init_available_devices�log�debug�join)�cls�r�/usr/lib/python3.6/base.py�_init_classszMonitor._init_classcCs
t��dS)N)�NotImplementedError)r
rrrr	!szMonitor._init_available_devicescCs"|j�tjddj|j��dS)Nz available devices updated to: %sz, )r	r
rrr)r
rrr�_update_available_devices%sz!Monitor._update_available_devicescCs|jS)N)r)r
rrr�get_available_devices+szMonitor.get_available_devicescCs
t��dS)N)r)r
rrr�update/szMonitor.updatecCs|jj|�dS)N)r�add)r
�instancerrr�_register_instance3szMonitor._register_instancecCs|jj|�dS)N)r�remove)r
rrrr�_deregister_instance7szMonitor._deregister_instancecCs:t�}x|jD]}||jO}qW|jj�|jj|�dS)N)rr�devicesr�clearr)r
Znew_updatingrrrr�_refresh_updating_devices;s

z!Monitor._refresh_updating_devicescCs|jS)N)r)r
rrr�	instancesCszMonitor.instancesNcCsBt|d�s|j�|j|�|dk	r,||_n
|j�|_|j�dS)Nr)�hasattrrrrrr)�selfrrrr�__init__Is


zMonitor.__init__c	Csy|j�WnYnXdS)N)�cleanup)rrrr�__del__WszMonitor.__del__cCs|j|�|j�dS)N)rr)rrrrr!]s
zMonitor.cleanupcCs|jS)N)�_devices)rrrrraszMonitor.devicescCs |jt|�@}||_|j�dS)N)rrr#r)r�valueZnew_devicesrrrrescCs.|j�||jkr*|jj|�|jj|�dS)N)rrr#rr)r�devicerrr�
add_deviceks
zMonitor.add_devicecCs&||jkr"|jj|�|jj|�dS)N)r#rr)rr%rrr�
remove_devicers
zMonitor.remove_devicecs t�fdd�t�jj��D��S)Ncsg|]}|d�jkr|�qS)r)r#)�.0Zdev_load)rrr�
<listcomp>ysz$Monitor.get_load.<locals>.<listcomp>)�dict�listr�items)rr)rr�get_loadxszMonitor.get_loadcCs|jj|d�S)N)r�get)rr%rrr�get_device_load{szMonitor.get_device_load)N)�__name__�
__module__�__qualname__�__doc__�classmethodrr	rrrrrrrr r"r!�propertyr�setterr&r'r-r/rrrrrs&


)Z
tuned.logsZtunedZlogsr.r
�__all__�objectrrrrr�<module>s


?>