MCPcopy
hub / github.com/benoitc/gunicorn / add

Method add

benchmarks/dirty_streaming.py:167–184  ·  view source on GitHub ↗
(self, name, iterations, duration, chunks=None, bytes_total=None,
            memory_start=None, memory_end=None)

Source from the content-addressed store, hash-verified

165 self.results = []
166
167 def add(self, name, iterations, duration, chunks=None, bytes_total=None,
168 memory_start=None, memory_end=None):
169 throughput = iterations / duration if duration > 0 else 0
170 result = {
171 "name": name,
172 "iterations": iterations,
173 "duration_s": round(duration, 4),
174 "throughput_per_s": round(throughput, 2),
175 }
176 if chunks:
177 result["chunks_per_s"] = round(chunks / duration, 2)
178 if bytes_total:
179 result["mb_per_s"] = round(bytes_total / (1024 * 1024) / duration, 2)
180 if memory_start is not None and memory_end is not None:
181 result["memory_start_mb"] = round(memory_start / (1024 * 1024), 2)
182 result["memory_end_mb"] = round(memory_end / (1024 * 1024), 2)
183 result["memory_delta_mb"] = round((memory_end - memory_start) / (1024 * 1024), 2)
184 self.results.append(result)
185
186 def display(self):
187 print("\n" + "=" * 70)

Calls

no outgoing calls