added scheduler code

This commit is contained in:
2024-12-11 17:41:52 +01:00
parent aeabdf4c3f
commit 7e36084b0f
8 changed files with 69 additions and 23 deletions
+8 -5
View File
@@ -9,18 +9,21 @@ class Governor(AppClass):
super().__init__(_config)
@cached_property
def cpufreq(self) -> cpuFreq:
def _cpufreq(self) -> cpuFreq:
return cpuFreq()
def set_governor(self, governor_name: str) -> None:
self.log.debug("setting governor to %s by using command self.cpufreq.set_governors(%s)", governor_name)
self.log.debug(
"setting cpu governor to %s by using command self._cpufreq.set_governors(%s)",
governor_name, governor_name
)
if self._config.testmode:
self.log.warning("application is running in testmode, governor not set")
self.log.warning("application is running in testmode, cpu governor not set")
return None
if governor_name not in self.cpufreq.available_governors:
if governor_name not in self._cpufreq.available_governors:
self.log.error("governor %s not supported by cpu", governor_name)
return None
self.cpufreq.set_governors(governor_name)
self._cpufreq.set_governors(governor_name)