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.
This commit is contained in:
Niko1221 committed 2026-10-25 18:56:26 +01:00
1 parent d18d8ba045
commit 91d4d7ff86
1 file changed
+5 -1
+5 -1
View File
@@ -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<double, std::milli>(Clock::now() - t0).count();
std::fprintf(stderr, "strata trace: %s %lld %lld %.1f ms\n", what, a, b, ms);
std::fflush(stderr);
};
{