ok

Mini Shell

Direktori : /proc/self/root/proc/self/root/proc/self/root/lib/python2.7/site-packages/tuned/daemon/
Upload File :
Current File : //proc/self/root/proc/self/root/proc/self/root/lib/python2.7/site-packages/tuned/daemon/daemon.pyc

�
��\c@s�ddlZddlZddlZddlZddlmZddlmZddl	j
Z
ddlmZddlm
Z
ddlmZddlZejj�Zdefd��YZdS(	i����N(tTunedException(tInvalidProfileException(tcommands(texports(tProfileRecommendertDaemoncBs�eZdddd�Zd�Zd�Zd�Zed�Ze	d��Z
e	d��Ze	d��Zd�Z
d	�Zd
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zed�ZRS(cCs%tjd�tj|_ttj�|_ttj�|_	tj
|_t|_
|dk	r�|jtjtj�|_t|jtjtj��|_t|jtjtj��|_	|jtjtj
�|_|jtjtj�|_
n||_|jdkr!ttj�|_n|j	dkr<t|_n!|j	|jkr]|j|_	n|j	|j|_tjd|j�|jr�tjd�tjd|j|j|jf�n||_||_|j�t�|_y|j |�Wn$t!k
r }tj"d|�nXdS(Nsinitializing daemonis$using sleep interval of %d second(s)s8dynamic tuning is enabled (can be overridden by plugins)sFusing update interval of %d second(s) (%d times of the sleep interval)s:Cannot set initial profile. No tunings will be enabled: %s(#tlogtdebugtconststCFG_DEF_DAEMONt_daemontinttCFG_DEF_SLEEP_INTERVALt_sleep_intervaltCFG_DEF_UPDATE_INTERVALt_update_intervaltCFG_DEF_DYNAMIC_TUNINGt_dynamic_tuningtTruet_recommend_commandtNonetget_boolt
CFG_DAEMONtgettCFG_SLEEP_INTERVALtCFG_UPDATE_INTERVALtCFG_DYNAMIC_TUNINGtCFG_RECOMMEND_COMMANDtCFG_DEF_RECOMMEND_COMMANDt_applicationtFalset
_sleep_cyclestinfot
_unit_managert_profile_loadert
_init_threadsRt_cmdt
_init_profileRterror(tselftunit_managertprofile_loadert
profile_namestconfigtapplicationte((s7/usr/lib/python2.7/site-packages/tuned/daemon/daemon.pyt__init__s@
	!!		
'		
cCsVd|_tj�|_tj�|_tj�|_|jj�tj�|_dS(N(	Rt_threadt	threadingtEventt
_terminatet_terminate_profile_switcht	_not_usedtsett_profile_applied(R'((s7/usr/lib/python2.7/site-packages/tuned/daemon/daemon.pyR#4s	
cCs|jd�dS(sARead configuration files again and load profile according to themN(R%R(R'((s7/usr/lib/python2.7/site-packages/tuned/daemon/daemon.pytreload_profile_config>scCs�t}|dkrC|j�\}}|dkr_tjd�q_n|dkr_tjd�nd|_d|_|j||�dS(NsINo profile is preset, running in manual mode. No profile will be enabled.tsNo profile will be enabled.(RRt_get_startup_profileRR t_profilet_manualtset_profile(R'R*tmanual((s7/usr/lib/python2.7/site-packages/tuned/daemon/daemon.pyR%Bs		cCs=|j�r*t|j|td���n|dksB|dkrWd|_||_n�|j�}xH|D]@}||jj	j
�krjt|j|td|���qjqjWy"|jj|�|_||_Wn8t
k
r
}t|j|td||f���nX|r9|dkr&d}n|j||�ndS(Ns/Cannot set profile while the daemon is running.R8s%Requested profile '%s' doesn't exist.sCannot load profile(s) '%s': %s(t
is_runningRt_notify_profile_changedRRR:R;tsplitR)tprofile_locatortget_known_namesR"tloadRt_save_active_profile(R'R*R=tsave_instantlytprofile_listtprofileR-((s7/usr/lib/python2.7/site-packages/tuned/daemon/daemon.pyR<Ps(	
	
)	cCs|jS(N(R:(R'((s7/usr/lib/python2.7/site-packages/tuned/daemon/daemon.pyRGiscCs|jS(N(R;(R'((s7/usr/lib/python2.7/site-packages/tuned/daemon/daemon.pyR=mscCs|jS(N(R"(R'((s7/usr/lib/python2.7/site-packages/tuned/daemon/daemon.pyR)qscCsG|jdk	rC|jjdk	rC|jjjtj|||�n|S(N(RRt_dbus_exportertsend_signalRtDBUS_SIGNAL_PROFILE_CHANGED(R'R*tresultterrstr((s7/usr/lib/python2.7/site-packages/tuned/daemon/daemon.pyR?ws!"cCs�|jjddgddg�\}}|dkr7tS|d dkrKtS|jjddgddg�\}}tjd|�dkS(	Nt	systemctlsis-system-runningt	no_errorsiitstoppings	list-jobss0\b(shutdown|reboot|halt|poweroff)\.target.*start(R$texecuteRtretsearchR(R'tretcodetout((s7/usr/lib/python2.7/site-packages/tuned/daemon/daemon.pyt_full_rollback_required|s''cCs%|jdkrtd��n|jj|jj�|j|jj|j�|jj	�|j
j�tj
d|jj�|jr�tj�n|j|jjtd�|jrF|j}x�|jj|j|j�sB|jr�|d8}|dkr?|j}tjd�|jj�tjd�|jj�q?q�q�Wn|j
j�d}x6|jj|j|j�r�|dkr�|d7}q\W|jj�r�t}nNt }|j!�r�|jr�tj
d	�t}q�tj
d
�n
tj
d�|jr|jj"|�n|jj#�dS(Ns2Cannot start the daemon without setting a profile.s'static tuning from profile '%s' appliedtOKiisupdating monitorssperforming tuningsis+terminating Tuned, rolling back all changess"terminating Tuned in one-shot modes1terminating Tuned due to system shutdown / reboot($R:RRR!tcreatetunitsRDtnameR;tstart_tuningR6R5RR R
RtstartR?RRR$twaitR2R
RRtupdate_monitorst
update_tuningtclearR4R3tis_setRRUtstop_tuningtdestroy_all(R't
_sleep_cnttit
full_rollback((s7/usr/lib/python2.7/site-packages/tuned/daemon/daemon.pyt_thread_code�sJ

	
			
	



+		
	
	cCsDy|jj||�Wn&tk
r?}tjt|��nXdS(N(R$tsave_active_profileRRR&tstr(R'R*R=R-((s7/usr/lib/python2.7/site-packages/tuned/daemon/daemon.pyRD�scCs;tjd�t�jd|j�}tjd|�|S(NsWRunning in automatic mode, checking what profile is recommended for your configuration.t	hardcodedsUsing '%s' profile(RR Rt	recommendR(R'RG((s7/usr/lib/python2.7/site-packages/tuned/daemon/daemon.pyt_get_recommended_profile�s
cCsO|jj�\}}|dkr0|dk	}n|sE|j�}n||fS(N(R$tget_active_profileRRk(R'RGR=((s7/usr/lib/python2.7/site-packages/tuned/daemon/daemon.pyR9�scCs|jjj�S(s$Return all accessible plugin classes(R!tplugins_repositorytload_all_plugins(R'((s7/usr/lib/python2.7/site-packages/tuned/daemon/daemon.pytget_all_plugins�scCs5y|jjj|�}Wntk
r-dSX|jS(sReturn plugin class docstringR8(R!Rmtload_plugintImportErrort__doc__(R'tplugin_nametplugin_class((s7/usr/lib/python2.7/site-packages/tuned/daemon/daemon.pytget_plugin_documentation�s

cCs8y|jjj|�}Wntk
r-iSX|j�S(s�Return plugin's parameters and their hints

		Parameters:
		plugin_name -- plugins name

		Return:
		dictionary -- {parameter_name: hint}
		(R!RmRpRqtget_config_options_hints(R'RsRt((s7/usr/lib/python2.7/site-packages/tuned/daemon/daemon.pytget_plugin_hints�s	

cCs
|jdk	S(N(R:R(R'((s7/usr/lib/python2.7/site-packages/tuned/daemon/daemon.pyt
is_enabled�scCs|jdk	o|jj�S(N(R/Rtis_alive(R'((s7/usr/lib/python2.7/site-packages/tuned/daemon/daemon.pyR>�scCs�|j�rtS|jdkr#tStjd�|jj�tj	d|j
�|_|jj
�|jj
�|jj�tS(Nsstarting tuningttarget(R>RR:RRR R4R5R0tThreadRfR/R3R_R2R[R(R'((s7/usr/lib/python2.7/site-packages/tuned/daemon/daemon.pyR[�s




cCs�|j�stjd�tS|jdkr=tjd�tS|jj�s]tjd�tS|jj	�tj
d|jj�|jj
|�}|jj�|S(Nstuned is not runningsno profile is setsprofile is not appliedsverifying profile(s): %s(R>RR&RR:RR6R`R4R_R RYR!t
verify_tuningR5(R'tignore_missingtret((s7/usr/lib/python2.7/site-packages/tuned/daemon/daemon.pytverify_profiles




cCsZ|j�stStjd�|r3|jj�n|jj�|jj�d|_t
S(Nsstopping tuning(R>RRR R3R5R2R/tjoinRR(R'tprofile_switch((s7/usr/lib/python2.7/site-packages/tuned/daemon/daemon.pytstops


	N(t__name__t
__module__RR.R#R7R%RR<tpropertyRGR=R)R?RURfRDRkR9RoRuRwRxR>R[RR�(((s7/usr/lib/python2.7/site-packages/tuned/daemon/daemon.pyRs,#	
						;					
					(tosterrnoR0t
tuned.logsttunedttuned.exceptionsRttuned.profiles.exceptionsRttuned.constsRttuned.utils.commandsRRttuned.utils.profile_recommenderRRQtlogsRRtobjectR(((s7/usr/lib/python2.7/site-packages/tuned/daemon/daemon.pyt<module>s

Zerion Mini Shell 1.0