Compare commits

...
Author SHA1 Message Date
poli0981andClaude Fable 5.2 ffa89dd52d docs(advanced): train B planned - three releases, the struct-version table from the upstream tags, the Agent's cost measured in a real session and NFR-2 amended to 2.5 % (Advanced B PR-1, D110-D117)
Train B (what only a hooked game can say) is three releases: beta.40 more fields of calls already hooked and no new
patch site; beta.41 slSetConstants + ffxConfigure; beta.42 slGetFeatureVersion + slGetFeatureRequirements. Inside the
game too, off means nothing more is read. docs/17_HOOK_ENGINE.md gains which struct version carries which field,
compared across sixteen Streamline and ten FidelityFX tags. tools/agent-cost.ps1 measures the shipped Agent in a
session: 1.93 % of one core off, 2.04 % on; the owner amended NFR-2 to 2.5 %. HANDOFF records beta.39's release facts.
ShmDrainIntegrationTests waits Init out and prints the guard's verdict.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-11 21:59:05 +07:00
12 changed files with 302 additions and 26 deletions

No files matched your search

+22
View File
@@ -35,6 +35,28 @@ numeric core and does not move; the heading is the full version — corrected 20
## [Unreleased]
### Added
- **Advanced metrics inside the game is planned — three releases, and nothing reads it yet.** The readings that
exist only inside a game — the options a game gives DLSS and FSR, FSR's own memory, later the constants a game
gives Streamline and its frame-generation configuration — come in three steps (owner decisions D110–D116):
first more fields of calls FrameLedger already intercepts, with no new hook; then two new hooks; then two more.
Each step waits for the one before to be run on real games. With Advanced metrics off, nothing more is read
inside a game either. This pull request changes nothing you can see or record: it records the decisions, and
**which version of each vendor struct carries which field**, compared across every upstream release of Streamline
2.x and of the FidelityFX API — a field is read only where it is proven to be there.
- **`tools/agent-cost.ps1`** (a developer tool): what the shipped capture agent costs while it records, measured on
the real program against the project's own test window, with Advanced metrics off and on.
### Changed
- **The agent's processor budget says what was measured.** The specification promised that the capture agent uses
at most 1 % of one processor core while recording; nobody had measured it. Measured on the development PC it is
1.93 % — 2.04 % with Advanced metrics on — nearly all of it the once-a-second read of the graphics card's sensors
that every session has always made, and its memory is 113 MiB (119 with the option on) against a limit of 150.
The owner chose to keep the readings and amend the limit: **NFR-2 is now ≤ 2.5 % of one core** (D117). Nothing the
agent does changes.
## Releases
Newest first. Each file holds that release's section exactly as it stood here.
+2
View File
@@ -171,6 +171,8 @@ tools/ # accuracy-check, changelog-check, chokepoint-che
# wiki-build (beta.17: builds and checks the wiki; the wiki-check gate),
# buildid-check (beta.18: the release's build id in the shipped natives),
# docs-split-check (beta.24, D66: CHANGELOG/HANDOFF and their parts agree),
# agent-cost (D110, 2026-11-11: a developer tool, not a gate - what the shipped
# Agent costs per second of session, Advanced metrics off and on),
# nvapi-readonly-check (D108, 2026-11-11: every NVAPI call of the bridge is on
# nvapi-allowed-calls.txt, and none there writes or identifies)
# (six names added 2026-10-04)
+1 -1
View File
@@ -105,7 +105,7 @@ Draw live FPS/frametime/upscaler info inside the game. Only for games already ho
## Non-functional requirements
- **NFR-1 Game-side overhead:** ≤ 1 µs per present, ≤ 8 MB resident, measured game FPS impact ≤ 0.5% vs uninstrumented.
- **NFR-2 Agent overhead:** ≤ 1% of one core during capture, ≤ 150 MB working set, ~0% idle. *(D101, 2026-11-11: the limits hold with Advanced metrics on — FR-5.6. Its reads run on a thread of their own, the slow ones seldom, and with no game running only while its page is open (D107), so "~0% idle" is not spent on it. **Unmeasured** until the owner's run with the option on and off, `HANDOFF` §Owner-only.)*
- **NFR-2 Agent overhead:** ~~≤ 1% of one core during capture~~ **≤ 2.5 % of one core during capture** *(owner decision D117, 2026-11-11: the 1 % had never been measured; measured in a real Agent it is 1.93 % with Advanced metrics off and 2.04 % with it on — `20_OPEN_QUESTIONS` §M16, `tools/agent-cost.ps1` — nearly all of it the once-a-second read of the graphics card's sensors, which stays)*, ≤ 150 MB working set *(measured: 113 MiB off, 119 MiB on)*, ~0% idle. *(D101, 2026-11-11: the limits hold with Advanced metrics on — FR-5.6. Its reads run on a thread of their own, the slow ones seldom, and with no game running only while its page is open (D107), so "~0% idle" is not spent on it. Measured on the development PC in a session that is not hooked; a hooked session, an elevated Agent with PawnIO's groups and a real game are the owner's run, `HANDOFF` §Owner-only.)*
- **NFR-3 Stability:** faults **originating in our own hook bodies** are contained by `FL_HOOK_GUARD`, counted, and self-disable the Overlay after 3 occurrences; the safety-unhook path completes within one frame. The Overlay adds no allocation, lock, syscall or logging to the present path.
> This deliberately does **not** say "must never crash a game" (`20_OPEN_QUESTIONS` §H8). SEH containment cannot reliably catch stack overflow, cannot intercept `__fastfail` — and `-D_HAS_EXCEPTIONS=0` converts a would-be STL throw into exactly that (`spike-notes.md` §H3) — and does not help when the game installs a vectored exception handler that runs first. An absolute promise the mechanism cannot support does not belong in a requirement, and must stay out of user-facing text: the Disclaimer already says injection carries risk, and that wording is the honest one.
+1 -1
View File
@@ -537,7 +537,7 @@ Crash-within-60s-of-injection happening twice for the same game ⇒ **hooking au
|---|---|
| Game process, per present | ≤ 1 µs; no syscall, no allocation, no lock, no logging (`17_HOOK_ENGINE`) |
| Game process, resident | ≤ 8 MB (DLL + ring) |
| Agent, during capture | ≤ 1% of one core average, ≤ 150 MB working set |
| Agent, during capture | ~~≤ 1%~~ ≤ 2.5 % of one core average *(NFR-2 as D117 amended it, 2026-11-11: measured 1.93 %, `20_OPEN_QUESTIONS` §M16)*, ≤ 150 MB working set |
| Agent, idle | ~0% (1 Hz process poll only) |
| Measured game FPS impact | ≤ 0.5% vs uninstrumented, verified per release (`14_TESTING` §Hook overhead) |
+1 -1
View File
@@ -145,7 +145,7 @@ own work item on the STA thread and puts back — and with the keys a parameter,
## Hook overhead measurement (NFR-1, per release)
1. `hook-harness` in a fixed workload, present-rate uncapped: 3 runs hooked vs 3 unhooked → mean present-call cost delta must be ≤ 1 µs (measured with QPC around the call site in an instrumented harness build).
2. Real game, fixed 10-minute scene, capture ON vs OFF, 3 runs each: **game's own Avg FPS delta ≤ 0.5%**, Agent CPU ≤ 1% of a core, Agent RSS ≤ 150 MB, Overlay resident ≤ 8 MB.
2. Real game, fixed 10-minute scene, capture ON vs OFF, 3 runs each: **game's own Avg FPS delta ≤ 0.5%**, Agent CPU ~~≤ 1%~~ ≤ 2.5 % of a core *(NFR-2 as D117 amended it, 2026-11-11; `tools/agent-cost.ps1` measures the unhooked half without a game)*, Agent RSS ≤ 150 MB, Overlay resident ≤ 8 MB.
> **NOT MEASURED. The runbook exists as of 2026-09-10 (P2 PR-G); the run is the owner's.**
> `tools/fps-impact-runbook.ps1` sequences the six launches, holds consent granted for the ON leg and
+51
View File
@@ -300,6 +300,57 @@ So:
> **`third_party/streamline/README.md` asserted this pass existed for five days
> before it did**, which is why it is described here rather than only there.
### Which struct version carries which field (owner decision D115, 2026-11-11)
**A field of a vendor struct is read only where it is proven to be there.** A game hands a hook a struct of the
version it was built against; a member a later version added lies past the end of what an older game allocated, and
reading it is reading game memory outside the argument (rule 4) — not merely a wrong value. So every read of a tail
member is gated on the struct's own version, and the gate comes from this table, not from the one header in the tree
— which declares only the newest shape, and for `sl::DLSSOptions` says nothing about which version added what.
Established 2026-11-11 from the upstream tags, through GitHub's API: each tag's header was fetched by blob and the
struct's declarations — type, name and order — compared across tags. The members' own types were checked at the
oldest and the newest tag (`enum Boolean : char`, `enum class DLSSMode : uint32_t`, `enum class DLSSPreset :
uint32_t`, `float2`/`float3`/`float4x4`; no `#pragma pack` in either).
**Streamline** (`NVIDIA-RTX/Streamline`; tags v2.0.0, v2.1.0, v2.2.0, v2.4.0, v2.4.15, v2.7.2, v2.7.30, v2.7.32,
v2.8.0, v2.9.0, v2.10.0, v2.10.3, v2.11.1, v2.12.0, v2.14.1, v2.14.16):
| Struct | `structVersion` | First tag (blob of the header) | Members that version adds, in order |
|---|---|---|---|
| `sl::DLSSOptions` (`include/sl_dlss.h`) | 1 | v2.0.0 (`7de7411e507d`) | `mode`, `outputWidth`, `outputHeight`, `sharpness`, `preExposure`, `exposureScale`, `colorBuffersHDR`, `indicatorInvertAxisX`, `indicatorInvertAxisY`, `dlaaPreset`, `qualityPreset`, `balancedPreset`, `performancePreset`, `ultraPerformancePreset` |
| | 2 | v2.1.0 (`60882f60e6f4`) | `ultraQualityPreset`, `useAutoExposure` |
| | 3 | v2.4.0 (`27d352db364f`) | `alphaUpscalingEnabled` |
| `sl::Constants` (`include/sl_consts.h`) | 1 | v2.0.0 (`db6f37adcf66`) | every member through `motionVectorsJittered` — the matrices, `jitterOffset`, `mvecScale`, `cameraPinholeOffset`, the camera's position and axes, `cameraNear`, `cameraFar`, `cameraFOV`, `cameraAspectRatio`, `motionVectorsInvalidValue`, the seven `Boolean`s |
| | 2 | v2.4.0 (`bba15338a623`) | `minRelativeLinearDepthObjectSeparation` |
`sl::DLSSOptions` keeps those seventeen declarations, same types and order, through v2.14.16 (`9a875bd4f843`); v2.8.0
only re-spelled the deprecated `sharpness`. `sl::Constants` is unchanged from v2.4.0 through v2.14.16
(`15589e577df9`). Streamline 1.x is refused before any read (`SpeaksStreamline2`).
**FidelityFX** (`GPUOpen-LibrariesAndSDKs/FidelityFX-SDK`; tags v1.1.0 — FSR 3.1.0, the first ffx-api — v1.1.1,
v1.1.2, v1.1.3, v1.1.4, v2.0.0, v2.1.0, v2.2.0, v2.3.0, v2.4.0). The descriptor header carries a `type` and no size
or version, so the question is whether the declaration ever changed:
| Struct | Tags | Result |
|---|---|---|
| `ffxDispatchDescUpscale` | v1.1.0 (`68860479bb94`) … v2.4.0 (`9d4a3e5f6c60`) | **one declaration in all ten**: twenty-three members, `flags` the last |
| `ffxConfigureDescFrameGeneration` | v1.1.0 (`0ecdd4b4e59b`) … v2.4.0 (`823a3b4720f1`) | **one declaration in all ten**: thirteen members |
| `FfxApiResource`, `FfxApiResourceDescription`, `FfxApiFloatCoords2D`, `FfxApiDimensions2D`, `FfxApiRect2D` | v1.1.0 … v2.4.0 | one declaration each in all ten |
| `ffxQueryDescUpscaleGetGPUMemoryUsage` (`0x00010008`), `FfxApiEffectMemoryUsage` | from v1.1.2 | one declaration since; a game that sends the type knows the struct |
| `ffxQueryDescUpscaleGetGPUMemoryUsageV2` (`0x00010009`) | from v2.0.0 | one declaration since |
**What follows for a hook** (Advanced metrics, train B):
- `sl::DLSSOptions`: a member is read at `structVersion >=` the row that adds it — never "at least 1" for the tail.
- `sl::Constants`: everything this project may read is version 1's. The camera's position, axes and matrices are
never read at any version (rule 4; the catalog's `PlayerState`).
- `ffxDispatchDescUpscale`, `ffxConfigureDescFrameGeneration`: every member may be read on the ffx-api route, since
no ffx-api release has a shorter one. `ffxDispatchDescFrameGenerationPrepareV2`'s camera arrays are never read.
- **Not established, so nothing more is read there**: the FSR 3.0 host's legacy descriptors (`fsr3-v3.0.x`) beyond
the `renderSize` the existing hook pins; any struct of a Streamline or FidelityFX release newer than the last tag
above — a re-vendoring re-runs this comparison (`third_party/*/README.md` §Checklist).
### Ray tracing
| Hook | Yields |
|---|---|
+38 -4
View File
@@ -609,7 +609,8 @@ and labelled with the hardware's words. A sensor with no family is not read.
costs 14 ms (62 ms elapsed)**. Once a second that refresh alone is 1.4% of one core, above NFR-2's 1% for the
whole Agent. So NVAPI is read every tick and **the sensor library every fifth** (0.28%), and on the ticks between a
sensor has no reading — its last value is not repeated. The same refresh is what the L2 telemetry layer does once
a second in every session: that cost is not this feature's, and is `20_OPEN_QUESTIONS` §M16.
a second in every session: that cost is not this feature's, and is `20_OPEN_QUESTIONS` §M16 — measured in a real
Agent on 2026-11-11 (1.93 % of one core off, 2.04 % on) and answered by amending NFR-2 to 2.5 % (D117).
### From the reader to the ledger (built 2026-11-11; fed since the switch)
@@ -703,9 +704,9 @@ every `nvapi.` row; nothing is estimated in its place (FR-4.9).
| Train | Release | What | Its gate |
|---|---|---|---|
| A | 0.1.0-beta.39 | read by the Agent only — NVAPI and LibreHardwareMonitor — storage, the page. **Nothing changes in code loaded into a game** | this section |
| B | 0.1.0-beta.40 | inside the game: more fields of the Streamline and FidelityFX calls already hooked, and new hooks on functions `sl.interposer.dll` **exports** (`17_HOOK_ENGINE` §Hook inventory's ⏳ rows); shared-memory layout 5 | a plan of its own; overhead measured |
| C | 0.1.0-beta.41 | Reflex latency per frame | a spike, then the owner's go or no |
| D | 0.1.0-beta.42 | the Streamline feature state behind `slGetFeatureFunction` — DLSS frame generation's, DLSS's, Reflex's | a spike, then the owner's go or no |
| B | 0.1.0-beta.40, .41, .42 *(three releases since D113, 2026-11-11; one was planned)* | inside the game: more fields of the Streamline and FidelityFX calls already hooked, and new hooks on functions `sl.interposer.dll` **exports** (`17_HOOK_ENGINE` §Hook inventory's ⏳ rows); shared-memory layout 5 — §Train B below | a plan of its own; overhead measured; each release after the first waits for the owner's run of the one before |
| C | ~~0.1.0-beta.41~~ 0.1.0-beta.43 | Reflex latency per frame | a spike, then the owner's go or no |
| D | ~~0.1.0-beta.42~~ 0.1.0-beta.44 | the Streamline feature state behind `slGetFeatureFunction` — DLSS frame generation's, DLSS's, Reflex's | a spike, then the owner's go or no |
Rules 4 and 5, the hook inventory, the measured overhead and the anti-cheat guard bind B, C and D exactly as they bind
every hook. `sl::Constants` is read without its camera position, axes and matrices: where the camera is, is where the
@@ -720,6 +721,39 @@ raises are the owner's: replacing the pointer the game receives is a **write**,
a wrapper must outlive the Overlay's own unhook. If the spike cannot answer all of it, the route stays refused and
the page says so.
### Train B (planned 2026-11-11, owner decisions D110–D116)
What the catalog marks `HookedCall` and `NewHook`. Planned the day train A shipped, the owner's decisions asked while
planning, the design reviewed against the code before it was approved.
- **D111 — off means off inside the game too.** The Agent writes one word of the control block
(`advancedRequested`, 0 or 1, unconditionally at attach) when the session records Advanced metrics. The Overlay
reads a new field, and installs a new hook, only while it is set; with the option off it hooks and reads exactly
what 0.1.0-beta.39's does.
- **D113 — three releases, because a new patch site cannot be proven in CI.** A crash in a game under the user-mode
anti-cheat exception's trial ends that exception for good (D38), and every release already means restarting the
game. **beta.40**: more fields of calls *already* hooked — `sl::DLSSOptions` where the game chains it into
`slEvaluateFeature`, the FSR upscale dispatch, the FSR memory query — shared-memory layout 5, the Agent and the
page; **no new patch site**. **beta.41**: `slSetConstants` and `ffxConfigure`. **beta.42**:
`slGetFeatureVersion` and `slGetFeatureRequirements` — the owner's words: a release of their own, still hooked.
Each starts when the owner says the one before passed its owner-only item.
- **D112 — `slInit` is not hooked in train B.** A game calls it before FrameLedger attaches, so its preferences
would almost never be seen. If it is ever hooked: `applicationId`, `projectId` and the paths are never read.
- **D114 — the field of view is a session's range**, lowest to highest, never a series: a series would say when the
player aimed.
- **D115 — a tail member is read only where it is proven to be there** (`17_HOOK_ENGINE` §Which struct version
carries which field): the table from the upstream tags, not the one header in the tree.
- **D116 — "never the camera" is a build check**, as "never a setter" is (D108): `tools/overlay-fields-check.ps1` —
every read of a vendor struct in one header, each allowed member named and used, the camera's names refused
anywhere in the Overlay and the Vulkan layer, no copy of `sl::Constants` by value.
- **What will read N/A, and says why.** Many titles set their DLSS options through `slDLSSSetOptions`, which is not
an export (train D), so `sl.dlss.*` is filled only for a title that passes its options with the evaluate call.
`slGetFeatureVersion` and `slGetFeatureRequirements` are calls a game makes while starting.
- **Privacy Policy 2.16** at beta.40, once for the three releases: with Advanced metrics on, for a game FrameLedger
injects into, the parameters the game gives its upscaler and frame generation through the intercepted calls are
*stored* — sizes, presets, exposure, sharpening, the jitter's, the depth's and the field of view's ranges, flags,
versions — and never the camera's position, axes or matrices.
### Left out, by name
Present in the vendored `nvapi.h`, readable from the Agent, and not in the inventory — each is either not a
+1 -1
View File
@@ -1862,7 +1862,7 @@ Moved verbatim, in this order.
| M11 🅓 | **The game's VRAM budget and `budget_exceeded_pct` (FR-4.5's second half), 2026-10-03.** D43 reads the game's usage from outside (the `GPU Process Memory` counters); the budget the OS grants the process is what DXGI's `QueryVideoMemoryInfo` returns to the *calling* process (§M7), so only an in-process call — the Overlay's background thread, which today only checks for a stop — or `D3DKMTQueryStatistics`' `PROCESS_SEGMENT_GROUP` query (documented "Reserved for system use") could read it. **Deferred by decision:** neither is built; `vram_budget_exceeded_pct` stays NULL and the budget N/A, and the in-process route would change what the Disclaimer says the Overlay's thread does. Reopening it needs that decision, not a measurement. | — |
| M12 ❓ | **Advanced metrics — which NVAPI rows answer on real hardware (D101, 2026-11-11).** `18_GPU_VENDOR_APIS` §The inventory lists sixty `nvapi.` rows whose reach is `Agent`. They are declared in the vendored headers; **none has been called on a GPU**, and CI has no driver, so it never takes that branch. Unknown per row: whether the RTX 5080 on the current driver answers or returns `NVAPI_NOT_SUPPORTED` (the memory-temperature target already does not exist on that card). | **The measurement is the bridge's probe on the owner's PC**, then the page itself (the release's owner-only item). Pre-committed: a call that does not answer → that row is N/A with NVAPI's own status as the reason, and nothing is put in its place; a call that hangs or faults twice → the row is off for the session (§Runtime policy); a value that contradicts the vendor's own tool → the row is withheld until it is explained. **Half answered the same day, by the bridge's own test on the dev box** (ctest `fl_nvapi_bridge`, AVAILABLE branch; RTX 5080): every fact answers (`present = 0xFFFFF`), eight of ten live groups answer (`0x33F` — no board and no power-supply temperature sensor on this card: N/A, by the first pre-committed outcome), the display answers its four groups, the global profile lists 24 settings; figures in `18_GPU_VENDOR_APIS` §L3. **Still open**: the same values on the page beside the vendor's own tool, and the session rows (`nvapi.session.*`), which need a game. **And one thing seen once and not explained**: in one test run of about a dozen that day, `FlNvReadLive` came back with no field at all although `FlNvReadFacts`, a moment earlier in the same process, had answered everything; nine further runs did not show it. A handle the driver invalidated is the usual cause of that shape, and nothing here re-enumerates after `FlNvInit`. Pre-committed for the reader that owns the thread: two readings in a row with no field → release and initialise the bridge again, once, and say so in the log; if that does not bring the fields back the layer is off for the session, as any layer that fails twice is. |
| M13 ❓ | **Advanced metrics — LibreHardwareMonitor's CPU, memory, motherboard and storage groups, elevated, with PawnIO (D103, 2026-11-11).** Never opened by any build: §M10's elevated run has not been taken either, and this is a larger surface — a sensor chip on the LPC bus, the embedded controller, SPD over SMBus, SMART. Unknown: whether each group opens on the owner's board, what a refresh costs, whether opening the storage group touches removable drives (this PC once had a failing USB drive), and whether any group enables a privilege (`PrivilegeFootprintTests`). | **One elevated run with the probe verb, before the option exists.** Pre-committed: the storage group cannot be opened without touching removable drives → `lhm.storage.*` stays N/A in beta.39 and its reach reads `Deferred`; a node that throws twice → skipped for the session; the Agent above 1% of one core or 150 MB with the option on (NFR-2) → the slow groups are read less often or dropped before the release; a privilege enabled by a group → that group is not opened, and the owner is asked. **Two of the four answered 2026-11-11, before the option exists.** (1) **Storage: not opened, by the first outcome.** LibreHardwareMonitor 0.9.6's `StorageGroup` lists every drive through DiskInfoToolkit's `ReloadStorages` with no filter by bus and follows drives plugged in later — it cannot be opened without touching removable drives. `lhm.storage.*` reads `Deferred`, and `LhmGroups` has no member for it. (2) **Cost, unelevated, measured with `probe-advanced`** on the dev box: one refresh of the graphics-card group alone is 14 ms of processor time (62 ms elapsed) — 1.4% of one core at one a second, above NFR-2 — and one NVAPI read 0.4 ms. By the third outcome the sensor library is read every fifth tick (0.28%). **Still open, and the owner's**: the same probe as administrator with PawnIO — whether the processor, memory and motherboard groups open on this board, what they cost, and `PrivilegeFootprintTests`' new case on a token that holds the privileges (CI's does; the dev box's unelevated run passes by construction). |
| M16 ❓ | **The L2 telemetry layer's cost — the first number, and it is above NFR-2 (found 2026-11-11, measuring something else).** `LhmTelemetrySource` refreshes LibreHardwareMonitor's graphics-card group once a second in every recorded session. `probe-advanced` measured that refresh, through the same library and the same group, at **14 ms of processor time** on the dev box (RTX 5080, 41 mapped sensors, about twenty of them the Direct3D engine nodes the library enumerates per card) — 1.4% of one core, where NFR-2 allows the whole Agent 1% during capture and `14_TESTING` §Hook overhead's Agent figure has never been measured. This is a measurement of the call, not yet of a session: L2's own poller was not instrumented. | **Measure L2 in a session** (the Agent's processor time over a ten-minute capture, telemetry at 1000 ms and at 2000 ms). Pre-committed: at or under 1% → this row closes with the number; above → the owner chooses between a slower default for `telemetry.interval_ms`, reading the sensors the layer keeps from NVAPI on NVIDIA cards (L3 already has most, at 0.4 ms), or amending NFR-2 to what is measured. Not decided here, and nothing about L2 changes in the Advanced-metrics train. |
| M16 ✅ | **The L2 telemetry layer's cost — the first number, and it is above NFR-2 (found 2026-11-11, measuring something else).** `LhmTelemetrySource` refreshes LibreHardwareMonitor's graphics-card group once a second in every recorded session. `probe-advanced` measured that refresh, through the same library and the same group, at **14 ms of processor time** on the dev box (RTX 5080, 41 mapped sensors, about twenty of them the Direct3D engine nodes the library enumerates per card) — 1.4% of one core, where NFR-2 allows the whole Agent 1% during capture and `14_TESTING` §Hook overhead's Agent figure has never been measured. This is a measurement of the call, not yet of a session: L2's own poller was not instrumented. | **Measure L2 in a session** (the Agent's processor time over a ten-minute capture, telemetry at 1000 ms and at 2000 ms). Pre-committed: at or under 1% → this row closes with the number; above → the owner chooses between a slower default for `telemetry.interval_ms`, reading the sensors the layer keeps from NVAPI on NVIDIA cards (L3 already has most, at 0.4 ms), or amending NFR-2 to what is measured. Not decided here, and nothing about L2 changes in the Advanced-metrics train. **Measured in a real Agent, 2026-11-11 (owner decision D110), and answered (D117).** `tools/agent-cost.ps1` runs the shipped `FrameLedger.Agent.exe --console capture` against a copy of hook-harness in a scratch data folder — a session that is not hooked, so the telemetry poller runs as in every session and nothing drains frames — and reads the Agent process's own processor time at exit; the cost per second is the slope between a 45 s and a 165 s session, two runs of each. Dev box (RTX 5080, not elevated, layers `l1+lhm+nvapi`): **19.3 ms of processor time per second of session = 1.93 % of one core with Advanced metrics off** (2,312 and 2,312 ms over 45 s; 4,594 and 4,656 ms over 165 s), **20.4 ms = 2.04 % with it on** (2,984 and 3,000; 5,547 and 5,344); peak working set 113 MiB and 119 MiB. A first pass with 30 s and 90 s sessions gave 1.56 % and 2.21 % — its two short runs differed by 670 ms, which is why the lengths were raised. So the probe's number holds in a session: the Agent's steady cost is about twice NFR-2's 1 %, nearly all of it the layer every session has always used, and the new option adds about a tenth of a percent. **The owner's answer: NFR-2 is amended to ≤ 2.5 % of one core** — the limit had never been measured, the sensors keep their one reading a second, and nothing in the code changes. Not measured: a hooked session (the drain's cost on top), a session with the Agent elevated and PawnIO's groups open, another PC. |
| M14 ❓ | **Reflex latency per frame — is there a route within rules 4 and 5? (Train C, 2026-11-11.)** `17_HOOK_ENGINE` §Memory / latency names hooks on `NvAPI_D3D_SetSleepMode` / `SetLatencyMarker` and a call to `NvAPI_D3D_GetLatency`. NVAPI resolves all three through `nvapi_QueryInterface` by id — they are not exports, so a hook on them is a patch at an address learned at run time, the class refused on 2026-08-09. The route to try first needs no hook: the Overlay's own background thread **calls** `GetLatency` with the device of the swap chain it already hooks, once a second (the call returns the last 64 frames' reports). Unknown: whether calling into the driver from that thread is safe on every device kind, what it costs, what it returns when the game never enabled Reflex, and what it means for the Disclaimer's sentence about that thread. | **A spike on `hook-harness` and a stub first, then one real title.** Pre-committed: no route without a patch at a run-time address or a loader-lock call on the game's thread → Reflex stays N/A and the page says why; overhead above NFR-1 → the same. The owner says go or no on the spike's result. |
| M15 ❓ | **The Streamline state behind `slGetFeatureFunction` — re-examined, not reopened (Train D, 2026-11-11).** The owner asked for the refusal in `handoff/history/p0-queue-1-6.md` to be looked at again. `18_GPU_VENDOR_APIS` §The trains states the route to try (hook the export, hand back a wrapper for a fixed list of names) and what it raises: the wrapper is a write to what the game receives, which rule 4 forbids as written; a wrapper must outlive the Overlay's unhook; a game that fetched its functions before the hook existed is never seen. | **A written design against each of the five grounds, then a spike.** Pre-committed: any ground unanswered → the route stays refused, and `sl.dlssg.*`, `sl.reflex.*` and the rest of that block read N/A with "refused" as the reason. Proceeding needs the owner's amendment of rule 4, asked with the rule quoted. |
| M10 ✅ | ~~PDH `\GPU Engine(*)\Utilization Percentage` summed across engines does not reproduce the Task Manager figure the doc invokes. Decide what we actually report and label it accordingly~~ **Decided 2026-09-09 (PR-E1): L1 does not read the engine counters at all.** `LoadPct` is L2's vendor-reported `GPU Core` load (measured ✓ on NVIDIA, §M5 row R1) and is labelled *GPU load (vendor)* wherever it is shown; on a machine without L2 the field is N/A, never a sum that is not the number the user expects. What L1 does read from PDH is one counter, `\GPU Adapter Memory(luid_…_phys_0)\Dedicated Usage`, bound by LUID — the figure Task Manager labels "Dedicated GPU memory", measured 1301 MB at an idle desktop on the RTX 5080. Reopening this needs a measurement of `max(engine)` against Task Manager's own number, not a decision |
+43 -16
View File
@@ -115,24 +115,38 @@ four trains are [`handoff/history/0.1.0-beta.38.md`](handoff/history/0.1.0-beta.
### NEXT
1. **Ask the owner `20_OPEN_QUESTIONS` §M16 before anything else.** The telemetry layer every session has always
used refreshes the sensor library once a second; measured on this PC that is about 1.4 % of one core, above
NFR-2's 1 % for the whole Agent. It is not this feature's cost and was not changed here. The choices are the
owner's: read it less often (and thin the fixed sensor series), keep it and amend NFR-2, or measure more first.
2. **Train B (0.1.0-beta.40) starts with a plan of its own**, its decisions asked then: inside the game, on calls
already hooked (`DLSSOptions`, the FidelityFX dispatch) and on functions Streamline exports (`slSetConstants`,
`slGetFeatureVersion`, `slGetFeatureRequirements`, `slInit`), shared-memory layout 5. Every rule that governs a
hook applies — rules 4 and 5, `17_HOOK_ENGINE` §Hook inventory, the overhead measured, the open S-series — and
**`sl::Constants`' camera position, axes and matrices are never read** (the catalog's `PlayerState`). The page
needs no new screen: the catalog's `HookedCall` and `NewHook` rows become read, and Sources says so by itself.
1. ~~**Ask the owner `20_OPEN_QUESTIONS` §M16 before anything else.**~~ **Asked 2026-11-11 — D110: measure it in a
real Agent first.** `tools/agent-cost.ps1` does, and §M16 holds the numbers: 1.93 % of one core with Advanced
metrics off, 2.04 % on. **D117: NFR-2 is amended to ≤ 2.5 %**; nothing in the code changes.
2. ~~**Train B (0.1.0-beta.40) starts with a plan of its own**~~ **Train B was planned and approved the same day**
(D111–D116): [`18_GPU_VENDOR_APIS.md`](18_GPU_VENDOR_APIS.md) §Train B is the design. What that section does not
carry:
- **The approval covers 0.1.0-beta.40 whole** — five pull requests: (1) the decisions, the struct-version table,
§M16 measured; (2) shared-memory layout 5, written by nobody yet; (3) the Overlay reads the extra fields of the
calls it already hooks, behind the control word, with `overlay-fields-check` and the overhead measured; (4) the
Agent's sampler, the catalog's new reach, the page's words, Privacy 2.16; (5) the release, owner-only item 38.
- **beta.41 and beta.42 are designed and not begun.** Each starts only when the owner says the release before it
passed its owner-only item on real games — that wait is what the split is for.
- **The design was reviewed against the code before approval, and the review changed it**: the split itself; the
struct-version table (the tree holds one version of each header); storing a vendor `Boolean` or preset as its
value plus one and refusing the vendors' sentinels (`INVALID_FLOAT` is FLT_MAX); flags as "ever seen" masks and
the frame time as a sum the watchdog drains, since a value sampled once a second aliases a per-frame one; the
new region written by the watchdog alone and only while requested; `AdvancedSources`' new member optional, so a
beta.39 row still parses; `kMaxPatches = 48` to be checked before a patch is added.
3. **Trains C and D** (Reflex latency; the Streamline state behind `slGetFeatureFunction`) each begin with a spike
and end in the owner's go or no. D needs an amendment of rule 4 if it goes ahead — handing the game a wrapper is
a write — and that question is put to the owner then, not assumed.
### Left open by this session
- **This release's own facts** — the tag's run, the digests, the delta — are not in any file yet: the release is cut
after this text. Record them in the next pull request, as beta.38's were in #387.
- ~~**This release's own facts** — the tag's run, the digests, the delta — are not in any file yet: the release is cut
after this text. Record them in the next pull request, as beta.38's were in #387.~~ **Recorded 2026-11-11, in the
first pull request of train B: 0.1.0-beta.39 was released 2026-11-11T13:52:07Z** from the signed tag on `e63cd49`
(#394), by run 43031168146 — green at the first attempt, one run for the one tag push. Eight assets; the seven
digests of `SHA256SUMS.txt` equal the ones GitHub computed; the shipped natives carry `FL_BUILD_ID v0.1.0-beta.39`.
The delta from beta.38 is 3,144,205 bytes beside a full package of 110,678,706 — "Delta processed 0452 files. 0026
patched, 0426 unchanged". The wiki was published by run 43033077805. The rehearsal on the release branch (run
43026873256) had made a delta of 3,159,090 bytes with the same file counts.
- **Nothing here was seen in the running App.** The page was rendered to images from a test over fixture data and
looked at; a chart does not render into such an image. No real Agent answered a real App, no session was recorded
with the option on, and no value was compared with another tool. All of that is owner-only item 37.
@@ -153,8 +167,12 @@ four trains are [`handoff/history/0.1.0-beta.38.md`](handoff/history/0.1.0-beta.
`gh pr create`, ask the API for the runs of the head commit before walking away.
- **`ShmDrainIntegrationTests.TheGuardInjectsTheOverlayAndTheReaderDrainsRealFrames` was red once** in a local gate
(#392's first run): the guard's re-scan refused the harness mid-run, under the gate's load. It passed alone and in
the rerun; nothing in that pull request is on its path; it was not diagnosed. If it shows again, read the verdict's
reason first — the assertion prints only that it was a refusal.
the rerun; nothing in that pull request is on its path; it was not diagnosed. ~~If it shows again, read the verdict's
reason first — the assertion prints only that it was a refusal.~~ **It showed again the same day** (train B's first
local gate), on another line: the Overlay's status was still `Init` with fifty records already drained. That one
is a race in the test and is fixed — the Overlay publishes `Ready` after its last hook, later than its first
record, so the test now waits `Init` out, bounded. The refusal was not reproduced; the assertion now prints the
verdict, so the next one says why.
- **`PagesLoadTests.EveryTextFollowsAThemeSwitch` was red once on a hosted runner** (#393's first run, green three
times locally): *Settings: "Processor" shows in a fresh one only*. Every build of the Settings page in that fixture
made a `SystemInfoViewModel` of its own, whose lines arrive from the thread pool, so two pages built a moment apart
@@ -471,8 +489,9 @@ with a real game, the first run as administrator with PawnIO, and what the Agent
there has ever been (`20_OPEN_QUESTIONS` §M10, §M13): the processor per core, the memory and the motherboard's
sensors appear on *This PC* and *Sources* says *Read*; watch for a pause or a hang when the page first opens,
and compare a few values with HWiNFO. Without it, *Sources* gives the reason in words. (f) **What it costs**: the
Agent's processor time and memory during a session with the option on and with it off (NFR-2: 1 % of one core,
150 MB) — and with that in hand, the answer to §M16. (g) **The words**: the `vi` strings read as a Vietnamese
Agent's processor time and memory during a session with the option on and with it off (NFR-2: ~~1 %~~ 2.5 % of one
core since D117, 150 MB) — ~~and with that in hand, the answer to §M16~~ §M16 was measured without a game and
answered on 2026-11-11; what is left for a real game is the hooked session and the elevated one. (g) **The words**: the `vi` strings read as a Vietnamese
speaker would write them; the `ja` strings marked `review`. (h) **A copy of the ledger** (`--data-dir`) that holds
such a session: the page is there, opens on *Session*, and *This PC* says it is a copy.
**Answered 2026-08-05, do not re-ask:** remove `gameguard` and keep `guard` (approved
@@ -597,6 +616,14 @@ Where each owner decision is recorded — the file and its section, and a label
| D106 | [`18_GPU_VENDOR_APIS.md`](18_GPU_VENDOR_APIS.md) §Advanced metrics | a `.partial` chunk of an unknown type with a right checksum is skipped, where it ended the read |
| D107 | [`18_GPU_VENDOR_APIS.md`](18_GPU_VENDOR_APIS.md) §Advanced metrics | with no game running the Agent reads sensors only while the page is open |
| D108 | [`18_GPU_VENDOR_APIS.md`](18_GPU_VENDOR_APIS.md) §Advanced metrics | "never call a setter" is a build gate: every `NvAPI_*` call of the bridge is held to a committed list |
| D110 | [`20_OPEN_QUESTIONS.md`](20_OPEN_QUESTIONS.md) §M16 | the L2 telemetry layer's cost is measured in a real Agent before anything is changed (`tools/agent-cost.ps1`); what to do about the number is asked after |
| D117 | [`02_SPEC.md`](02_SPEC.md) NFR-2 | asked with the measurement in hand (1.93 % off, 2.04 % on): NFR-2 is amended to ≤ 2.5 % of one core during capture; the sensors keep one reading a second and no code changes |
| D111 | [`18_GPU_VENDOR_APIS.md`](18_GPU_VENDOR_APIS.md) §Train B | inside the game too, off means nothing more is read: the Overlay reads new fields and installs new hooks only while the Agent's control word says the session records Advanced metrics |
| D112 | [`18_GPU_VENDOR_APIS.md`](18_GPU_VENDOR_APIS.md) §Train B | `slInit` is not hooked in train B; if ever, never `applicationId`, `projectId` or the paths |
| D113 | [`18_GPU_VENDOR_APIS.md`](18_GPU_VENDOR_APIS.md) §Train B | train B is three releases: beta.40 fields of calls already hooked (no new patch site), beta.41 `slSetConstants` + `ffxConfigure`, beta.42 `slGetFeatureVersion` + `slGetFeatureRequirements`; each waits for the owner's run of the one before; C is beta.43, D beta.44 |
| D114 | [`18_GPU_VENDOR_APIS.md`](18_GPU_VENDOR_APIS.md) §Train B | the field of view is stored as a session's range, never as a series |
| D115 | [`17_HOOK_ENGINE.md`](17_HOOK_ENGINE.md) §Which struct version carries which field | a tail member of a vendor struct is read only where the upstream tags prove it is there |
| D116 | [`18_GPU_VENDOR_APIS.md`](18_GPU_VENDOR_APIS.md) §Train B | "never the camera" is a build gate: `tools/overlay-fields-check.ps1` |
| D109 | [`../legal/DISCLAIMER.md`](../legal/DISCLAIMER.md) §5, §5A | asked on 2026-11-11 with both sentences quoted: the Disclaimer goes to 2.15 with the Privacy Policy — PawnIO and the admin mode are no longer "for the CPU temperature" alone; with Advanced metrics on they also read the processor's, the memory's and the motherboard's sensors. The admin mode's disclosure follows (`agent-admin-dialog/2`) |
---
+1 -1
View File
@@ -99,7 +99,7 @@ The last thing P1 owes (§R4 moved it here because it needs P2's drain and recor
| 2 | OFF | | | |
| 3 | OFF | | | |
Gates: FPS delta ≤ 0.5 %, Agent CPU ≤ 1 % of a core, Agent RSS ≤ 150 MB. **Overlay resident ≤ 8 MB is
Gates: FPS delta ≤ 0.5 %, Agent CPU ≤ 1 % of a core *(≤ 2.5 % since 2026-11-11, D117)*, Agent RSS ≤ 150 MB. **Overlay resident ≤ 8 MB is
not measured by the runbook** and is left blank rather than guessed: it is a module inside the game
process, and reading the target's memory is what CLAUDE.md rule 4 forbids — an external tool that
inspects module sizes is the way to fill it.
@@ -325,6 +325,11 @@ public sealed class ShmDrainIntegrationTests
// The Overlay's own health, which the frame stream cannot report: a DLL that never hooked
// anything, or self-disabled after three faults, produces an empty ring that looks exactly like
// a game sitting in a loading screen.
// INIT IS "NOT YET", NOT A FAILURE (2026-11-11, red once in a local gate: Status was 0 with fifty records already
// drained). The Overlay installs its present hooks, then the loader's and OpenGL's, and only then publishes Ready
// (dllmain.cpp InitThread) - so on a loaded machine frames can be read before it. It is waited out, bounded; a
// DLL that never gets there still fails, on the line below.
SpinWait.SpinUntil(() => reader.WriterState.Status != (uint)FlStatus.Init, TimeSpan.FromSeconds(5));
FlWriterState state = reader.WriterState;
state.Status.Should().Be((uint)FlStatus.Ready);
state.FaultCount.Should().Be(0u);
@@ -508,7 +513,8 @@ public sealed class ShmDrainIntegrationTests
bool mayContinue = await supervisor.ScanOnceAsync(pid, TestContext.Current.CancellationToken)
.ConfigureAwait(false);
reader.PublishGuardResult(supervisor.CompletedEvaluations, supervisor.UnhookRequested);
mayContinue.Should().BeTrue("our own harness must not start matching the blocklist mid-run");
// The verdict is in the message (2026-11-11): this was red once in a local gate with nothing but "false" to go on.
mayContinue.Should().BeTrue("our own harness must not start matching the blocklist mid-run (the verdict: {0})", supervisor.LastVerdict);
DrainResult r = reader.Drain(buffer, gaps);
records.AddRange(buffer.AsSpan(0, r.Copied).ToArray());
+134
View File
@@ -0,0 +1,134 @@
# SPDX-License-Identifier: GPL-3.0-only
# Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
#Requires -Version 7.0
<#
.SYNOPSIS
What the shipped Agent costs while it records a session: processor time per second of session, measured on the
real FrameLedger.Agent.exe, with Advanced metrics off and on.
.DESCRIPTION
docs/20_OPEN_QUESTIONS.md §M16 (owner decision D110, 2026-11-11): a number read off a probe is not the number of
a session. This runs `FrameLedger.Agent.exe --console capture` against a copy of hook-harness - the only thing
this project's tools ever point the Agent at - in a scratch data folder, never the profile's, and reads the
Agent process's own processor time when it exits.
A capture of an executable nobody consented to is a session that is not hooked: the Agent injects nothing, and
the telemetry poller runs exactly as in every session (L1 + LibreHardwareMonitor + NVAPI, the processor and
memory counters, the game's own memory). That isolates what §M16 asks about - the cost of telemetry - from the
cost of draining frames.
One run includes the Agent's start (the host, the ledger's migration, the sensor library opening), so a single
run says little. Each mode is run at two lengths and the cost per second is the slope between them:
(processor time of the long run - of the short run) / (long - short).
Developer tool, not a gate: it needs a release build (./build.ps1 native, then a Release build of the solution),
Python 3 on the path to write one row of the scratch ledger's `settings` table, and a few minutes.
.PARAMETER Seconds
The two session lengths, short then long.
.PARAMETER Repeats
How many times each (mode, length) is run; the median is reported.
#>
[CmdletBinding()]
param(
[string]$RepoRoot = (Split-Path $PSScriptRoot -Parent),
[int[]]$Seconds = @(30, 90),
[int]$Repeats = 2,
[string]$Configuration = 'Release'
)
Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'
if ($Seconds.Count -ne 2 -or $Seconds[0] -ge $Seconds[1]) { throw 'Seconds takes two lengths, short then long' }
$tfm = 'net11.0-windows10.0.22621.0'
$agent = Join-Path $RepoRoot "src/FrameLedger.Agent/bin/$Configuration/$tfm/win-x64/FrameLedger.Agent.exe"
$harness = Join-Path $RepoRoot "tests/FrameLedger.Agent.Tests/bin/$Configuration/$tfm/win-x64/hook-harness.exe"
foreach ($f in $agent, $harness) { if (-not (Test-Path $f)) { throw "not built: $f (./build.ps1 native, then build the solution in $Configuration)" } }
$run = [guid]::NewGuid().ToString('N').Substring(0, 12)
$scratch = Join-Path ([IO.Path]::GetTempPath()) "fl-agent-cost-$run"
$data = Join-Path $scratch 'data'
$profileData = Join-Path $env:LOCALAPPDATA 'FrameLedger'
if ($data.StartsWith($profileData, [StringComparison]::OrdinalIgnoreCase)) { throw 'the scratch data folder may never be the profile''s' }
New-Item -ItemType Directory -Force $data | Out-Null
# A copy under a name of this run's own: the Agent finds its target by executable, and another hook-harness.exe
# running on this machine - a test suite's - would be a second match.
$target = Join-Path $scratch "hook-harness-$run.exe"
Copy-Item $harness $target
function Set-Advanced([bool]$On) {
$db = Join-Path $data 'ledger.db'
$value = if ($On) { '1' } else { '0' }
$code = "import sqlite3,sys; c=sqlite3.connect(sys.argv[1]); c.execute('INSERT INTO settings(key,value) VALUES(?,?) ON CONFLICT(key) DO UPDATE SET value=excluded.value', ('telemetry.advanced', sys.argv[2])); c.commit(); c.close()"
& python -c $code $db $value
if ($LASTEXITCODE -ne 0) { throw 'could not write telemetry.advanced into the scratch ledger (is Python 3 on the path?)' }
}
function Measure-Capture([int]$Length) {
$game = Start-Process -FilePath $target -ArgumentList '--real', '--hold-presenting', ($Length + 40) -PassThru -WindowStyle Hidden
try {
Start-Sleep -Seconds 4
$psi = [Diagnostics.ProcessStartInfo]::new($agent)
$psi.UseShellExecute = $false
$psi.CreateNoWindow = $true
$psi.RedirectStandardOutput = $true
$psi.RedirectStandardError = $true
foreach ($a in '--console', '--data-dir', $data, 'capture', '--exe', $target, '--seconds', "$Length") { $psi.ArgumentList.Add($a) }
$p = [Diagnostics.Process]::Start($psi)
$null = $p.Handle
$out = $p.StandardOutput.ReadToEndAsync()
$err = $p.StandardError.ReadToEndAsync()
$peak = 0L
while (-not $p.WaitForExit(1000)) {
try { $p.Refresh(); $peak = [Math]::Max($peak, $p.WorkingSet64) } catch { }
}
$p.WaitForExit()
$text = $out.Result
# The verb's exit code says the hook was refused (2) - which is the point here; what matters is that the session was stored.
if ($text -notmatch 'SAVED as sessions\.id=\d+ \(tier 2') { throw "the capture did not end as a stored, unhooked session (exit $($p.ExitCode)):`n$text`n$($err.Result)" }
$layers = if ($text -match 'telemetry=(\S+)') { $Matches[1] } else { '?' }
[pscustomobject]@{ Seconds = $Length; CpuMs = $p.TotalProcessorTime.TotalMilliseconds; PeakMiB = [Math]::Round($peak / 1MB, 1); Layers = $layers }
}
finally {
if (-not $game.HasExited) { $game.Kill($true) }
}
}
function Median([double[]]$Values) {
$s = @($Values | Sort-Object)
if ($s.Count % 2) { $s[($s.Count - 1) / 2] } else { ($s[$s.Count / 2 - 1] + $s[$s.Count / 2]) / 2 }
}
try {
# The first run creates and migrates the scratch ledger; it is not measured.
$null = Measure-Capture 5
$rows = @()
foreach ($mode in $false, $true) {
Set-Advanced $mode
foreach ($length in $Seconds) {
foreach ($i in 1..$Repeats) {
$m = Measure-Capture $length
$rows += [pscustomobject]@{ Advanced = $mode; Seconds = $length; CpuMs = [Math]::Round($m.CpuMs); PeakMiB = $m.PeakMiB; Layers = $m.Layers }
Write-Host (" advanced={0,-5} {1,3} s cpu {2,6:N0} ms peak {3,6:N1} MiB {4}" -f $mode, $length, $m.CpuMs, $m.PeakMiB, $m.Layers)
}
}
}
Write-Host ''
foreach ($mode in $false, $true) {
$short = Median @($rows | Where-Object { $_.Advanced -eq $mode -and $_.Seconds -eq $Seconds[0] } | ForEach-Object CpuMs)
$long = Median @($rows | Where-Object { $_.Advanced -eq $mode -and $_.Seconds -eq $Seconds[1] } | ForEach-Object CpuMs)
$perSecond = ($long - $short) / ($Seconds[1] - $Seconds[0])
$peak = ($rows | Where-Object { $_.Advanced -eq $mode } | Measure-Object PeakMiB -Maximum).Maximum
Write-Host ("advanced={0,-5}: {1:N1} ms of processor time per second of session = {2:N2} % of one core (median {3:N0} ms over {4} s, {5:N0} ms over {6} s); peak working set {7:N1} MiB" -f `
$mode, $perSecond, ($perSecond / 10), $short, $Seconds[0], $long, $Seconds[1], $peak)
}
}
finally {
Remove-Item -Recurse -Force $scratch -ErrorAction SilentlyContinue
}