def renderSlowestRequests(self, number): """Render the n slowest requests of the best cycle.""" stats = self.stats self.append(rst_title("Slowest requests", 2)) cycle = self.getBestCycle() cycle_name = None if not (cycle and stats[cycle].has_key('response_step')): return steps = stats[cycle]['response_step'].keys() items = [] for step_name in steps: stat = stats[cycle]['response_step'][step_name] stat.finalize() items.append((stat.avg, stat.step, stat.type, stat.url, stat.description, stat.apdex_score)) if not cycle_name: cycle_name = stat.cvus items.sort() items.reverse() self.append('The %d slowest average response time during the ' 'best cycle with **%s** CUs:\n' % (number, cycle_name)) for item in items[:number]: self.append(LI + ' In page %s, Apdex rating: %s, avg response time: %3.2fs, %s: ``%s``\n' ' `%s`' % ( item[1], Apdex.get_label(item[5]), item[0], item[2], item[3], item[4]))
def render_stat(self): """Render rst stat.""" stats = self.stats stats.finalize() ret = [' ' * self.indent] ret.append(self.fmt_int % stats.cvus) ret.append(self.fmt_float % stats.apdex_score) ret.append(self.fmt_str % Apdex.get_label(stats.apdex_score)) ret.append(self.fmt_int % stats.count) ret.append(self.fmt_int % stats.success) ret.append(self.fmt_percent % stats.error_percent) ret.append(self.fmt_float % stats.min) ret.append(self.fmt_float % stats.avg) ret.append(self.fmt_float % stats.max) if self.with_percentiles: self._attach_percentiles(ret) ret = self.sep.join(ret) return ret