def get_request_time_quantiles(self, url=None, series=None): elapsed = [ total_seconds(h.elapsed) for h in self._get_hits(url=url, series=series) ] # XXX Cache these results, they might be long to compute. return get_quantiles(elapsed, (0, 0.1, 0.5, 0.9, 1))
def average_request_time(self, url=None, series=None): """Computes the average time a request takes (in ms) :param url: The url we want to know the average request time. Could be `None` if you want to get the overall average time of a request. :param series: You can filter by the series, to only know the average request time during a particular series. """ elapsed = [total_seconds(h.elapsed) for h in self._get_hits(url, series)] if elapsed: return float(sum(elapsed)) / len(elapsed) else: return 0
def average_request_time(self, url=None, series=None): """Computes the average time a request takes (in seconds) :param url: The url we want to know the average request time. Could be `None` if you want to get the overall average time of a request. :param series: You can filter by the series, to only know the average request time during a particular series. """ elapsed = [total_seconds(h.elapsed) for h in self._get_hits(url, series)] if elapsed: return float(sum(elapsed)) / len(elapsed) else: return 0
def add_hit(self, cvus, method, url, status, started, elapsed): """Generates a funkload XML item with the data coming from the request. Adds the new XML node to the list of nodes for this output and return it. """ node = ('<response cycle="000" cvus="{cvus}" thread="000" ' 'suite="" name="" ' 'step="001" number="001" type="{method}" result="Successful" ' 'url="{url}" code="{status}" description="" ' 'time="{started}" duration="{elapsed}" />').format( cvus=cvus, method=method, url=url, status=status, started=mktime(started.timetuple()), elapsed=total_seconds(elapsed)) self.nodes.append(node) return node
def add_hit(self, cvus, method, url, status, started, elapsed): """Generates a funkload XML item with the data coming from the request. Adds the new XML node to the list of nodes for this output and return it. """ node = ('<response cycle="000" cvus="{cvus}" thread="000" ' 'suite="" name="" ' 'step="001" number="001" type="{method}" result="Successful" ' 'url="{url}" code="{status}" description="" ' 'time="{started}" duration="{elapsed}" />').format( cvus=cvus, method=method, url=url, status=status, started=mktime(started.timetuple()), elapsed=total_seconds(elapsed)) self.nodes.append(node) return node
def add_hit(self, loads_status=None, started=0, elapsed=0, url='', method="GET", status=200, agent_id=None, _RESPONSE=_RESPONSE): """Generates a funkload XML item with the data coming from the request. Adds the new XML node to the list of nodes for this output. """ hit, user, current_hit, current_user = loads_status self.nodes.append(_RESPONSE.format( cycle=self.cycle_ids[user], cvus=user, method=method.lower(), url=url, status=status, thread=current_user, started=timegm(started.timetuple()), elapsed=total_seconds(elapsed))) test = self._get_current_test(loads_status, agent_id) if test: test.incr_counter('__funkload_requests')
def duration(self): end = self.stop_time or datetime.utcnow() if self.start_time is None: return 0 return total_seconds(end - self.start_time)
def duration(self): if self.end is not None: return total_seconds(self.end - self.start) else: return 0
def tests_per_second(self): delta = self.stop_time - self.start_time return self.nb_tests / total_seconds(delta)
def get_request_time_quantiles(self, url=None, series=None): elapsed = [total_seconds(h.elapsed) for h in self._get_hits(url=url, series=series)] # XXX Cache these results, they might be long to compute. return get_quantiles(elapsed, (0, 0.1, 0.5, 0.9, 1))
def duration(self): end = self.stop_time or datetime.utcnow() if self.start_time is None: return 0 return total_seconds(end - self.start_time)
def duration(self): if self.end is not None: return total_seconds(self.end - self.start) else: return 0
def tests_per_second(self): delta = self.stop_time - self.start_time return self.nb_tests / total_seconds(delta)