AlkantarClanX12

Your IP : 18.224.56.97


Current Path : /proc/self/root/lib/python3.6/site-packages/tuned/monitors/__pycache__/
Upload File :
Current File : //proc/self/root/lib/python3.6/site-packages/tuned/monitors/__pycache__/base.cpython-36.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)
	cCs\d|_t�|_t�|_t�|_i|_|j�t|jt�s<t�d|_t	j
ddj|j��dS)NFTzavailable devices: %sz, )�_class_initialized�set�
_instances�_available_devices�_updating_devices�_load�_init_available_devices�
isinstance�AssertionError�log�debug�join)�cls�r�/usr/lib/python3.6/base.py�_init_classszMonitor._init_classcCs
t��dS)N)�NotImplementedError)rrrrr	!szMonitor._init_available_devicescCs"|j�tjddj|j��dS)Nz available devices updated to: %sz, )r	rr
rr)rrrr�_update_available_devices%sz!Monitor._update_available_devicescCs|jS)N)r)rrrr�get_available_devices+szMonitor.get_available_devicescCs
t��dS)N)r)rrrr�update/szMonitor.updatecCs|jj|�dS)N)r�add)r�instancerrr�_register_instance3szMonitor._register_instancecCs|jj|�dS)N)r�remove)rrrrr�_deregister_instance7szMonitor._deregister_instancecCs:t�}x|jD]}||jO}qW|jj�|jj|�dS)N)rr�devicesr�clearr)rZnew_updatingrrrr�_refresh_updating_devices;s

z!Monitor._refresh_updating_devicescCs|jS)N)r)rrrr�	instancesCszMonitor.instancesNcCsPt|d�s |j�t|d�s t�|j|�|dk	r:||_n
|j�|_|j�dS)Nr)�hasattrrrrrrr)�selfrrrr�__init__Is


zMonitor.__init__c	Csy|j�WnYnXdS)N)�cleanup)r!rrr�__del__WszMonitor.__del__cCs|j|�|j�dS)N)rr)r!rrrr#]s
zMonitor.cleanupcCs|jS)N)�_devices)r!rrrraszMonitor.devicescCs |jt|�@}||_|j�dS)N)rrr%r)r!�valueZnew_devicesrrrrescCsFt|t�st|t�st�|j�||jkrB|jj|�|jj|�dS)N)	r
�str�unicoderrrr%rr)r!�devicerrr�
add_deviceks

zMonitor.add_devicecCs>t|t�st|t�st�||jkr:|jj|�|jj|�dS)N)r
r'r(rr%rr)r!r)rrr�
remove_devicers
zMonitor.remove_devicecs t�fdd�t�jj��D��S)Ncsg|]}|d�jkr|�qS)r)r%)�.0Zdev_load)r!rr�
<listcomp>ysz$Monitor.get_load.<locals>.<listcomp>)�dict�listr�items)r!r)r!r�get_loadxszMonitor.get_loadcCs|jj|d�S)N)r�get)r!r)rrr�get_device_load{szMonitor.get_device_load)N)�__name__�
__module__�__qualname__�__doc__�classmethodrr	rrrrrrrr"r$r#�propertyr�setterr*r+r1r3rrrrrs&


)Z
tuned.logsZtunedZlogsr2r�__all__�objectrrrrr�<module>s