# Workspace refresh runtime measurement

This drives a real source server and Replay (dev), not a mocked service or unit test.
The fixture is a non-Git directory with 300,001 synthetic files, nested under
300 groups and ten nested directories per group.

On Windows, install each checkout's dependencies with `vp i`. Save `driver-full.ts` and `driver.ts`
and `proof-hook.cjs` in its `apps/server` directory. Use the same Node runtime,
fixture, machine, and script for both revisions, and a fresh server data directory
and output directory for every run.

```powershell
node seed.cjs <fixture>
$env:PROOF_TRACE="0"
node <checkout>/apps/server/driver-full.ts <checkout> <fresh-home> <fixture> <output> 900
```

In a second shell, while that driver runs:

```powershell
powershell -File io-sampler.ps1 -PidFile <output>/server.pid -OutputFile <output>/io.jsonl -Duration 1100
```

The full driver searches for `proof-needle`, measures 21 startup process launches, then
runs for 15 minutes: a new replay thread every ten seconds, a filename lookup
every thirty seconds, and a launch of the same `node -e` acknowledgement process
roughly every second. Turns and launches run concurrently. It then writes
`editor-created-proof.txt` through the editor's `projects.writeFile` RPC and
verifies the new file can be found through `projects.searchEntries`.

Remove only that synthetic editor-created file between runs to restore the fixture.
The native observer calls the original `FileFinder.scanFilesAsync` unchanged and
records request timestamps and returned success. It counts requests, not an
independent observation of the native walk's start or finish.

The Windows sampler records process read/write/other I/O operation rates from
`Win32_PerfFormattedData_PerfProc_Process`; those counters include non-file I/O.
A trial WPR filesystem trace dropped events and was excluded. WPR code in the
driver is disabled by `PROOF_TRACE=0` in the measurements.

The startup samples in the full runs overlapped native index warmup and are
excluded as an idle baseline. Fresh shorter latency repetitions use `driver.ts`
with duration `180`, with a fresh home/output directory each time. This version
collects 21 idle launches after a ten-second settle, before registering the project
or running the first search; the subsequent workload is unchanged. The I/O sampler is used
for the full runs only. `analyze.py <results-directory>` calculates the output
from each directory's `measurement.json`, `scans.jsonl`, and optional `io.jsonl`.

Public artifacts contain synthetic results only; private server logs and auth
material are excluded.

Microsoft documents that these are calculated process performance counters,
and their read-I/O totals include file, network, and device I/O:
[WMI performance classes](https://learn.microsoft.com/en-us/windows/win32/wmisdk/accessing-wmi-preinstalled-performance-classes),
[process I/O counter definitions](https://learn.microsoft.com/en-us/previous-versions/aa394323(v=vs.85)).
