def fill(self, servers, dummy): """ Create IdleTasks in order to reach 100% system utilization. """ from collections import namedtuple # pylint: disable-msg=C0103 IdleTask = namedtuple('IdleTask', ['utilization', 'deadline', 'name']) idle = len(self.processors) - sum([s.utilization for s in servers]) for server in servers: if server.utilization < 1 and idle > 0: task = IdleTask(min(1 - server.utilization, idle), 0, 'IdleTask') t = TaskServer(task) self.Tdummy.append(t) t.dummyServer = True dummy.append(t) server.add_child(t) idle -= task.utilization while idle > 0: task = IdleTask(min(1, idle), 0, 'IdleTask') t = TaskServer(task) server = EDFServer() server.add_child(TaskServer(task)) idle -= task.utilization servers.append(server)
def independent(self, servers, dummy): """ Add dummy sem misturar """ from collections import namedtuple # pylint: disable-msg=C0103 IdleTask = namedtuple('IdleTask', ['utilization', 'deadline', 'name']) u = sum([s.utilization for s in servers]) idle = ceil(u) - u while idle > 0: task = IdleTask(min(1, idle), 0, 'IdleTask') server = EDFServer() server.dummyServer = True t = TaskServer(task) self.Tdummy.append(t) t.dummyServer = True server.add_child(t) servers.append(server) dummy.append(t) idle -= min(1, idle)
def before(self, servers, dummy): """ Create IdleTasks in order to reach 100% system utilization. """ from collections import namedtuple # pylint: disable-msg=C0103 IdleTask = namedtuple('IdleTask', ['utilization', 'deadline', 'name']) idle = len(self.processors) - sum([s.utilization for s in servers]) new_servers = [] for server in servers: if server.utilization < 1 and idle > 0: dummy = IdleTask(min(1 - server.utilization, idle), 0, 'IdleTask') # Create a EDFserver to add dummy and the task server s = EDFServer() s.add_child(TaskServer(dummy)) s.add_child(server) idle -= dummy.utilization new_servers.append(s) else: new_servers.append(server) return new_servers
def independent(self, servers, dummy): """ Add dummy sem misturar """ from collections import namedtuple # pylint: disable-msg=C0103 IdleTask = namedtuple('IdleTask', ['utilization', 'deadline', 'name']) idle = len(self.processors) - sum([s.utilization for s in servers]) if min(1, idle) == 1: idle -= 1 if min(1, idle) == 1: idle -= 1 """ for s in servers: task = IdleTask(0, 0, 'IdleTask') t = TaskServer(task) t.dummyServer = True s.add_child(t) """ while idle > 0: task = IdleTask(min(1, idle), 0, 'IdleTask') server = EDFServer() server.dummyServer = True t = TaskServer(task) self.Tdummy.append(t) t.dummyServer = True server.add_child(t) servers.append(server) dummy.append(t) #self.sim.logger.log("add dummy {} to server {} idle = {}".format(t.identifier, server.identifier, Fraction(round(min(1, idle),2)))) idle -= min(1, idle)