MCPcopy Create free account
hub / github.com/FastLED/FastLED / run_benchmark

Method run_benchmark

ci/profile_runner.py:268–403  ·  view source on GitHub ↗

Run benchmark iterations and collect results

(self)

Source from the content-addressed store, hash-verified

266 time.sleep(0.1)
267
268 def run_benchmark(self) -> bool:
269 """Run benchmark iterations and collect results"""
270 # Docker mode: Binary is in Docker volume, not accessible from host
271 # For Docker+callgrind, we skip iterations and rely on callgrind analysis
272 if self.use_docker and self.use_callgrind:
273 print("🐳 Docker + Callgrind mode: Skipping benchmark iterations")
274 print(" (Callgrind provides deterministic instruction counts)")
275 # Create minimal results file for callgrind
276 minimal_result = {
277 "variant": "docker_build",
278 "target": self.target,
279 "total_calls": 1,
280 "total_time_ns": 0,
281 "ns_per_call": 0,
282 "calls_per_sec": 0,
283 }
284 with open(self.results_file, "w") as f:
285 json.dump([minimal_result], f, indent=2)
286 return True
287
288 print(f"Running {self.iterations} iterations...")
289 print(f"⏱️ Timeout: 120 seconds per iteration (deadlock detector enabled)")
290 if self.debuggable or self.build_mode in ["debug", "quick"]:
291 print(f"🐛 Stack traces enabled (build mode: {self.build_mode})")
292 else:
293 print(
294 f"⚡ Performance mode (build mode: {self.build_mode}) - limited stack traces"
295 )
296
297 if self.use_docker:
298 print(
299 f"🐳 Running in Docker (volume: fastled-docker-build-{self._get_project_hash()})"
300 )
301
302 binary_path = self.get_binary_path()
303 if not self.use_docker and not binary_path.exists():
304 print(f"Error: Binary not found at {binary_path}")
305 return False
306
307 results: list[dict[str, Any]] = []
308
309 for i in range(1, self.iterations + 1):
310 print(f" Iteration {i}/{self.iterations}...", end=" ", flush=True)
311
312 try:
313 if self.use_docker:
314 # Docker: Run binary inside container with access to build volume
315 docker_cmd = [
316 "docker",
317 "run",
318 "--rm",
319 "-v",
320 f"{Path.cwd().as_posix()}:/fastled",
321 "-v",
322 f"fastled-docker-build-{self._get_project_hash()}:/fastled/.build",
323 "fastled-unit-tests",
324 f"/fastled/.build/meson-{self.build_mode}/tests/profile/{self.test_name}",
325 "baseline",

Callers 1

runMethod · 0.95

Calls 9

_get_project_hashMethod · 0.95
get_binary_pathMethod · 0.95
_run_with_timeoutMethod · 0.95
printFunction · 0.50
dumpMethod · 0.45
runMethod · 0.45
findMethod · 0.45
rfindMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected