@@ -19,27 +19,28 @@ def __init__(self, unit_manager, profile_loader, profile_names=None, config=None
1919 self ._daemon = consts .CFG_DEF_DAEMON
2020 self ._sleep_interval = int (consts .CFG_DEF_SLEEP_INTERVAL )
2121 self ._update_interval = int (consts .CFG_DEF_UPDATE_INTERVAL )
22- self ._dynamic_tuning = consts .CFG_DEF_DYNAMIC_TUNING
2322 self ._recommend_command = True
2423 self ._rollback = consts .CFG_DEF_ROLLBACK
24+ dynamic_plugins = []
2525 if config is not None :
2626 self ._daemon = config .get_bool (consts .CFG_DAEMON , consts .CFG_DEF_DAEMON )
2727 self ._sleep_interval = int (config .get (consts .CFG_SLEEP_INTERVAL , consts .CFG_DEF_SLEEP_INTERVAL ))
2828 self ._update_interval = int (config .get (consts .CFG_UPDATE_INTERVAL , consts .CFG_DEF_UPDATE_INTERVAL ))
29- self ._dynamic_tuning = config .get_bool (consts .CFG_DYNAMIC_TUNING , consts .CFG_DEF_DYNAMIC_TUNING )
3029 self ._recommend_command = config .get_bool (consts .CFG_RECOMMEND_COMMAND , consts .CFG_DEF_RECOMMEND_COMMAND )
3130 self ._rollback = config .get (consts .CFG_ROLLBACK , consts .CFG_DEF_ROLLBACK )
31+ dynamic_plugins = config .get (consts .CFG_DYNAMIC_PLUGINS , [])
3232 self ._application = application
33+ self ._periodic_tuning = any (plugin .uses_periodic_tuning () for plugin in dynamic_plugins )
3334 if self ._sleep_interval <= 0 :
3435 self ._sleep_interval = int (consts .CFG_DEF_SLEEP_INTERVAL )
3536 if self ._update_interval == 0 :
36- self ._dynamic_tuning = False
37+ self ._periodic_tuning = False
3738 elif self ._update_interval < self ._sleep_interval :
3839 self ._update_interval = self ._sleep_interval
3940 self ._sleep_cycles = self ._update_interval // self ._sleep_interval
40- log . info ( "using sleep interval of %d second(s)" % self ._sleep_interval )
41- if self ._dynamic_tuning :
42- log .info ("dynamic tuning is enabled (can be overridden by plugins) " )
41+ if self ._periodic_tuning :
42+ log . info ( "using sleep interval of %d second(s)" % self ._sleep_interval )
43+ log .info ("periodic tuning is enabled" )
4344 log .info ("using update interval of %d second(s) (%d times of the sleep interval)" % (self ._sleep_cycles * self ._sleep_interval , self ._sleep_cycles ))
4445
4546 self ._profile_recommender = ProfileRecommender (is_hardcoded = not self ._recommend_command )
@@ -215,7 +216,7 @@ def _thread_code(self):
215216 # For more details see TuneD rhbz#917587.
216217 _sleep_cnt = self ._sleep_cycles
217218 while not self ._cmd .wait (self ._terminate , self ._sleep_interval ):
218- if self ._dynamic_tuning :
219+ if self ._periodic_tuning :
219220 _sleep_cnt -= 1
220221 if _sleep_cnt <= 0 :
221222 _sleep_cnt = self ._sleep_cycles
0 commit comments