Viewing File: /usr/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|j4y%|j|}|jƒ|j|=WnnXWdQXdS(N(R
Rtcancel(RR
R((s;/usr/lib/python2.7/site-packages/tuned/daemon/controller.pyt
drop_timers


cCsE|j6x!|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|rtjntj	}|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	
Back to Directory File Manager