def __calculate_test_duration(self, steps): ''' Get total test duration ''' duration = 0 for rps, dur in tankcore.pairs(steps): duration += dur return duration
def __calculate_test_duration(self, steps): ''' Get total test duration ''' duration = 0 for rps, dur in tankcore.pairs(steps): duration += dur self.owner.core.set_option(self.owner.SECTION, self.OPTION_TEST_DURATION, str(duration))
def check_open_files(self): if not self.phout and self.phantom.phantom and os.path.exists(self.phantom.phantom.phout_file): self.log.debug("Opening phout file: %s", self.phantom.phantom.phout_file) self.phout = open(self.phantom.phantom.phout_file, 'r') # strange decision to place it here, but no better idea yet if self.phantom.stepper: for item in tankcore.pairs(self.phantom.stepper.steps): self.steps.append([item[0], item[1]]) if not self.stat and self.phantom.phantom and self.phantom.phantom.stat_log and os.path.exists(self.phantom.phantom.stat_log): self.log.debug("Opening stat file: %s", self.phantom.phantom.stat_log) self.stat = open(self.phantom.phantom.stat_log, 'r')
def get_info(self): ''' get merged info about phantom conf ''' result = copy.copy(self.streams[0]) result.stat_log = self.stat_log result.steps = [] result.ammo_file = '' result.rps_schedule = None result.ammo_count = 0 result.duration = 0 result.instances = 0 result.loadscheme = [] result.loop_count = 0 for stream in self.streams: sec_no = 0 # logging.info("Steps: %s", stream.stepper.steps) for item in tankcore.pairs(stream.stepper.steps): for x in range(0, item[1]): if len(result.steps) > sec_no: result.steps[sec_no][0] += item[0] else: result.steps.append([item[0], 1]) sec_no += 1 if result.rps_schedule: result.rps_schedule = u'multiple' else: result.rps_schedule = stream.stepper.rps_schedule if result.loadscheme: result.loadscheme = '' else: result.loadscheme = stream.stepper.loadscheme if result.loop_count: result.loop_count = u'0' else: result.loop_count = stream.stepper.loop_count result.ammo_file += stream.stepper.ammo_file + ' ' result.ammo_count += stream.stepper.ammo_count result.duration = max(result.duration, stream.stepper.duration) result.instances += stream.instances if not result.ammo_count: raise ValueError("Total ammo count cannot be zero") return result
def check_open_files(self): if not self.phout and self.phantom.phantom and os.path.exists( self.phantom.phantom.phout_file): self.log.debug("Opening phout file: %s", self.phantom.phantom.phout_file) self.phout = open(self.phantom.phantom.phout_file, 'r') # strange decision to place it here, but no better idea yet if self.phantom.stepper: for item in tankcore.pairs(self.phantom.stepper.steps): self.steps.append([item[0], item[1]]) if not self.stat and self.phantom.phantom and self.phantom.phantom.stat_log and os.path.exists( self.phantom.phantom.stat_log): self.log.debug("Opening stat file: %s", self.phantom.phantom.stat_log) self.stat = open(self.phantom.phantom.stat_log, 'r')