+
     Gi4  c                   s    ^ RI t ^ RIt^ RIt^ RIt^ RIHt ^ RIHt ^ RI	H
t
 ^ RIHt ^ RIHt ^ RIHt ^ RIt]P"                  P%                  4       t ! R R]4      tR# )	i    N)TunedException)InvalidProfileException)commands)exports)ProfileRecommenderc                   s  a  ] tR t^t o RR ltR tR tR tR tR t	R t
R R	 lt]R
 4       t]R 4       t]R 4       t]R 4       t]R 4       tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR R lt Rt!V t"R# )!DaemonNc                s|   \         P                  R 4       \        P                  V n        \        \        P                  4      V n        \        \        P                  4      V n	        \        P                  V n        RV n        \        P                  V n        VEeE   VP                  \        P                   \        P                  4      V n        \        VP#                  \        P$                  \        P                  4      4      V n        \        VP#                  \        P&                  \        P                  4      4      V n	        VP                  \        P(                  \        P                  4      V n        VP                  \        P*                  \        P,                  4      V n        VP#                  \        P.                  \        P                  4      V n        WPn        V P                  ^ 8:  d   \        \        P                  4      V n        V P                  ^ 8X  d	   RV n        M,V P                  V P                  8  d   V P                  V n	        V P                  V P                  ,          V n        \         P5                  RV P                  ,          4       V P                  '       dY   \         P5                  R4       \         P5                  RV P2                  V P                  ,          V P2                  3,          4       \7        V P                  '       * R7      V n        Wn        W n        V P?                  4        \A        4       V n!         V PE                  V4       R#   \F         dE   p\         PI                  RT,          4       T P                  '       g   \G        R	4      h Rp?R# Rp?ii ; i)
zinitializing daemonTNFz$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))Zis_hardcodedz:Cannot set initial profile. No tunings will be enabled: %sz<Applying TuneD profile failed, check TuneD logs for details.)%logdebugconstsZCFG_DEF_DAEMON_daemonZintZCFG_DEF_SLEEP_INTERVAL_sleep_intervalZCFG_DEF_UPDATE_INTERVAL_update_intervalZCFG_DEF_DYNAMIC_TUNING_dynamic_tuning_recommend_commandZCFG_DEF_ROLLBACK	_rollbackZget_boolZ
CFG_DAEMONgetZCFG_SLEEP_INTERVALZCFG_UPDATE_INTERVALZCFG_DYNAMIC_TUNINGZCFG_RECOMMEND_COMMANDZCFG_DEF_RECOMMEND_COMMANDCFG_ROLLBACK_application_sleep_cyclesinfor   _profile_recommender_unit_manager_profile_loader_init_threadsr   _cmd_init_profiler    error)selfZunit_managerprofile_loaderprofile_namesZconfigZapplicationes   &&&&&& 8/usr/lib/python3.14/site-packages/tuned/daemon/daemon.py__init__ZDaemon.__init__   s   ))!"&&$,V::;$f<<=$66$ $**$.//&"3"3V5J5JK4<fjj)B)BFDaDabc4vzz&*D*DfFdFdef4 //&*C*CVEbEbc4#__V-I-I6KkKkl4JJv22F4K4KL4>!	Qf;;<4	a4t333//4,,0D0DD$((1D4H4HHI	88FG88TX\XjXjmq  nB  nB  YB  DH  DV  DV  XW  W  X0DD[D[@[\$#'j$)Ym$	 Y99IAMN
,,,
W
XX Ys   M, ,N;79N66N;c                s   R V n         \        P                  ! 4       V n        \        P                  ! 4       V n        \        P                  ! 4       V n        \        P                  ! 4       V n        \        P                  ! 4       V n        V P
                  P                  4        \        P                  ! 4       V n	        R # N)
_thread	threadingZEvent
_terminate_terminate_profile_switch	_not_used_sighup_processing_sighup_pendingset_profile_appliedr      &r   r   ZDaemon._init_threads9   sq    $,OO%$/#,??#4$ ??$$.%OO-$"*$..#//+$    c                s(    V P                  R4       R# )zARead configuration files again and load profile according to themN)r   r+   r,   r   reload_profile_configZDaemon.reload_profile_configG   s    Tr-   c                s   R pV P                   P                  4       pVfJ   V P                  4       w  rVf3   RpV'       d   VR,          pM	VR,          p\        P	                  V4       M:VR8X  d4   V'       d   \        P	                  R4       M\        P	                  R4       RV n        RV n        . V n        RV n        V P                  WV4       R# )TNz.No profile is preset, running in manual mode. z(Only post-loaded profile will be enabledzNo profile will be enabled. )
r   Zget_post_loaded_profile_get_startup_profiler   r   _profile_manual_active_profiles_post_loaded_profileset_all_profiles)r   r   manualpost_loaded_profileZmsgs   &&   r   r   ZDaemon._init_profileK   s    &		99;!668M
:C66S))SHHSMHH78HH*+$-$,$"$/BCr-   c                s   T;'       g    R pVP                  4       pV P                  '       d:   \        P                  RV P                  ,          4       W0P                  .,           pV FR  pW@P                  P
                  P                  4       9  g   K-  RV,          pV P                  VRV4       \        V4      h	   V'       d"   V P                  P                  V4      V n        MRV n        W n        VP                  4       V n        R#   \         d=   pRRP                  T4      : RT: 2pT P                  TRT4       \        T4      hRp?ii ; i)r/   zUsing post-loaded profile '%s'z%Requested profile '%s' doesn't exist.FNzCannot load profile(s) ' z': )splitr4   r   r   r   Zprofile_locatorZget_known_names_notify_profile_changedr    r   Zloadr1   r2   r3   r   join)r   r   r6   Zprofile_listprofileerrstrr   s   &&&    r   _load_profilesZDaemon._load_profilesd   s    %%2-$$&,	88,  ! "";";!<<<g((88HHJJ4w>F  v>

  	 
 ((--l;DMDM<(..04	   14,1GK6uf=		 s   D 	AD E7EEc                s    V P                  4       '       d!   R pV P                  VRV4       \        V4      hV P                  W4       R# z/Cannot set profile while the daemon is running.FN)
is_runningr:   r    r>   )r   r   r6   r=      &&& r   set_profileZDaemon.set_profile~   sB    	__=6u		m,r-   c                s    V'       g
   R V n         R # \        VP                  4       4      ^8  d   Rp\        V4      hWn         R # )NzYWhitespace is not allowed in profile names; only a single post-loaded profile is allowed.)r4   Zlenr9   r    )r   profile_namer=      && r   _set_post_loaded_profileZDaemon._set_post_loaded_profile   s9    	#4
< 1$g6		+r-   c                s   V P                  4       '       d!   R pV P                  VRV4       \        V4      hV P                  V4       V P	                  W4       V'       d%   V P                  W4       V P                  V4       R# R# r?   )r@   r:   r    rE   r>   _save_active_profile_save_post_loaded_profile)r   Zactive_profilesr6   r7   Zsave_instantlyr=   s   &&&&& r   r5   ZDaemon.set_all_profiles   sv    	__=6		 34o._5!!"56 r-   c                    V P                   # r!   r1   r+   r,   r   r<   ZDaemon.profile   s    	r-   c                rH   r!   )r2   r+   r,   r   r6   ZDaemon.manual   s    	r-   c                sB    V P                   '       d   V P                  # R # r!   )r1   r4   r+   r,   r   r7   ZDaemon.post_loaded_profile   s     '+mmm	"	"==r-   c                rH   r!   )r   r+   r,   r   profile_recommenderZDaemon.profile_recommender   s    		"	""r-   c                rH   r!   )r   r+   r,   r   r   ZDaemon.profile_loader   s    			r-   c                sn    V P                   e'   \        P                  ! \        P                  WV4       V# r!   )r   r   Zsend_signalr   ZSIGNAL_PROFILE_CHANGED)r   r   Zresultr=   s   &&&&r   r:   ZDaemon._notify_profile_changed   s+    	"
v44mVT	-r-   c                s   V P                   P                  R R.^ .R7      w  rV^ 8  d   R# VR,          R8X  d   R# V P                   P                  R R.^ .R7      w  r\        P                  ! RV4      RJ ;'       d    V'       * # )	Z	systemctlzis-system-running)Z	no_errorsF:Ni   NZstoppingz	list-jobsz0\b(shutdown|reboot|halt|poweroff)\.target.*startN)r   ZexecutereZsearch)r   ZretcodeZout   &  r   _full_rollback_requiredZDaemon._full_rollback_required   s    ""K1D#ETUSV"W,'q[
W

""K#=A3"O,'	F	LPT	T	d	d]dYddr-   c                s*   V P                   f   \        R4      hV P                  P                  V P                   P                  4       V P                  RP                  V P                  4      V P                  4       V P                  V P                  4       V P                  P                  4        V P                  P                  4        \        P                  RV P                   P                   ,          4       V P"                  '       d   \$        P&                  ! 4        RP                  V P                  4      pV P)                  VRR4       V P*                  P-                  4        V P"                  '       d   V P.                  pV P0                  P3                  V P4                  V P6                  4      '       g   V P8                  '       g   KJ  V^,          pV^ 8:  g   K\  V P.                  p\        P;                  R4       V P                  P=                  4        \        P;                  R4       V P                  P?                  4        K  V P                  P-                  4        ^ pV P0                  P3                  V P@                  V P6                  4      '       g   V^8  d   V^,          pKH  V PB                  PE                  4       '       d   \F        PH                  pM\F        PJ                  pV PM                  4       '       g   \        P                  R4       MV PN                  R	8X  dL   \F        PP                  p\        P                  R
\F        PR                  : R\F        PT                  : R24       MMV P"                  '       d'   \        P                  R4       \F        PH                  pM\        P                  R4       V P"                  '       d   V P                  PW                  V4       V P                  PY                  4        R # )Nz2Cannot start the daemon without setting a profile.r8   z'static tuning from profile '%s' appliedTZOKzupdating monitorszperforming tuningsz1terminating TuneD due to system shutdown / rebootZnot_on_exitz;terminating TuneD and not rolling back any changes due to 'z' option in 'Z'z+terminating TuneD, rolling back all changesz"terminating TuneD in one-shot mode)-r1   r    r   ZcreateZunitsrF   r;   r3   r2   rG   r4   Zstart_tuningr*   r)   r   r   namer	   r   startr:   r'   clearr   r   Zwaitr$   r
   r   r   Zupdate_monitorsZupdate_tuningr&   r%   is_setr   ZROLLBACK_FULLZROLLBACK_SOFTrM   r   ZROLLBACK_NONEr   ZGLOBAL_CONFIG_FILEZstop_tuningZdestroy_all)r   r   Z
_sleep_cntZiZrollbacks   &    r   _thread_codeZDaemon._thread_code   s   	]]	L	MMDMM//0CHHT%:%:;||  !:!:;!!#((4t}}7I7IIJ	\\\
==?((4001-}dD9!	\\\ "":YY^^DOOT-A-ABB1_Za%%j	ii#$
((*	ii$%
&&( !IINN4>>4+?+?@@QU61 
##**,,""8 ""8

&
&
(
(HH@A-'##HHH`f`s`su{  vO  vO  P  Q|||XX;<$$XXX23	\\\!!(+  "r-   c                s     V P                   P                  W4       R #   \         d*   p\        P	                  \        T4      4        R p?R # R p?ii ; ir!   )r   Zsave_active_profiler    r   r   str)r   r   r6   r   rA   r   rF   ZDaemon._save_active_profile  s<    99  7	 99SV    AAAc                s     V P                   P                  V4       R #   \         d*   p\        P	                  \        T4      4        R p?R # R p?ii ; ir!   )r   Zsave_post_loaded_profiler    r   r   rS   )r   rC   r   rD   r   rG   Z Daemon._save_post_loaded_profile  s<    99%%l3	 99SVrT   c                s    \         P                  R 4       V P                  P                  4       p\         P                  RV,          4       V# )zWRunning in automatic mode, checking what profile is recommended for your configuration.zUsing '%s' profile)r   r   r   Z	recommend)r   r<   s   & r   _get_recommended_profileZDaemon._get_recommended_profile  s:    ((de%%//1'((')*	.r-   c                s    V P                   P                  4       w  rVf   VR JpV'       g   V P                  4       pW3# r!   )r   Zget_active_profilerU   )r   r<   r6   rL   r   r0   ZDaemon._get_startup_profile  s>    II002/'^46	**,7	r-   c                sJ    V P                   P                  P                  4       # )z$Return all accessible plugin classes)r   plugins_repositoryZload_all_classesr+   r,   r   get_all_pluginsZDaemon.get_all_plugins&  s    				.	.	?	?	AAr-   c                s     V P                   P                  P                  V4      pVP                  #   \         d     R# i ; i)zReturn plugin class docstringr/   )r   rV   
load_classImportErrorZ__doc__r   Zplugin_nameZplugin_classrD   r   get_plugin_documentationZDaemon.get_plugin_documentation*  sH    $$77BB<
 
		 
 
s   %3 AAc                s     V P                   P                  P                  V4      pVP	                  4       #   \         d    / u # i ; i)zReturn plugin's parameters and their hints

Parameters:
plugin_name -- plugins name

Return:
dictionary -- {parameter_name: hint}
)r   rV   rX   rY   Zget_config_options_hintsrZ   rD   r   get_plugin_hintsZDaemon.get_plugin_hints4  sM    $$77BB<
 
	.	.	00 
 
9s   %7 AAc                s    V P                   R J# r!   rI   r+   r,   r   
is_enabledZDaemon.is_enabledE  s    	d	""r-   c                sb    V P                   R J;'       d    V P                   P                  4       # r!   )r"   Zis_aliver+   r,   r   r@   ZDaemon.is_runningH  s&    	T	!	=	=dll&;&;&==r-   c                s   V P                  4       '       d   R # V P                  f   R # \        P                  R4       V P                  P                  4        \        P                  ! V P                  R7      V n	        V P                  P                  4        V P                  P                  4        V P                  P                  4        R# )Fzstarting tuning)ZtargetT)r@   r1   r   r   r&   r)   r#   ZThreadrR   r"   r%   rP   r$   rO   r+   r,   r   rO   ZDaemon.startK  s    	__
	]]
((..!!):):;$,  &&(//,,	r-   c                s   V P                  4       '       g   \        P                  R 4       R# V P                  f   \        P                  R4       R# V P                  P                  4       '       g   \        P                  R4       R# V P                  P                  4        \        P                  RV P                  P                  ,          4       V P                  P                  V4      pV P                  P                  4        V# )zTuneD is not runningFzno profile is setzprofile is not appliedzverifying profile(s): %s)r@   r   r   r1   r*   rQ   r&   rP   r   rN   r   Zverify_tuningr)   )r   Zignore_missingZretrD   r   verify_profileZDaemon.verify_profileZ  s    			99#$
	]]99 !
				%	%	'	'99%&
 ..((%(:(::;((8#..	*r-   c                s   V P                  4       '       g   R # \        P                  R4       V'       d   V P                  P	                  4        V P
                  P	                  4        V P                  P                  4        RV n        R# )Fzstopping tuningNT)r@   r   r   r%   r)   r$   r"   r;   )r   Zprofile_switchs   &&r   stopZDaemon.stopp  s^    			
((!!%%'//,,$,	r-   )r3   r   r   r	   r   r2   r&   r4   r1   r*   r   r   r   r   r(   r'   r   r
   r$   r%   r"   r   r   )NNN)F)#Z__name__Z
__module__Z__qualname__Z__firstlineno__r    r   r.   r   r>   rB   rE   r5   Zpropertyr<   r6   r7   rJ   r   r:   rM   rR   rF   rG   rU   r0   rW   r[   r\   r]   r@   rO   r^   r_   Z__static_attributes__Z__classdictcell__)Z__classdict__s   @r   r   r      s     &YP,D2 4-,7     > >
 # #  

eE#NB1"#>,
 
r-   r   )ZosZerrnor#   Z
tuned.logsZtunedZtuned.exceptionsr    Ztuned.profiles.exceptionsr   Ztuned.constsr   Ztuned.utils.commandsr   r   Ztuned.utils.profile_recommenderr   rK   Zlogsr   r   Zobjectr   ) r-   r   <module>r`      sD    	    + =  )  > 	jjnnjV jr-   