def start(self): while not NicSimulator.complete: msg = yield self.queue.get() self.logger.log('Received msg at core {}:\n\t"{}"'.format( self.ID, str(msg))) # service the request at least once yield self.env.timeout(msg.runtime) msg.update_service_time() # Continue servicing the request while either the following two conditions are met: # 1. The dispatcher queue is empty and this msg still needs to be serviced # 2. The dispatcher queue is not empty and this msg is higher priority than the msg at the head of the queue while (len(self.dispatcher.queue.items) == 0 and msg.runtime > 0) \ or (len(self.dispatcher.queue.items) > 0 and msg < self.dispatcher.queue.items[0] and msg.runtime > 0): yield self.env.timeout(msg.runtime) msg.update_service_time() self.logger.log( 'Stopped Processing msg at core {}:\n\t"{}"'.format( self.ID, str(msg))) # add this core to the list of idle cores yield self.env.timeout(cPRESRPTCore.comm_delay) self.dispatcher.idle_cores.put(self) if msg.runtime > 0: # the request needs to be processed for longer self.dispatcher.queue.put(msg) else: NicSimulator.completion_times['all'].append(self.env.now - msg.start_time) NicSimulator.request_cnt += 1 NicSimulator.check_done(self.env.now)
def start(self): while not NicSimulator.complete: msg = yield self.queue.get() self.logger.log('Received msg at core {}:\n\t"{}"'.format( self.ID, str(msg))) # service the request at least once yield self.env.timeout(msg.runtime) msg.update_service_time() # continue servicing the request while the dispatcher queue is empty while len(self.dispatcher.queue.items) == 0 and msg.runtime > 0: yield self.env.timeout(msg.runtime) msg.update_service_time() self.logger.log( 'Stopped Processing msg at core {}:\n\t"{}"'.format( self.ID, str(msg))) # add this core to the list of idle cores yield self.env.timeout(cPRECore.comm_delay) self.dispatcher.idle_cores.put(self) if msg.runtime > 0: # the request needs to be processed for longer self.dispatcher.queue.put(msg) else: NicSimulator.completion_times['all'].append(self.env.now - msg.start_time) NicSimulator.request_cnt += 1 NicSimulator.check_done(self.env.now)
def notify_dispatcher(self, msg): yield self.env.timeout(PREJBSQCore.comm_delay) self.dispatcher.idle_cores.put(self) if msg.runtime > 0: # the request needs to be processed for longer self.dispatcher.queue.put(msg) else: NicSimulator.completion_times['all'].append(self.env.now - msg.start_time) NicSimulator.request_cnt += 1 NicSimulator.check_done(self.env.now)
def start(self): while not NicSimulator.complete: msg = yield self.queue.get() self.logger.log('Received msg at core {}:\n\t"{}"'.format( self.ID, str(msg))) yield self.env.timeout(msg.service_time) self.logger.log( 'Finished Processing msg at core {}:\n\t"{}"'.format( self.ID, str(msg))) NicSimulator.completion_times['all'].append(self.env.now - msg.start_time) NicSimulator.request_cnt += 1 NicSimulator.check_done(self.env.now)
def start(self): while not NicSimulator.complete: msg = yield self.queue.get() self.logger.log('Received msg at core {}:\n\t"{}"'.format( self.ID, str(msg))) yield self.env.timeout(msg.service_time) self.logger.log( 'Finished Processing msg at core {}:\n\t"{}"'.format( self.ID, str(msg))) # add this core to the list of idle cores yield self.env.timeout(cSRPTCore.comm_delay) self.dispatcher.idle_cores.put(self) NicSimulator.completion_times['all'].append(self.env.now - msg.start_time) NicSimulator.request_cnt += 1 NicSimulator.check_done(self.env.now)
def start(self): while not NicSimulator.complete: msg = yield self.queue.get() self.logger.log('Received msg at core {}:\n\t"{}"'.format( self.ID, str(msg))) # service the msg yield self.env.timeout(msg.runtime) msg.update_service_time() self.logger.log( 'Stopped processing msg at core {}:\n\t"{}"'.format( self.ID, str(msg))) if msg.runtime > 0: # the request needs to be processed for longer self.dispatcher.queue.put(msg) else: NicSimulator.completion_times['all'].append(self.env.now - msg.start_time) NicSimulator.request_cnt += 1 NicSimulator.check_done(self.env.now)
def notify_dispatcher(self, msg): yield self.env.timeout(JBSQCore.comm_delay) self.dispatcher.idle_cores.put(self) NicSimulator.completion_times['all'].append(self.env.now - msg.start_time) NicSimulator.request_cnt += 1 NicSimulator.check_done(self.env.now)