Commit 36206879 authored by Swann Perarnau's avatar Swann Perarnau

[feature] Add actuator logic for decreasing power

Change the PowerActuator to be able to lower the power limit. Because
RAPL doesn't provide an actual lower limit, we use 0 as the minimal
parent 26e9c239
......@@ -63,12 +63,18 @@ class PowerActuator(object):
actions = []
pl = self.sensor_manager.get_powerlimits()"power limits: %r:", pl)
if target == 'i':
for k in pl:
r = range(int(pl[k]['curW']), int(pl[k]['maxW']))
actions.extend([Action(k, s, s - r[0]) for s in r])
elif target == 'd':
for k in pl:
r = range(0, int(pl[k]['curW']))
actions.extend([Action(k, s, s - r[-1]) for s in r])
return actions
def execute(self, action):"changing power limit: %r", action)
self.sensor_manager.set_powerlimit(, action.command)
def update(self, action):
......@@ -40,5 +40,5 @@ class SensorManager:
# only return enabled domains
return {k: pl[k] for k in pl if pl[k]['enabled']}
def set_powerlimits(self, domain, value):
def set_powerlimit(self, domain, value):
self.rapl.set_powerlimit(value, domain)
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment