added app_class and governor
This commit is contained in:
+22
@@ -0,0 +1,22 @@
|
||||
from app_class import AppClass
|
||||
from config import Config
|
||||
from cpufreq import cpuFreq
|
||||
from functools import cached_property
|
||||
|
||||
|
||||
class Governor(AppClass):
|
||||
def __init__(self, _config: Config, testmode: bool = False) -> None:
|
||||
super().__init__(_config, testmode)
|
||||
|
||||
@cached_property
|
||||
def cpufreq(self) -> cpuFreq:
|
||||
if self.testmode:
|
||||
self.log.info("setting up governor in testmode")
|
||||
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)
|
||||
if self.testmode:
|
||||
self.log.warning("application is running in testmode, governor not set")
|
||||
return None
|
||||
self.cpufreq.set_governors(governor_name)
|
||||
Reference in New Issue
Block a user