# Latency Measurement

## Symptom

OpenMouse felt slow while the peer card showed the Macs connected over Thunderbolt.

## Root Cause Hypothesis

The app could label the selected network path but did not measure the actual OpenMouse control socket or local input send rate. Shell `ping` to the peer's Thunderbolt IP also showed 100% packet loss during investigation, despite the route and ARP entry pointing at `bridge0`, so path labeling alone is not enough to judge current health.

## Fix

Added a lightweight TCP `latency:ping` / `latency:pong` probe over the existing OpenMouse socket. Each peer now tracks RTT, missed probes, and input frames per second. The Nearby Macs card and footer display these metrics beside the network path.

## Evidence

Commands run:

```text
ping -c 20 -i 0.2 169.254.148.79
ping -S 169.254.148.80 -c 5 -i 0.2 169.254.148.79
route -n get 169.254.148.79
arp -an
node --check app.js
node --check app-ui/renderer.js
git diff --check
```

`ping` reported 100% packet loss. `route` and `arp` still showed the Thunderbolt path through `bridge0`.

## Status

DONE_WITH_CONCERNS: static verification passed, but live RTT numbers require restarting/updating the running OpenMouse instances on both Macs so both sides understand the new probe frames.
