AlkantarClanX12
Current Path : /lib/python3.6/site-packages/tuned/daemon/__pycache__/ |
Current File : //lib/python3.6/site-packages/tuned/daemon/__pycache__/daemon.cpython-36.pyc |
3 �<�e�3 � @ s� d dl Z d dlZd dlZd dlZd dlmZ d dlmZ d dl j Z d dlmZ d dlm Z d dlmZ d dlZejj� ZG dd� de�ZdS ) � N)�TunedException)�InvalidProfileException)�commands)�exports)�ProfileRecommenderc @ s e Zd Zd;dd�Zdd� Zdd� Zdd � Zd d� Zdd � Zdd� Z d<dd�Z edd� �Zedd� �Z edd� �Zedd� �Zedd� �Zdd� Zdd � Zd!d"� Zd#d$� Zd%d&� Zd'd(� Zd)d*� Zd+d,� Zd-d.� Zd/d0� Zd1d2� Zd3d4� Zd5d6� Zd7d8� Zd=d9d:�ZdS )>�DaemonNc C s� t jd� tj| _ttj�| _ttj�| _ tj | _d| _tj | _|d k r�|jtjtj�| _t|jtjtj��| _t|jtjtj��| _ |jtjtj �| _|jtjtj�| _|jtjtj �| _|| _| jdkr�ttj�| _| j dkr�d| _n| j | jk r�| j| _ | j | j | _t jd| j � | j�rJt jd� t jd| j| j | jf � t| j d�| _|| _|| _| j� t � | _!y| j"|� W n2 t#k �r� } zt j$d | � W Y d d }~X nX d S ) Nzinitializing daemonTr Fz$using sleep interval of %d second(s)z8dynamic tuning is enabled (can be overridden by plugins)zFusing update interval of %d second(s) (%d times of the sleep interval))Zis_hardcodedz:Cannot set initial profile. No tunings will be enabled: %s)%�log�debug�constsZCFG_DEF_DAEMON�_daemon�intZCFG_DEF_SLEEP_INTERVAL�_sleep_intervalZCFG_DEF_UPDATE_INTERVALZ_update_intervalZCFG_DEF_DYNAMIC_TUNING�_dynamic_tuningZ_recommend_commandZCFG_DEF_ROLLBACK� _rollbackZget_boolZ CFG_DAEMON�getZCFG_SLEEP_INTERVALZCFG_UPDATE_INTERVALZCFG_DYNAMIC_TUNINGZCFG_RECOMMEND_COMMANDZCFG_DEF_RECOMMEND_COMMAND�CFG_ROLLBACK�_application� _sleep_cycles�infor �_profile_recommender� _unit_manager�_profile_loader� _init_threadsr �_cmd� _init_profiler �error)�selfZunit_manager�profile_loader� profile_names�configZapplication�e� r! �/usr/lib/python3.6/daemon.py�__init__ sF zDaemon.__init__c C sF d | _ tj� | _tj� | _tj� | _tj� | _| jj� tj� | _d S )N) �_thread� threadingZEvent� _terminate�_terminate_profile_switch� _not_used�_sighup_processing�set�_profile_applied)r r! r! r"