Compare commits

...
Author SHA1 Message Date
poli0981andClaude Fable 5.2 e9cef8ce87 docs(roadmap): FrameLedger has no product in Partner Center yet - the one there is another program of the owner's
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-14 21:51:25 +07:00
poli0981andClaude Fable 5.2 09b1a62f1b docs(roadmap): the owner's order of work after the controller train - time played, more from stored data, shader-compilation stutter, the in-game overlay, winget and the Microsoft Store
The owner was shown six directions on 2026-11-14 and chose four, and added distribution; the
Store upload and its listing are the owner's by hand. What must be verified before anything is
promised of the two channels is listed as leads, not findings. Documents only.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-14 21:49:43 +07:00
poli0981andClaude Fable 5.2 e20bf9abc0 feat(advanced): Advanced metrics is closed - the ten Streamline readings that waited for a spike are not read, with the reason (D154) (#463)
The owner was shown the catalog (140 entries, 110 read) and what the ten entries of reach
Spike hold, read from Streamline 2.14.16's own headers, with what reading them takes: none
is an export, a game gets each function through slGetFeatureFunction and keeps the pointer,
so seeing its calls means handing the game a function of ours in place of Streamline's
(rule 4) - and a game that fetched its functions before the attach never calls it. The
owner closed it.

The ten are RefusedRoute; that reach's sentence names the third refused route in English,
Vietnamese and Japanese; the guide no longer says a later release reads more; 18_GPU's
inventory, 20_OPEN_QUESTIONS M15 and HANDOFF say train D is not built. Nothing that was
read stops being read; no hook, layout, schema or stored value changes.

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-14 14:04:54 +00:00
poli0981andClaude Fable 5.2 5440f8a34a fix(app): the two GPU labels say what each figure is, not which holds the other (D152) (#462)
* docs: owner-only item 47 read (the Cyberpunk difference is the driver's; the holes are gone from steady play); Streamline's Reflex and DLSS-RR guides read against the code

Item 47, run by the owner on 0.1.0-beta.49 (sessions 236-245), read from a copy of the
ledger and the Overlay's logs: in Cyberpunk 2077 without frame generation the driver's
active GPU time is longer than its two marks are apart on 4 917 of 5 394 frames, and on
none of 129 900 frames in five other games; samples without a report are confined to a
game's start; off means off; D141's stop fired in a real game for the first time.

NVIDIA's Streamline guides for Reflex and DLSS Ray Reconstruction (2.14.16), read whole:
the guide's page on Advanced metrics now says what bUseGameSleep and bLowLatencyMode
mean; two design tables no longer promise PC latency (D147); spike-notes 30 has what the
guides add. Two comments (fl_shm.h, dllmain.cpp) said super resolution and ray
reconstruction run together - they do not; comments only, no object code changes.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* docs(handoff): item 47 (f) and (g) in the owner's words - the NVIDIA App's Low Latency Mode is off, no hitch

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* docs(handoff): item 47 (f) as the owner showed it - the NVIDIA App's Low Latency Mode is off for Cyberpunk 2077, the game's own Reflex is on

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* fix(app): the two GPU labels say what each figure is, not which holds the other (D152)

"GPU active render (idle time excluded)" and "GPU render, start to end (idle time included)"
followed NVIDIA's header, which defines the active time as the span between the driver's two
GPU marks less its idle time. Item 47 counted it on 0.1.0-beta.49: in Cyberpunk 2077 without
frame generation the active time is the longer of the two on 4 917 of 5 394 frames. The owner
chose to reword the labels. They now read "GPU active render (the driver's own figure)" and
"GPU render (between the driver's start and end marks)", in English, Vietnamese and Japanese;
the guide says why. Strings only: the numbers and the means are unchanged.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* docs(handoff): D153 - of Reflex it is enough to tell whether a game has it: Reflex and PCL leave train D, D141's stop is unchanged

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-14 13:13:15 +00:00
poli0981andClaude Fable 5.2 dc329c09b4 docs: owner-only item 47 read; Streamline's Reflex and DLSS-RR guides read against the code (#461)
* docs: owner-only item 47 read (the Cyberpunk difference is the driver's; the holes are gone from steady play); Streamline's Reflex and DLSS-RR guides read against the code

Item 47, run by the owner on 0.1.0-beta.49 (sessions 236-245), read from a copy of the
ledger and the Overlay's logs: in Cyberpunk 2077 without frame generation the driver's
active GPU time is longer than its two marks are apart on 4 917 of 5 394 frames, and on
none of 129 900 frames in five other games; samples without a report are confined to a
game's start; off means off; D141's stop fired in a real game for the first time.

NVIDIA's Streamline guides for Reflex and DLSS Ray Reconstruction (2.14.16), read whole:
the guide's page on Advanced metrics now says what bUseGameSleep and bLowLatencyMode
mean; two design tables no longer promise PC latency (D147); spike-notes 30 has what the
guides add. Two comments (fl_shm.h, dllmain.cpp) said super resolution and ray
reconstruction run together - they do not; comments only, no object code changes.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* docs(handoff): item 47 (f) and (g) in the owner's words - the NVIDIA App's Low Latency Mode is off, no hitch

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* docs(handoff): item 47 (f) as the owner showed it - the NVIDIA App's Low Latency Mode is off for Cyberpunk 2077, the game's own Reflex is on

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-14 12:55:35 +00:00
poli0981andClaude Fable 5.2 1a8a3cb713 docs(handoff): 0.1.0-beta.49's release facts - the tag's run, the digests, the delta, the wiki, the two rehearsals, what SonarCloud and Qodana said on the release's commit (#460)
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-14 11:32:35 +00:00
poli0981andClaude Fable 5.2 afe498452b release: 0.1.0-beta.49 - the latency report's frames counted for the log; a read a second on a grid; the Agent keeps the reading that waits (D148-D151); owner-only item 47 (#459)
* feat(overlay): the frames of NVIDIA's latency report are counted for the native log - each by its GPU span and the driver's active time, in batches that belong to one state of the sleep status (D148, D151; nothing published, no new call, no further member; in no release yet)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* test(guard): the log case's expected words are widened before they are multiplied (Qodana native: bugprone-implicit-widening-of-multiplication-result, two)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* fix(overlay): the watchdog's periodic tick is on a grid of one second, and a tick the loader woke no longer takes the driver read or publishes region 5 - a read a second whatever a tick's work took (D150, the Overlay's half; in no release yet)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* fix(agent): a reading that waits for a sample is no longer overwritten by the next one - two wait, the older is carried first; the guide says whose switches the latency table shows (D150, the Agent's half; D151)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* release: 0.1.0-beta.49 - item 46 read; the latency report's frames counted for the log, Reflex and frame generation together; a read a second on a grid; the Agent keeps the reading that waits (D148-D151); owner-only item 47

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* test(guard): the measurement case prints the numbers it parsed, never a line of the log as it stands (SonarCloud cppsecurity:S5145)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-14 17:42:58 +07:00
poli0981andClaude Fable 5.2 3838e26422 fix(agent): a reading that waits for a sample is no longer overwritten; the guide on whose switches the latency table shows (D150, D151) (#458)
* feat(overlay): the frames of NVIDIA's latency report are counted for the native log - each by its GPU span and the driver's active time, in batches that belong to one state of the sleep status (D148, D151; nothing published, no new call, no further member; in no release yet)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* test(guard): the log case's expected words are widened before they are multiplied (Qodana native: bugprone-implicit-widening-of-multiplication-result, two)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* fix(overlay): the watchdog's periodic tick is on a grid of one second, and a tick the loader woke no longer takes the driver read or publishes region 5 - a read a second whatever a tick's work took (D150, the Overlay's half; in no release yet)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* fix(agent): a reading that waits for a sample is no longer overwritten by the next one - two wait, the older is carried first; the guide says whose switches the latency table shows (D150, the Agent's half; D151)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* test(guard): the measurement case prints the numbers it parsed, never a line of the log as it stands (SonarCloud cppsecurity:S5145)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-14 17:28:30 +07:00
poli0981andClaude Fable 5.2 f70a9153fa fix(overlay): the driver read is on a grid of one second; a tick the loader woke no longer takes it or publishes (D150, the Overlay's half) (#457)
* feat(overlay): the frames of NVIDIA's latency report are counted for the native log - each by its GPU span and the driver's active time, in batches that belong to one state of the sleep status (D148, D151; nothing published, no new call, no further member; in no release yet)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* test(guard): the log case's expected words are widened before they are multiplied (Qodana native: bugprone-implicit-widening-of-multiplication-result, two)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* fix(overlay): the watchdog's periodic tick is on a grid of one second, and a tick the loader woke no longer takes the driver read or publishes region 5 - a read a second whatever a tick's work took (D150, the Overlay's half; in no release yet)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* test(guard): the measurement case prints the numbers it parsed, never a line of the log as it stands (SonarCloud cppsecurity:S5145)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-14 17:03:08 +07:00
poli0981andClaude Fable 5.2 4f02a17380 feat(overlay): the latency report's frames counted for the native log, by GPU span and active time, a batch per sleep-status state (D148, D151) (#456)
* feat(overlay): the frames of NVIDIA's latency report are counted for the native log - each by its GPU span and the driver's active time, in batches that belong to one state of the sleep status (D148, D151; nothing published, no new call, no further member; in no release yet)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* test(guard): the log case's expected words are widened before they are multiplied (Qodana native: bugprone-implicit-widening-of-multiplication-result, two)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-14 16:14:48 +07:00
poli0981andClaude Fable 5.2 c97bf8bd98 docs(handoff): owner-only item 46 read - beta.48 on ten real sessions (#455)
* docs(handoff): owner-only item 46 read - ten sessions on beta.48: samples a second apart, both games gave the driver's own GPU times, the multipliers listed, off means off; active render longer than the span in Cyberpunk 2077 without frame generation, not explained

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* docs(handoff): item 46 (g) - the owner's answer: no hitch with Advanced metrics on

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-14 07:36:55 +00:00
42 changed files with 2046 additions and 187 deletions

No files matched your search

+1 -1
View File
@@ -9,7 +9,7 @@ barrier. It is written for the person who has just met one; the details for deve
FrameLedger is a desktop program: its own window, its dialogs, its document windows, the icon by the clock and the
notices Windows shows for it. It draws nothing inside a game, so it cannot make a game itself any easier to use.
*Beta software: this page describes version 0.1.0-beta.48. In the app: Help ▸ Accessibility.*
*Beta software: this page describes version 0.1.0-beta.49. In the app: Help ▸ Accessibility.*
## What FrameLedger aims for
+37
View File
@@ -35,12 +35,49 @@ numeric core and does not move; the heading is the full version — corrected 20
## [Unreleased]
### Changed
- **Advanced metrics is closed: the ten readings that were "being studied" are now "not read", with the reason**
(D154, the owner's decision). What a game sets and asks through Streamline's own functions for a feature — DLSS
frame generation's options and state, the video memory DLSS estimates for itself, the options of ray
reconstruction, Image Scaling and Dynamic Vibrance, the PC-latency markers — is reached only by handing the game
a function of FrameLedger's in place of Streamline's, which is refused. The *Sources* list says so, in English,
Vietnamese and Japanese, and the guide no longer says a later release reads more. Nothing that was read stops
being read.
- **The two lines of the graphics card's time say what each is, not which holds the other** (D152, the owner's
decision). *GPU active render (idle time excluded)* and *GPU render, start to end (idle time included)* are now
*GPU active render (the driver's own figure)* and *GPU render (between the driver's start and end marks)*, in
English, Vietnamese and Japanese, and the guide says why: in Cyberpunk 2077 without frame generation the
driver's active time is longer than its two marks are apart. The numbers are unchanged.
- **The guide's page on Advanced metrics says what two of the driver's switches mean** (`guide/12`): the latency
report is there in a game that has Reflex built in, whether Reflex is on or off in its menu; `bUseGameSleep`
says the game calls Reflex's sleep — NVIDIA asks for that even with Reflex off — and `bLowLatencyMode` is the
one that says the mode is on; frame generation needs Reflex, not the reverse. From NVIDIA's Streamline guide
for Reflex, and from the owner's ten sessions on 0.1.0-beta.49.
### Documentation
- **Owner-only item 47 was run and read** (`docs/HANDOFF.md`): in Cyberpunk 2077 without frame generation the
driver's active GPU time is longer than its own two marks are apart on 4 917 of 5 394 frames (1 849 µs beside
1 571 µs) and on none of 129 900 frames in five other games — the difference is the driver's; samples without a
report are now confined to a game's start; a session with the option off has no latency line; and the stop of
D141 fired in a real game for the first time (Kingdom Come: Deliverance II, one call of 5.3 ms while it
started).
- **Streamline's programming guides for Reflex and for DLSS Ray Reconstruction (2.14.16) read against the code**
(`docs/spike-notes/30-reflex-latency.md`, *Added 2026-11-14*). Ray reconstruction was already measured the way
the guide describes; two comments in the Overlay's source and one line of `17_HOOK_ENGINE` said super
resolution and ray reconstruction run together, and they do not. `03_METRICS` and `05_DETECTION` no longer
promise "PC latency as reported by Reflex" (D147). No code changed: comments only.
## Releases
Newest first. Each file holds that release's section exactly as it stood here.
| Version | Date | Notes |
|---|---|---|
| `0.1.0-beta.49` | 2026-11-14 | [`docs/changelog/0.1.0-beta.49.md`](docs/changelog/0.1.0-beta.49.md) |
| `0.1.0-beta.48` | 2026-11-14 | [`docs/changelog/0.1.0-beta.48.md`](docs/changelog/0.1.0-beta.48.md) |
| `0.1.0-beta.47` | 2026-11-14 | [`docs/changelog/0.1.0-beta.47.md`](docs/changelog/0.1.0-beta.47.md) |
| `0.1.0-beta.46` | 2026-11-13 | [`docs/changelog/0.1.0-beta.46.md`](docs/changelog/0.1.0-beta.46.md) |
+5
View File
@@ -142,6 +142,11 @@ src/
# Since 0.1.0-beta.48 (D142-D144) also two figures the driver works out itself, of
# the same report - no further call: an entry of their own, nvapi.reflex.gpu_times,
# two adv.* series; and the table lists every frame-generation multiplier seen.
# Since 0.1.0-beta.49 (D148-D151) the Overlay also counts each frame of that report
# by its GPU span and the driver's active time - for its native log ONLY
# (LATENCY_FRAMES, a batch per state of the sleep status; nothing published or
# stored); its watchdog's periodic tick is on a grid (fl_watchdog_tick.h), and
# Recording/PendingInGameReadings keeps the reading that waits for a sample.
FrameLedger.Infrastructure/ # SQLite, shm reader, vendor APIs, injector interop, parsers,
# and Capture/ (PR-C): ShmRingAttacher/ShmCaptureSink over the
# reader, HeldProcessLivenessSource, TargetResolver (path only,
+3 -2
View File
@@ -5,7 +5,7 @@ hooking on for — and reading the graphics calls the game makes. That is why it
resolution, the upscaler, frame generation and ray tracing apart. It is also where its limits come from. This
page lists them in plain words; each item links to the document that has the details.
*Beta software: this page describes version 0.1.0-beta.48.*
*Beta software: this page describes version 0.1.0-beta.49.*
## Games it will not measure
@@ -131,7 +131,8 @@ shown is recorded too, from outside the game. ([Capture](docs/04_CAPTURE.md))
second. They are the driver's numbers, not FrameLedger's measurement. **The stages overlap and do not add up to
the total**, and the graphics card's stage includes the time the card waited — in one game it is longer than the
whole frame; the driver's own figure for the card's active time is shown beside it where the driver gives one.
One point is one reading; with the sensor interval set above one second, some readings are not stored.
One point is one reading, drawn at the sample that carried it — up to a second after it was taken; with the
sensor interval set above one second, some readings are not stored.
FrameLedger asks the driver for them from inside the game; a read that is slow or faults is switched off until the game is closed, and the session says so.
([Advanced metrics](guide/12-advanced-metrics.md))
+2 -2
View File
@@ -13,7 +13,7 @@ app too (Help ▸ User guide, Help ▸ Limitations, Help ▸ Accessibility), and
<!-- accuracy-block:begin -->
> ⚠ **What FrameLedger actually measures today — 2026-11-11.** The software is a beta; its latest
> **beta is `0.1.0-beta.48`** (2026-11-14), an unsigned installer built from that tag with its
> **beta is `0.1.0-beta.49`** (2026-11-14), an unsigned installer built from that tag with its
> checksums published beside it (alphas — experimental builds that try a newer .NET — are published apart). The source holds the desktop app
> (library, store import, charts, settings) and the background Agent, which records a session when a
> game in the library runs (unless you switched its recording off), injects only into games you enabled
@@ -215,7 +215,7 @@ Elevation is **optional — for everything.** Hooked capture is the normal path
## Install
> **The latest beta is `v0.1.0-beta.48` (2026-11-14); before it `v0.1.0-beta.47` (2026-11-14), `v0.1.0-beta.46` (2026-11-13), `v0.1.0-beta.45` (2026-11-12), `v0.1.0-beta.44` (2026-11-12), `v0.1.0-beta.43` (2026-11-12), `v0.1.0-beta.42` (2026-11-12), `v0.1.0-beta.41` (2026-11-12), `v0.1.0-beta.40` (2026-11-12), `v0.1.0-beta.39` (2026-11-11), `v0.1.0-beta.38` (2026-11-11), `v0.1.0-beta.37` (2026-11-11), `v0.1.0-beta.36` (2026-11-10), `v0.1.0-beta.35` (2026-11-09), `v0.1.0-beta.34` (2026-11-06), `v0.1.0-beta.33` (2026-11-03), `v0.1.0-beta.32` (2026-10-31), `v0.1.0-beta.31` (2026-10-26), `v0.1.0-beta.30` (2026-10-26), `v0.1.0-beta.29` (2026-10-25), `v0.1.0-beta.28` (2026-10-20), `v0.1.0-beta.27` (2026-10-20), `v0.1.0-beta.26` (2026-10-19), `v0.1.0-beta.25` (2026-10-19), `v0.1.0-beta.24` (2026-10-19), `v0.1.0-beta.23` (2026-10-14), `v0.1.0-beta.22` (2026-10-13), `v0.1.0-beta.21` (2026-10-13), `v0.1.0-beta.20` (2026-10-12), `v0.1.0-beta.19` (2026-10-12), `v0.1.0-beta.18` (2026-10-07), `v0.1.0-beta.17` (2026-10-07), `v0.1.0-beta.16` (2026-10-06), `v0.1.0-beta.15` (2026-10-06), `v0.1.0-beta.14` (2026-10-06), `v0.1.0-beta.13` (2026-10-04), `v0.1.0-beta.12` (2026-10-04), `v0.1.0-beta.11` (2026-10-03), `v0.1.0-beta.10` (2026-09-28), `v0.1.0-beta.9` (2026-09-26), `v0.1.0-beta.8` (2026-09-25), `v0.1.0-beta.7` (2026-09-23), `v0.1.0-beta.6` (2026-09-23), `v0.1.0-beta.5` (2026-09-22), `v0.1.0-beta.4` (2026-09-21), `v0.1.0-beta.3` (2026-09-21), `v0.1.0-beta.2` (2026-09-17) and `v0.1.0-beta.1` (2026-09-16).** They are pre-releases: read the notes of the one you install — `CHANGELOG.md` links each release's own file under `docs/changelog/` — for what it measures, what it does not yet, and how to update, before installing. A source build is `docs/12_BUILD.md`.
> **The latest beta is `v0.1.0-beta.49` (2026-11-14); before it `v0.1.0-beta.48` (2026-11-14), `v0.1.0-beta.47` (2026-11-14), `v0.1.0-beta.46` (2026-11-13), `v0.1.0-beta.45` (2026-11-12), `v0.1.0-beta.44` (2026-11-12), `v0.1.0-beta.43` (2026-11-12), `v0.1.0-beta.42` (2026-11-12), `v0.1.0-beta.41` (2026-11-12), `v0.1.0-beta.40` (2026-11-12), `v0.1.0-beta.39` (2026-11-11), `v0.1.0-beta.38` (2026-11-11), `v0.1.0-beta.37` (2026-11-11), `v0.1.0-beta.36` (2026-11-10), `v0.1.0-beta.35` (2026-11-09), `v0.1.0-beta.34` (2026-11-06), `v0.1.0-beta.33` (2026-11-03), `v0.1.0-beta.32` (2026-10-31), `v0.1.0-beta.31` (2026-10-26), `v0.1.0-beta.30` (2026-10-26), `v0.1.0-beta.29` (2026-10-25), `v0.1.0-beta.28` (2026-10-20), `v0.1.0-beta.27` (2026-10-20), `v0.1.0-beta.26` (2026-10-19), `v0.1.0-beta.25` (2026-10-19), `v0.1.0-beta.24` (2026-10-19), `v0.1.0-beta.23` (2026-10-14), `v0.1.0-beta.22` (2026-10-13), `v0.1.0-beta.21` (2026-10-13), `v0.1.0-beta.20` (2026-10-12), `v0.1.0-beta.19` (2026-10-12), `v0.1.0-beta.18` (2026-10-07), `v0.1.0-beta.17` (2026-10-07), `v0.1.0-beta.16` (2026-10-06), `v0.1.0-beta.15` (2026-10-06), `v0.1.0-beta.14` (2026-10-06), `v0.1.0-beta.13` (2026-10-04), `v0.1.0-beta.12` (2026-10-04), `v0.1.0-beta.11` (2026-10-03), `v0.1.0-beta.10` (2026-09-28), `v0.1.0-beta.9` (2026-09-26), `v0.1.0-beta.8` (2026-09-25), `v0.1.0-beta.7` (2026-09-23), `v0.1.0-beta.6` (2026-09-23), `v0.1.0-beta.5` (2026-09-22), `v0.1.0-beta.4` (2026-09-21), `v0.1.0-beta.3` (2026-09-21), `v0.1.0-beta.2` (2026-09-17) and `v0.1.0-beta.1` (2026-09-16).** They are pre-releases: read the notes of the one you install — `CHANGELOG.md` links each release's own file under `docs/changelog/` — for what it measures, what it does not yet, and how to update, before installing. A source build is `docs/12_BUILD.md`.
1. Download the latest `FrameLedger.App-win-Setup.exe` from [Releases](https://github.com/poli0981/frameledger/releases). It installs into `%LOCALAPPDATA%\FrameLedger.App`; your data stays in `%LOCALAPPDATA%\FrameLedger`, and uninstalling asks before touching it.
2. SmartScreen may warn — releases are not code-signed (free, open-source project). Verify the SHA-256 checksum published with each release, then **More info → Run anyway**.
+1 -1
View File
@@ -1019,7 +1019,7 @@ processor's, not the whole PC's — averaged over the session's sensor ticks. `D
| RT active | measured per frame | not available |
| Path tracing | heuristic, confidence-scored, never asserted | not available |
| ~~Per-process VRAM~~ Game process memory (beta.12) | ~~exact~~ dedicated / shared GPU memory as Task Manager counts it — a known 512 MiB allocation read +512.0 MiB (`spike-notes` §16); private working set equal to Windows' own counter; read from outside the game | ~~not available~~ the same, from outside; an unpinned hold sums the executable's processes |
| PC latency | as reported by Reflex | not available |
| PC latency | ~~as reported by Reflex~~ **not available** (D147, *corrected 2026-11-14*): the driver's report ends at the end of the GPU's work, not at the display. The stages it does give are Advanced metrics — the driver's numbers, unchecked | not available |
| Display mode (beta.10) | per 100 ms sample: exclusive fullscreen as the swap chain answers it (DXGI; OpenGL and Vulkan cannot say), borderless, windowed, minimised; the window's size from user32 | per 1 s sample, from the window alone: windowed, minimised, or *fullscreen or borderless* — never split |
| GPU temp / load / power | vendor API accuracy, ±1 s sampling | same |
| GPU clocks / fan / memory temperature (beta.14) | vendor API accuracy, ±1 s sampling | same |
+2 -2
View File
@@ -22,8 +22,8 @@ Derived in the Agent from the record stream; the mapping is in `03_METRICS`. Sum
| Render resolution vs output resolution (incl. mid-session changes) | upscaler parameter reads + `ResizeBuffers` |
| Frame Generation mode + factor | NGX/SL/FFX FG feature evaluation, then cadence — **Tier 1 only**. ~~then (Tier 2 only) PresentMon `FrameType`~~ retired (§S31 row P2), and Tier 2 no longer produces frames to run cadence over either |
| Ray Tracing active | AS builds + `DispatchRays` (both, to catch inline RayQuery) |
| Ray Reconstruction | NGX `RayReconstruction` feature evaluated |
| Reflex on + PC latency | NVAPI Reflex hooks |
| Ray Reconstruction | ~~NGX `RayReconstruction` feature evaluated~~ Streamline's `slEvaluateFeature(kFeatureDLSS_RR)` — it runs **instead of** super resolution, in DLSS's own quality mode (Streamline's guide; measured 2026-08-15), so the upscaler is DLSS and this is a yes/no beside it. A game that calls NGX directly reads N/A (`03_METRICS` §RT/PT/RR) *(corrected 2026-11-14)* |
| ~~Reflex on + PC latency~~ The driver's latency report and sleep status (0.1.0-beta.47, Advanced metrics only) | ~~NVAPI Reflex hooks~~ two read-only getters of the driver, called by the Overlay (`17_HOOK_ENGINE` §Calls the Overlay makes into a driver). **PC latency — input to display — is not read** (D147): the report ends where the GPU's work ends, and NVIDIA's own figure is taken from outside the game (`spike-notes` §30, route E) *(corrected 2026-11-14)* |
| Per-process VRAM | `QueryVideoMemoryInfo` |
| PSO compilation events | pipeline-creation hooks |
| Display mode — exclusive fullscreen / borderless / windowed / minimised, with the window, back buffer and monitor (beta.10) | `GetFullscreenState` + `GetDesc` polled on the presenting chain (≤ 2 Hz, shared-memory region 4), and the window's geometry read by the Agent **out of process** — so this row is **both tiers**: a Tier-2 session has the window alone, and never splits exclusive from borderless (`03_METRICS` §Display mode) |
+5
View File
@@ -496,6 +496,11 @@ Because Tier-1 and Tier-2 sessions carry different fields, every query that comp
> Sensor series are aligned to `t_ms` (milliseconds from `qpc_epoch`) and a tick with no reading is stored as
> **−1** — never 0, which would be a reading — because temperatures, loads, power and memory are never negative.
>
> **A reading taken inside a game stands at the sample that carried it** (0.1.0-beta.49, owner decision D150): the
> Overlay publishes about once a second and the Agent samples exactly once a second, so a publication waits for
> the next sample — two may wait, the older is carried first (`PendingInGameReadings`). An `adv.*` point that
> came from a game can therefore stand up to a second after its read; a tick with nothing waiting is NaN.
>
> **`t_ms` is the time axis; `hz` is the fallback** (written here 2026-11-14, owner decision D146 — the code cited
> this rule before the page had it). Every series of a session is stored beside `t_ms`, which carries each
> sample's own time, and the App draws against it; `hz` is read only for a row that has no `t_ms`
+21 -2
View File
@@ -117,8 +117,27 @@ What the region is, as a contract between the two sides:
(`FlAdvancedState.request`, the word that was `reserved0`). The reader returns only a publication that names the
value it wrote: what a second session of the same game finds in the region before the first tick is the first
session's, and is not read. After an "off" the region keeps its last publication, untouched.
- **One writer, once a second.** The detours keep process-local accumulators; the watchdog copies them here at its
tick. No game thread writes the region, so the seqlock has a single writer: `seq` odd, the fields, `seq` even.
- **One writer, once a second — on a grid since 0.1.0-beta.49 (owner decision D150).** The detours keep
process-local accumulators; the watchdog copies them here at its **periodic** tick, one a second by the
performance counter (`fl_watchdog_tick.h`). Until then it published at *every* tick, and a tick was a second
and its own work after the one before — or at once, whenever the LoadLibrary detour woke the thread. So a
session's publications fell behind the Agent's samples a little with every tick, and a woken tick's publication
took the driver read with it and armed none: the publication after it was empty (0.4 to 16 % of a session's
samples carried no report, HANDOFF item 46; under a loader that never stops, 35 720 publications in eight
seconds and nine reads). A tick woken early still follows the request, installs and takes the census; it writes
nothing here. **A request first seen on a woken tick is published by the periodic tick that follows, however
soon that is**: a session's first publication may hold a moment's worth — one dispatch of a range that has two
ends — and every one after it a second's. A reader takes ranges and "seen" words as *since the request*, which
they are, and never reads a single publication as complete. No game thread writes the region, so the seqlock has a single writer: `seq` odd, the fields,
`seq` even.
- **A publication waits for a sample, and is not replaced while it waits** (0.1.0-beta.49, owner decision D150;
the Agent's half). `SessionRecorder` looks at the region and at the telemetry poller about ten times a second
and attaches a publication's readings to the newest sample it drains. It used to keep one set and overwrite it:
a publication that landed just after a sample left that sample without a report, and at the next change of
step the set that had waited was overwritten — one sample in five for minutes in the owner's session 223. Two
sets now wait, the older is carried first (`PendingInGameReadings`): a session lacks a report at one sample at
most when the two fall out of step, and loses no reading after it. With the sensor interval above a second
more publications arrive than samples and the oldest is pushed out, as before.
- **The reader keeps its last consistent copy** (`ShmRingReader.AdvancedState`): null until something was published
for its request;
the same copy while `seq` has not moved, without copying 1472 bytes again; and that copy still when the writer is
+12 -1
View File
@@ -174,7 +174,18 @@ others cannot say.** `fl_reflex_summary` (Catch2) drives `fl_adv_fields.h`'s rea
two newest frames held back, a frame summed once, a span the driver did not report, a span no frame can have, frame
ids that start again, and the ten words of a publication — and since 0.1.0-beta.48 the driver's two own times
(summed over the frames that gave one, each with its own count; zero and more than a second are not counted and
refuse nothing) and the bit a multiplier has. `fl_guard`'s seven `[latency]` cases inject the Overlay
refuse nothing) and the bit a multiplier has — and since 0.1.0-beta.49 the counts for the native log: every place
a summed frame can be in, a span of a microsecond, an active time as long as the span, a refused frame, when a
batch is due, a batch closed by a change of state and the thirty-two such closings a request has, the six lines
and what each carries; a hidden `[.bench]` case is the measurement of one report's cost. `fl_watchdog_tick`
(Catch2, no thread and no clock) drives the grid the watchdog's periodic tick is on: sixty ticks each late and
each followed by work keep whole seconds, a wait is never rounded down, a tick woken early is not periodic and
moves nothing, a late tick is not followed by another within half a period. `fl_guard`'s nine `[latency]` cases
(the eighth reads the log: the first batch after ten reads, by number, and what is left when a flush is asked for
— against the stand-in's `kModeGpuShapes`; the ninth keeps the loader waking the watchdog without pause — a
thread that asks for `opengl32.dll` for as long as the target lives — and holds one publication a second, each
with a read, none within half a second of another: 35 720 publications in eight seconds on the code before it; a
hidden `[.measure]` case prints ninety reads' own lines) inject the Overlay
into a Direct3D 12 target that has loaded a stand-in `nvapi64.dll`, and read that module's call counts from outside
through its named section (`fl_stub_nvapi_shared.h`) — so "the driver was not called" is a count: not asked → not
even asked for the addresses; asked → about one read a second, sums equal to the stand-in's, every counted read a
+44
View File
@@ -332,6 +332,50 @@ CI/CD with the native build (`release.yml` exists since P4 PR-5, 2026-09-14 —
**Total ≈ 5.5–6.5 weeks full-time** — roughly 1.5–2 weeks more than the ETW design, which is the honest price of the accuracy.
## After the controller train — the owner's order (2026-11-14)
Advanced metrics is closed (D154) and the controller feature is being built as 0.1.0-beta.50's train. Asked what
comes after, the owner was shown six directions and chose four of them, and added distribution. **This is the
order of work after the controller train; each begins with a plan of its own and the owner's approval.** Nothing
here is designed yet, and what is marked *to verify* is a lead, not a finding.
1. **Time actually played (AFK segmentation).** The v2 backlog's "AFK segmentation via `GetLastInputInfo`", moved
up: the controller train already stores when the keyboard, the mouse or a controller was in use, so the time
nobody was at the game can be told apart and left out of a session's averages. Timestamps of activity only —
never a key, as that train's Privacy text says.
2. **More from what is already stored — interface only, no hook.** The comparison of two stretches of one
session ("before and after I changed DLSS Quality to Balanced", v1.1 below), and a timeline for a game that
marks where the driver, the game's build or the settings changed, so a drop in frame rate has a date. *To
verify*: which of those changes the ledger already records for every session.
3. **Stutter from shader compilation (PSO).** `03_METRICS` defines *PSO stutter %* and `05_DETECTION` says no
writer exists. New hooks at pipeline creation: staged like Advanced metrics' train B — small releases, the
overhead measured, the owner's real games between them, never first on a game inside the user-mode
exception's trial (D38).
4. **The in-game overlay (FR-15).** v1.1's first line below: live frame rate, frame time, upscaler and
ray-tracing state drawn in the game, per game, off by default. The largest and the riskiest of the four — it
draws in the game's process — so it comes last, with a risk review of its own (rule 5, and what an
anti-cheat makes of a drawing module).
5. **Distribution: winget and the Microsoft Store.** The owner uploads to the Store and fills in its listing by
hand. FrameLedger has no product in Partner Center yet — the one there today is another program of the
owner's — so which type it is submitted as (*EXE or MSI app*, or *MSIX or PWA app*) is part of what the plan
settles. The repository's part is what the two channels need from a release. *To verify, before anything is promised*:
- whether the Store accepts an **unsigned** installer for an *EXE or MSI app* — the installer is unsigned
today (`CLAUDE.md`, Packaging), and if the Store wants a certificate that is a cost and a decision of the
owner's; whether an MSIX package is a real alternative for a program that loads a library into games and
registers a Vulkan layer;
- the installer's silent switch and a versioned, permanent download address for each release, which both
channels ask for; whether either takes a pre-release version;
- who updates an installation that came from winget or the Store — the App's own updater (Velopack) or the
channel — and that the two cannot fight;
- a winget manifest per release (address, SHA-256, switches) and whether `release.yml` writes it or the owner
submits it;
- rule 8 is untouched: a channel that delivers the installer is not a network call of the App's.
**Not chosen, and not refused**: a stabilising pass with a cross-check against another tool (the limits page
still says no reading has been checked against one), and export for CapFrameX and for video overlays. Two things
only the owner can settle stay open beside them: what leaving beta takes, and code signing — which direction 5
may force.
## v1.1 — earned features (only after the data path is stable)
- **In-game overlay** (FR-15): we are already in the process; draw live FPS/frametime/upscaler/RT state. Opt-in per game, off by default. Borderless and fullscreen-flip both handled since we own the swapchain.
+50 -3
View File
@@ -215,6 +215,33 @@ Overlay's flags, a report of 62 summed frames, 2 million reports × 3, twice): 3
— **+36 ns a read**, once a second, and after the call's time has been taken, so it cannot reach the 2 ms latch.
The present path is unchanged: one relaxed load.
**Since 0.1.0-beta.49 each summed frame is also counted for the native log** (owner decisions D148, D151;
§Native logging, `LATENCY_FRAMES`). The owner's ten sessions on beta.48 (HANDOFF, item 46) gave both of the
driver's own times in every frame report of both games — and in Cyberpunk 2077 without frame generation the mean
active time was **longer** than the mean span between the two GPU marks (3.17 against 2.79 ms), which the two
means cannot explain: the span's is over every summed frame, one of no length included, the active time's over
the frames that gave one. So the reader places each summed frame by its own two numbers (`CountGpuTimes`), after
the frame is accepted: which frames are summed does not change, and the seven spans, the two times and their
counts are what they were. **No new call, no further member of the report** — the two GPU marks and
`gpuActiveRenderTimeUs` were read already — and nothing of it leaves the process: the watchdog adds each read's
counts to a batch and writes the batch to the log. **Measured** (the same instrument: 2 million reports × 3,
twice): 424–435 ns before, 490–499 ns after — **+65 ns a read**, once a second, after the call's time has been
taken. `fl_reflex_summary_test "[.bench]"` is that measurement in the tree. The present path is unchanged.
**Since 0.1.0-beta.49 the read is on a grid of one second** (owner decision D150; `fl_watchdog_tick.h`). The
watchdog used to wait a second *after* each tick's work, and a tick the LoadLibrary detour woke was a tick like
any other: it took what the last read left, published it and — less than a second having passed since the last
arm — armed nothing, so the next publication carried no read. The Agent samples on a period of exactly one second
since 0.1.0-beta.48, and its sessions showed the holes: 0.4 to 16 % of a session's samples without a report
(HANDOFF, item 46). Now the watchdog's **periodic** tick is due at a deadline by the performance counter, and the
next deadline is one period after the one that was due, not after the moment the tick ran; a tick woken early
does everything it did — the request is followed and the hooks a session asks for go in at once — **except take
the driver read and publish region 5**, which are the periodic tick's. One read is armed at every periodic tick
(`g_latArmedQpc` and its "a second since the last arm" are gone). A periodic tick that ran more than half a
second late is not followed by another on the grid's next mark: the grid starts again from it, so **two reads are
never less than half a second apart** — "about once a second" still, and no longer "at most". Nothing on a game
thread changed: the presenting thread makes the read when it finds the gate armed, as before. **Measured** on `hook-harness` with the stand-in module, by the batches' own lines (`fl_guard_test "[.measure]"`): ten reads in 9 996 ms, the next twenty in 20 002, the next sixty in 59 997, each batch with as many periodic ticks as reads; and with a thread asking the loader for a module without pause — 18 240, 36 427 and 143 424 early wakes in the three batches — 9 997, 20 000 and 59 999 ms for the same reads. On the code before it the second case published 35 720 times in eight seconds, with nine reads. **Not measured in a game**, and not the whole of the holes: the Agent overwrote a reading that waited for a sample, which is its own change (`07_IPC` §Region 5).
**The gate.** One word, four states — idle, armed, reading, off (`dllmain.cpp`, above `ReadLatencyOnce`). Only the
watchdog arms; a presenting thread takes *armed* to *reading* by compare-exchange and owns the 15.4 KB report
buffer (static storage, never a game thread's stack) and the read's result until it stores *idle* or *off*; the
@@ -630,9 +657,11 @@ static_assert(sizeof(FlFrameRecord) == 64);
> v3 makes it safe by CONSTRUCTION. Every enum's 0 is now `NOT_REPORTED`, and
> `rtFlags`' polarity is flipped so its bits mean *observed*.
>
> Four answers items 4/6/7 owe had no home and now do: DLSS-SR **and** Ray
> Reconstruction concurrently (`featureFlags`, since RR was a mutually exclusive
> `upscaler` value), `upscalerSharpness`, and — in `FlWriterState`, because they
> Four answers items 4/6/7 owe had no home and now do: DLSS **with** Ray
> Reconstruction (`featureFlags`, since RR was a mutually exclusive
> `upscaler` value — *corrected 2026-11-14: this said "DLSS-SR and Ray
> Reconstruction concurrently"; RR runs instead of super resolution, it is still
> DLSS*), `upscalerSharpness`, and — in `FlWriterState`, because they
> are session facts and not per-frame — the device **RT tier** without which
> `03_METRICS`' definite RT `No` had no producer at all, plus `rtStateObjectsCreated`
> and `rasterPsoCreated`.
@@ -932,6 +961,24 @@ No logging in hook bodies. A small fixed-size in-memory ring of structured event
> `FlLatencyState`, the text what it means — and, when the module is found, two more with the end of the path
> `nvapi64.dll` was loaded from and of the image its getters are in. Written by the watchdog; a fault in a getter
> is a `FAULT` line from the presenting thread, as any fault is.
> **`LATENCY_FRAMES` (0.1.0-beta.49, owner decisions D148, D151)**: the frames the driver reads summed, counted
> for this log and nowhere else — nothing of it is published, stored or shown. Each summed frame is placed by its
> own two numbers, the span between its two GPU marks and the driver's active render time: no start mark, a span
> of no length, an active time with no span, a span with no active time, and — where a frame has both — *active
> longer than the span* or *active within the span*, each with its count and both sums in microseconds. No
> threshold: a span of one microsecond is a span. **A batch is seven lines and belongs to one state of the driver's
> sleep status** — its low-latency switch, its "the game sleeps" switch and its frame-generation multiplier —
> because the counts mean nothing apart from it: a read in another state closes the batch first (thirty-two such
> closings a request, after which a batch runs to its length and its first line says what it held). A batch is
> also written after a request's tenth read, its thirtieth and every sixtieth from there, when the Agent asks for
> a flush, at a new request and at a stop. `a` is printed in decimal and `b` in hex: *reads* and the switches
> seen on, off (`<<8`) and the multipliers seen (`<<16`); *frames summed* and refused; *GPU span absent* and of no
> length; *active time with no span* and span with no active time; then the two heaps, `a` their frames and `b`
> their span sum (`<<32`) and active sum; and the watchdog's own line — the *milliseconds the batch spans* and its
> ticks in them, on time (`<<32`) and woken early: a read a second is a thousand milliseconds a read and as many
> periodic ticks as reads (D150). **A game that exits by itself takes the batch in hand with it** — under a
> minute of reads. About seven lines a minute while a session with *Advanced metrics* reads the driver; none
> otherwise.
> **Three flush points — four since beta.42, the same note —, none on a present path:** the end of `InitThread` (so the
> file exists from the start of the session and a crash mid-session still leaves it), the watchdog when
> `FlControlBlock.logFlushRequested` changes (a counter the Agent bumps at session end; nothing clears it),
+18 -14
View File
@@ -724,7 +724,7 @@ Rules 4 and 5, the hook inventory, the measured overhead and the anti-cheat guar
every hook. `sl::Constants` is read without its camera position, axes and matrices: where the camera is, is where the
player is (rule 4). NGX stays closed by its licence (`17_HOOK_ENGINE` §NGX).
**Train D re-examines a refusal; it does not lift it.** `handoff/history/p0-queue-1-6.md` refused, on five grounds,
**Closed 2026-11-14 (owner decision D154): train D is not built, and the refusal stands.** The ten entries it would have read — what a game sets and asks through Streamline's feature functions — have reach `RefusedRoute`: seeing those calls takes handing the game a function of FrameLedger's in place of Streamline's, and a game that fetched its functions before the attach would never call it. What follows is the plan as it stood. **Train D re-examines a refusal; it does not lift it.** `handoff/history/p0-queue-1-6.md` refused, on five grounds,
hooking `slGetFeatureFunction` and patching the function it returns. The route to try is a different one:
`slGetFeatureFunction` is itself an export (`vendor-exports.json`), so its hook is an ordinary inventory row, and
what it hands back could be a wrapper for a fixed list of names instead of a patch at an address learned at run time
@@ -910,7 +910,7 @@ the catalog differ in either direction. **Reach** is where a value can be read f
FrameLedger measures, from the arguments of a call the Overlay hooks, while the session records Advanced metrics —
since 0.1.0-beta.40), `HookedCall` (an argument of a call the Overlay already hooks, not read yet), `NewHook` (a hook
that is not built — Train B; no entry carries it since 0.1.0-beta.45), `BeforeAttach` (a call the game makes once,
before FrameLedger is inside it, so no hook could read it — D129), `Spike` (Trains C and D), `Refused`, `Deferred`, `Identifier` (D104), `PlayerState`
before FrameLedger is inside it, so no hook could read it — D129), `Spike` (Trains C and D; no entry since D154), `Refused`, `Deferred`, `Identifier` (D104), `PlayerState`
(rule 4), `Licence`, `NotInHeaders`. ~~Only the first two are read by a build of Train A.~~ The first three are read
(`AdvancedMetric.IsRead`).
@@ -1099,7 +1099,11 @@ session that ended in a menu read 1). **Since 0.1.0-beta.48 (D142) two more seri
`adv.nvapi.reflex.gpu_times.` and `active_render`, `frame_time` — the driver's `gpuActiveRenderTimeUs` and
`gpuFrameTimeUs`, each the mean over the frames of that read that gave one. They are the driver's own figures, not
spans between two of its marks: in Phantom Blade Zero `gpu_render` (the two GPU marks, idle time included) was
longer than `total`, which is why its label now says what it includes (D143). An entry of their own keeps the
longer than `total`, which is why its label now says what it includes (D143). **Reworded 2026-11-14 (D152)**:
NVIDIA's header defines the active time as that span "excluding the idles in between", and in Cyberpunk 2077
without frame generation the active time is the longer of the two on nine frames in ten (HANDOFF, item 47) — so
the labels now say what each is (*the driver's own figure*; *between the driver's start and end marks*) and no
longer that one is the other less its idle time. The numbers and the means are unchanged. An entry of their own keeps the
seven spans within what one chart draws as lines. What the *game* asked of Reflex (`nvapi.reflex.mode`) is an argument of a function no module exports:
reading it takes a patch at an address learned at run time, which is refused.
@@ -1110,21 +1114,21 @@ reading it takes a patch at an address learned at run time, which is refused.
| `nvapi.reflex.frame_report` | Latency per frame: simulation, render submit, present, driver, OS queue, GPU render | Series, one per device | Nvapi | GameDriver | Microseconds |
| `nvapi.reflex.gpu_times` | The graphics card's time per frame, as the driver works it out: active render, frame to frame | Series, one per device | Nvapi | GameDriver | Microseconds |
**Inside the game: routes a spike decides**
**Inside the game: Streamline's feature functions — not read (D154, 2026-11-14)**
| Id | What it is | Scope | Source | Reach | Unit |
|---|---|---|---|---|---|
| `sl.dlss.optimal_settings` | The render size and sharpness DLSS recommends | SessionFact | Streamline | Spike | Text |
| `sl.dlss.vram_estimate` | DLSS's own estimate of its video memory | Series | Streamline | Spike | Mebibytes |
| `sl.dlssg.options` | DLSS frame generation: mode, frames to generate | SessionFact | Streamline | Spike | Text |
| `sl.dlssg.state` | DLSS frame generation: status, the most frames it can generate | SessionFact | Streamline | Spike | Text |
| `sl.dlssg.frames_presented` | Frames DLSS frame generation presented, by its own count | Series | Streamline | Spike | Count |
| `sl.dlssg.vram_estimate` | DLSS frame generation's estimate of its video memory | Series | Streamline | Spike | Mebibytes |
| `sl.dlssd.options` | Ray reconstruction's options | SessionFact | Streamline | Spike | Text |
| `sl.nis.options` | NVIDIA Image Scaling's options | SessionFact | Streamline | Spike | Text |
| `sl.deepdvc.options` | RTX Dynamic Vibrance's options | SessionFact | Streamline | Spike | Text |
| `sl.dlss.optimal_settings` | The render size and sharpness DLSS recommends | SessionFact | Streamline | RefusedRoute | Text |
| `sl.dlss.vram_estimate` | DLSS's own estimate of its video memory | Series | Streamline | RefusedRoute | Mebibytes |
| `sl.dlssg.options` | DLSS frame generation: mode, frames to generate | SessionFact | Streamline | RefusedRoute | Text |
| `sl.dlssg.state` | DLSS frame generation: status, the most frames it can generate | SessionFact | Streamline | RefusedRoute | Text |
| `sl.dlssg.frames_presented` | Frames DLSS frame generation presented, by its own count | Series | Streamline | RefusedRoute | Count |
| `sl.dlssg.vram_estimate` | DLSS frame generation's estimate of its video memory | Series | Streamline | RefusedRoute | Mebibytes |
| `sl.dlssd.options` | Ray reconstruction's options | SessionFact | Streamline | RefusedRoute | Text |
| `sl.nis.options` | NVIDIA Image Scaling's options | SessionFact | Streamline | RefusedRoute | Text |
| `sl.deepdvc.options` | RTX Dynamic Vibrance's options | SessionFact | Streamline | RefusedRoute | Text |
| `sl.reflex.state` | Reflex through Streamline: availability and its frame reports | SessionFact | Streamline | RefusedRoute | Table |
| `sl.pcl.markers` | PC-latency markers the game sets | Series | Streamline | Spike | Count |
| `sl.pcl.markers` | PC-latency markers the game sets | Series | Streamline | RefusedRoute | Count |
**Closed by a licence**
+2 -2
View File
@@ -1873,8 +1873,8 @@ Moved verbatim, in this order.
| 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). **The first run was taken on 2026-11-12, by the owner, in ordinary use** (0.1.0-beta.40, the Agent as administrator with PawnIO, an i7-14700KF on a board with an IT8689E chip, an RTX 5080), and read here from a copy of the ledger and the Agent's log, not from a probe. **The groups open and read**: nine of ten sessions stored 119 processor series (a clock and a load per thread, temperatures, powers, voltages), 14 memory series and 21 motherboard series (six fans, six temperatures, nine voltages) beside the card's 41 — 195 from the sensor library in all. **No value was compared with another tool**; that is still the owner's. **Two faults, one cause** (`Infrastructure.Telemetry.LhmLibrary`): the Agent held up to three `Computer`s at once, and the library keeps the driver it reads the processor through and its bus mutexes per process — closing one `Computer` let go of them under the others. After seven sessions the Advanced reader's processor device threw `NullReferenceException` twice and was left alone (the page lost the processor until the reader reopened); once a session's start met another instance's close, the reader's `Open` threw `ObjectDisposedException`, and that session stored 17 series instead of 212. **Fixed 2026-11-12**: opens and closes are serialised and a `Computer` is parked, not closed, while another is in use. The cause is read from the log's timing and was not reproduced — it needs this elevation — so **whether the faults are gone is the owner's next sessions to show**: no `advanced: a device is left alone` and no `did not open` in the Agent's log. **First evidence, 2026-11-12, 0.1.0-beta.41, the same PC:** seven sessions between 06:38 and 07:01 with no `advanced:` line at all, each with the option on storing 212 or 213 series; on beta.40 that morning the processor device faulted out after each of six sessions (04:34–05:07) — thirteen of sixteen over the night. The reader failing to open was seen once in sixteen, so this is not yet enough to call that one gone. Still open: any value beside another tool. |
| 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. **2026-11-12 — the reading that comes before that spike is `spike-notes` §30** (owner decision D130: a document first, beside 0.1.0-beta.45; nothing was run). It finds: a hook on NVAPI's latency functions is the refused class, and a hook on Streamline's Reflex and PCL functions is train D's wrapper (§M15) — and would miss a game that fetched them before the attach, as `slInit` is missed (D129); the Overlay calling `slReflexGetState` itself breaks the thread contract the vendor's header states; **what remains is the route named in this row**, the Overlay calling two driver getters with the game's device, and a no-injection ETW route that gives the game-side markers only and makes the game post messages to its own window. Corrected there: `nvapi64.dll` exports **two** functions on the dev box (`nvapi_Direct_GetMethod` beside `nvapi_QueryInterface`), not one. The go or no is the owner's, and a go needs the owner's ruling that calling a driver getter with the game's device is inside rule 4. **2026-11-13 — the owner answered (D132, D133).** Route D goes to the spike this row names, on `hook-harness` and a stub `nvapi64.dll`, with the ruling: a driver's read-only getter called with the device of the swap chain the Overlay hooks is inside rule 4 (`CLAUDE.md`, the rule's note of that day). No real game before the owner has seen the result, and nothing shipped changes for the spike (`spike-notes` §31, written after 0.1.0-beta.46). Route C is **refused**; the ETW route **stays closed**, and §G is not reopened. **2026-11-13 — the harness spike is done (`spike-notes` §31), and none of its stop conditions fired.** With a stand-in module: nothing is called or loaded when `nvapi64.dll` is absent, a missing getter is refused whole, an error and a report of nothing read as what they are, and a call the driver holds for seconds stops only the thread that made it — so not the watchdog. With the installed driver (32.0.16.2114, RTX 5080), in the probe's own process and with the probe setting the markers a game would: no fault before `NvAPI_Initialize`, without markers, or across 38 million reads beside a marker-setting thread; a call costs half a microsecond to a microsecond and a half; the report is readable from markers alone, in microseconds; and the Direct3D 12 **device** — the object the Overlay already holds — is what the driver takes. What only a game can say is unanswered: a game's own device, a real report, another driver. **The owner's next word is go or no for one real title**; a go is a plan of its own first. **2026-11-13, the same evening — go (D136)**: a plan for one title, Cyberpunk 2077; no code before the plan is approved, and no release carrying it before a stop while a game runs has been exercised on 0.1.0-beta.46 (owner-only item 44 (d)). **2026-11-13, the plan and four more answers (D138–D141).** The read has **no switch of its own**: it is part of Advanced metrics, so after the release it reaches every Direct3D 12 game that loaded the driver's `nvapi64.dll`, for everyone who switched Advanced metrics on — "one title" is the order of the owner's first runs, not a limit in code (D138). The probe ran a leg with a sleep mode first (D139; `spike-notes` §31, *The leg with a sleep*): **the getters do not wait behind `NvAPI_D3D_Sleep`** — thirty-one million reads beside a thread that slept 97 % of the time, none of a millisecond; a read after a sleeping frame costs about 2.6 µs. An `nvapi64.dll` loaded from the game's own folder is refused with the reason (D140). One call of 2 ms or more switches the read off until the game exits (D141). The plan's design, as reviewed against the source, is in [`handoff/history/0.1.0-beta.46.md`](handoff/history/0.1.0-beta.46.md) §The train after 0.1.0-beta.46. **2026-11-13, night — written; released as 0.1.0Line truncated
| 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. |
| 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. **2026-11-12 — the reading that comes before that spike is `spike-notes` §30** (owner decision D130: a document first, beside 0.1.0-beta.45; nothing was run). It finds: a hook on NVAPI's latency functions is the refused class, and a hook on Streamline's Reflex and PCL functions is train D's wrapper (§M15) — and would miss a game that fetched them before the attach, as `slInit` is missed (D129); the Overlay calling `slReflexGetState` itself breaks the thread contract the vendor's header states; **what remains is the route named in this row**, the Overlay calling two driver getters with the game's device, and a no-injection ETW route that gives the game-side markers only and makes the game post messages to its own window. Corrected there: `nvapi64.dll` exports **two** functions on the dev box (`nvapi_Direct_GetMethod` beside `nvapi_QueryInterface`), not one. The go or no is the owner's, and a go needs the owner's ruling that calling a driver getter with the game's device is inside rule 4. **2026-11-13 — the owner answered (D132, D133).** Route D goes to the spike this row names, on `hook-harness` and a stub `nvapi64.dll`, with the ruling: a driver's read-only getter called with the device of the swap chain the Overlay hooks is inside rule 4 (`CLAUDE.md`, the rule's note of that day). No real game before the owner has seen the result, and nothing shipped changes for the spike (`spike-notes` §31, written after 0.1.0-beta.46). Route C is **refused**; the ETW route **stays closed**, and §G is not reopened. **2026-11-13 — the harness spike is done (`spike-notes` §31), and none of its stop conditions fired.** With a stand-in module: nothing is called or loaded when `nvapi64.dll` is absent, a missing getter is refused whole, an error and a report of nothing read as what they are, and a call the driver holds for seconds stops only the thread that made it — so not the watchdog. With the installed driver (32.0.16.2114, RTX 5080), in the probe's own process and with the probe setting the markers a game would: no fault before `NvAPI_Initialize`, without markers, or across 38 million reads beside a marker-setting thread; a call costs half a microsecond to a microsecond and a half; the report is readable from markers alone, in microseconds; and the Direct3D 12 **device** — the object the Overlay already holds — is what the driver takes. What only a game can say is unanswered: a game's own device, a real report, another driver. **The owner's next word is go or no for one real title**; a go is a plan of its own first. **2026-11-13, the same evening — go (D136)**: a plan for one title, Cyberpunk 2077; no code before the plan is approved, and no release carrying it before a stop while a game runs has been exercised on 0.1.0-beta.46 (owner-only item 44 (d)). **2026-11-13, the plan and four more answers (D138–D141).** The read has **no switch of its own**: it is part of Advanced metrics, so after the release it reaches every Direct3D 12 game that loaded the driver's `nvapi64.dll`, for everyone who switched Advanced metrics on — "one title" is the order of the owner's first runs, not a limit in code (D138). The probe ran a leg with a sleep mode first (D139; `spike-notes` §31, *The leg with a sleep*): **the getters do not wait behind `NvAPI_D3D_Sleep`** — thirty-one million reads beside a thread that slept 97 % of the time, none of a millisecond; a read after a sleeping frame costs about 2.6 µs. An `nvapi64.dll` loaded from the game's own folder is refused with the reason (D140). One call of 2 ms or more switches the read off until the game exits (D141). The plan's design, as reviewed against the source, is in [`handoff/history/0.1.0-beta.46.md`](handoff/history/0.1.0-beta.46.md) §The train after 0.1.0-beta.46. **2026-11-13, night — written; released as 0.1.0Line truncated
| M15 🅓 | **Decided 2026-11-14 (D154): not built. The owner closed Advanced metrics with the refusal standing; the ten entries are listed as not read, with the reason.** ~~**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 |
#### §M5 — the decision table, pre-committed 2026-09-03 BEFORE the first run
+263 -75
View File
@@ -87,6 +87,7 @@ owner-only items stay below; the history of every train, the passed owner-only i
| `§beta.45`, what the owner's seven sessions on beta.45 showed, session by session (item 43), that release's facts and SonarCloud's gate on its commit, the traps of that train | [`handoff/history/0.1.0-beta.45.md`](handoff/history/0.1.0-beta.45.md) |
| `§beta.46`, what the owner's five sessions on beta.46 showed (item 44), the design of the train that followed as the plan's review left it (`§The train after 0.1.0-beta.46`), that release's facts, the traps of that train | [`handoff/history/0.1.0-beta.46.md`](handoff/history/0.1.0-beta.46.md) |
| `§beta.47`, what that release decided beyond D136–D141, what item 44's last part showed, that release's facts, the traps of that train, its NEXT as the owner's sessions of 2026-11-14 changed it | [`handoff/history/0.1.0-beta.47.md`](handoff/history/0.1.0-beta.47.md) |
| `§beta.48`, what that release decided beyond D142–D147, that release's facts, the traps of that train, its NEXT and its "Left open" as item 46 changed them | [`handoff/history/0.1.0-beta.48.md`](handoff/history/0.1.0-beta.48.md) |
| `§Owner-only`, an open item | [§Owner-only](#owner-only--no-pr-can-close-these) below |
| `§Owner-only`, a passed item (3, 12, 14–19, 38, 39) | [`handoff/owner-only-passed.md`](handoff/owner-only-passed.md) |
| `§Traps`, `§Two corrections carried forward` | [`handoff/traps.md`](handoff/traps.md) |
@@ -94,96 +95,115 @@ owner-only items stay below; the history of every train, the passed owner-only i
---
## **START HERE** — 2026-11-14, 0.1.0-beta.48: two real games read; the driver's own GPU times beside a span that includes idle; every multiplier seen; samples a second apart
## **START HERE** — 2026-11-14, 0.1.0-beta.49: item 46 read; the frames counted for the log, Reflex and frame generation together; a read a second on a grid; the Agent keeps the reading that waits
*Status is `docs/changelog/0.1.0-beta.48.md`; this is what no other file carries.* The owner ran eight sessions on
beta.47 the morning it was released and said, twice: check. They were read (#448, #449): Phantom Blade Zero three
times, Cyberpunk 2077 twice, two Direct3D 11 games and a Direct3D 12 game with no NVIDIA library — **the read
works in real games**, and four things came out of it that the owner ruled on the same morning (D142–D147) and
approved as one train: #450 (the Overlay reads two more members of the report and keeps the multipliers seen),
#451 (the Agent, the App, the texts — Privacy Policy 2.21, Disclaimer 2.17), #452 (the poller's period), and this
release. **What the eight sessions showed is item 45's last paragraphs, below; beta.47's own section, its traps
and its release facts are [`handoff/history/0.1.0-beta.47.md`](handoff/history/0.1.0-beta.47.md)**; what the
read is and what bounds it is [`17_HOOK_ENGINE.md`](17_HOOK_ENGINE.md) §Calls the Overlay makes into a driver.
*Status is `docs/changelog/0.1.0-beta.49.md`; this is what no other file carries.* The owner ran item 46 on
beta.48 the afternoon it was released — ten sessions, then eight more — and said: check (#455, and item 46's last
paragraphs, below). The read works, the samples are a second apart, both games give both of the driver's own
times, the multipliers are listed, off means off, **and the owner's word: no hitch**. Two things were left, the
owner said *do both*, and four answers given while planning made the train (D148–D151): #456 (the Overlay counts
each summed frame for its log), #457 (the watchdog's periodic tick on a grid), #458 (the Agent keeps the reading
that waits; the guide on whose switches the table shows), and this release. **beta.48's own section, its traps
and its release facts are [`handoff/history/0.1.0-beta.48.md`](handoff/history/0.1.0-beta.48.md).**
### What this release decided, beyond D142–D147
### What this release decided, beyond D148–D151
- **Two more members of a report already fetched are not a new call.** Rule 4's note stands as written: the same
two getters, the Overlay's own buffer, the two names on `tools/overlay-allowed-fields.txt`. The owner ruled on
them by name (D142); a third member is asked the same way.
- **The driver's own times have a count each, and zero means not given.** An older driver leaves both zero, and
so did the probe's frames. They are added after the frame is accepted, so which frames the seven spans are made
of did not move — a session's old series mean what they meant.
- **An entry of their own in the catalog** (`nvapi.reflex.gpu_times`), not an eighth and ninth line of the frame
report: `AdvancedPresenter.MaxLines` is 8, and nine series of one entry are drawn as a band.
- **The layout stayed 5 again**: line 0 of region 5 was full, so the four words came out of the seven reserved
words that ended the `sl::DLSSOptions` line. Three remain there, two on the `sl::Constants` line, two on the
FidelityFX line.
- **The fact's key no longer holds the last multiplier.** It held it since beta.47, so every menu rewrote the
session's context.
- **`hz` is measured from the samples, not taken from the setting**: the finalizer cannot see the setting, and a
session recovered from a `.partial` file never knew it.
- **The plan named `tools/agent-cost` for the poller's change and it was not run**: it runs the Agent unelevated,
where a poll takes a millisecond and the period was already a second. Said in #452 rather than run for show.
- **The counts are of each frame's own two numbers, with sums, and no threshold.** The draft counted spans of no
length; a sample whose mean span is half a microsecond says spans of one or two microseconds exist, and a count
of exact zeros would have read "the driver's" where it was "ours". So the frames that have both a span and an
active time are kept in two heaps — active longer than the span, or not — each with its count and both sums.
- **A batch's state is three things**: the driver's low-latency switch, its "the game sleeps" switch
(`bUseGameSleep`: NVAPI's "is `NvAPI_D3D_Sleep()` being called") and its frame-generation multiplier. The second
was added on the owner's word — Reflex goes with frame generation in the owner's games, and the low-latency
switch can be the NVIDIA App's override — and Clair Obscur's two sessions read exactly that: `bUseGameSleep`
off throughout without frame generation, on with ×3.
- **Only the driver read and the publication are the periodic tick's.** The request is still followed on every
tick, so the hooks a session asks for go in on the tick the loader woke — a game that has just loaded
Streamline calls it at once. A draft that moved the whole block would have missed those calls.
- **One read is armed at every periodic tick, and the grid is what keeps two apart**: half a second at the least,
after a tick that ran that late. "At most once a second" is no longer said anywhere.
- **A session's first publication may hold a moment's worth.** A request seen on a woken tick is published by the
periodic tick that follows, however soon. One test read a single publication as complete and had to stop.
- **The Agent keeps two sets, and an empty one does not wait.** A reading can stand at the sample after the one it
would have ridden — a second later. With the sensor interval above a second the oldest is still pushed out.
- **No legal text changed (D149)**, although a bug report carries the Overlay's logs and so these lines: the
owner was told and chose it. The Privacy Policy names the logs of the component loaded into games.
- **The plan was reviewed against the source by a second reader before the owner saw it, and sixteen things in
the draft were wrong** — among them the three above, and the whole of the Agent's half, which the draft did not
have.
### Traps this train left
- **A cause I wrote down before checking it.** "The third of a second is the processor's temperature" went into
five files on two facts — unelevated a poll takes a millisecond; the sessions without a `cpu_temp` series are a
second apart — and then four sessions *with* the series turned out to be a second apart too. The texts were
taken back to what is established before the commit. **Count the exceptions before naming a cause.**
- **A bash here-document ate a backslash again** (a Python one-liner with `'\\'`). Edit scripts are files — the
rule already existed.
- **`FETCH_HEAD` belongs to the worktree that fetched.** A merge in a second worktree needs the commit's id.
- **A squash-merge of the lower pull request conflicts the upper one in `CHANGELOG.md` every time** both added to
`[Unreleased]`. With Auto-fix on, the app asks for a merge of `main`, not a rebase: do it in a worktree of its
own when a gate is running in the main one, keep the upper branch's file (it is the superset), and check that
the merged tree equals the branch's tip — then the gate already run still stands.
- **The gate script's last lines do not reach a background task's output**: read the log's last line and hash the
`rules` folder by hand.
- **An analyzer wants a `<summary>` once any `<param>` is written** (RCS1139).
- **A cause I offered and then counted away**: "the holes are the sensor library's fifth tick" — 25 of 134 fell on
one. The pattern that was there (46 of 134 exactly five samples apart) was the Agent's own attach rule, found
by reading `SessionRecorder`, not by looking harder at the Overlay.
- **A fixture that proved nothing**: the case for a woken watchdog first churned `sl.common.dll`, which wakes
nobody — it is in neither the inventory nor the census — and passed. It was caught only because the case
asserts, from the log, that the watchdog *was* woken (0 early ticks). **A test of a mechanism asserts that the
mechanism ran.** `opengl32.dll` is the wake that unloads nothing under a hook.
- **Qodana's native report reads the tests**: `static_cast<unsigned long long>(a * b)` is
`bugprone-implicit-widening-of-multiplication-result`. Widen an operand, not the product.
- **A here-document with an apostrophe in it failed again.** Edit scripts are files.
- **No edit while a gate runs still holds when CI asks for one**: the Qodana fix went into a second worktree of
the lower branch, and reached the upper one by a merge.
- **The item's own text said "nothing is lost by it" of the holes**, on a reading of the Overlay alone. A reading
was lost at every return to step. Say what was looked at.
### NEXT
1. **The owner runs item 46** — one batch on beta.48, with what is left of item 45 in it. Every outcome's meaning
is written there.
2. **Then the owner's to say**: more titles; D141 on a larger sample (the slowest call seen in a game is 65 µs);
whether the processor update is worth timing on their PC and moving off the poll's thread (below).
1. ~~**The owner runs item 47**~~ **Run and read 2026-11-14** (item 47, *Run 2026-11-14*): the difference in
Cyberpunk 2077 is the driver's, the holes are gone from steady play, off means off, and the stop fired once.
2. **The two GPU labels were reworded on the owner's word** (D152, 2026-11-14; strings in three languages, the
guide — in `[Unreleased]`, not in a release yet). **D141's stop stays as it is, and nothing more of Reflex is read** (D153, the owner
the same evening: "it only has to tell whether the game has it or not; Kingdom Come: Deliverance II has no
Reflex in its settings" — so that session lost nothing to the stop). (f) and (g) are said: the App's *Low
Latency Mode* is off, and no hitch.
3. **`slAllocateResources`** keeps its patch (D135); looked at again when there are more sessions.
4. **Train D** after it, the same way: a spike first — `sl.pcl.markers` waits for it, and §30 found its hook
would miss a game that fetched its functions before the attach.
4. ~~**Train D**~~ **Advanced metrics is closed (D154, 2026-11-14): train D is not built.** The owner was shown
the catalog — 140 entries, 110 read — and what the ten entries of reach `Spike` hold (Streamline's own headers,
2.14.16: DLSS frame generation's options and state, the video-memory estimates, ray reconstruction's, Image
Scaling's and Dynamic Vibrance's options, the PCL markers), with what reading them takes: a function of ours
handed to the game in place of Streamline's (rule 4), which a game that fetched its functions before the
attach never calls. The owner: "Đóng luôn". The ten are `RefusedRoute` now, the guide no longer says a later
release reads more, and §M15 is decided. **What is next is the controller feature**, planned in a session of
its own.
### 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, with what SonarCloud and Qodana said.~~ **Recorded
2026-11-14: 0.1.0-beta.48 was released 2026-11-14T04:49:19Z** (11:49 in the owner's time zone) from the signed
tag on `aec1736` (#453), by run 43556901499 — green at the first attempt, one run for the one tag push. Eight
2026-11-14: 0.1.0-beta.49 was released 2026-11-14T11:12:44Z** (18:12 in the owner's time zone) from the signed
tag on `afe4984` (#459), by run 43587336452 — 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, and the portable package hashed
here equals its line; the five native libraries in it carry `FL_BUILD_ID v0.1.0-beta.48`, none of them
`-dirty`. The delta from beta.47 is 1 944 037 bytes beside a full package of 110 800 248 — "Delta processed
0452 files. 0024 patched, 0428 unchanged". The wiki was published by run 43558546949. The rehearsal on the
release branch (run 43555020289, at `0c210d0`, the released tree) had made a delta of 1 966 174 bytes with the
same file counts. **SonarCloud answered on `aec1736`: the quality gate passed and no issue is open on `main`. Qodana's two reports, CodeQL and `check` are green on that
commit**, as they were on each of #450–#453 before its merge; no advisory check found anything in this train.
- **No real game has given the two new figures yet.** In the probe `gpuActiveRenderTimeUs` read 0; whether
Phantom Blade Zero's is the short number the reading of 2026-11-14 expects is item 46's to say.
- **Where the third of a second of a poll goes is not established.** Unelevated, a poll takes about a millisecond
(the layers composed as the Agent composes them, each read under a stopwatch). In the owner's ledger 180 of 186
sessions are 1.32 s apart and six are 1.0 s: the two with no `cpu_temp` series (an Agent not elevated) are among
the six — which points at the sensor library's processor update, run on the poll's thread as administrator
with PawnIO — **but four sessions that have the series kept one second** (22, 72, 73, 136). **Not measured**:
that call itself (it needs elevation), and whether it is processor time or waiting. The period no longer
depends on it; a poll that takes a third of every second is still a poll that takes a third of every second.
- **With the sensor interval above one second, some readings of the driver's report are not stored**: the newest
stands until a sample carries it (`SessionRecorder`). Said in the guide; not changed.
- **No test runs the whole path through the real Agent**: the injected tests stop at the shared memory and the
sampler's start from it; no end-to-end case loads the stand-in module under an Agent session.
- **Two install batches of beta.46 took 0.61 s and 1.26 s and nothing explains them.** Cyberpunk 2077's eight
batches on beta.47 took 85–221 ms, each in one apply; Hogwarts Legacy has not been run since.
- **The Japanese strings are new and unreviewed**, as every `ja` string is.
- **Off means off has never been exercised on a real game** (item 43 (f), 44 (g), 45 (g), now 46 (e)); nor (c)
and (h) of item 43, which only the owner sees.
here equals its line; the five native libraries in it carry `FL_BUILD_ID v0.1.0-beta.49`, none of them
`-dirty`. The delta from beta.48 is 1 100 211 bytes beside a full package of 110 803 443 — "Delta processed
0452 files. 0023 patched, 0429 unchanged". The wiki was published by run 43588972123. **Two rehearsals on the
release branch**: run 43580081466 at `1ab2809`, and — after a test-only fix reached the branch — run
43581734484 at `9f94356`, whose tree is the released one (a delta of 1 134 949 bytes, the same file counts).
**SonarCloud analysed `afe4984`: the quality gate passed and no issue is open on `main`. Qodana's two reports,
CodeQL and `check` are green on that commit.** On the way two advisory checks did find something, each in a
test of this train and each fixed before its pull request merged: Qodana's native report on #456 (two
products widened after the multiplication), SonarCloud on #457 (a line of the log handed to `printf`). **The
train stopped once for the owner**: two signed merges timed out at the passphrase prompt after #457; it went on
when the owner had unlocked the key. The tag's message reads `FrameLedger 0.1.0-beta.49` where the tags before
it read the bare version — nothing reads it, and a pushed tag is not moved.
- **Why Cyberpunk 2077's active render is longer than its span without frame generation** — item 47's to say. A
third session that afternoon repeated it (233: 3.40 against 3.13 ms at 292 of 296 samples) and a session of
menus did not (232: 0 of 126).
- **The Agent's half of the holes is read from the code and fits the ledger; it is not measured.** And with both
sides on a second a slip of phase can still leave a sample without a report: item 47 counts them.
- **A game that exits by itself loses the batch of counts in hand** — under a minute. Not changed: nothing runs
at a process's exit.
- **Where the third of a second of a poll goes is not established** (the history file of beta.48 has what is
known). Not looked at in this train.
- **With the sensor interval above one second, some readings of the driver's report are not stored** — the oldest
of the two that wait is pushed out. Said in the guide; not changed.
- **No test runs the whole path through the real Agent**: the injected tests stop at the shared memory, the
sampler's and the pending queue's start from it.
- **Two install batches of beta.46 took 0.61 s and 1.26 s and nothing explains them.** Item 46's ten sessions had none
above 191 ms.
- **The Japanese strings are unreviewed**, as every `ja` string is; this release added none.
- **(c) and (h) of item 43**, which only the owner sees, are still not exercised.
- **Valor Mortis's crash at 51 s** (twice, beta.40 and beta.44) **and Black Myth: Wukong's fault in Steam's crash
handler at every exit** are not explained. One session of each with hooking off is the comparison that is missing.
- **What item 41 left unexercised**: a configure through the FidelityFX 2.3 loader (Cyberpunk 2077 with FSR frame
@@ -194,7 +214,7 @@ read is and what bounds it is [`17_HOOK_ENGINE.md`](17_HOOK_ENGINE.md) §Calls t
- **`LIMITATIONS.md` and the accuracy statement still say the processor's, the memory's and the motherboard's
sensors "have never been read on real hardware"** — the owner's to reword. The alpha line still rests (D98).
**Owner-only:** item 46; one session each of Valor Mortis and Black Myth: Wukong with hooking off; what item 41
**Owner-only:** item 47; one session each of Valor Mortis and Black Myth: Wukong with hooking off; what item 41
left unexercised; item 40 (d).
## Owner-only — no PR can close these
@@ -830,6 +850,167 @@ left unexercised; item 40 (d).
and the driver reported no frame* are possible and neither is wrong. *(e) the log has a `LATENCY` line*: off
does not mean off — say so at once, with the log. **A fault, a freeze, a game closing by itself, a hitch every
second, or a session that says *stopped***: as item 45 says for each — say so at once.
**Run 2026-11-14, 12:49–14:12, and read the same afternoon** from a copy of the ledger and the logs: ten
sessions on beta.48 — Phantom Blade Zero seven times (217, 219, 220, 223–226), Cyberpunk 2077 three times (218,
221, 222). Every one tier 1, exit code 0, no fault counted, nothing dropped; nothing in Windows' application
log. (Session 216, an hour of Phantom Blade Zero, was still beta.47 — it ran while the release was cut — and
is 1.32 s apart like the ones before it.)
**The samples are a second apart**: the median gap is 996–1002 ms in all ten (session 223: 2 294 of 2 394 gaps
round to 1.00 s, the rest lie between 0.80 and 1.27 s), and `hz` reads 1.000–1.017.
(a) `legal_acceptance` holds Privacy Policy 2.21 and Disclaimer 2.17, accepted at 12:48:40.
(b) **Both figures were given by both games, in every frame report**: in the nine sessions with the option on,
every sample that has a *GPU render* span has both (3 834 of 3 834). **Phantom Blade Zero is what the reading of
2026-11-14 expected**: at 60 FPS (217) the span's median is 16.39 ms, *GPU frame time* 16.67 ms and *GPU active
render* **9.59 ms**; in the menu (224) 16.39 / 16.67 / **2.77**; at 91 FPS (225) 11.49 / 11.79 / 10.05; with
frame generation ×5 (223) 15.67 / 15.88 / 14.08. So in that game the span is the time from one frame to the
next less a third of a millisecond, whatever the card did in it, and active render is never longer than it
(0 of 3 406 samples). **Cyberpunk 2077 is the outcome written above as "active render longer than GPU render,
start to end"**: without frame generation it is longer at 157 of 158 samples (218: medians 3.17 against
2.79 ms, frame time 6.02) and at 48 of 48 (221: 2.03 against 1.82, frame time 2.37); with frame generation ×2
(222) it is shorter at all 222 (4.85 against 6.35, frame time 6.67). Shown as reported. **Why is not
established**, and two things could do it: the two are averages over different frames — the span over every
summed frame, one of no length included (the smallest mean span of a sample there is 0.5 µs, the smallest active
time 0.29 ms), active render over the frames that gave one — or the driver counts work the two marks do not
enclose. The ledger cannot tell them apart; a count of the frames whose span has no length would.
(c) `fgMultiplier` reads **1, 2** in Cyberpunk 2077 (222: ×2.0 for 69 % of it), **1, 5** in Phantom Blade Zero
(220: ×5.0 for 71 %, 30 → 151 FPS; 223: ×5.0 for 95 %, 63 → 316) and **1** in the seven sessions that generated
nothing.
(d) **Session 221** (Cyberpunk 2077, 59 s of menus at 421 FPS) is the only Cyberpunk session whose
`bLowLatencyMode` reads *on and off* — 218 and 222 read *on*, as 211 and 212 did — and is taken to be the one
where Reflex was switched off; the owner has not said which it was. Its line reads *read*, 48 of 57 samples
carry a report, every one from the first on, and the slowest call took 19 µs: the driver goes on reporting
frames.
(e) **Off means off, on a real game for the first time**: session 226 (`telemetry.advanced` 0) has no
`session_advanced` row and 19 series where the others have 240; its log has ten hooks, none of the ones
Advanced metrics adds, and **no `LATENCY` line**. The setting was still off when the ledger was copied.
(f) No other game was in the batch.
**The read itself**: one `reading the driver's latency report` line a session, 1.4–6.7 s after the attach, in
the same two files, and none after it; the slowest call of a session 18–123 µs; no latch. The install batches
took 75–191 ms, every one `install`.
**Samples with no report**: after a session's first report, 0.4–7.3 % of its samples carry none (1 of 223 in
222; 134 of 2 377 in 223, minutes of four in five there). They are not the sensor library's ticks (25 of the 134
fall on one, 24 just after one). What the code says, not measured: the watchdog ticks once a second and arms a
read when a second has passed since the last arm, so a tick that comes a moment early waits for the next one —
the reads are a second apart or two, the samples exactly one. Nothing is lost by it; a sample shows a gap.
(g) **The owner's answer, asked whether a game hitched once a second with the option on (2026-11-14): no
hitch.** What the frames say, in the sessions without frame
generation: a frame three times the median of the 120 before it and 8 ms longer comes 0.33 times a second
with the option on (225) and 0.32 with it off (226), and such frames do not gather at a period of one second
(vector strength 0.05–0.10 where chance gives 0.10–0.20; 217, 218 and 222 the same). Sessions with frame
generation cannot be judged that way. **Not seen in the ledger**: what the page looked like, and the Agent's
processor use now that a poll comes every second.
**Read, and (g) answered**: (a)–(g) each have their answer; ~~whether session 221 was (d) is inferred, and the
owner's to say~~ (d) is withdrawn in the next paragraph. The owner has not said the item is passed.
**Eight more sessions the same afternoon (227–234), read at once, and three things the owner said.** Still
beta.48: Cyberpunk 2077 three times (227 with the option off — no `LATENCY` line, no row; 232 mostly menus; 233
five minutes without frame generation), Phantom Blade Zero three times (228, 231, 234), Clair Obscur:
Expedition 33 twice (229 with frame generation ×3 for 79 % of it, 230 without). All tier 1, exit code 0, no
fault, nothing dropped; samples a second apart; slowest calls 10–29 µs; `fgMultiplier` *1, 3* in 229.
**The owner's words**: *Reflex is checked together with frame generation — without frame generation the game
does not switch Reflex on*; *a value that reads on and off is the NVIDIA App's override* (the App's page for
Phantom Blade Zero: **Low Latency Mode — Ultra**); and a session with Reflex off may be read. **So (d) above
is withdrawn as written**: session 221 was not "the one where Reflex was switched off in a menu", and nothing
here says what its `bLowLatencyMode` *on and off* was. What the sessions do read: **Clair Obscur without frame
generation has `bUseGameSleep` off throughout (230) and with ×3 on and off (229)** — the game's own Reflex
goes with its frame generation, as the owner said; **Phantom Blade Zero has `bLowLatencyMode` off throughout
in 234**; and in both the read is what it is with Reflex on — one `reading` line, a report at every read, the
two new figures in every one. **Cyberpunk 2077 without frame generation again has active render longer than
the span** (233: 3.40 against 3.13 ms at 292 of 296 samples), **and its menus do not** (232: 0 of 126; active
0.39 ms inside a span of 1.18).
**The holes are larger in short sessions**: 11.3 %, 16.2 % and 11.1 % of the samples after the first report
in 228, 229 and 231; 6.0 % in 230; 0.8 % in 232. **And "nothing is lost by it", above, was wrong**: it was
written on a reading of the Overlay alone. The Agent kept one set of readings until a sample carried it and
overwrote it — a publication that landed just after a sample left that sample without, and the set that had
waited was replaced at the next return to step (46 of session 223's 134 holes are exactly five samples
apart). The Overlay's part is the other half: its ticks were a second and their own work apart, and a tick the
loader woke published the read and armed none. Both are mended in 0.1.0-beta.49 (D150); neither is measured in
a game yet.
47. **beta.49 — whose the difference is in Cyberpunk 2077's GPU times; and the holes** (D148–D151). **One batch,
in pairs**: the same game with frame generation off and with it on, *Advanced metrics* on. Reflex is not
switched by hand — it goes with frame generation. **Not first on a game under the user-mode exception's
trial** (D38). Then say *check*; the logs and a copy of the ledger are read.
(a) **The update shows no terms window**: no legal text changed.
(b) **Cyberpunk 2077**: six minutes or more of play **without frame generation**, in a scene like session
218's; six minutes or more with **frame generation ×2**; two minutes of menus only.
(c) **Phantom Blade Zero**: six minutes or more without frame generation — the control — and six or more with.
(d) **About eight short sessions**, three minutes each, any Direct3D 12 game that uses Reflex: the step between
the game's side and the Agent's is different in every session, and one long session shows one of them.
(e) **One session with *Advanced metrics* off**; switch it back on afterwards.
(f) **What *Low Latency Mode* is set to for Cyberpunk 2077 in the NVIDIA App** — a word is enough.
(g) **How the games felt**, as always.
A game closed by itself loses its last batch of counts, under a minute: that is why six minutes and not two.
**What each outcome means, written before the run.** The log's `LATENCY_FRAMES` batches each carry the state
they belong to, so every one is read as *this state, these counts*.
*Cyberpunk without frame generation: nearly every frame that has both is in "active longer than span", and
their mean span is near the 2.8 ms the chart shows* — **the difference is the driver's**: it counts work the
two marks do not enclose. The numbers are shown as reported and the label "idle time included" is what is
wrong for that game: the owner decides its wording.
*"Active longer" is a minority whose spans are next to nothing, the rest have active within the span, and
spans of no length or of a microsecond are about as many as that minority* — **the difference is ours**: the
span's mean is pulled down by frames that have none. The owner decides whether the mean is taken over the
frames that have a span.
*Both heaps are large, with real spans* — both; the heaps' sums give the like-for-like figure, and it is said
with them.
*"GPU span absent" is not zero* — those reads published no GPU point at all, and were never in the comparison.
*Phantom Blade Zero shows many frames in "active longer"* — suspect the count before the driver: say so.
*The counts differ between a batch with `bUseGameSleep` on and one with it off, in the same game* — that is
the owner's point, measured: say the two side by side.
*The batches say a thousand milliseconds a read and as many periodic ticks as reads, and every session has
next to no sample without a report* — D150 did what it was for.
*The log says a thousand milliseconds a read and some sessions still lack a report at a steady share of their
samples* — the Agent's rule is not the whole of it: say the sessions and the share.
*The log says more than a thousand milliseconds a read* — the Overlay is still uneven; the line's tick counts
say whether the loader was waking it.
*(e) has a `LATENCY` or `LATENCY_FRAMES` line* — off does not mean off: say so at once, with the log.
**A fault, a freeze, a game closing by itself, a hitch every second, or a session that says *stopped***: as
item 45 says for each — say so at once.
**Run 2026-11-14 (sessions 236–245, ten on 0.1.0-beta.49), read the same day** from a copy of the ledger and
the Overlay's logs. All ten tier 1, exit code 0, no fault, nothing dropped. Phantom Blade Zero twice (236
without frame generation, 1 108 s; 237 with ×2, 811 s), Kingdom Come: Deliverance II (238), Clair Obscur (239),
Black Myth: Wukong (240), Lies of P (241, and 245 with the option off), Hogwarts Legacy (242), Dying Light: The
Beast (243), Cyberpunk 2077 (244). 239 and 240 ran at the same time, and so did 241, 242 and 243.
(a) **No new acceptance row** after the update: the terms window did not appear.
(b) **Cyberpunk 2077 was one session of 125 s without frame generation** (374 FPS); ×2 and the menus were not
run. It is enough for the question. 88 reads in one state — low-latency mode on, the game sleeping, ×1 — summed
5 394 frames: **4 917 in "active longer than span", mean span 1 571 µs, mean active 1 849 µs**; 96 within
(3 866 / 3 431 µs); 381 with a span of no length and an active time; none absent, none refused. **So the
difference is the driver's**: on frames that have a real span, its active time is 278 µs (18 %) longer than
the two marks are apart. A small part is ours as well — 7 % of the frames have a span of no length and pull the
span's mean down (the stored means are 1 892 and 2 138 µs). With frame generation on it is not measured on
this build (0.1.0-beta.48's means: never longer).
(c) **The count is not what is wrong**: in the six other sessions that reported (five games), **not one frame of 129 900** is
in "active longer", and no span is absent or of no length. Phantom Blade Zero: without frame generation
63 123 frames, span 16.4 ms, active 11.1 ms; with ×2 21 209 frames, span 33.2 ms, active 12.6 ms.
(d) **The holes**: in batches of twenty reads or more a read took 1 000.94 ms (236), 997.18 (237), 999.99 (242,
244), and up to 1 013 ms in the sessions that shared the PC with another game. Samples without a
report: 236 — 40 of 1 106, **39 of them in the first 46**, while the game started; 237 — 36 of 809, in the first 42 and
the last two; 244 — 9 of 123, in the first ten. Before, they were spread through a session (0.4–16 %). **D150 did what
it was for.** Where two or three games ran at once the holes are blocks in which the game did not present
(240: 103 of 477; 242: 80 of 402, 68 of them at its start; 243: 37 of 414; 239: 23 of 184): a read is taken on
the presenting thread, so a game that presents nothing is not read — Lies of P's log has sixty reads in 189 s.
(e) **Off means off**: session 245 has no `LATENCY` line and no Advanced row.
**The stop fired in a real game for the first time** (D141): Kingdom Come: Deliverance II, 12 s after the
attach, while the game was starting — the seventh read took 5 337 µs, and no further read was made; the
session says so (`Slow`), the game ran 287 s and closed normally. No frame had been reported in those seven
reads. **The owner: that game has no Reflex in its settings** — so there was no report to lose; the
session's line says *stopped* where, without the slow call, it would have said *the driver reported no
frame*. Elsewhere the slowest call was 22–235 µs. In Lies of P the driver reported no frame at all.
**What the states say of Reflex and frame generation** (each batch carries its own): low-latency mode was
**on at a multiplier of 1** in Cyberpunk 2077 (88 reads), Black Myth: Wukong (253), Hogwarts Legacy (299) and
Dying Light: The Beast (345); Phantom Blade Zero without frame generation sleeps through Reflex with
low-latency mode **off** (1 062 reads) and switches it on with ×2; Clair Obscur without frame generation has
both off and still reports its frames. The logs cannot say whether a game's menu or the NVIDIA App switched
the mode on. NVIDIA's own guide makes frame generation need Reflex and not the reverse
(`spike-notes` §30, *Added 2026-11-14*). Hogwarts Legacy gave a multiplier of 6 for seventeen reads.
(f), (g) **The owner, the same evening: "App reflex off, không khựng"** — *Low Latency Mode* is off in the
NVIDIA App, and no hitch. Read with (f) as it was asked, for Cyberpunk 2077: the low-latency mode its 88
reads show at a multiplier of 1 is then the game's own Reflex and not the App's override — Reflex on without
frame generation, as NVIDIA's guide allows. **Then shown, in two screenshots**: the NVIDIA App's *Program
Settings* for Cyberpunk 2077 have *Low Latency Mode* **Off**, set for that program (the rows that follow the
global setting read "Global - …"; this one does not); and the game's own *Video* page has **NVIDIA Reflex Low
Latency: On**, V-Sync off, borderless at 2560×1440, 378 FPS on the game's counter. So the driver's
`bLowLatencyMode` on, at a multiplier of 1, is the game's menu, seen from both sides. **The owner's**: the wording of the two GPU labels — *idle time excluded /
included* does not describe a game whose active time is the longer.
**Answered 2026-08-05, do not re-ask:** remove `gameguard` and keep `guard` (approved
over a red `Rules` gate, with the reasoning recorded in the merge commit); vendor NVAPI
@@ -991,6 +1172,13 @@ Where each owner decision is recorded — the file and its section, and a label
| D145 | [`../legal/ACCURACY.md`](../legal/ACCURACY.md) | the accuracy statement, the README and the guide say two real games were read on one driver (they said none); Privacy Policy 2.21 and Disclaimer 2.17 with it |
| D146 | [`06_DATA_MODEL.md`](06_DATA_MODEL.md) §sensor_blobs | the Agent's samples were 1.32 s apart under a 1 s setting (it waited the whole interval after its work): sample on a fixed period, and store the rate the samples had |
| D147 | [`03_METRICS.md`](03_METRICS.md) | the session summary's latency fields stay N/A: the driver's total is simulation start to GPU end, not input to display |
| D148 | [`17_HOOK_ENGINE.md`](17_HOOK_ENGINE.md) §Native logging | asked on 2026-11-14 with item 46's Cyberpunk 2077 numbers (active render longer than the span between the GPU marks): count the frames, and write the counts **only to the Overlay's native log** — no layout, schema, App or string change |
| D149 | [`17_HOOK_ENGINE.md`](17_HOOK_ENGINE.md) §Native logging | told that a bug report carries the five newest Overlay logs and so these lines: **no change to the legal texts** — the Privacy Policy names the logs of the component loaded into games, and the lines are counts and sums of microseconds |
| D150 | [`07_IPC.md`](07_IPC.md) §Region 5 | the samples that carry no report are mended **on both sides**: the Overlay reads and publishes on a grid of one second, and the Agent no longer overwrites a reading that waits for a sample |
| D151 | [`17_HOOK_ENGINE.md`](17_HOOK_ENGINE.md) §Native logging | the owner's word: Reflex is checked together with frame generation — without it the owner's games do not switch Reflex on, and a low-latency switch that reads on and off is the NVIDIA App's override. A batch of counts belongs to one state of the sleep status |
| D152 | [`18_GPU_VENDOR_APIS.md`](18_GPU_VENDOR_APIS.md) §The inventory | the two GPU labels say what each figure is — *the driver's own figure*, *between the driver's start and end marks* — not "idle time excluded / included": item 47 counted the active time as the longer in Cyberpunk 2077. Strings only; numbers and means unchanged |
| D153 | [`spike-notes/30-reflex-latency.md`](spike-notes/30-reflex-latency.md) *Added 2026-11-14* | the owner's word: of Reflex it is enough to tell whether a game has it. Reflex and PCL leave train D (`sl.pcl.markers` stays refused), and D141's stop is not changed for a game's first seconds. My reading of one sentence; nothing shipped is removed by it |
| D154 | [`18_GPU_VENDOR_APIS.md`](18_GPU_VENDOR_APIS.md) §The trains, [`20_OPEN_QUESTIONS.md`](20_OPEN_QUESTIONS.md) §M15 | Advanced metrics is closed: train D is not built, the ten Streamline entries that waited for a spike are not read (`RefusedRoute`), rule 4 is not amended for them. Nothing shipped is removed |
| 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`) |
---
+79
View File
@@ -0,0 +1,79 @@
<!-- Moved from CHANGELOG.md's [Unreleased] when 0.1.0-beta.49 was cut, 2026-11-14 (D66). CHANGELOG.md lists every release. -->
## [0.1.0-beta.49] - 2026-11-14
**The forty-ninth pre-release: what the owner's sessions on 0.1.0-beta.48 showed, the same day.** Eighteen
sessions, sixteen of them with *Advanced metrics* on — Phantom Blade Zero, Cyberpunk 2077 and Clair Obscur:
Expedition 33, with frame generation on and off, with Reflex on and off. Sensors are now read every second; NVIDIA's driver gave both
of its own GPU times in every report of every game; the table lists every frame-generation multiplier; a game
started with the option off was left alone; the driver was read just the same with Reflex off; and the owner's
word on how the games felt: no hitch. The same unsigned installer: verify its hash against `SHA256SUMS.txt`, then
*More info → Run anyway*. **No legal text changed, so the terms window does not appear.**
**Two things those sessions showed, and what this release does about each.**
- **The *Latency* charts had holes.** After a session's first reading, between 0.4 and 16 % of its samples had
none. There were two reasons, one on each side. The part inside the game did its once-a-second round a second
*after* the last one finished — so it fell behind — and whenever the game loaded a library it was woken early,
published what it had, and asked the driver for nothing new. And the capture agent kept one reading until a
sample could carry it, and replaced it if another arrived first. Both are mended: the round inside the game is
now due at fixed moments, and the agent keeps the reading that waits.
- **In Cyberpunk 2077 without frame generation, NVIDIA's *GPU active render* time is longer than the time from the
card's start on a frame to its end** — which should contain it. Nothing stored can say whether that is the
driver's arithmetic or the way FrameLedger averages the two (one over every frame, one only over the frames that
gave a time). **This release changes no number you see.** It counts, frame by frame, how the two stand to each
other, and writes the counts to the game component's own log, together with the driver's low-latency state and
its frame-generation multiplier — the owner asked that Reflex and frame generation always be read together. The
next sessions say which it is; what to do about it is decided then.
**What it is not.** Not a promise that every sample now carries a reading: with both sides on one second a slip
can still leave one without, and the log says how often. The reason given for the agent's half was read from the
code and fits the pattern in the ledger; it has not been measured in a session. Nothing here is read on
Direct3D 11, Vulkan or OpenGL, and the figures remain the driver's, not a measurement by FrameLedger. The log of
the component inside a game grows by about seven lines a minute while *Advanced metrics* reads the driver — a few
tens of kilobytes an hour — and a bug report carries those logs, as it always carried them. A game that closes by
itself loses the last batch of counts, under a minute.
**Measured overhead this release.** A presented frame: unchanged — no line that runs with a present was touched.
The reading of the driver's report, once a second while a session with *Advanced metrics* runs in a Direct3D 12
game: 65 billionths of a second more (424–435 → 490–499 billionths, the same instrument as before), after the
request's own time has been taken. The background thread inside the game: ten readings in 9 996 ms, twenty in
20 002, sixty in 59 997 on the test harness — and the same with another thread waking it eighteen thousand times
in ten seconds, where the code before it published 35 720 times in eight seconds and read nine times.
### Added
- **The frames NVIDIA's latency report gives are counted, for the Overlay's own log** (owner decisions D148,
D151; nothing new is stored, shown, asked of the driver or read from its report). The owner's sessions on
0.1.0-beta.48 showed both of the driver's own GPU times in two games — and in Cyberpunk 2077 without frame
generation an *active render* time longer than the span from the card's start on a frame to its end, which the
two averages cannot explain: one is over every frame, one only over the frames that gave a time. While a session
with *Advanced metrics* reads the driver, the Overlay now places each frame by its own two numbers and writes
the counts to `overlay-<pid>-….log` as `LATENCY_FRAMES` lines, in batches that each belong to **one state of
the driver's low-latency status and its frame-generation multiplier** — the counts are read together with
Reflex and frame generation, never apart. About six lines a minute; a game that exits by itself loses the last
batch, under a minute. A bug report carries those logs, as it carried them before. Measured: 65 billionths of a
second more for each reading of the report, once a second; a presented frame costs what it did.
### Changed
- **The guide says whose switches the latency table shows**: the driver's, not the game's menu. `bLowLatencyMode`
is also on when *Low Latency Mode* is set for the game in the NVIDIA App, and `bUseGameSleep` says whether the
game itself paces its frames through Reflex — in some games only with frame generation on (the owner's word,
2026-11-14, and what Clair Obscur's sessions of that afternoon read).
### Fixed
- **NVIDIA's latency report is read on a grid of one second, and a busy loader no longer leaves holes in it**
(owner decision D150; the Overlay's half). After a session's first report, 0.4 to 16 % of its samples carried
none — the *Latency* charts had gaps. The Overlay's background thread waited a second *after* each round of its
work, so it fell behind the capture agent, which samples exactly every second; and whenever the game loaded a
library that thread was woken early, published what it had and asked for no new reading, so the round after it
had nothing to publish. Its once-a-second round is now due at fixed moments whatever the work took, and a round
woken early no longer publishes or takes a reading. Two readings are never less than half a second apart.
Nothing on a game's own threads changed.
- **A reading that waits for a sample is no longer overwritten by the next one** (D150; the capture agent's
half). The agent kept one reading from the game until a sensor sample could carry it, and replaced it when
another arrived first. When a reading landed just after a sample, that sample went without and a reading was
lost a little later — in one session of the owner's, one sample in five for four minutes. Two readings may now
wait and the older is stored first; a point can stand up to a second after its reading was taken. With the
sensor interval above one second, not every reading is stored, as before.
+115
View File
@@ -0,0 +1,115 @@
# HANDOFF history — 0.1.0-beta.48
*Moved verbatim from `docs/HANDOFF.md` when 0.1.0-beta.49 was cut, 2026-11-14 (owner decision D66); `docs/HANDOFF.md` §How this file is split lists every part. Nothing below was edited, so its "below" and "above" mean HANDOFF.md as it stood then, and a path it writes is relative to `docs/`. **Its NEXT and its "Left open" were written through the afternoon of 2026-11-14 as item 46 was read**: what they led to is HANDOFF.md's section for 0.1.0-beta.49.*
## **START HERE** — 2026-11-14, 0.1.0-beta.48: two real games read; the driver's own GPU times beside a span that includes idle; every multiplier seen; samples a second apart
*Status is `docs/changelog/0.1.0-beta.48.md`; this is what no other file carries.* The owner ran eight sessions on
beta.47 the morning it was released and said, twice: check. They were read (#448, #449): Phantom Blade Zero three
times, Cyberpunk 2077 twice, two Direct3D 11 games and a Direct3D 12 game with no NVIDIA library — **the read
works in real games**, and four things came out of it that the owner ruled on the same morning (D142–D147) and
approved as one train: #450 (the Overlay reads two more members of the report and keeps the multipliers seen),
#451 (the Agent, the App, the texts — Privacy Policy 2.21, Disclaimer 2.17), #452 (the poller's period), and this
release. **What the eight sessions showed is item 45's last paragraphs, below; beta.47's own section, its traps
and its release facts are [`handoff/history/0.1.0-beta.47.md`](handoff/history/0.1.0-beta.47.md)**; what the
read is and what bounds it is [`17_HOOK_ENGINE.md`](17_HOOK_ENGINE.md) §Calls the Overlay makes into a driver.
### What this release decided, beyond D142–D147
- **Two more members of a report already fetched are not a new call.** Rule 4's note stands as written: the same
two getters, the Overlay's own buffer, the two names on `tools/overlay-allowed-fields.txt`. The owner ruled on
them by name (D142); a third member is asked the same way.
- **The driver's own times have a count each, and zero means not given.** An older driver leaves both zero, and
so did the probe's frames. They are added after the frame is accepted, so which frames the seven spans are made
of did not move — a session's old series mean what they meant.
- **An entry of their own in the catalog** (`nvapi.reflex.gpu_times`), not an eighth and ninth line of the frame
report: `AdvancedPresenter.MaxLines` is 8, and nine series of one entry are drawn as a band.
- **The layout stayed 5 again**: line 0 of region 5 was full, so the four words came out of the seven reserved
words that ended the `sl::DLSSOptions` line. Three remain there, two on the `sl::Constants` line, two on the
FidelityFX line.
- **The fact's key no longer holds the last multiplier.** It held it since beta.47, so every menu rewrote the
session's context.
- **`hz` is measured from the samples, not taken from the setting**: the finalizer cannot see the setting, and a
session recovered from a `.partial` file never knew it.
- **The plan named `tools/agent-cost` for the poller's change and it was not run**: it runs the Agent unelevated,
where a poll takes a millisecond and the period was already a second. Said in #452 rather than run for show.
### Traps this train left
- **A cause I wrote down before checking it.** "The third of a second is the processor's temperature" went into
five files on two facts — unelevated a poll takes a millisecond; the sessions without a `cpu_temp` series are a
second apart — and then four sessions *with* the series turned out to be a second apart too. The texts were
taken back to what is established before the commit. **Count the exceptions before naming a cause.**
- **A bash here-document ate a backslash again** (a Python one-liner with `'\\'`). Edit scripts are files — the
rule already existed.
- **`FETCH_HEAD` belongs to the worktree that fetched.** A merge in a second worktree needs the commit's id.
- **A squash-merge of the lower pull request conflicts the upper one in `CHANGELOG.md` every time** both added to
`[Unreleased]`. With Auto-fix on, the app asks for a merge of `main`, not a rebase: do it in a worktree of its
own when a gate is running in the main one, keep the upper branch's file (it is the superset), and check that
the merged tree equals the branch's tip — then the gate already run still stands.
- **The gate script's last lines do not reach a background task's output**: read the log's last line and hash the
`rules` folder by hand.
- **An analyzer wants a `<summary>` once any `<param>` is written** (RCS1139).
### NEXT
1. ~~**The owner runs item 46**~~ **Run and read 2026-11-14** (the item, below): the samples are a second apart,
both games gave both figures, the multipliers are listed, off means off. **The owner's word, the same day: no
hitch.** What is left of it is whether session 221 was the one with Reflex off.
2. **Then the owner's to say**: more titles; D141 on a larger sample (the slowest call seen in a game is 65 µs);
whether the processor update is worth timing on their PC and moving off the poll's thread (below).
3. **`slAllocateResources`** keeps its patch (D135); looked at again when there are more sessions.
4. **Train D** after it, the same way: a spike first — `sl.pcl.markers` waits for it, and §30 found its hook
would miss a game that fetched its functions before the attach.
### 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, with what SonarCloud and Qodana said.~~ **Recorded
2026-11-14: 0.1.0-beta.48 was released 2026-11-14T04:49:19Z** (11:49 in the owner's time zone) from the signed
tag on `aec1736` (#453), by run 43556901499 — 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, and the portable package hashed
here equals its line; the five native libraries in it carry `FL_BUILD_ID v0.1.0-beta.48`, none of them
`-dirty`. The delta from beta.47 is 1 944 037 bytes beside a full package of 110 800 248 — "Delta processed
0452 files. 0024 patched, 0428 unchanged". The wiki was published by run 43558546949. The rehearsal on the
release branch (run 43555020289, at `0c210d0`, the released tree) had made a delta of 1 966 174 bytes with the
same file counts. **SonarCloud answered on `aec1736`: the quality gate passed and no issue is open on `main`. Qodana's two reports, CodeQL and `check` are green on that
commit**, as they were on each of #450–#453 before its merge; no advisory check found anything in this train.
- ~~**No real game has given the two new figures yet.**~~ **Two have (item 46, 2026-11-14)**, in every frame
report: Phantom Blade Zero's active render is the short number the reading expected (9.6 ms inside a span of
16.4 ms at 60 FPS). **In Cyberpunk 2077 without frame generation active render is longer than the span between
the two GPU marks** (3.17 against 2.79 ms) **and why is not established** — the two averages are over different
frames, or the driver counts work outside the marks. The label says *idle time included*, which that game's
numbers do not show; the texts say the figures are the driver's own. Not changed.
- **After a session's first report, 0.4–7.3 % of its samples carry none** (item 46): the Overlay's reads are a
second apart or two — its watchdog's tick — and the Agent's samples exactly one. Read in the code, not measured;
not changed.
- **Where the third of a second of a poll goes is not established.** Unelevated, a poll takes about a millisecond
(the layers composed as the Agent composes them, each read under a stopwatch). In the owner's ledger 180 of 186
sessions are 1.32 s apart and six are 1.0 s: the two with no `cpu_temp` series (an Agent not elevated) are among
the six — which points at the sensor library's processor update, run on the poll's thread as administrator
with PawnIO — **but four sessions that have the series kept one second** (22, 72, 73, 136). **Not measured**:
that call itself (it needs elevation), and whether it is processor time or waiting. The period no longer
depends on it; a poll that takes a third of every second is still a poll that takes a third of every second.
- **With the sensor interval above one second, some readings of the driver's report are not stored**: the newest
stands until a sample carries it (`SessionRecorder`). Said in the guide; not changed.
- **No test runs the whole path through the real Agent**: the injected tests stop at the shared memory and the
sampler's start from it; no end-to-end case loads the stand-in module under an Agent session.
- **Two install batches of beta.46 took 0.61 s and 1.26 s and nothing explains them.** Cyberpunk 2077's eight
batches on beta.47 took 85–221 ms, each in one apply; Hogwarts Legacy has not been run since.
- **The Japanese strings are new and unreviewed**, as every `ja` string is.
- ~~**Off means off has never been exercised on a real game**~~ **It was, 2026-11-14** (item 46 (e), session
226: no `LATENCY` line, none of the hooks Advanced metrics adds, no row). (c) and (h) of item 43, which only the
owner sees, are still not.
- **Valor Mortis's crash at 51 s** (twice, beta.40 and beta.44) **and Black Myth: Wukong's fault in Steam's crash
handler at every exit** are not explained. One session of each with hooking off is the comparison that is missing.
- **What item 41 left unexercised**: a configure through the FidelityFX 2.3 loader (Cyberpunk 2077 with FSR frame
generation), a game with neither library.
- **A fault while a game is closing is not seen by a hooked session** (D127: written down, not changed).
- **`docs/LIST_GAME_TESTED.md` is as of 2026-11-06**: refreshing it is a new copy of the ledger and the owner's review.
- **Item 40 (d)** was not exercised and the owner has not said item 40 passed. **Items 36 (d) and 37 are still open.**
- **`LIMITATIONS.md` and the accuracy statement still say the processor's, the memory's and the motherboard's
sensors "have never been read on real hardware"** — the owner's to reword. The alpha line still rests (D98).
**Owner-only:** one session each of Valor Mortis and Black Myth: Wukong with hooking off; what item 41 left
unexercised; item 40 (d).
+55
View File
@@ -175,3 +175,58 @@ route.
The spike is [`spike-notes` §31](31-reflex-route-d-harness.md), run on 2026-11-13: none of the stop conditions
above fired on the harness, and it ends in the question of one real title.
### Added 2026-11-14: Streamline's two programming guides, read against this note and the code
`docs/ProgrammingGuideReflex.md` and `docs/ProgrammingGuideDLSS_RR.md` of NVIDIA's Streamline repository, both
"Version 2.14.16", fetched as text and read whole — at the owner's request. What they add, and what they change.
**Reflex**
- **Low latency and frame generation: the dependency runs one way.** The guide lists the plugin's parts as
"distinct to each other without any cross-dependencies", wants Reflex's default to be *On*, and its checklist
tests *Reflex On* with frame generation **off**. Frame generation is what needs Reflex. The owner's "without
frame generation the game cannot switch Reflex on" is true of some of the owner's games' menus, not of Reflex.
The sessions of 2026-11-14 agree (HANDOFF, item 47): low-latency mode on at a multiplier of 1 in four games;
Phantom Blade Zero switches it on with frame generation; Clair Obscur without frame generation has it off.
- **The sleep and the markers are sent whatever the mode.** "`slReflexSleep` and `slPCLSetMarker` must always be
called even when Reflex Low Latency mode is Off"; the verification overlay's *App Called Sleep* stays 1 with
Reflex off. So `bUseGameSleep` says the game calls the sleep, **not** that Reflex is on, and a report exists
with Reflex off — which is what the sessions on 0.1.0-beta.48 showed (HANDOFF, item 46). Phantom Blade Zero
without frame generation is exactly this: the game sleeps, low-latency mode off, 1 062 reads.
- **`slReflexSetOptions` is called once, and again only when an option changes.** A hook on it would see nothing
in most sessions even if it could be placed: `nvapi.reflex.mode` stays refused for a second reason.
- **The markers are the report.** `slPCLSetMarker` replaces `NvAPI_D3D_SetLatencyMarker`, and the times the
markers carry (simulation, render submit, present) are the ones the driver hands back in the report this
product already reads (route D). `sl.pcl.markers` would add a count of calls, the ping and the flash trigger —
nothing a player reads. **Recommended to the owner: leave Reflex and PCL out of train D** — **decided the
same evening (D153)**: whether a game has Reflex is all that is wanted.
- **PC latency is not in the report, and NVIDIA takes it from outside the game**: its PCL statistics, read by
tools started from an administrator's prompt (route E here). D147 stands on that; two design tables that still
promised "PC latency as reported by Reflex" were corrected today (`03_METRICS`, `05_DETECTION`).
- **The stages, in NVIDIA's words** (the verification overlay's table): *driver* is from the first buffer
submission to the last present submission; *OS queue* from the first significant buffer submission to the end
of the GPU's work; *GPU* from where its rendering starts to where it ends; *total render time* is "time spent
by GPU rendering". With frame generation the test's own columns split the GPU's part at "DLSS FG start". **Not
reconciled with what is stored**: an OS queue that ends with the GPU's work should not be shorter than the
GPU's span, and in Phantom Blade Zero it is (12.9 ms beside 16.4 ms). The guide's table describes an overlay,
not the fields of `NV_LATENCY_RESULT_PARAMS`; nothing is concluded from it, and no label was changed on it.
- **Where Reflex helps**, by the guide: GPU-bound, or V-Sync with variable refresh; not CPU-bound. FrameLedger
shows the driver's switches and draws no conclusion about benefit.
**DLSS Ray Reconstruction**
- **The code already has it right, and two comments had the reason wrong.** The guide: "When DLSS-RR is switched
on, it completely overrides DLSS (Super Resolution)", in the quality mode set for DLSS, through
`slEvaluateFeature(sl::kFeatureDLSS_RR, …)`. That is the present detour's RR arm (upscaler DLSS, the RR fact
beside it), measured on Cyberpunk 2077 on 2026-08-15. `fl_shm.h` and `dllmain.cpp` still said super resolution
and RR "run together" / "in the SAME frame"; they do not, and the comments now say what is true.
- **Off is a mode, not a release**: "set `sl::DLSSDOptions.mode` to `sl::DLSSDMode::eOff`, note that this does
NOT release any resources". So *loaded* and *allocated* (the Advanced tables of 0.1.0-beta.45) are not *in
use*; the RR verdict is taken from evaluations and from nothing else, which is why it is right.
- **If `sl.dlssd.options` is ever read** (it is a spike entry, set through a call no hook sees): the structure
carries `worldToCameraView` and `cameraViewToWorld` — camera matrices, never read (rule 4) — and RR ignores the
DLSS options `sharpness` and `useAutoExposure`, so a session's DLSS rows do not describe RR on those two.
What the entry would add is RR's preset for each mode and how normals and roughness are packed. Little.
- **No dynamic resolution under RR**: a change of input size re-initialises the denoiser. Nothing here depends
on it.
+26 -11
View File
@@ -85,20 +85,31 @@ under which of the three happened to each.
### What NVIDIA's driver says about each frame's stages
On an NVIDIA card, in a **Direct3D 12** game that uses **NVIDIA Reflex**, a session with Advanced metrics on also
stores the driver's own latency report: how long the driver says each stage of a frame took — *simulation*,
On an NVIDIA card, in a **Direct3D 12** game that has **NVIDIA Reflex** built in, a session with Advanced metrics
on also stores the driver's own latency report — whether Reflex is on or off in the game's menu, because a game
with Reflex marks its frames either way: how long the driver says each stage of a frame took — *simulation*,
*render submit*, *present*, *driver*, *operating system's render queue*, *GPU render*, and the *total* from the start
of simulation to the end of the graphics card's work. They are seven lines under **Latency**, one point about every
second, each the average of the frames of one reading, in microseconds. A table beside them shows the driver's
low-latency state as five switches, by NVIDIA's own names, each *On*, *Off* or *On at times, off at others*, and
`fgMultiplier`: every frame-generation multiplier the driver gave during the session (*1, 2* is a session that
generated frames at ×2 for part of it).
generated frames at ×2 for part of it). **They are the driver's switches, not the game's menu.** `bLowLatencyMode`
is on when the game switched Reflex on *and* when **Low Latency Mode** is set for that game in the NVIDIA App —
an override there shows here, and can read *On at times, off at others* in a game whose own setting never
changed. `bUseGameSleep` says whether the game calls Reflex's sleep each frame. NVIDIA asks games to call it even
while Reflex is off, so *On* there does not say Reflex is on — `bLowLatencyMode` does; some games call it only
while frame generation is on. Frame generation needs Reflex and not the other way round: the mode can be on
with `fgMultiplier` at 1.
**The stages overlap; they are not parts that add up to the total.** And *GPU render, start to end* includes the
time the card spent waiting between pieces of work — in one game it is longer than the whole frame. So a second
chart, **the graphics card's time per frame, as the driver works it out**, has two lines of the driver's own
figures: *GPU active render*, the same stage without the waiting, and *GPU frame time*, from the end of one
frame's work to the end of the next. A driver may give neither; the chart is then not there, and nothing is wrong.
**The stages overlap; they are not parts that add up to the total.** And *GPU render* is the time between two
marks the driver sets, at the start and at the end of the card's work on a frame: where the card waits between
pieces of work, the waiting is in it — in one game it is longer than the whole frame. So a second chart, **the
graphics card's time per frame, as the driver works it out**, has two lines of the driver's own figures: *GPU
active render*, how long the driver says the card worked on the frame, and *GPU frame time*, from the end of one
frame's work to the end of the next. **The active time is usually the shorter of the two, and not always**: in
Cyberpunk 2077 without frame generation it is about a fifth longer than the two marks are apart, frame after
frame — the driver counts work its marks do not enclose. Both are shown as the driver gives them. A driver may
give neither; the chart is then not there, and nothing is wrong.
Three things to know about them:
@@ -144,10 +155,14 @@ comes from, and whether it is read. Where it is not, the reason is written out:
administrator*);
- **not present on this PC** — the driver's own figures exist on NVIDIA cards only;
- **read inside a game FrameLedger measures, when the game makes the call** — what the game tells DLSS and FSR
(above). Some further readings inside the game **come with a later release**;
(above);
- **read inside a game FrameLedger measures, from the graphics driver** — NVIDIA's latency report (above);
- **not read: it would take a patch at an address found while the game runs, or a call the vendor forbids from
outside the game's own threads** — what the game asked of Reflex, and Reflex's state through Streamline;
- **not read: it would take a patch at an address found while the game runs, a function of FrameLedger's handed
to the game in place of the vendor's, or a call the vendor forbids from outside the game's own threads** — what
the game asked of Reflex, Reflex's state through Streamline, and what a game sets and asks through Streamline's
own functions for a feature: DLSS frame generation's options and state, the video memory DLSS estimates for
itself, and the options of ray reconstruction, Image Scaling and Dynamic Vibrance. No later release will read
these;
- **the game makes this call once, before FrameLedger is inside it** — what the game started Streamline with. It is
not read, and no later release will read it;
- **never read** — a serial number, a display's identification data, which other programs are encoding, the camera's
+1 -1
View File
@@ -12,7 +12,7 @@
HTML comments are not part of the block.
-->
> ⚠ **What FrameLedger actually measures today — 2026-11-11.** The software is a beta; its latest
> **beta is `0.1.0-beta.48`** (2026-11-14), an unsigned installer built from that tag with its
> **beta is `0.1.0-beta.49`** (2026-11-14), an unsigned installer built from that tag with its
> checksums published beside it (alphas — experimental builds that try a newer .NET — are published apart). The source holds the desktop app
> (library, store import, charts, settings) and the background Agent, which records a session when a
> game in the library runs (unless you switched its recording off), injects only into games you enabled
+1 -1
View File
@@ -125,7 +125,7 @@ Frame timing is derived from high-resolution timestamps taken at the moment the
<!-- accuracy-block:begin -->
> ⚠ **What FrameLedger actually measures today — 2026-11-11.** The software is a beta; its latest
> **beta is `0.1.0-beta.48`** (2026-11-14), an unsigned installer built from that tag with its
> **beta is `0.1.0-beta.49`** (2026-11-14), an unsigned installer built from that tag with its
> checksums published beside it (alphas — experimental builds that try a newer .NET — are published apart). The source holds the desktop app
> (library, store import, charts, settings) and the background Agent, which records a session when a
> game in the library runs (unless you switched its recording off), injects only into games you enabled
+3 -3
View File
@@ -958,7 +958,7 @@
<comment>review</comment>
</data>
<data name="AdvReach_RefusedRoute" xml:space="preserve">
<value>読み取りません: ゲーム実行中にしか分からないアドレスへのパッチ、またはゲーム自身のスレッド以外からの呼び出しをベンダーが禁じている関数が必要になるためです - どちらも行いません</value>
<value>読み取りません: ゲーム実行中にしか分からないアドレスへのパッチ、ベンダーの関数の代わりに FrameLedger の関数をゲームに渡すこと、またはゲーム自身のスレッド以外からの呼び出しをベンダーが禁じている関数が必要になるためです - いずれも行いません</value>
<comment>review</comment>
</data>
<data name="AdvReach_Spike" xml:space="preserve">
@@ -1054,7 +1054,7 @@
<comment>review</comment>
</data>
<data name="AdvToken_active_render" xml:space="preserve">
<value>GPU 実描画 (待機時間を除く)</value>
<value>GPU 実描画 (ドライバーの算出値)</value>
<comment>review</comment>
</data>
<data name="AdvToken_frame_time" xml:space="preserve">
@@ -1062,7 +1062,7 @@
<comment>review</comment>
</data>
<data name="AdvToken_gpu_render" xml:space="preserve">
<value>GPU 描画、開始から終了まで (待機時間を含む)</value>
<value>GPU 描画 (ドライバーの開始マークから終了マークまで)</value>
<comment>review</comment>
</data>
<data name="AdvToken_gsync_module" xml:space="preserve">
+3 -3
View File
@@ -724,7 +724,7 @@
<value>Not read: it would make the sensor library search every USB device</value>
</data>
<data name="AdvReach_RefusedRoute" xml:space="preserve">
<value>Not read: it would take a patch at an address found while the game runs, or a call the vendor forbids from outside the game's own threads - both refused</value>
<value>Not read: it would take a patch at an address found while the game runs, a function of FrameLedger's handed to the game in place of the vendor's, or a call the vendor forbids from outside the game's own threads - all refused</value>
</data>
<data name="AdvReach_Spike" xml:space="preserve">
<value>Being studied; not decided</value>
@@ -796,13 +796,13 @@
<value>Game Ready</value>
</data>
<data name="AdvToken_active_render" xml:space="preserve">
<value>GPU active render (idle time excluded)</value>
<value>GPU active render (the driver's own figure)</value>
</data>
<data name="AdvToken_frame_time" xml:space="preserve">
<value>GPU frame time, one frame's end to the next</value>
</data>
<data name="AdvToken_gpu_render" xml:space="preserve">
<value>GPU render, start to end (idle time included)</value>
<value>GPU render (between the driver's start and end marks)</value>
</data>
<data name="AdvToken_gsync_module" xml:space="preserve">
<value>G-SYNC module</value>
+3 -3
View File
@@ -719,7 +719,7 @@
<value>Không đọc: việc này khiến thư viện cảm biến dò mọi thiết bị USB</value>
</data>
<data name="AdvReach_RefusedRoute" xml:space="preserve">
<value>Không đọc: việc đó cần vá mã tại một địa chỉ chỉ tìm được khi game đang chạy, hoặc một lời gọi mà nhà cung cấp cấm thực hiện từ ngoài luồng của game - cả hai đều bị từ chối</value>
<value>Không đọc: việc đó cần vá mã tại một địa chỉ chỉ tìm được khi game đang chạy, hoặc đưa cho game một hàm của FrameLedger thay cho hàm của nhà cung cấp, hoặc một lời gọi mà nhà cung cấp cấm thực hiện từ ngoài luồng của game - tất cả đều bị từ chối</value>
</data>
<data name="AdvReach_Spike" xml:space="preserve">
<value>Đang nghiên cứu; chưa quyết định</value>
@@ -791,13 +791,13 @@
<value>Game Ready</value>
</data>
<data name="AdvToken_active_render" xml:space="preserve">
<value>GPU thực sự vẽ (không tính lúc nghỉ)</value>
<value>GPU thực sự vẽ (số do driver tự tính)</value>
</data>
<data name="AdvToken_frame_time" xml:space="preserve">
<value>nhịp khung của GPU, từ lúc xong khung này tới lúc xong khung kế</value>
</data>
<data name="AdvToken_gpu_render" xml:space="preserve">
<value>GPU vẽ, từ lúc bắt đầu tới lúc xong (gồm cả lúc nghỉ)</value>
<value>GPU vẽ (giữa mốc bắt đầu và mốc kết thúc của driver)</value>
</data>
<data name="AdvToken_gsync_module" xml:space="preserve">
<value>Mô-đun G-SYNC</value>
@@ -193,20 +193,24 @@ public static class AdvancedMetricCatalog
// its two GPU marks includes the card's idle time and was longer than a frame's whole in a real game.
SampledFamily("nvapi.reflex.gpu_times", Nvapi, GameDriver, Microseconds, Latency, "The graphics card's time per frame, as the driver works it out: active render, frame to frame"),
// ---- Inside the game: routes a spike decides ------------------------------------------------------------
Session("sl.dlss.optimal_settings", Streamline, Spike, Text, Upscaling, "The render size and sharpness DLSS recommends"),
Sampled("sl.dlss.vram_estimate", Streamline, Spike, Mebibytes, Upscaling, "DLSS's own estimate of its video memory"),
Session("sl.dlssg.options", Streamline, Spike, Text, FrameGeneration, "DLSS frame generation: mode, frames to generate"),
Session("sl.dlssg.state", Streamline, Spike, Text, FrameGeneration, "DLSS frame generation: status, the most frames it can generate"),
Sampled("sl.dlssg.frames_presented", Streamline, Spike, Count, FrameGeneration, "Frames DLSS frame generation presented, by its own count"),
Sampled("sl.dlssg.vram_estimate", Streamline, Spike, Mebibytes, FrameGeneration, "DLSS frame generation's estimate of its video memory"),
Session("sl.dlssd.options", Streamline, Spike, Text, Upscaling, "Ray reconstruction's options"),
Session("sl.nis.options", Streamline, Spike, Text, Upscaling, "NVIDIA Image Scaling's options"),
Session("sl.deepdvc.options", Streamline, Spike, Text, Upscaling, "RTX Dynamic Vibrance's options"),
// ---- Inside the game: Streamline's feature functions - not read ---------------------------------------
// Advanced metrics is closed (owner decision D154, 2026-11-14). None of these is an export: a game gets each
// function through slGetFeatureFunction and keeps the pointer, so seeing its calls would take handing the game
// a function of ours in place of Streamline's - a write to what the game receives (rule 4) - and would still
// miss every game that fetched its functions before the attach. They stay listed, with the reason.
Session("sl.dlss.optimal_settings", Streamline, RefusedRoute, Text, Upscaling, "The render size and sharpness DLSS recommends"),
Sampled("sl.dlss.vram_estimate", Streamline, RefusedRoute, Mebibytes, Upscaling, "DLSS's own estimate of its video memory"),
Session("sl.dlssg.options", Streamline, RefusedRoute, Text, FrameGeneration, "DLSS frame generation: mode, frames to generate"),
Session("sl.dlssg.state", Streamline, RefusedRoute, Text, FrameGeneration, "DLSS frame generation: status, the most frames it can generate"),
Sampled("sl.dlssg.frames_presented", Streamline, RefusedRoute, Count, FrameGeneration, "Frames DLSS frame generation presented, by its own count"),
Sampled("sl.dlssg.vram_estimate", Streamline, RefusedRoute, Mebibytes, FrameGeneration, "DLSS frame generation's estimate of its video memory"),
Session("sl.dlssd.options", Streamline, RefusedRoute, Text, Upscaling, "Ray reconstruction's options"),
Session("sl.nis.options", Streamline, RefusedRoute, Text, Upscaling, "NVIDIA Image Scaling's options"),
Session("sl.deepdvc.options", Streamline, RefusedRoute, Text, Upscaling, "RTX Dynamic Vibrance's options"),
// A refused route (owner decision D133): the Overlay calling slReflexGetState itself breaks the thread
// contract the vendor's header states.
Session("sl.reflex.state", Streamline, RefusedRoute, Table, Latency, "Reflex through Streamline: availability and its frame reports"),
Sampled("sl.pcl.markers", Streamline, Spike, Count, Latency, "PC-latency markers the game sets"),
Sampled("sl.pcl.markers", Streamline, RefusedRoute, Count, Latency, "PC-latency markers the game sets"),
// ---- Closed by a licence --------------------------------------------------------------------------------
Session("ngx.parameters", Ngx, Licence, Table, Upscaling, "NGX parameters: the quality value, the DLSS hints"),
@@ -25,7 +25,10 @@ public enum AdvancedReach
/// <summary>Needs a hook on a function its module exports; the hook is not built. No entry carries it since 0.1.0-beta.45.</summary>
NewHook = 4,
/// <summary>A route nobody has proven safe: a spike decides, and the owner says go or no.</summary>
/// <summary>
/// A route nobody has proven safe: a spike decides, and the owner says go or no. No entry carries it since the
/// owner closed Advanced metrics (D154, 2026-11-14): the ten that did are <see cref="RefusedRoute"/>.
/// </summary>
Spike = 5,
/// <summary>A source the project decided not to open (D103).</summary>
@@ -70,7 +73,8 @@ public enum AdvancedReach
/// <summary>
/// Reading it needs a route the project refused, whatever the source: a patch at an address learned at run time
/// (what a game asks of Reflex is an argument of a function no module exports), or a call the vendor's own header
/// forbids from a thread that is not the game's (owner decision D133). Never read.
/// forbids from a thread that is not the game's (owner decision D133), or a function of ours handed to the game in
/// place of the vendor's (what a game sets and asks through Streamline's feature functions - D154). Never read.
/// </summary>
RefusedRoute = 15,
}
@@ -0,0 +1,62 @@
// SPDX-License-Identifier: GPL-3.0-only
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
using System.Diagnostics.CodeAnalysis;
using FrameLedger.Application.Advanced;
namespace FrameLedger.Application.Recording;
/// <summary>
/// What a hooked game published and no telemetry sample carries yet (owner decision D150): at most
/// <see cref="Capacity"/> sets of readings, the older taken first.
/// </summary>
/// <remarks>
/// <para>
/// <b>Why not one.</b> A publication arrives about once a second and a sample exactly once a second, on two clocks,
/// and the recorder looks at both every tenth of a second or so. Until 0.1.0-beta.49 it kept the newest set and
/// overwrote it: when a publication landed just after a sample, a look could fall between the two - that sample went
/// without, and at the next change of step the set that had waited was overwritten by its successor. In the owner's
/// sessions that was one sample in five without a report for minutes on end (HANDOFF, item 46).
/// </para>
/// <para>
/// <b>What two give.</b> A set that waited is carried by the next sample instead of being replaced, so with both sides
/// on a second a session lacks a report at one sample at most - the first time the two fall out of step - and loses
/// none after it. A reading then stands at the sample after the one it would have ridden: a second later, no more.
/// </para>
/// <para>
/// <b>What it does not give.</b> With the sensor interval above a second more sets arrive than samples: a third
/// pushes the oldest out, and not every reading is stored - as before, and as the guide says.
/// </para>
/// </remarks>
public sealed class PendingInGameReadings
{
/// <summary>The most sets that wait: the one a sample is about to carry, and the one that arrived meanwhile.</summary>
public const int Capacity = 2;
private readonly Queue<IReadOnlyList<AdvancedReading>> _waiting = new(Capacity);
/// <summary>How many sets wait.</summary>
public int Count => _waiting.Count;
/// <summary>A publication's readings. A set with nothing in it does not wait: it would only stand in a real one's way.</summary>
/// <param name="readings">The readings of one publication.</param>
public void Offer(IReadOnlyList<AdvancedReading> readings)
{
ArgumentNullException.ThrowIfNull(readings);
if (readings.Count == 0)
{
return;
}
if (_waiting.Count == Capacity)
{
_ = _waiting.Dequeue();
}
_waiting.Enqueue(readings);
}
/// <summary>The oldest set that waits, which then waits no longer; false when none does.</summary>
/// <param name="readings">The set, when there is one.</param>
public bool TryTake([NotNullWhen(true)] out IReadOnlyList<AdvancedReading>? readings) => _waiting.TryDequeue(out readings);
}
@@ -374,7 +374,7 @@ public sealed class SessionRecorder : ISessionRecorder
// What the game told its upscaler (train B): read inside the game by the Overlay, only for a session that
// records Advanced metrics - the same condition the shared reader is held under.
private readonly InGameAdvancedSampler? _inGame = advanced is null ? null : new InGameAdvancedSampler();
private IReadOnlyList<AdvancedReading>? _inGamePending;
private readonly PendingInGameReadings _inGamePending = new();
private (IReadOnlyList<AdvancedFact> Facts, AdvancedInGameStatus Status, InGameCallStates Calls) _inGameContext =
([], AdvancedInGameStatus.Unknown, default);
private IReadOnlyList<AdvancedFact> _sessionWithGame = [];
@@ -417,8 +417,9 @@ public sealed class SessionRecorder : ISessionRecorder
FollowAdapter(progress.AdapterLuid);
if (_inGame?.Take(progress.InGameAdvanced) is { } fresh)
{
// The newest stands until a telemetry sample carries it: both arrive once a second, out of step.
_inGamePending = fresh;
// It waits until a telemetry sample carries it: both arrive once a second, out of step - and it is no
// longer replaced by the one after it (owner decision D150; PendingInGameReadings says why).
_inGamePending.Offer(fresh);
}
DrainTelemetry();
@@ -631,13 +632,12 @@ public sealed class SessionRecorder : ISessionRecorder
_drained.Clear();
poller.Drain(_drained);
if (_inGamePending is { } pending && _drained.Count > 0)
if (_drained.Count > 0 && _inGamePending.TryTake(out IReadOnlyList<AdvancedReading>? pending))
{
// What the game said rides the newest sample of this drain, beside whatever the Agent's own reader
// gave it: one tick, one set of readings.
// gave it: one tick, one set of readings - the oldest that waits.
TelemetrySample newest = _drained[^1];
_drained[^1] = newest with { Advanced = newest.Advanced is { Count: > 0 } own ? [.. own, .. pending] : pending };
_inGamePending = null;
}
writer.AddSensors(_drained);
+1 -1
View File
@@ -852,7 +852,7 @@ public enum FlLatencyState : uint
/// <summary>A getter faulted: off until the game exits.</summary>
Faulted = 8,
/// <summary>A call had not returned after a second: nothing can stop it.</summary>
/// <summary>A call had not returned after two seconds: nothing can stop it.</summary>
Stalled = 9,
}
@@ -675,12 +675,33 @@ inline void ObserveSlShutdown(Accumulators& a) noexcept {
// ---------------------------------------------------------------------------------------------------------------------
inline constexpr uint32_t kLatSpans =
7u; // simulation, submit, present, driver, OS queue, GPU, total: the region's order
inline constexpr uint32_t kLatGpu = 5u;
inline constexpr uint32_t kLatTotal = 6u;
inline constexpr uint32_t kLatReportFrames = 64u;
inline constexpr uint64_t kLatSpanLimitUs = 1000000u;
static_assert(sizeof(NV_LATENCY_RESULT_PARAMS::frameReport) / sizeof(NV_LATENCY_RESULT_PARAMS::FrameReport) ==
kLatReportFrames);
// HOW A FRAME'S GPU SPAN AND THE DRIVER'S ACTIVE TIME STAND TO EACH OTHER (0.1.0-beta.49, owner decision D148). In one
// real game the mean active time was LONGER than the mean span between the two GPU marks (HANDOFF, item 46), and the
// two means cannot say why: the span's is over every summed frame, one of no length included, the active time's over
// the frames that gave one. So each summed frame is put in one place here, by its own two numbers, and the frames
// that have both are kept in two heaps -- the active time longer than the span, or not -- each with its count and
// both sums. No threshold: a span of one microsecond is a span. FOR THE NATIVE LOG ONLY: nothing of it is published,
// and which frames are summed does not depend on it.
struct LatencyGpuCounts {
uint32_t spanAbsent = 0; // no GPU start mark
uint32_t spanZero = 0; // the two GPU marks are the same instant
uint32_t activeNoSpan = 0; // an active time, and no span with a length
uint32_t spanNoActive = 0; // a span with a length, and no active time
uint32_t longerFrames = 0; // both, and the active time is the LONGER
uint32_t longerSpanUs = 0; // ... their spans
uint32_t longerActiveUs = 0; // ... their active times
uint32_t withinFrames = 0; // both, and the active time is no longer than the span
uint32_t withinSpanUs = 0;
uint32_t withinActiveUs = 0;
};
// What one read of the report added up to.
struct LatencyTally {
uint32_t frames = 0; // frames summed
@@ -688,10 +709,11 @@ struct LatencyTally {
uint32_t sumUs[kLatSpans]{}; // microseconds, over the frames summed
uint32_t lacking = 0; // bit n: a summed frame did not report span n
// The driver's two own times, each over the summed frames that gave one: a count apiece.
uint32_t activeSumUs = 0;
uint32_t activeFrames = 0;
uint32_t frameTimeSumUs = 0;
uint32_t frameTimeFrames = 0;
uint32_t activeSumUs = 0;
uint32_t activeFrames = 0;
uint32_t frameTimeSumUs = 0;
uint32_t frameTimeFrames = 0;
LatencyGpuCounts gpu; // the summed frames, each by its GPU span and its active time: the native log's
};
// Where the reader is in the game's frame ids: the newest one already summed or refused. 0 = none yet.
@@ -728,13 +750,45 @@ inline uint64_t LatencyFrameId(const NV_LATENCY_RESULT_PARAMS::FrameReport& lf)
// (an older driver leaves both zero, and so did the probe's frames, which had no work for the card); more than a
// second is a time no frame can have. Neither is summed, and neither refuses the frame: which frames the spans are
// made of does not depend on these.
inline bool LatencyTimeGiven(uint32_t us) noexcept {
return us != 0u && us <= kLatSpanLimitUs;
}
inline void LatencyAddTime(uint32_t us, uint32_t& sumUs, uint32_t& frames) noexcept {
if (us != 0u && us <= kLatSpanLimitUs) {
if (LatencyTimeGiven(us)) {
sumUs += us;
++frames;
}
}
// One summed frame's place in LatencyGpuCounts: its GPU span as LatencySpan gave it, and the driver's active time
// of the same frame, "given" by the rule LatencyAddTime sums it by. An impossible span never comes here -- its frame
// was refused.
inline void CountGpuTimes(uint32_t spanKind, uint32_t spanUs, uint32_t activeUs, LatencyGpuCounts& counts) noexcept {
const bool span = spanKind == kLatSpanReported && spanUs != 0u;
const bool active = LatencyTimeGiven(activeUs);
if (spanKind == kLatSpanAbsent) {
++counts.spanAbsent;
} else if (spanUs == 0u) {
++counts.spanZero;
}
if (span && active) {
if (activeUs > spanUs) {
++counts.longerFrames;
counts.longerSpanUs += spanUs;
counts.longerActiveUs += activeUs;
} else {
++counts.withinFrames;
counts.withinSpanUs += spanUs;
counts.withinActiveUs += activeUs;
}
} else if (active) {
++counts.activeNoSpan;
} else if (span) {
++counts.spanNoActive;
}
}
inline void ObserveLatencyFrame(const NV_LATENCY_RESULT_PARAMS::FrameReport& lf, LatencyTally& tally) noexcept {
uint32_t us[kLatSpans]{};
const uint32_t kind[kLatSpans] = {
@@ -764,6 +818,7 @@ inline void ObserveLatencyFrame(const NV_LATENCY_RESULT_PARAMS::FrameReport& lf,
}
LatencyAddTime(lf.gpuActiveRenderTimeUs, tally.activeSumUs, tally.activeFrames);
LatencyAddTime(lf.gpuFrameTimeUs, tally.frameTimeSumUs, tally.frameTimeFrames);
CountGpuTimes(kind[kLatGpu], us[kLatGpu], lf.gpuActiveRenderTimeUs, tally.gpu);
}
// One report: the frames newer than the cursor, the two newest left for the next read.
@@ -825,6 +880,154 @@ inline uint32_t LatencyMultiplierBit(uint32_t value) noexcept {
return 1u << (value > 31u ? 31u : value);
}
// ---------------------------------------------------------------------------------------------------------------------
// THE COUNTS, IN BATCHES, FOR THE NATIVE LOG (0.1.0-beta.49, owner decisions D148, D151). The watchdog's.
//
// A BATCH BELONGS TO ONE STATE of the driver's sleep status -- its low-latency switch, its "the game sleeps" switch
// and its frame-generation multiplier -- because the counts mean nothing apart from it: the owner's games switch
// Reflex on only with frame generation, and the low-latency switch may be the NVIDIA App's override and not the
// game's. A read in another state closes the batch before it is added. A state that flickers would write a batch a
// read, so after kLatStateClosures such closings a request's batches run to their length whatever the state, and the
// "seen" words of the batch say what it held.
//
// A batch is also closed after the request's tenth read, its thirtieth, and every sixtieth from there: a game that
// exits takes the watchdog with it, and what was not written by then is lost -- under a minute of it.
//
// AND HOW EVENLY THE READS CAME (owner decision D150): the milliseconds the batch spans and the watchdog's ticks in
// them, periodic and woken early. A read a second is a thousand milliseconds a read and as many periodic ticks as
// reads; anything else says which side of it was uneven.
// ---------------------------------------------------------------------------------------------------------------------
inline constexpr uint32_t kLatBatchFirst = 10u;
inline constexpr uint32_t kLatBatchSecond = 30u;
inline constexpr uint32_t kLatBatchEvery = 60u;
inline constexpr uint32_t kLatStateClosures = 32u;
inline constexpr uint32_t kLatStateUnknown = 0xFFFFFFFFu; // a read whose sleep status did not come back
inline constexpr uint32_t kLatStateSwitches = 1u | 8u; // bLowLatencyMode, bUseGameSleep (ObserveSleepStatus)
struct LatencyBatch {
uint32_t reads = 0; // reads whose report came back, in this batch
uint32_t frames = 0; // frames they summed
uint32_t refused = 0; // frames they refused
LatencyGpuCounts gpu;
uint32_t sleepOn = 0; // switches the status showed on in this batch
uint32_t sleepOff = 0; // ... and off
uint32_t multipliers = 0; // LatencyMultiplierBit of every multiplier it gave
uint32_t state = kLatStateUnknown; // LatencyStateOf its first read
// The watchdog's own, set by it: not a read's.
uint32_t spannedMs = 0; // from the batch before -- or the request -- to this one's writing
uint32_t ticksOnTime = 0; // its periodic ticks in that time
uint32_t ticksEarly = 0; // ... and the ticks something woke early
};
struct LatencyBatchBook {
LatencyBatch batch;
uint32_t okReads = 0; // reads whose report came back, since the request
uint32_t closures = 0; // batches a change of state closed, since the request
};
inline uint32_t LatencyStateOf(bool sleepValid, const LatencySleep& sleep) noexcept {
if (!sleepValid) {
return kLatStateUnknown;
}
return (sleep.on & kLatStateSwitches) | ((sleep.multiplier > 255u ? 255u : sleep.multiplier) << 8);
}
// Whether the batch is to be written BEFORE a read in `state` is added to it.
inline bool LatencyBatchTurns(const LatencyBatchBook& book, uint32_t state) noexcept {
return book.batch.reads != 0u && book.batch.state != state && book.closures < kLatStateClosures;
}
// Whether the batch is to be written AFTER the request's okReads-th read was added.
inline bool LatencyBatchDue(uint32_t okReads) noexcept {
if (okReads <= kLatBatchSecond) {
return okReads == kLatBatchFirst || okReads == kLatBatchSecond;
}
return (okReads - kLatBatchSecond) % kLatBatchEvery == 0u;
}
// A batch is sixty reads of sixty-two frames at most, and a time is a second at most: under 2^32 microseconds. The
// sums stop there all the same, so that a word never wraps into a small number.
inline void LatencyAddStop(uint32_t& sum, uint32_t value) noexcept {
sum = value > 0xFFFFFFFFu - sum ? 0xFFFFFFFFu : sum + value;
}
inline void LatencyBatchAdd(LatencyBatchBook& book, const LatencyTally& tally, bool sleepValid,
const LatencySleep& sleep) noexcept {
LatencyBatch& batch = book.batch;
if (batch.reads == 0u) {
batch.state = LatencyStateOf(sleepValid, sleep);
}
++batch.reads;
++book.okReads;
LatencyAddStop(batch.frames, tally.frames);
LatencyAddStop(batch.refused, tally.refused);
LatencyAddStop(batch.gpu.spanAbsent, tally.gpu.spanAbsent);
LatencyAddStop(batch.gpu.spanZero, tally.gpu.spanZero);
LatencyAddStop(batch.gpu.activeNoSpan, tally.gpu.activeNoSpan);
LatencyAddStop(batch.gpu.spanNoActive, tally.gpu.spanNoActive);
LatencyAddStop(batch.gpu.longerFrames, tally.gpu.longerFrames);
LatencyAddStop(batch.gpu.longerSpanUs, tally.gpu.longerSpanUs);
LatencyAddStop(batch.gpu.longerActiveUs, tally.gpu.longerActiveUs);
LatencyAddStop(batch.gpu.withinFrames, tally.gpu.withinFrames);
LatencyAddStop(batch.gpu.withinSpanUs, tally.gpu.withinSpanUs);
LatencyAddStop(batch.gpu.withinActiveUs, tally.gpu.withinActiveUs);
if (sleepValid) {
batch.sleepOn |= sleep.on & FL_LAT_SLEEP_BITS;
batch.sleepOff |= ~sleep.on & FL_LAT_SLEEP_BITS;
batch.multipliers |= LatencyMultiplierBit(sleep.multiplier);
}
}
// The batch as lines of the native log: a text, the line's `a` (printed in decimal) and its `b` (printed in hex).
inline constexpr uint32_t kLatBatchLines = 7u;
struct LatencyLogLine {
const char* text;
uint32_t a;
uint64_t b;
};
constexpr uint64_t LatencyPair(uint32_t high, uint32_t low) noexcept {
return (static_cast<uint64_t>(high) << 32) | low;
}
constexpr LatencyLogLine LatencyBatchLine(const LatencyBatch& batch, uint32_t line) noexcept {
switch (line) {
case 0u:
return {"reads / sleep switches on | off<<8 | multipliers seen<<16", batch.reads,
batch.sleepOn | (batch.sleepOff << 8) | (static_cast<uint64_t>(batch.multipliers) << 16)};
case 1u:
return {"frames summed / refused", batch.frames, batch.refused};
case 2u:
return {"GPU span absent / of no length", batch.gpu.spanAbsent, batch.gpu.spanZero};
case 3u:
return {"active time with no span / span with no active time", batch.gpu.activeNoSpan, batch.gpu.spanNoActive};
case 4u:
return {"active longer than span: frames / span us<<32 | active us", batch.gpu.longerFrames,
LatencyPair(batch.gpu.longerSpanUs, batch.gpu.longerActiveUs)};
case 5u:
return {"active within span: frames / span us<<32 | active us", batch.gpu.withinFrames,
LatencyPair(batch.gpu.withinSpanUs, batch.gpu.withinActiveUs)};
default:
return {"ms spanned / watchdog ticks on time<<32 | woken early", batch.spannedMs,
LatencyPair(batch.ticksOnTime, batch.ticksEarly)};
}
}
// The longest of those texts, for whoever writes them into a line of fixed length.
constexpr uint32_t LatencyBatchLongestText() noexcept {
uint32_t longest = 0u;
for (uint32_t line = 0u; line < kLatBatchLines; ++line) {
const char* text = LatencyBatchLine(LatencyBatch{}, line).text;
uint32_t length = 0u;
while (text[length] != '\0') {
++length;
}
longest = length > longest ? length : longest;
}
return longest;
}
// What the watchdog publishes of it. THE WATCHDOG'S: filled from what a read left behind while nobody is reading.
struct LatencyOut {
uint32_t state = FL_LAT_NONE; // FlLatencyState
@@ -0,0 +1,64 @@
// SPDX-License-Identifier: GPL-3.0-only
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
// When the Overlay's watchdog makes its PERIODIC tick (0.1.0-beta.49, owner decision D150).
//
// WHAT WAS WRONG. The watchdog waited a second AFTER each tick's work, so its ticks were a second and that work
// apart -- and a tick the LoadLibrary detour woke early counted as a tick like any other. The driver's latency
// report is read once for each tick that arms it, and region 5 is published once a tick; the Agent samples on a
// period of exactly one second. So the Overlay fell behind the Agent a little with every tick, a woken tick took a
// read and armed none, and a session's samples had holes: 0.4 to 16 % of them carried no report (HANDOFF, item 46).
//
// WHAT THIS IS. A grid in performance-counter ticks: the periodic tick is due at a deadline, and the next deadline is
// one period after the one that was due -- not after the moment the tick ran, so nothing accumulates. A tick woken
// early is still a tick (the loader's signals must be acted on at once) but not a periodic one: it does not move the
// grid. A periodic tick that ran more than half a period late does not get a second one right behind it: the grid
// starts again from that tick, so two periodic ticks are never less than half a period apart.
//
// Pure arithmetic, no call: the watchdog's loop (dllmain.cpp) is the only user, and fl_watchdog_tick_test drives it
// without a thread.
#ifndef FRAMELEDGER_FL_WATCHDOG_TICK_H
#define FRAMELEDGER_FL_WATCHDOG_TICK_H
#include <cstdint>
namespace fl::watchdog {
struct Grid {
int64_t period = 1; // performance-counter ticks between two periodic ticks
int64_t deadline = 0; // the counter value the next periodic tick is due at
};
inline void StartGrid(Grid& grid, int64_t now, int64_t period) noexcept {
grid.period = period > 0 ? period : 1;
grid.deadline = now + grid.period;
}
// How long to wait for the periodic tick, in whole milliseconds ROUNDED UP -- a wait rounded down ends before the
// deadline and would have to be followed by another of a millisecond -- and never more than `ceilingMs`. Zero when
// the tick is due.
inline uint32_t WaitMs(const Grid& grid, int64_t now, int64_t frequency, uint32_t ceilingMs) noexcept {
if (now >= grid.deadline || frequency <= 0) {
return 0u;
}
const int64_t ms = ((grid.deadline - now) * 1000 + frequency - 1) / frequency;
return ms > static_cast<int64_t>(ceilingMs) ? ceilingMs : static_cast<uint32_t>(ms);
}
// Whether the tick that begins at `now` is the periodic one. A wait that timed out is: Windows counts a timeout in
// its own clock's ticks, so it may end a little short of the deadline by this counter, and that tick is the one the
// wait was for. A wait a signal ended is periodic only when the deadline has passed all the same.
inline bool IsPeriodic(const Grid& grid, int64_t now, bool timedOut) noexcept {
return timedOut || now >= grid.deadline;
}
// The grid after a periodic tick that began at `now`.
inline void Advance(Grid& grid, int64_t now) noexcept {
const int64_t next = grid.deadline + grid.period;
grid.deadline = next - now < grid.period / 2 ? now + grid.period : next;
}
} // namespace fl::watchdog
#endif // FRAMELEDGER_FL_WATCHDOG_TICK_H
+104 -28
View File
@@ -61,6 +61,7 @@
#include <fl_sl_inputs.h>
#include <fl_sl_seen.h>
#include <fl_tolerance.h>
#include <fl_watchdog_tick.h>
#include <knownfolders.h>
#include <MinHook.h>
#include <shlobj_core.h>
@@ -143,7 +144,10 @@ void PublishHandshake() noexcept {
// the log that should have said which hooks went in and what they were handed
// ended before the game had loaded its upscaler. Events are few and bounded
// (installs, a handful of first sights, three faults at most), so this is a few
// appends per session, on the watchdog's own tick.
// appends per session, on the watchdog's own tick -- and, since 0.1.0-beta.49,
// six lines a batch of the driver read's frame counts (LATENCY_FRAMES: a batch
// a minute at most once a session is under way), only while a session asks for
// Advanced metrics and the driver is being read.
// ---------------------------------------------------------------------------
enum FlLogCode : uint32_t {
kLogRingCreated = 1,
@@ -166,6 +170,7 @@ enum FlLogCode : uint32_t {
kLogFfxConfigureType,
kLogPatchBatch,
kLogLatency,
kLogLatencyFrames,
};
const char* LogCodeName(uint32_t code) noexcept {
@@ -210,6 +215,8 @@ const char* LogCodeName(uint32_t code) noexcept {
return "PATCH_BATCH";
case kLogLatency:
return "LATENCY";
case kLogLatencyFrames:
return "LATENCY_FRAMES";
default:
return "?";
}
@@ -227,6 +234,8 @@ struct FlLogEvent {
static_assert(sizeof(FlLogEvent) == 96, "the native log's event: 256 of them are static storage in a game's process");
static_assert(sizeof(fl::inventory::RowName::text) <= sizeof(FlLogEvent::text),
"a row's module!symbol name must fit an event's text, or two rows could log the same truncated name");
static_assert(fl::adv::LatencyBatchLongestText() < sizeof(FlLogEvent::text),
"a line of the driver read's frame counts must fit an event's text: LogNote cuts without saying so");
constexpr uint32_t kLogCapacity = 256;
FlLogEvent g_log[kLogCapacity]{};
@@ -750,10 +759,12 @@ void PublishD3D12Device(ID3D12Device* device) noexcept {
// Nothing is hooked for it and nothing is loaded for it.
//
// WHO DOES WHAT. The WATCHDOG finds the module and the two addresses, once for the process, and arms the gate at
// most once a second. A PRESENTING THREAD that finds the gate armed makes the read, after its frame's record is
// published: a call the driver holds stops the thread that made it, and the watchdog -- which supervises, installs
// and flushes -- must never be that thread (spike-notes §31, M2). So the call delays one present a second by its own
// length: 0.5-2.6 us measured, and one of 2 ms or more is the last one this process makes (D141).
// each of its PERIODIC ticks -- one a second on a grid, never two within half a second (fl_watchdog_tick.h; until
// 0.1.0-beta.49 "at most once a second", on ticks a second and their own work apart). A PRESENTING THREAD that finds
// the gate armed makes the read, after its frame's record is published: a call the driver holds stops the thread that
// made it, and the watchdog -- which supervises, installs and flushes -- must never be that thread (spike-notes §31,
// M2). So the call delays one present a second by its own length: 0.5-2.6 us measured, and one of 2 ms or more is the
// last one this process makes (D141).
//
// THE GATE, four states in one word, is what makes that safe without a lock:
// idle nobody is reading. g_latRead is the watchdog's: it takes what the last read left, then may arm.
@@ -801,9 +812,11 @@ fl::adv::LatencyOut g_latOut;
bool g_latResolved = false; // the two addresses are in g_latApi
bool g_latFinal = false; // the module was looked at and will not be read; g_latOut.state says why
bool g_latStalled = false;
int64_t g_latArmedQpc = 0;
int64_t g_latReadingSinceQpc = 0;
uint32_t g_latLoggedState = FL_LAT_NONE;
// The frame counts of the reads, for the native log only (fl_adv_fields.h; owner decisions D148, D151).
fl::adv::LatencyBatchBook g_latBook;
int64_t g_latBatchBeganQpc = 0; // the request's start, or the batch before's writing
// One read, on a presenting thread that found the gate armed. Not inlined: RecordPresent stays as small as it was.
__declspec(noinline) void ReadLatencyOnce() noexcept {
@@ -890,9 +903,34 @@ const char* LatencyStateName(uint32_t state) noexcept {
}
}
// THE WATCHDOG'S HALF, once a tick while a session asks. `now` is this tick's QPC.
// The batch of frame counts in hand, as LATENCY_FRAMES lines; nothing when no read is in it. The watchdog's: at the
// batch's end, when the Agent asks for a flush, at a new request and at a stop -- whatever a game that exits by
// itself had not had written by then is lost, under a minute of it.
void WriteLatencyBatch() noexcept {
if (g_latBook.batch.reads == 0u) {
return;
}
const int64_t now = QpcNow();
const uint64_t ticks = now > g_latBatchBeganQpc ? static_cast<uint64_t>(now - g_latBatchBeganQpc) : 0u;
const uint64_t millis = g_logQpcFreq != 0u ? ticks * 1000ull / g_logQpcFreq : 0u;
g_latBook.batch.spannedMs = millis > 0xFFFFFFFFull ? 0xFFFFFFFFu : static_cast<uint32_t>(millis);
for (uint32_t line = 0; line < fl::adv::kLatBatchLines; ++line) {
const fl::adv::LatencyLogLine entry = fl::adv::LatencyBatchLine(g_latBook.batch, line);
LogNote(kLogLatencyFrames, entry.text, entry.a, entry.b);
}
g_latBook.batch = fl::adv::LatencyBatch{};
g_latBatchBeganQpc = now;
}
// THE WATCHDOG'S HALF, once a PERIODIC tick while a session asks -- never on a tick something woke early, so that
// what it takes is the read its last call armed and what it arms is taken by its next (owner decision D150). `now`
// is this tick's QPC.
void TickLatency(bool newRequest, int64_t now) noexcept {
if (newRequest) {
// What the session before left of a batch is its own, written before this one's counts begin.
WriteLatencyBatch();
g_latBook = fl::adv::LatencyBatchBook{};
g_latBatchBeganQpc = now;
// A session's counts are its own; where the read stands is the process's and stays.
g_latOut.reads = 0u;
g_latOut.worstUs = 0u;
@@ -936,6 +974,16 @@ void TickLatency(bool newRequest, int64_t now) noexcept {
if (g_latRead.ok != 0u) {
g_latOut.tally = g_latRead.tally;
fl::adv::NoteBits(g_adv.validMask, FL_ADV_VALID_LATENCY);
// The same read's frames, counted for the log: a batch is of one state of the sleep status.
const bool sleepValid = g_latRead.sleepValid != 0u;
if (fl::adv::LatencyBatchTurns(g_latBook, fl::adv::LatencyStateOf(sleepValid, g_latRead.sleep))) {
WriteLatencyBatch();
++g_latBook.closures;
}
fl::adv::LatencyBatchAdd(g_latBook, g_latRead.tally, sleepValid, g_latRead.sleep);
if (fl::adv::LatencyBatchDue(g_latBook.okReads)) {
WriteLatencyBatch();
}
}
if (g_latRead.sleepValid != 0u) {
g_latOut.sleepSeenOn |= g_latRead.sleep.on & FL_LAT_SLEEP_BITS;
@@ -1000,10 +1048,10 @@ void TickLatency(bool newRequest, int64_t now) noexcept {
return;
}
}
if (g_latArmedQpc == 0 || static_cast<uint64_t>(now - g_latArmedQpc) >= g_logQpcFreq) {
g_latArmedQpc = now;
g_latGate.store(kLatGateArmed, std::memory_order_release);
}
// One read for each periodic tick. Until 0.1.0-beta.49 this asked that a second had passed since the last arm:
// a tick a moment early then armed nothing, and the publication after it carried no read. The grid is what keeps
// two of these apart now -- half a second at the least.
g_latGate.store(kLatGateArmed, std::memory_order_release);
}
// The request went off: a read that was wanted and not yet made is not made in a session that never asked.
@@ -1499,9 +1547,11 @@ bool MayObserve() noexcept {
// ---------------------------------------------------------------------------
// Which Streamline features were evaluated since the last present. Bits, not a
// last-writer-wins value: DLSS super-resolution and Ray Reconstruction run in
// the SAME frame (fl_shm.h retired FL_UPSCALER_RETIRED_RAY_RECONSTRUCTION for
// exactly that reason), so a single slot would drop one of them.
// last-writer-wins value: a game may evaluate more than one feature between two
// presents (several viewports, NIS after DLSS), so a single slot would drop one
// of them. NOT because DLSS super-resolution and Ray Reconstruction run in the
// same frame, as this said until 2026-11-14: RR runs INSTEAD of super-resolution
// (Streamline's guide; the measurement at the RR arm of the present detour).
// FRAME GENERATION NEEDS A COUNT, NOT A BIT, so the word is now split: features in
// the low byte, a saturating count of kFeatureDLSS_G evaluations above them
// (fl_sl_seen.h owns the encoding and is unit-tested without a hook). A bit
@@ -1927,7 +1977,7 @@ PFN_LoadLibraryExW g_origLoadLibraryExW = nullptr;
constexpr uint32_t kLoaderInstalledBit = 0x8000u;
constexpr uint32_t kLoaderCountMask = 0x7FFFu;
std::atomic<uint32_t> g_loaderSignals{0};
// Auto-reset; the watchdog waits on it with its 1 s timeout, so a signal ends the
// Auto-reset; the watchdog waits on it until its periodic tick is due, so a signal ends the
// wait early and a missing event (creation failed) degrades to the plain sleep.
HANDLE g_watchdogWake = nullptr;
@@ -3533,13 +3583,30 @@ bool InstallRtHooks() noexcept {
// exists; see the block comment above for why a thread is acceptable in the
// Overlay and was not in the Vulkan layer.
DWORD WatchdogLoop() noexcept {
// THE PERIODIC TICK IS ON A GRID (fl_watchdog_tick.h; owner decision D150): one a second by the performance
// counter, whatever a tick's work took and however often the loader woke this thread in between.
const auto frequency = static_cast<int64_t>(g_logQpcFreq);
fl::watchdog::Grid grid;
fl::watchdog::StartGrid(grid, QpcNow(), frequency * kWatchdogIntervalMs / 1000);
bool latencyRequestIsNew = false; // a request not yet handed to TickLatency, which runs on periodic ticks
for (;;) {
// The 1 s tick, OR the LoadLibrary detour's wake -- whichever comes first.
// An event that failed to create degrades to the plain sleep.
// The periodic tick's deadline, OR the LoadLibrary detour's wake -- whichever comes first. An event that
// failed to create, or a wait that failed, degrades to the plain sleep.
const DWORD waitMs = fl::watchdog::WaitMs(grid, QpcNow(), frequency, kWatchdogIntervalMs);
bool timedOut = true;
if (g_watchdogWake != nullptr) {
WaitForSingleObject(g_watchdogWake, kWatchdogIntervalMs);
const DWORD waited = WaitForSingleObject(g_watchdogWake, waitMs);
if (waited == WAIT_FAILED) {
Sleep(waitMs);
}
timedOut = waited != WAIT_OBJECT_0;
} else {
Sleep(kWatchdogIntervalMs);
Sleep(waitMs);
}
const int64_t tickQpc = QpcNow();
const bool periodic = fl::watchdog::IsPeriodic(grid, tickQpc, timedOut);
if (periodic) {
fl::watchdog::Advance(grid, tickQpc);
}
if (g_observing.load(std::memory_order_acquire) == 0) {
@@ -3560,6 +3627,7 @@ DWORD WatchdogLoop() noexcept {
std::atomic_ref<uint32_t> flushReq{g_control->logFlushRequested};
if (const uint32_t req = flushReq.load(std::memory_order_acquire); req != g_logFlushSeen) {
g_logFlushSeen = req;
WriteLatencyBatch(); // what is counted of the driver read so far is part of what the Agent asks for
FlushLog();
}
@@ -3568,24 +3636,31 @@ DWORD WatchdogLoop() noexcept {
// one writer. With the word at 0 nothing more is read in any hook and the region is never touched. A request
// not seen before is a new session's: the summaries start afresh BEFORE the detours are let in, so a range or
// a count never spans two sessions of a game that kept running.
//
// THE REQUEST IS FOLLOWED ON EVERY TICK, THE REGION IS WRITTEN ON THE PERIODIC ONE (0.1.0-beta.49, D150). The
// installers below put in the hooks a session asked for in the very tick that saw the request -- a tick the
// loader woke, when the game has just loaded Streamline -- so the word is read and the flag stored whatever
// the tick. The read of the driver and the publication are once a second: a tick woken early used to take the
// read, publish it and arm nothing, and the publication after it had no read in it.
std::atomic_ref<uint32_t> advancedReq{g_control->advancedRequested};
const uint32_t advancedNow = advancedReq.load(std::memory_order_acquire);
const bool advancedIsNew = advancedNow != 0u && advancedNow != g_advancedSeen;
if (advancedIsNew) {
if (advancedNow != 0u && advancedNow != g_advancedSeen) {
fl::adv::Reset(g_adv);
g_advancedSeen = advancedNow;
latencyRequestIsNew = true;
}
g_advancedRequested.store(advancedNow != 0u ? 1u : 0u, std::memory_order_relaxed);
if (advancedNow != 0u) {
// Initialised through QuadPart, the member read below, so that it is the active one (cpp:S6232).
LARGE_INTEGER advancedQpc{.QuadPart = 0};
QueryPerformanceCounter(&advancedQpc);
if (advancedNow == 0u) {
DisarmLatency();
} else if (periodic) {
++g_latBook.batch.ticksOnTime;
// The driver's latency report (train C): what the last read left is taken, and the next one armed,
// BEFORE the publication -- so the publication carries the read, and carries it once.
TickLatency(advancedIsNew, advancedQpc.QuadPart);
fl::adv::Publish(g_adv, g_advanced, advancedNow, static_cast<uint64_t>(advancedQpc.QuadPart), &g_latOut);
TickLatency(latencyRequestIsNew, tickQpc);
latencyRequestIsNew = false;
fl::adv::Publish(g_adv, g_advanced, advancedNow, static_cast<uint64_t>(tickQpc), &g_latOut);
} else {
DisarmLatency();
++g_latBook.batch.ticksEarly;
}
// The in-process stop, for a title that is NOT presenting (menu, hung,
@@ -3698,6 +3773,7 @@ DWORD WINAPI WatchdogThread(LPVOID) noexcept {
}
}
const bool complete = g_stopLogged.load(std::memory_order_acquire) != 0u;
WriteLatencyBatch(); // the watchdog's own book: no presenting thread ever touches it
LogNote(kLogStopFlushed, complete ? "every stop line is above" : "the stop was still writing", complete ? 1u : 0u);
FlushLog(true);
return r;
+7 -4
View File
@@ -176,9 +176,12 @@ enum FlUpscaler : uint8_t {
FL_UPSCALER_DLSS = 1,
// RETIRED, and the slot is reserved rather than reused. DLSS Ray
// Reconstruction was a value here, which made it MUTUALLY EXCLUSIVE with
// DLSS super-resolution -- but they run together, and 03_METRICS §RT/PT/RR
// makes RR an independent tri-state axis ("Yes / No if DLSS is active
// Reconstruction was a value here, which made it a technology BESIDE DLSS
// -- but it is DLSS: RR takes over the upscale, in DLSS's own quality mode
// (it does not run together with super-resolution, as this comment said
// until 2026-11-14: Streamline's guide has it "completely override" it, and
// Cyberpunk 2077 evaluated kFeatureDLSS_RR and never kFeatureDLSS). 03_METRICS
// §RT/PT/RR makes RR an independent tri-state axis ("Yes / No if DLSS is active
// without it"), which is also CLAUDE.md rule 7's trio. The record was the
// only place the two were conflated; 06_DATA_MODEL already stored them
// apart. RR is now FL_FEAT_RAY_RECONSTRUCTION in featureFlags.
@@ -1003,7 +1006,7 @@ enum FlLatencyState : uint32_t {
FL_LAT_ERROR = 6, // the last read returned an NVAPI status that is not OK; reading goes on
FL_LAT_SLOW = 7, // one call took 2 ms or more: off until the game exits (D141)
FL_LAT_FAULTED = 8, // a getter faulted: off until the game exits, and counted once in faultCount
FL_LAT_STALLED = 9, // a call had not returned after a second: nothing can stop it; reported and left
FL_LAT_STALLED = 9, // a call had not returned after two seconds: nothing can stop it; reported and left
};
// latState, above the state: the driver's sleep status as SEEN -- a switch can be in both groups in one session.
+10
View File
@@ -207,6 +207,16 @@ target_compile_definitions(fl_reflex_summary_test PRIVATE WIN32_LEAN_AND_MEAN NO
add_test(NAME fl_reflex_summary COMMAND fl_reflex_summary_test)
fl_catch2_test_completes(fl_reflex_summary)
# fl_watchdog_tick.h (0.1.0-beta.49, D150): when the Overlay's watchdog makes its periodic tick -- a grid that does
# not drift with a tick's work, a tick woken early that does not move it, a wait never rounded down, and two
# periodic ticks never within half a period. Pure arithmetic: no thread, no clock, no Windows header.
add_executable(fl_watchdog_tick_test watchdog_tick_test.cpp)
target_include_directories(fl_watchdog_tick_test PRIVATE "${CMAKE_SOURCE_DIR}/FrameLedger.Overlay/include")
target_link_libraries(fl_watchdog_tick_test PRIVATE fl_native_flags Catch2::Catch2WithMain)
target_compile_options(fl_watchdog_tick_test PRIVATE /EHsc)
add_test(NAME fl_watchdog_tick COMMAND fl_watchdog_tick_test)
fl_catch2_test_completes(fl_watchdog_tick)
# fl_ffx_types.h (0.1.0-beta.42, D121): the descriptor types an ffx-api module was handed, kept by the detours for
# the native log. The header the Overlay compiles, driven without the Overlay -- including from eight threads.
add_executable(fl_ffx_types_test ffx_types_test.cpp)
+281
View File
@@ -21,6 +21,7 @@
#include <catch2/catch_test_macros.hpp>
#include <catch2/reporters/catch_reporter_event_listener.hpp>
#include <catch2/reporters/catch_reporter_registrars.hpp>
#include <chrono>
#include <cstdio>
#include <cstring>
#include <cwchar>
@@ -6198,6 +6199,38 @@ bool LogHasLine(const std::string& text, const char* code, const std::string& na
return false;
}
// The `a` and `b` of the LAST line of this code whose text starts with `name`; false when there is none.
bool LogLineWords(const std::string& text, const char* code, const std::string& name, uint32_t& a, uint64_t& b) {
const std::string head = std::string("s ") + code + " ";
bool found = false;
std::size_t at = 0;
while (at < text.size()) {
std::size_t end = text.find('\n', at);
if (end == std::string::npos) {
end = text.size();
}
const std::string line = text.substr(at, end - at);
const std::size_t h = line.find(head);
const std::size_t words = line.rfind(" a=");
if (h != std::string::npos && words != std::string::npos) {
std::size_t n = h + head.size();
while (n < line.size() && line[n] == ' ') {
++n;
}
unsigned first = 0;
unsigned long long second = 0;
if (line.compare(n, name.size(), name) == 0 &&
sscanf_s(line.c_str() + words, " a=%u b=0x%llx", &first, &second) == 2) {
a = first;
b = second;
found = true;
}
}
at = end + 1;
}
return found;
}
std::size_t CountOf(const std::string& text, const char* needle) {
std::size_t n = 0;
for (std::size_t at = text.find(needle); at != std::string::npos; at = text.find(needle, at + 1)) {
@@ -7344,6 +7377,13 @@ TEST_CASE("FSR's plane at infinity (beta.42, D119): a far plane of FLT_MAX reach
SetAdvancedRequest(r, 11u);
fl::FlAdvancedState a{};
REQUIRE(ReadAdvanced(r, 11u, a, 0u, fl::FL_ADV_VALID_FFX_UPSCALE));
// The ranges are since the request, and the first publication that carries the descriptor may hold one dispatch
// of it: since 0.1.0-beta.49 a request seen on a tick the loader woke is published by the periodic tick that
// follows, however soon that is. The field of view alternates, so both of its values have been seen once the
// range is one.
for (int i = 0; i < 5 && a.ffxFovMinBits == a.ffxFovMaxBits; ++i) {
REQUIRE(ReadAdvanced(r, 11u, a, a.samples, fl::FL_ADV_VALID_FFX_UPSCALE));
}
INFO("near 0x" << std::hex << a.ffxNearBits << " far 0x" << a.ffxFarBits);
CHECK(a.ffxFarBits == FL_ADV_FLOAT_INFINITE);
CHECK(std::bit_cast<float>(a.ffxFarBits) > 3.0e38f); // the float it decodes to IS infinity
@@ -7857,6 +7897,247 @@ bool TargetHasModule(HANDLE process, const wchar_t* leaf) {
} // namespace
TEST_CASE("the frames a read summed are counted in the native log, each by its GPU span and the driver's active time: "
"a batch after ten reads, and what is left when the Agent asks",
"[guard][inject][shm][advanced][latency][log]") {
// WHY (0.1.0-beta.49, owner decisions D148, D151). In one real game the mean active time was longer than the mean
// span between the two GPU marks, and the two means cannot say whether that is the driver's doing or the way they
// are taken. The counts that can are written to the log only -- nothing of them is published -- in batches that
// each belong to one state of the sleep status.
LatencyTarget t;
REQUIRE(StartLatencyTarget(t, LatencyArgs(L"--hold-presenting-d3d12 40"), true));
const MappedRing& r = t.r;
fl::stubnv::Shared* stub = t.stub.words;
if (stub == nullptr || r.st == nullptr || r.ctl == nullptr) {
return; // not reached after the REQUIRE; said in the form a static analyser follows (cpp:S2259)
}
REQUIRE(WaitForRecords(r));
SetStubWord(stub->mode, fl::stubnv::kModeGpuShapes); // before the first read: every read is of these frames
SetAdvancedRequest(r, 7u);
// Ten reads sum the frames 5000..5151: sixty-two, then ten a read. By frameID % 5 (fl_stub_nvapi_shared.h) that is
// 31, 31, 30, 30, 30 of the five shapes.
const uint32_t zero = 31u + 30u; // shapes 1 and 4
const uint32_t longer = 30u; // shape 2
const uint32_t within = 31u; // shape 0
char tails[6][64]{};
snprintf(tails[0], sizeof(tails[0]), " a=10 b=0x%x", (1u | 8u) | ((2u | 4u | 16u) << 8) | ((1u << 2) << 16));
snprintf(tails[1], sizeof(tails[1]), " a=152 b=0x0");
snprintf(tails[2], sizeof(tails[2]), " a=0 b=0x%x", zero);
snprintf(tails[3], sizeof(tails[3]), " a=30 b=0x%x", 30u); // shape 4; shape 3
snprintf(tails[4], sizeof(tails[4]), " a=%u b=0x%llx", longer,
(static_cast<unsigned long long>(longer) * fl::stubnv::kGpuUs << 32) |
(static_cast<unsigned long long>(longer) * fl::stubnv::kGpuActiveLongUs));
snprintf(tails[5], sizeof(tails[5]), " a=%u b=0x%llx", within,
(static_cast<unsigned long long>(within) * fl::stubnv::kGpuUs << 32) |
(static_cast<unsigned long long>(within) * fl::stubnv::kGpuActiveUs));
const char* names[6] = {"reads / sleep switches", "frames summed / refused", "GPU span absent / of no length",
"active time with no span", "active longer than span", "active within span"};
std::wstring log;
std::string text;
bool complete = false;
for (int i = 0; i < 500 && !complete; ++i) {
++r.ctl->guardTicks;
Sleep(50);
if (i % 10 != 9 || (log.empty() && !FindOverlayLog(t.child.pi.dwProcessId, t.child.pi.hProcess, log))) {
continue;
}
text = ReadWholeFile(log);
complete = CountOf(text, "LATENCY_FRAMES") >= 7u;
}
INFO("log " << Narrow(log) << ":\n" << text);
REQUIRE(complete);
for (int line = 0; line < 6; ++line) {
INFO("line " << line << ": " << names[line] << " ..." << tails[line]);
CHECK(LogHasLine(text, "LATENCY_FRAMES", names[line], tails[line]));
}
// The seventh line is the watchdog's own: ten reads took about ten seconds and ten periodic ticks or a few more
// (the ticks before the module was found), and the loader woke it at most a few times.
uint32_t spannedMs = 0;
uint64_t ticks = 0;
REQUIRE(LogLineWords(text, "LATENCY_FRAMES", "ms spanned", spannedMs, ticks));
CHECK(spannedMs >= 9000u);
CHECK(spannedMs <= 16000u);
CHECK((ticks >> 32) >= 10u);
CHECK((ticks >> 32) <= 16u);
CHECK((ticks & 0xFFFFFFFFu) <= 8u);
CHECK(CountOf(text, "LATENCY_FRAMES") == 7u); // one batch: the next is twenty reads away
CHECK(r.ctl->logFlushRequested == 0u); // nobody asked for it
// What is published is what it was: these counts are the log's.
fl::FlAdvancedState a{};
REQUIRE(ReadAdvanced(r, 7u, a, 0u, fl::FL_ADV_VALID_LATENCY));
CHECK(LatStateOf(a) == fl::FL_LAT_READING);
for (uint32_t word : a.reservedDlss) {
CHECK(word == 0u);
}
// ---- THE REST, WHEN THE AGENT ASKS. A few reads more, then a flush request: the batch in hand is written with
// the log, seven lines whose frames are ten a read.
TickFor(r, 3200);
++r.ctl->logFlushRequested;
complete = false;
for (int i = 0; i < 100 && !complete; ++i) {
++r.ctl->guardTicks;
Sleep(50);
if (i % 10 == 9) {
text = ReadWholeFile(log);
complete = CountOf(text, "LATENCY_FRAMES") >= 14u;
}
}
INFO("log after the flush request:\n" << text);
REQUIRE(complete);
CHECK(CountOf(text, "LATENCY_FRAMES") == 14u);
bool rest = false;
for (uint32_t reads = 1u; reads < 20u && !rest; ++reads) { // the thirtieth read would close it itself
char frames[32]{};
snprintf(frames, sizeof(frames), " a=%u b=0x0", reads * fl::stubnv::kFrameIdStep);
rest = LogHasLine(text, "LATENCY_FRAMES", names[1], frames);
}
CHECK(rest);
CHECK(r.st->faultCount == 0u);
}
TEST_CASE("a watchdog the loader keeps waking reads the driver once a second all the same, and every publication "
"carries a read",
"[guard][inject][shm][advanced][latency][log]") {
// WHAT A REAL SESSION SHOWED (HANDOFF, item 46): 0.4 to 16 % of a session's samples carried no report. The
// watchdog's ticks were a second and their own work apart, and a tick the LoadLibrary detour woke took the read,
// published it and armed none. Here a thread asks the loader for opengl32.dll for as long as the target lives --
// a module the detour wakes the watchdog for, and one the harness already holds, so nothing is ever unloaded
// under a hook: the watchdog is woken without pause. Until 0.1.0-beta.49 every such tick published region 5.
// (sl.common.dll, D123's churn, wakes nobody: it is in neither the inventory nor the census.)
LatencyTarget t;
const std::wstring presenting = L"--churn-module opengl32.dll --hold-presenting-d3d12 30";
REQUIRE(StartLatencyTarget(t, LatencyArgs(presenting.c_str()), true));
const MappedRing& r = t.r;
fl::stubnv::Shared* stub = t.stub.words;
if (stub == nullptr || r.st == nullptr || r.ctl == nullptr) {
return; // not reached after the REQUIRE; said in the form a static analyser follows (cpp:S2259)
}
REQUIRE(WaitForRecords(r));
SetAdvancedRequest(r, 7u);
fl::FlAdvancedState first{};
REQUIRE(ReadAdvanced(r, 7u, first, 0u, fl::FL_ADV_VALID_LATENCY)); // the first publication with a read
// Eight seconds of publications, looked for every 20 ms: far finer than the half second two may be apart.
uint32_t lastSamples = first.samples;
uint32_t withFrames = 0;
uint32_t withoutFrames = 0;
bool twoAtOnce = false;
long long closestMs = 1'000'000;
const auto began = std::chrono::steady_clock::now();
auto lastAt = began;
bool haveLast = false;
while (std::chrono::steady_clock::now() - began < std::chrono::milliseconds(8000)) {
++r.ctl->guardTicks;
Sleep(20);
fl::FlAdvancedState a{};
if (!CopyAdvanced(r, a) || a.request != 7u || a.samples == lastSamples) {
continue;
}
const auto at = std::chrono::steady_clock::now();
twoAtOnce = twoAtOnce || a.samples != lastSamples + 1u;
if (haveLast) {
const long long apart = std::chrono::duration_cast<std::chrono::milliseconds>(at - lastAt).count();
closestMs = apart < closestMs ? apart : closestMs;
}
haveLast = true;
lastAt = at;
lastSamples = a.samples;
if ((a.latFrames & 0xFFFFu) != 0u) {
++withFrames;
} else {
++withoutFrames;
}
}
const uint32_t publications = lastSamples - first.samples;
INFO("publications " << publications << " in eight seconds: " << withFrames << " with frames, " << withoutFrames
<< " without; the two closest " << closestMs << " ms apart; stub calls "
<< StubWord(stub->latencyCalls));
CHECK(publications >= 6u);
CHECK(publications <= 9u); // one a second: not one for every time the loader woke the thread
CHECK_FALSE(twoAtOnce); // never two inside one look
CHECK(closestMs >= 400); // half a second at the least, less what the looking itself costs
CHECK(withoutFrames <= 1u); // a publication carries the read its tick's predecessor armed
CHECK(withFrames + 1u >= publications);
CHECK(StubWord(stub->latencyCalls) + 2u >= publications);
CHECK(StubWord(stub->latencyCalls) <= publications + 3u);
// THE FIXTURE DID WAKE IT: the batch's own line says how many ticks were on time and how many were woken early.
++r.ctl->logFlushRequested;
std::wstring log;
std::string text;
uint32_t spannedMs = 0;
uint64_t ticks = 0;
bool written = false;
for (int i = 0; i < 100 && !written; ++i) {
++r.ctl->guardTicks;
Sleep(50);
if (i % 10 != 9 || (log.empty() && !FindOverlayLog(t.child.pi.dwProcessId, t.child.pi.hProcess, log))) {
continue;
}
text = ReadWholeFile(log);
written = LogLineWords(text, "LATENCY_FRAMES", "ms spanned", spannedMs, ticks);
}
INFO("log " << Narrow(log) << ":\n" << text);
REQUIRE(written);
const auto onTime = static_cast<uint32_t>(ticks >> 32);
const auto wokenEarly = static_cast<uint32_t>(ticks & 0xFFFFFFFFu);
INFO("the batch spans " << spannedMs << " ms: " << onTime << " ticks on time, " << wokenEarly << " woken early");
CHECK(wokenEarly > 20u); // or this case proved nothing about a woken watchdog
CHECK(onTime >= 6u);
CHECK(onTime * 1000u <= spannedMs + 1500u); // a tick a second, by the batch's own clock
CHECK(r.st->faultCount == 0u);
}
// A number for a pull request, not a gate: how evenly the reads come over a minute and a half, by the batches' own
// seventh line. Hidden: `fl_guard_test "[.measure]"`.
TEST_CASE("how evenly the driver is read over ninety reads, with a quiet loader and with one that never stops",
"[.measure]") {
for (const wchar_t* presenting :
{L"--hold-presenting-d3d12 110", L"--churn-module opengl32.dll --hold-presenting-d3d12 110"}) {
LatencyTarget t;
REQUIRE(StartLatencyTarget(t, LatencyArgs(presenting), true));
const MappedRing& r = t.r;
REQUIRE(WaitForRecords(r));
SetAdvancedRequest(r, 7u);
std::wstring log;
std::string text;
for (int i = 0; i < 2100 && CountOf(text, "ms spanned") < 3u; ++i) {
++r.ctl->guardTicks;
Sleep(50);
if (i % 20 == 19 && (!log.empty() || FindOverlayLog(t.child.pi.dwProcessId, t.child.pi.hProcess, log))) {
text = ReadWholeFile(log);
}
}
// The numbers of each batch's first and last line, parsed: what a file held is never printed as it stands
// (SonarCloud's cppsecurity:S5145 on a line of the log handed to printf).
std::printf("%ls\n", presenting);
std::size_t at = 0;
while (at < text.size()) {
std::size_t end = text.find('\n', at);
end = end == std::string::npos ? text.size() : end;
const std::string line = text.substr(at, end - at);
const std::size_t words = line.rfind(" a=");
unsigned first = 0;
unsigned long long second = 0;
if (line.find("LATENCY_FRAMES") != std::string::npos && words != std::string::npos &&
sscanf_s(line.c_str() + words, " a=%u b=0x%llx", &first, &second) == 2) {
if (line.find("reads /") != std::string::npos) {
std::printf(" %u reads", first);
} else if (line.find("ms spanned") != std::string::npos) {
std::printf(" in %u ms: %llu ticks on time, %llu woken early\n", first, second >> 32,
second & 0xFFFFFFFFull);
}
}
at = end + 1;
}
CHECK(CountOf(text, "ms spanned") >= 3u);
}
}
TEST_CASE("the driver's latency report is read only while a session asks, once a second, and stops with the request "
"and with the hooks",
"[guard][inject][shm][advanced][latency]") {
+238
View File
@@ -12,7 +12,10 @@
// read as a game that has stopped.
#include <catch2/catch_test_macros.hpp>
#include <chrono>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <fl_adv_fields.h>
#include <memory>
@@ -310,3 +313,238 @@ TEST_CASE("a publication carries one read, packed as fl_shm.h says, and carries
CHECK(untouched.latGpuCounts == 0u);
CHECK(untouched.latMultipliersSeen == 0u);
}
// ---------------------------------------------------------------------------------------------------------------------
// THE COUNTS FOR THE NATIVE LOG (0.1.0-beta.49, owner decisions D148, D151).
// ---------------------------------------------------------------------------------------------------------------------
TEST_CASE("each summed frame is counted by its GPU span and the driver's active time, and what is summed does not move",
"[latency]") {
fl::adv::LatencyCursor cursor;
fl::adv::LatencyTally tally;
auto report = Report(100u); // 100..163: 100..161 are summed
for (std::uint32_t i = 0; i < 64u; ++i) {
Frame& f = report->frameReport[i];
switch (i % 6u) {
case 0u: // a span of 3700 and an active time that is the shorter
f.gpuActiveRenderTimeUs = 3500u;
break;
case 1u: // the two marks at one instant, and no active time
f.gpuRenderStartTime = f.gpuRenderEndTime;
break;
case 2u: // an active time longer than the span
f.gpuActiveRenderTimeUs = 4000u;
break;
case 3u: // the span, and no active time
break;
case 4u: // the two marks at one instant, and an active time
f.gpuRenderStartTime = f.gpuRenderEndTime;
f.gpuActiveRenderTimeUs = 3500u;
break;
default: // no start mark, and an active time
f.gpuRenderStartTime = 0u;
f.gpuActiveRenderTimeUs = 3500u;
break;
}
}
fl::adv::ObserveLatencyReport(*report, cursor, tally);
// Sixty-two frames: eleven each of the first two shapes, ten each of the other four.
REQUIRE(tally.frames == 62u);
CHECK(tally.refused == 0u);
CHECK(tally.gpu.withinFrames == 11u);
CHECK(tally.gpu.withinSpanUs == 11u * 3700u);
CHECK(tally.gpu.withinActiveUs == 11u * 3500u);
CHECK(tally.gpu.longerFrames == 10u);
CHECK(tally.gpu.longerSpanUs == 10u * 3700u);
CHECK(tally.gpu.longerActiveUs == 10u * 4000u);
CHECK(tally.gpu.spanZero == 11u + 10u);
CHECK(tally.gpu.spanAbsent == 10u);
CHECK(tally.gpu.spanNoActive == 10u);
CHECK(tally.gpu.activeNoSpan == 10u + 10u);
// Every summed frame is in exactly one place: the four counted here, or neither a span nor an active time -- the
// eleven whose two marks are one instant and that gave no time.
const std::uint32_t placed =
tally.gpu.withinFrames + tally.gpu.longerFrames + tally.gpu.spanNoActive + tally.gpu.activeNoSpan;
CHECK(placed + 11u == tally.frames);
// WHAT IS PUBLISHED IS WHAT IT WAS: the span over every frame that reported one, the time over those that gave one.
CHECK(tally.sumUs[fl::adv::kLatGpu] == (11u + 10u + 10u) * 3700u);
CHECK((tally.lacking & (1u << fl::adv::kLatGpu)) != 0u);
CHECK(tally.activeFrames == 11u + 10u + 10u + 10u);
CHECK(tally.activeSumUs == 31u * 3500u + 10u * 4000u);
CHECK(tally.sumUs[fl::adv::kLatTotal] == 62u * 7500u);
}
TEST_CASE(
"an active time as long as the span is not the longer; one of over a second was not given; a refused frame is "
"not counted",
"[latency]") {
fl::adv::LatencyGpuCounts counts;
fl::adv::CountGpuTimes(fl::adv::kLatSpanReported, 3700u, 3700u, counts);
CHECK(counts.withinFrames == 1u);
CHECK(counts.longerFrames == 0u);
fl::adv::CountGpuTimes(fl::adv::kLatSpanReported, 1u, 2u, counts); // a span of a microsecond is a span
CHECK(counts.longerFrames == 1u);
CHECK(counts.longerSpanUs == 1u);
CHECK(counts.longerActiveUs == 2u);
CHECK(counts.spanZero == 0u);
fl::adv::CountGpuTimes(fl::adv::kLatSpanReported, 3700u, 1'000'001u, counts); // no frame has such a time
CHECK(counts.spanNoActive == 1u);
CHECK(counts.longerFrames == 1u);
fl::adv::LatencyCursor cursor;
fl::adv::LatencyTally tally;
auto report = Report(100u);
for (auto& f : report->frameReport) {
f.gpuActiveRenderTimeUs = 3500u;
}
report->frameReport[5].presentEndTime = report->frameReport[5].presentStartTime - 50u; // refused whole
fl::adv::ObserveLatencyReport(*report, cursor, tally);
CHECK(tally.frames == 61u);
CHECK(tally.refused == 1u);
CHECK(tally.gpu.withinFrames == 61u);
CHECK(tally.gpu.withinSpanUs == 61u * 3700u);
}
TEST_CASE("a batch of the log's counts is written after ten reads, after thirty, and every sixty from there",
"[latency]") {
std::uint32_t due = 0u;
for (std::uint32_t reads = 1u; reads <= 400u; ++reads) {
const bool expected = reads == 10u || reads == 30u || reads == 90u || reads == 150u || reads == 210u ||
reads == 270u || reads == 330u || reads == 390u;
CHECK(fl::adv::LatencyBatchDue(reads) == expected);
due += fl::adv::LatencyBatchDue(reads) ? 1u : 0u;
}
CHECK(due == 8u);
CHECK_FALSE(fl::adv::LatencyBatchDue(0u));
}
TEST_CASE("a batch belongs to one state of the sleep status: another state closes it, until a request has closed "
"thirty-two that way",
"[latency]") {
fl::adv::LatencyTally tally;
tally.frames = 10u;
tally.refused = 1u;
tally.gpu.spanZero = 2u;
tally.gpu.longerFrames = 3u;
tally.gpu.longerSpanUs = 300u;
tally.gpu.longerActiveUs = 450u;
tally.gpu.withinFrames = 4u;
tally.gpu.withinSpanUs = 4000u;
tally.gpu.withinActiveUs = 3600u;
// The state: the low-latency switch, "the game sleeps", and the multiplier -- not the other three switches.
const fl::adv::LatencySleep reflexTwo{1u | 8u, 2u};
const fl::adv::LatencySleep reflexTwoVrr{1u | 2u | 8u | 16u, 2u};
const fl::adv::LatencySleep overrideOne{1u, 1u};
const fl::adv::LatencySleep manyFrames{0u, 900u};
CHECK(fl::adv::LatencyStateOf(true, reflexTwo) == ((1u | 8u) | (2u << 8)));
CHECK(fl::adv::LatencyStateOf(true, reflexTwoVrr) == fl::adv::LatencyStateOf(true, reflexTwo));
CHECK(fl::adv::LatencyStateOf(true, overrideOne) != fl::adv::LatencyStateOf(true, reflexTwo));
CHECK(fl::adv::LatencyStateOf(false, reflexTwo) == fl::adv::kLatStateUnknown);
CHECK(fl::adv::LatencyStateOf(true, manyFrames) == (255u << 8));
fl::adv::LatencyBatchBook book;
CHECK_FALSE(fl::adv::LatencyBatchTurns(book, fl::adv::LatencyStateOf(true, reflexTwo))); // nothing to close
fl::adv::LatencyBatchAdd(book, tally, true, reflexTwo);
fl::adv::LatencyBatchAdd(book, tally, true, reflexTwoVrr);
CHECK(book.okReads == 2u);
CHECK(book.batch.reads == 2u);
CHECK(book.batch.frames == 20u);
CHECK(book.batch.refused == 2u);
CHECK(book.batch.gpu.spanZero == 4u);
CHECK(book.batch.gpu.longerFrames == 6u);
CHECK(book.batch.gpu.longerActiveUs == 900u);
CHECK(book.batch.gpu.withinSpanUs == 8000u);
CHECK(book.batch.state == fl::adv::LatencyStateOf(true, reflexTwo));
CHECK(book.batch.sleepOn == (1u | 2u | 8u | 16u));
CHECK(book.batch.sleepOff == (2u | 4u | 16u)); // off in one read or the other
CHECK(book.batch.multipliers == (1u << 2));
CHECK_FALSE(fl::adv::LatencyBatchTurns(book, fl::adv::LatencyStateOf(true, reflexTwoVrr)));
CHECK(fl::adv::LatencyBatchTurns(book, fl::adv::LatencyStateOf(true, overrideOne)));
CHECK(fl::adv::LatencyBatchTurns(book, fl::adv::kLatStateUnknown)); // a read with no status is a state too
// A read with no status adds its frames and nothing to the "seen" words.
fl::adv::LatencyBatchAdd(book, tally, false, overrideOne);
CHECK(book.batch.reads == 3u);
CHECK(book.batch.sleepOn == (1u | 2u | 8u | 16u));
CHECK(book.batch.multipliers == (1u << 2));
// A status that flickers: after thirty-two closings the batch runs on, and says what it held.
book.closures = fl::adv::kLatStateClosures;
CHECK_FALSE(fl::adv::LatencyBatchTurns(book, fl::adv::LatencyStateOf(true, overrideOne)));
fl::adv::LatencyBatchAdd(book, tally, true, overrideOne);
CHECK(book.batch.state == fl::adv::LatencyStateOf(true, reflexTwo)); // its first read's
CHECK(book.batch.multipliers == ((1u << 1) | (1u << 2)));
CHECK(book.batch.sleepOff == (2u | 4u | 8u | 16u));
// A sum stops at the top of its word instead of wrapping into a small number.
std::uint32_t sum = 0xFFFFFFF0u;
fl::adv::LatencyAddStop(sum, 0x20u);
CHECK(sum == 0xFFFFFFFFu);
}
TEST_CASE("a batch is seven lines of the log: a text that fits, a count in decimal, and a word in hex", "[latency]") {
fl::adv::LatencyBatch batch;
batch.reads = 10u;
batch.frames = 152u;
batch.refused = 3u;
batch.sleepOn = 1u | 8u;
batch.sleepOff = 2u | 4u | 16u;
batch.multipliers = 1u << 2;
batch.gpu.spanAbsent = 5u;
batch.gpu.spanZero = 61u;
batch.gpu.activeNoSpan = 30u;
batch.gpu.spanNoActive = 31u;
batch.gpu.longerFrames = 30u;
batch.gpu.longerSpanUs = 111000u;
batch.gpu.longerActiveUs = 120000u;
batch.gpu.withinFrames = 26u;
batch.gpu.withinSpanUs = 96200u;
batch.gpu.withinActiveUs = 91000u;
batch.spannedMs = 10012u;
batch.ticksOnTime = 10u;
batch.ticksEarly = 3u;
const std::uint64_t expectedB[fl::adv::kLatBatchLines] = {
0x41609ull, 3ull, 61ull, 31ull, (111000ull << 32) | 120000ull, (96200ull << 32) | 91000ull,
(10ull << 32) | 3ull};
const std::uint32_t expectedA[fl::adv::kLatBatchLines] = {10u, 152u, 5u, 30u, 30u, 26u, 10012u};
for (std::uint32_t line = 0; line < fl::adv::kLatBatchLines; ++line) {
const fl::adv::LatencyLogLine entry = fl::adv::LatencyBatchLine(batch, line);
INFO("line " << line << ": " << entry.text);
CHECK(entry.a == expectedA[line]);
CHECK(entry.b == expectedB[line]);
CHECK(std::strlen(entry.text) <= fl::adv::LatencyBatchLongestText());
CHECK(std::strlen(entry.text) < 72u); // the native log's event has 72 characters of text, the last a zero
for (std::uint32_t other = 0; other < line; ++other) {
CHECK(std::strcmp(entry.text, fl::adv::LatencyBatchLine(batch, other).text) != 0);
}
}
}
// What summing one report costs: the reader runs on a game's presenting thread, once a second. Hidden -- a number
// for a pull request, not a gate: `fl_reflex_summary_test "[.bench]"`.
TEST_CASE("what summing one report of sixty-four frames costs", "[.bench]") {
auto report = Report(5000u);
for (auto& f : report->frameReport) {
f.gpuActiveRenderTimeUs = 3500u;
f.gpuFrameTimeUs = 4200u;
}
constexpr std::uint32_t kRuns = 2'000'000u;
std::uint64_t frames = 0u;
for (int pass = 0; pass < 5; ++pass) {
const auto began = std::chrono::steady_clock::now();
for (std::uint32_t run = 0; run < kRuns; ++run) {
fl::adv::LatencyCursor cursor; // every run sums the report's sixty-two frames anew
fl::adv::LatencyTally tally;
fl::adv::ObserveLatencyReport(*report, cursor, tally);
frames += tally.frames + tally.gpu.withinFrames;
}
const auto nanos =
std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::steady_clock::now() - began).count();
std::printf("pass %d: %.1f ns a report\n", pass, static_cast<double>(nanos) / kRuns);
}
CHECK(frames == 5ull * kRuns * (62u + 62u));
}
+99
View File
@@ -0,0 +1,99 @@
// SPDX-License-Identifier: GPL-3.0-only
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
// fl_watchdog_tick.h: when the Overlay's watchdog makes its periodic tick (0.1.0-beta.49, owner decision D150),
// driven without a thread and without a clock -- the header the Overlay compiles, on counter values written here.
//
// What it holds: the grid does not drift with the work of a tick or with the lateness of a wake; a tick woken early
// is not the periodic one and does not move the grid; a wait is never rounded down to end before its deadline; and
// two periodic ticks are never less than half a period apart, however late one ran.
#include <catch2/catch_test_macros.hpp>
#include <cstdint>
#include <fl_watchdog_tick.h>
namespace {
constexpr std::int64_t kFrequency = 10'000'000; // the performance counter's on the machines this runs on
constexpr std::int64_t kPeriod = kFrequency; // one second
constexpr std::int64_t kMs = kFrequency / 1000;
} // namespace
TEST_CASE("the periodic tick keeps a grid of one period whatever each tick's work and lateness were", "[watchdog]") {
fl::watchdog::Grid grid;
fl::watchdog::StartGrid(grid, 5 * kPeriod, kPeriod);
CHECK(grid.deadline == 6 * kPeriod);
// Sixty ticks, each begun 3 to 17 ms after its deadline (the timer's own granularity and a busy machine) and each
// followed by work of up to 240 ms: the deadlines stay whole seconds.
std::int64_t now = 5 * kPeriod;
for (std::int64_t tick = 0; tick < 60; ++tick) {
const std::uint32_t wait = fl::watchdog::WaitMs(grid, now, kFrequency, 1000u);
CHECK(wait <= 1000u);
CHECK(now + wait * kMs >= grid.deadline); // never rounded down to end short of it
now = grid.deadline + (3 + tick % 15) * kMs;
REQUIRE(fl::watchdog::IsPeriodic(grid, now, true));
fl::watchdog::Advance(grid, now);
CHECK(grid.deadline == (7 + tick) * kPeriod);
now += (tick % 5) * 60 * kMs; // the tick's work
}
}
TEST_CASE("a wait is whole milliseconds rounded up, zero when the tick is due, and never longer than its ceiling",
"[watchdog]") {
fl::watchdog::Grid grid;
fl::watchdog::StartGrid(grid, 0, kPeriod);
CHECK(fl::watchdog::WaitMs(grid, 0, kFrequency, 1000u) == 1000u);
CHECK(fl::watchdog::WaitMs(grid, kPeriod - 5 * kMs, kFrequency, 1000u) == 5u);
CHECK(fl::watchdog::WaitMs(grid, kPeriod - 5 * kMs + 1, kFrequency, 1000u) == 5u); // 4.9999 ms: five, not four
CHECK(fl::watchdog::WaitMs(grid, kPeriod - 1, kFrequency, 1000u) == 1u);
CHECK(fl::watchdog::WaitMs(grid, kPeriod, kFrequency, 1000u) == 0u);
CHECK(fl::watchdog::WaitMs(grid, kPeriod + 40 * kMs, kFrequency, 1000u) == 0u);
CHECK(fl::watchdog::WaitMs(grid, -3 * kPeriod, kFrequency, 1000u) == 1000u); // a counter that went back
CHECK(fl::watchdog::WaitMs(grid, 0, 0, 1000u) == 0u); // no frequency: no wait to compute
}
TEST_CASE("a tick something woke early is not the periodic one and leaves the grid where it was", "[watchdog]") {
fl::watchdog::Grid grid;
fl::watchdog::StartGrid(grid, 0, kPeriod);
const std::int64_t deadline = grid.deadline;
// Five wakes inside one period: none is periodic, and the wait after each is what is left to the same deadline.
for (std::int64_t wake = 1; wake <= 5; ++wake) {
const std::int64_t now = wake * 150 * kMs;
CHECK_FALSE(fl::watchdog::IsPeriodic(grid, now, false));
CHECK(grid.deadline == deadline);
CHECK(fl::watchdog::WaitMs(grid, now, kFrequency, 1000u) == static_cast<std::uint32_t>(1000 - wake * 150));
}
// A signal that came when the deadline had passed all the same: that tick is the periodic one.
CHECK(fl::watchdog::IsPeriodic(grid, deadline + 2 * kMs, false));
// And a wait that timed out a little short of the deadline, by this counter, is the tick the wait was for.
CHECK(fl::watchdog::IsPeriodic(grid, deadline - kMs / 2, true));
fl::watchdog::Advance(grid, deadline - kMs / 2);
CHECK(grid.deadline == deadline + kPeriod); // on the grid, not a period after the early moment
}
TEST_CASE("a periodic tick that ran late is not followed by another within half a period", "[watchdog]") {
fl::watchdog::Grid grid;
fl::watchdog::StartGrid(grid, 0, kPeriod);
// 400 ms late: the next is on the grid, 600 ms away.
fl::watchdog::Advance(grid, kPeriod + 400 * kMs);
CHECK(grid.deadline == 2 * kPeriod);
// 600 ms late: the grid's next would be 400 ms away, so the grid starts again from this tick.
fl::watchdog::Advance(grid, 2 * kPeriod + 600 * kMs);
CHECK(grid.deadline == 3 * kPeriod + 600 * kMs);
// A tick whose work took seconds (an install batch on a loaded machine): one tick follows, a period on -- not
// one for each deadline that passed.
fl::watchdog::Advance(grid, 9 * kPeriod);
CHECK(grid.deadline == 10 * kPeriod);
CHECK(fl::watchdog::WaitMs(grid, 9 * kPeriod, kFrequency, 1000u) == 1000u);
// A period that is not a positive number is one tick, not a division by zero or a wait without end.
fl::watchdog::StartGrid(grid, 100, 0);
CHECK(grid.period == 1);
CHECK(grid.deadline == 101);
}
@@ -25,6 +25,13 @@ enum Mode : std::uint32_t {
kModeFault = 3, // an access violation inside GetLatency
kModeNoDriverSpan = 4, // reports whose driverStartTime is zero: what the driver gives without a sleep mode
kModeImpossible = 5, // reports whose present ends before it starts
// Reports whose frames differ in their GPU span and in the driver's active time, by frameID % 5:
// 0 as kModeReports: a span of kGpuUs and an active time of kGpuActiveUs, which is the shorter
// 1 the two GPU marks at the same instant, and no active time
// 2 an active time of kGpuActiveLongUs, longer than the span
// 3 the span, and no active time
// 4 the two GPU marks at the same instant, and an active time
kModeGpuShapes = 6,
};
// One frame of kModeReports, in microseconds: every frame has these spans.
@@ -38,7 +45,8 @@ inline constexpr std::uint32_t kTotalUs = 7500u;
// The two times a driver works out itself, of every frame: the card at work, and one frame's GPU end to the next's.
inline constexpr std::uint32_t kGpuActiveUs = 3500u;
inline constexpr std::uint32_t kGpuFrameUs = 4200u;
inline constexpr std::uint32_t kFgMultiplier = 2u; // what GetSleepStatus gives while `fgMultiplier` is zero
inline constexpr std::uint32_t kGpuActiveLongUs = 4000u; // kModeGpuShapes: longer than kGpuUs
inline constexpr std::uint32_t kFgMultiplier = 2u; // what GetSleepStatus gives while `fgMultiplier` is zero
inline constexpr std::uint32_t kFirstFrameId = 5000u;
inline constexpr std::uint32_t kFrameIdStep = 10u; // how far the ids move on at each call
@@ -125,6 +125,18 @@ NvAPI_Status __cdecl StubGetLatency(IUnknown* device, NV_LATENCY_RESULT_PARAMS*
if (mode == fl::stubnv::kModeImpossible) {
r.presentEndTime = r.presentStartTime - 50u;
}
if (mode == fl::stubnv::kModeGpuShapes) {
const std::uint64_t shape = id % 5u;
if (shape == 1u || shape == 4u) {
r.gpuRenderStartTime = r.gpuRenderEndTime; // a span of no length; the frame's total is as it was
}
if (shape == 1u || shape == 3u) {
r.gpuActiveRenderTimeUs = 0u;
}
if (shape == 2u) {
r.gpuActiveRenderTimeUs = fl::stubnv::kGpuActiveLongUs;
}
}
}
return NVAPI_OK;
}
@@ -455,13 +455,16 @@ public sealed class AdvancedPresenterTests
];
AdvancedPresenter.Metrics(series, []).Select(static m => m.Id).Should().BeEquivalentTo("nvapi.reflex.frame_report", "nvapi.reflex.gpu_times");
// The span between the driver's two GPU marks says what it includes, in every language (D143).
// The span between the driver's two GPU marks says what it is, in every language (D143) - and neither label says
// which of the two holds the other (D152): in Cyberpunk 2077 the driver's active time is the longer.
foreach (string culture in new[] { "", "vi", "ja" })
{
string render = Strings.ResourceManager.GetString(nameof(Strings.AdvToken_gpu_render), CultureInfo.GetCultureInfo(culture))!;
string active = Strings.ResourceManager.GetString(nameof(Strings.AdvToken_active_render), CultureInfo.GetCultureInfo(culture))!;
render.Should().Contain("(", "the label carries what the span includes");
render.Should().Contain("(", "the label carries what the span is");
render.Should().NotBe(active);
render.Should().NotContain("idle", "the span is not said to include the active time's idle time");
active.Should().NotContain("idle", "the active time is not said to be the span less its idle time");
}
}
@@ -114,6 +114,20 @@ public sealed partial class AdvancedMetricCatalogTests
AdvancedMetricCatalog.Find("nvapi.reflex.mode")!.Reach.Should().Be(AdvancedReach.RefusedRoute);
AdvancedMetricCatalog.Find("sl.reflex.state")!.Reach.Should().Be(AdvancedReach.RefusedRoute);
_all.Where(static m => m.Reach == AdvancedReach.RefusedRoute).Should().OnlyContain(static m => !m.IsRead);
// Advanced metrics is closed (D154): what a game sets and asks through Streamline's feature functions is not
// read - seeing those calls would take handing the game a function of ours. Nothing is left "being studied".
string[] closed =
[
"sl.dlss.optimal_settings", "sl.dlss.vram_estimate", "sl.dlssg.options", "sl.dlssg.state", "sl.dlssg.frames_presented",
"sl.dlssg.vram_estimate", "sl.dlssd.options", "sl.nis.options", "sl.deepdvc.options", "sl.pcl.markers",
];
foreach (string id in closed)
{
AdvancedMetricCatalog.Find(id)!.Reach.Should().Be(AdvancedReach.RefusedRoute, id);
}
_all.Where(static m => m.Reach == AdvancedReach.Spike).Should().BeEmpty("no route is waiting for a spike");
}
[Fact]
@@ -0,0 +1,153 @@
// SPDX-License-Identifier: GPL-3.0-only
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
using FluentAssertions;
using FrameLedger.Application.Advanced;
using FrameLedger.Application.Recording;
namespace FrameLedger.Application.Tests.Recording;
/// <summary>
/// What a hooked game published and no sample carries yet (owner decision D150): two sets may wait, the older is
/// carried first, and a set that waited is no longer overwritten by the one after it.
/// </summary>
public sealed class PendingInGameReadingsTests
{
private static IReadOnlyList<AdvancedReading> Set(int second) => [new AdvancedReading("adv.nvapi.reflex.frame_report.total", second)];
private static double Second(IReadOnlyList<AdvancedReading> set) => set[0].Value;
[Fact]
public void Nothing_waits_until_something_is_offered()
{
var pending = new PendingInGameReadings();
pending.Count.Should().Be(0);
pending.TryTake(out IReadOnlyList<AdvancedReading>? none).Should().BeFalse();
none.Should().BeNull();
}
[Fact]
public void Two_publications_between_two_samples_are_both_carried_the_older_first()
{
var pending = new PendingInGameReadings();
pending.Offer(Set(1));
pending.Offer(Set(2));
pending.Count.Should().Be(2);
pending.TryTake(out IReadOnlyList<AdvancedReading>? first).Should().BeTrue();
Second(first!).Should().Be(1);
pending.TryTake(out IReadOnlyList<AdvancedReading>? second).Should().BeTrue();
Second(second!).Should().Be(2);
pending.TryTake(out _).Should().BeFalse();
}
[Fact]
public void A_third_pushes_the_oldest_out_so_a_slow_sensor_interval_keeps_the_two_newest()
{
var pending = new PendingInGameReadings();
pending.Offer(Set(1));
pending.Offer(Set(2));
pending.Offer(Set(3));
pending.Count.Should().Be(PendingInGameReadings.Capacity);
pending.TryTake(out IReadOnlyList<AdvancedReading>? first).Should().BeTrue();
Second(first!).Should().Be(2);
pending.TryTake(out IReadOnlyList<AdvancedReading>? second).Should().BeTrue();
Second(second!).Should().Be(3);
}
[Fact]
public void A_publication_with_no_reading_does_not_wait()
{
var pending = new PendingInGameReadings();
pending.Offer(Set(1));
pending.Offer([]);
pending.Count.Should().Be(1);
pending.TryTake(out IReadOnlyList<AdvancedReading>? first).Should().BeTrue();
Second(first!).Should().Be(1);
}
[Fact]
public void A_null_set_is_refused()
{
var pending = new PendingInGameReadings();
Action offer = () => pending.Offer(null!);
offer.Should().Throw<ArgumentNullException>();
}
/// <summary>
/// The owner's sessions, as the recorder sees them. Each second has one publication and one sample. In step, one
/// look of the recorder finds both - the publication is taken first, the sample carries it. Out of step, the
/// publication lands just after the sample: a look falls between them, so the sample is drained before its
/// publication is taken. The phase wanders, so a session goes in and out of step.
/// </summary>
[Fact]
public void A_session_that_falls_out_of_step_and_back_lacks_one_sample_and_loses_no_reading()
{
var pending = new PendingInGameReadings();
var carried = new List<double?>();
void Sample() => carried.Add(pending.TryTake(out IReadOnlyList<AdvancedReading>? set) ? Second(set) : null);
int second = 0;
for (int round = 0; round < 3; round++)
{
for (int i = 0; i < 4; i++)
{
// In step: the publication, then the sample, in one look.
pending.Offer(Set(++second));
Sample();
}
for (int i = 0; i < 4; i++)
{
// Out of step: the sample is drained in one look, its publication is taken in the next.
Sample();
pending.Offer(Set(++second));
}
}
// Twenty-four seconds, twenty-four samples: one without a reading - the first that fell out of step - and
// every reading up to the last carried once, in order. The last one waits for a sample that never came.
carried.Should().HaveCount(24);
carried.Count(static c => c is null).Should().Be(1);
carried[4].Should().BeNull();
carried.Where(static c => c is not null).Should().Equal(Enumerable.Range(1, 23).Select(static s => (double?)s));
pending.Count.Should().Be(1);
}
/// <summary>The rule until 0.1.0-beta.49, on the same session: what the change is for.</summary>
[Fact]
public void The_rule_before_it_lacked_a_sample_at_every_fall_out_of_step_and_lost_a_reading_at_every_return()
{
IReadOnlyList<AdvancedReading>? newest = null;
var carried = new List<double?>();
void Sample()
{
carried.Add(newest is null ? null : Second(newest));
newest = null;
}
int second = 0;
for (int round = 0; round < 3; round++)
{
for (int i = 0; i < 4; i++)
{
newest = Set(++second);
Sample();
}
for (int i = 0; i < 4; i++)
{
Sample();
newest = Set(++second);
}
}
carried.Count(static c => c is null).Should().Be(3);
carried.Where(static c => c is not null).Should().HaveCount(21).And.NotContain(8d).And.NotContain(16d);
}
}