Commit 991894c8 authored by Valentin Reis's avatar Valentin Reis

[feature] energy,power,instrumentation reporting

parent 9fe8a58c
......@@ -22,7 +22,8 @@ class Application(object):
def __init__(self, uuid, container, progress, threads):
self.uuid = uuid
self.container_uuid = container
self.progress = 1
self.progress = 0
self.hardwareprogress = 0
self.threads = threads
self.thread_state = 'stable'
......@@ -57,11 +58,15 @@ class Application(object):
def update_progress(self, msg):
"""Update the progress tracking."""
self.progress = self.progress + float(msg['payload'])/10000.
if msg['event']=='progress':
self.progress = self.progress + float(msg['payload'])
elif msg['event']=='hardwareprogress':
self.hardwareprogress = self.hardwareprogress + float(msg['payload'])/10000.
def reset_progress(self):
"""Update the progress tracking."""
self.progress = 0
self.hardwareprogress = 0
class ApplicationManager(object):
......@@ -147,12 +147,13 @@ class BanditController(object):
if self.log_power is not None:
self.log_power.write("progress power loss a desc\n")
self.log_power.write("hardwareprogress progress power loss a desc p_inst\n")
def planify(self, target, machineinfo, applications):
"""Plan the next action for the control loop."""
current_e = float(machineinfo['energy']['energy']['cumulative']['package-0'])/(1000*1000) # in joules
current_p = float(machineinfo['energy']['power']['p0'])/(1000*1000) # in joules
if self.last_e==0:
......@@ -169,6 +170,7 @@ class BanditController(object):
total_progress = sum([a.progress for a in applications.values()])
total_hardwareprogress = sum([a.hardwareprogress for a in applications.values()])
for a in applications.values():
a.reset_progress()"Controller: applications %r" %applications.values())
......@@ -189,9 +191,9 @@ class BanditController(object):"Controller: playing arm id %s (powercap '%s')."
%(str(a),str([act.command for act in list(action)])))
if self.log_power is not None:
self.log_power.write("%s %s %s %s %s\n"
str(a),str([act.command for act in list(action)])))
self.log_power.write("%s %s %s %s %s %s %s\n"
str(a),str([act.command for act in list(action)]),current_p))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment