From 91d4d7ff8628ed477b4085f4111fb06eabee9ed2 Mon Sep 17 00:00:00 2001 From: Niko1221 Date: Sun, 25 Oct 2026 18:56:26 +0100 Subject: [PATCH] STRATA_TRACE: print elapsed milliseconds on each request step The trace lines named the step a request reached but not how long it took to get there, so a stall between two marks was invisible. Each line now carries the time since the first traced step (thread-local). A diagnostic only: no step, no order and no output changes without STRATA_TRACE set. Found with it on z440 (Q2_0, layer split 24, 16,383-token prompt): the batched read takes 8,758 ms while stage 0's own GPU timeline is 5,374 ms - stage 1 is the slow one - and the expert-cache refill after the prompt costs a further 592 ms of the request. --- src/program/generate.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/program/generate.cpp b/src/program/generate.cpp index 0b153ee1..56c2136a 100644 --- a/src/program/generate.cpp +++ b/src/program/generate.cpp @@ -11026,7 +11026,11 @@ int main(int argc, char** argv) { const bool trace = std::getenv("STRATA_TRACE") != nullptr; auto tr = [&](const char* what, long long a = -1, long long b = -1) { if (!trace) return; - std::fprintf(stderr, "strata trace: %s %lld %lld\n", what, a, b); + static thread_local Clock::time_point t0; + static thread_local bool t0_set = false; + if (!t0_set) { t0 = Clock::now(); t0_set = true; } + const double ms = std::chrono::duration(Clock::now() - t0).count(); + std::fprintf(stderr, "strata trace: %s %lld %lld %.1f ms\n", what, a, b, ms); std::fflush(stderr); }; {