#include "bench.h" #include #include int kobo_bench_enabled = 0; int kobo_bench_frames = 1800; Uint32 kobo_bench_seed = 12345; extern "C" void kobo_bench_init_env(void) { const char *e = getenv("KOBO_BENCH"); kobo_bench_enabled = (e && *e && *e != '0') ? 1 : 0; const char *f = getenv("KOBO_BENCH_FRAMES"); if (f && *f) kobo_bench_frames = atoi(f); const char *s = getenv("KOBO_BENCH_SEED"); if (s && *s) kobo_bench_seed = (Uint32)strtoul(s, NULL, 10); if (!kobo_bench_enabled) return; // Default a steady stress workload so the move pass has predictable cost. if (!getenv("KOBO_STRESS")) setenv("KOBO_STRESS", "1500", 1); // Profiler is the whole point of running in bench mode. if (!getenv("KOBO_PROF")) setenv("KOBO_PROF", "1", 1); fprintf(stderr, "[bench] enabled: frames=%d seed=%u stress=%s prof=%s\n", kobo_bench_frames, (unsigned)kobo_bench_seed, getenv("KOBO_STRESS"), getenv("KOBO_PROF")); }