diff --git a/implementations/main.cpp b/implementations/main.cpp index 474d0ac..36285c1 100644 --- a/implementations/main.cpp +++ b/implementations/main.cpp @@ -1378,6 +1378,10 @@ public: // spend a verdict on. A press made only of these is a "try again", not // a rejection. int skippedUnsettled = 0; + // Split the latency: everything before contact is the user placing a + // finger, everything after is this daemon. + int msToContact = 0; + int msFromContact = 0; }; // `accept` is the set of fids that count as a match for THIS request. The @@ -1412,6 +1416,12 @@ public: int pressFrames = 0, rescans = 0, skipped = 0; std::uint32_t pressFid = 0; auto t0 = std::chrono::steady_clock::now(); + // When contact first appeared. The wall clock a client sees starts when + // the REQUEST starts, so it is dominated by how long the user takes to + // get a finger onto the sensor -- measured at 2 s and more, against a + // match that lands on the first contact frame. Timing from contact is + // the only figure that says anything about the daemon. + std::optional tContact; auto msSince = [&](auto t) { return std::chrono::duration_cast( std::chrono::steady_clock::now() - t).count(); @@ -1431,6 +1441,7 @@ public: bool finger = baseline_.IsFinger(c.metric); // A press begins only once contact is settled; see TouchTracker. bool settled = baseline_.IsSettled(c.metric); + if (finger && !tContact) tContact = std::chrono::steady_clock::now(); fingerPresent_.store(finger); out.frames++; if (finger && !settled && !tracker.FingerDown()) skipped++; @@ -1533,6 +1544,12 @@ public: out.frames, msSince(t0), out.frames ? msSince(t0) / out.frames : 0, g_frameGapMs, skipped ? std::format(", {} unsettled frame(s) skipped", skipped) : ""); + if (tContact) { + out.msToContact = static_cast(msSince(t0) - msSince(*tContact)); + out.msFromContact = static_cast(msSince(*tContact)); + std::println(" timing: {} ms waiting for a finger, {} ms deciding once it was there", + out.msToContact, out.msFromContact); + } out.skippedUnsettled = skipped; if (cancel) { SendCommand(app_, ta::Cmd::Cancel, {});