Compare commits

...
Author SHA1 Message Date
poli0981andClaude Opus 5.5 47c30563bf feat: the display mode - how each game was shown and for how much of the session, both tiers, on the summary, the game page, the trend and compare (schema 0016, beta.10)
The owner asked for the game's window size and display mode (exclusive fullscreen / borderless / windowed) and the share of
the session each took, with trend and compare. PR-2 (#242) published the swap chain's own answer in shared-memory region 4;
this change reads the window from outside, classifies, tallies, stores and shows it.

- Domain/Display: DisplayModeClassifier (no window -> minimised -> exclusive, only from a region-4 sample under 2 s old ->
  covers its monitor: borderless when the chain said not exclusive, "fullscreen or borderless" when nothing could say ->
  windowed), DisplayTally (milliseconds, not ticks: a sample stands for the time until the next), DisplaySummary.
- Application: IDisplayProbe; DisplaySampler on the capture loop's tick beside focus (100 ms hooked) and on the Tier-2
  hold's tick (1 s) - an interval ending on a paused tick is dropped; ITargetResolver.PidsOf finds a hold's processes by
  image path in the watcher's snapshot (never by name, never an unreadable path), still opening nothing;
  CaptureOutcome.Display; the recorder writes it on the row's skeleton (SessionDisplayColumns), so a Tier-2 row has it.
- Infrastructure: WindowGeometryProbe - user32 out of process, per-monitor DPI aware (V2) while it asks and put back; the
  window region 4 names when it still belongs to the game (to its root), else the largest visible, uncloaked, non-tool
  top-level window of the game's processes; MONITORINFOEX + EnumDisplaySettings for the monitor and its refresh rate.
  Nothing belonging to the game is read (CLAUDE.md rule 4). Schema 0016: fifteen sessions.display_* columns, ADD COLUMN
  only; sessions.swap_effect gets its first writer.
- Composition: the Agent's CaptureSession and the operator host's take the probe.
- App: a Display stat card and line on the session summary, the last measured session and a Display column (tooltip with
  every share) on the game page, three Trend metrics (exclusive / borderless / windowed share, every tier, never left out
  as a mid-session change, no exclusive or borderless point where the two could not be told apart), three Compare rows
  (never ranked), the CSV's "# display:" line (invariant). Strings en/vi/ja; Strings.Designer.cs regenerated.
- Tests: classifier and tally (Domain); sampler on a moved clock, pause, staleness, swap-effect names; CaptureSession Tier 1
  from region 4 + window and Tier-2 hold by the snapshot's pids; recorder Tier-2 row and hooked row; LatestProcessSnapshot
  pids; migration 0016 and the repository round trip; WindowGeometryProbe against hook-harness's real window; App card,
  line, game page, trend, compare, export, DisplayText.
- Docs: 03_METRICS (new section Display mode, accuracy row, export header), 04_CAPTURE, 05_DETECTION (runtime facts row;
  present mode still has no writer), 06_DATA_MODEL (DDL + 0016), 08_UI, 02_SPEC (FR-7.4, FR-7.2 note), CHANGELOG.

No hook-path change: the Overlay is untouched by this PR (its cost was measured in #242).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-27 22:53:09 +07:00
62 changed files with 2633 additions and 35 deletions

No files matched your search

+13 -2
View File
@@ -38,6 +38,18 @@ under a `## [x.y.z] - date` heading in the same commit that bumps `VERSION`, the
whole, once per version of the file (up to 7.5 s on a USB drive for Black Myth: Wukong), and the scan stops if the Agent
is asked to. Rules `2026.09.6`: every game is re-detected once. Schema 0015 adds `games.engine_version_source`.
- **How each game was shown, and for how much of the session** (owner request, beta.10): exclusive fullscreen, borderless,
windowed or minimised, with the window's size, the monitor it was on and its refresh rate, and the swap chain's back
buffer. On the session summary (a *Display* card and a line with every share), the game page (the last measured session,
and a *Display* column in Sessions), the Trend (three new metrics: the share of each session in exclusive fullscreen,
borderless and windowed), Compare (three rows, never ranked) and both exports (the CSV's `# display:` line, the JSON's
aggregates). **Both tiers:** a game that was not hooked has its window read from outside, which can say windowed or
*fullscreen or borderless* but never which of those two — only the swap chain of a hooked DirectX game can say
exclusive. What Windows does with an exclusive game behind the scenes ("fullscreen optimizations") is not visible to
FrameLedger, and a game's menu may call a borderless window "Fullscreen": the swap chain's answer is the one shown.
Sessions recorded before, and one recovered after a crash, read N/A. Schema 0016 adds fifteen `sessions.display_*`
columns, and `sessions.swap_effect` — a column with no writer since the first schema — is now filled.
### Changed
- **Groundwork for the display mode (beta.10): the injected component reports how the game presents** — whether its swap
@@ -45,8 +57,7 @@ under a `## [x.y.z] - date` heading in the same commit that bumps `VERSION`, the
from two getters on the swap chain the game passed (measured at 13–15 ns each on the test fixture: nothing a frame rate
can see). The shared-memory layout moves to version 4 (a new region; the frame ring moved behind it): **a game that is
running while FrameLedger is updated must be restarted before it can be measured**, which the app already says when it
meets an old layout. Nothing is shown yet — the window's size, the mode and its share of a session arrive in the next
change of this train.
meets an old layout. What the app shows from it is the display mode under *Added*.
### Fixed
+2 -1
View File
@@ -60,7 +60,8 @@ Requirement IDs (`FR-x`, `NFR-x`) are referenced by other docs, commits, and tes
### FR-7 Detection
- FR-7.1 Static: engine, engine version, store platform, store id, publisher, game version (`05_DETECTION`; the Unreal Engine version since 2026-09-27, §Engine version).
- FR-7.2 Runtime: API, present mode, swap effect, HDR, upscaler, FG, RT — all Tier 1, all measured.
- FR-7.2 Runtime: API, present mode, swap effect, HDR, upscaler, FG, RT — all Tier 1, all measured. (Present mode and HDR have no writer yet, `05_DETECTION` §Runtime facts; swap effect is written since beta.10 from the display-mode sample.)
- FR-7.4 Display mode (beta.10, owner request 2026-09-27): how each session's game was shown — exclusive fullscreen, borderless, windowed, minimised, or *fullscreen or borderless* where nothing could tell the two apart — as a share of the session's time, with the window, back buffer and monitor sizes; both tiers (Tier 2 from the window alone); shown on the session summary, the game page, the Trend (three share metrics) and Compare, and exported (`03_METRICS` §Display mode).
- FR-7.3 Rules ship as `detection-rules.json`, updatable independently of releases; **anticheat-block updates apply regardless of the user's rules auto-update preference.**
### FR-8 Tri-state flags
+66 -1
View File
@@ -681,6 +681,70 @@ Derived extras (Tier 1): `rays_per_pixel` (mean dispatch volume ÷ output pixels
> 2026-08-20 `maxTraceRecursionDepth` has no producer: `CreateStateObject` is a separate PR,
> and `pt_confidence` reads it, which is one of the reasons Path Tracing is still `N/A`.
## Display mode — both tiers (beta.10)
**Owner request, 2026-09-27:** "detect the game's window size and whether it runs full-screen, borderless or windowed,
and how much of the time". Schema 0016 (`06_DATA_MODEL`), shared-memory region 4 (`07_IPC`, layout 4), the Agent's
`Application.Capture.DisplaySampler`, Domain's `Display.DisplayModeClassifier` and `Display.DisplayTally`.
**Two witnesses, and neither reads the game.**
1. *The swap chain's own answer* — Tier 1, DXGI only. The Overlay asks `IDXGISwapChain::GetFullscreenState` and `GetDesc`
on the chain the game passed to `Present`, at most twice a second per chain, and publishes the chain with the largest
back buffer in region 4: its window, back buffer, swap effect, and whether it is exclusive (`17_HOOK_ENGINE` §Hook
inventory — polled, not a `SetFullscreenState` hook). OpenGL publishes its window and client area with no exclusive
answer; the Vulkan layer publishes nothing yet.
2. *The window from outside* — both tiers. The Agent asks user32 about the game's top-level window: minimised or not, the
client area in screen coordinates, the monitor it is on and that monitor's refresh rate — per-monitor DPI aware while it
asks, because the Agent runs DPI-unaware and Windows would otherwise scale another process's coordinates
(`Infrastructure.Display.WindowGeometryProbe`). The window is the one region 4 names when it still belongs to the game
(a handle is reused once its window is gone), else the largest visible, uncloaked, non-tool top-level window of any
process running the game's executable — found by image path in the watcher's snapshot for a Tier-2 session that never
opened the process. This is the focus sample's class of question: CLAUDE.md rule 4 is about game memory, and no handle
to the game's process is opened for it.
**The ladder, per sample** (`DisplayModeClassifier`):
| Mode | When | Column (ms) |
|---|---|---|
| No window | no window could be read and the chain did not say exclusive | `display_nowindow_ms` — outside every share |
| Minimized | the window is minimised | `display_minimized_ms` |
| Exclusive fullscreen | a region-4 sample under 2 s old in which the swap chain SAID exclusive | `display_exclusive_ms` |
| Borderless | the client area covers its monitor (±1 px each edge) and the chain said not exclusive | `display_borderless_ms` |
| Fullscreen or borderless | the client area covers its monitor and nothing could say which — OpenGL, Vulkan, every Tier-2 session | `display_covers_ms` |
| Windowed | anything else | `display_windowed_ms` |
**Time, not ticks.** A sample stands for the wall time until the next: every drain tick (100 ms) hooked, every hold tick
(1 s) at Tier 2 — so the two add up in one unit, milliseconds. An interval that ends on a paused tick is dropped, which
excludes a pause to within one tick at each edge, as the frame series' gap does. A mode's **share** is its milliseconds
over the observed time (every mode but *No window*). `display_changes` counts samples whose mode differs from the one
before, no-window samples skipped. The sizes — `display_window_*` (client area), `display_buffer_*` (back buffer),
`display_monitor_*` and `display_monitor_hz` — are the ones seen in the mode that lasted longest; `display_source` is the
strongest witness any sample had (`swapchain` > `opengl` > `window`). `sessions.swap_effect`, a column since 0001 with no
writer, is written from region 4.
**What it cannot say** (the user-facing list is `LIMITATIONS.md`):
- *Exclusive* is what the game asked DXGI for. Windows may still present such a game through the compositor ("fullscreen
optimizations"), and a flip-model borderless window may be promoted to independent flip; neither is visible without a
trace session, which FrameLedger does not have (`20_OPEN_QUESTIONS` §G).
- A game's menu may call a borderless window "Fullscreen"; the swap chain's answer is what is reported.
- A minimised game issues only occlusion probes, which the hook drops before sampling: a region-4 sample older than 2 s
keeps its window and loses its exclusive bits.
- Tier 2, OpenGL and Vulkan can never tell exclusive from borderless. Their covering time is *Fullscreen or borderless*,
and the trend draws no exclusive or borderless point for a session with any of it.
- A session recovered from its `.partial` file has no display facts — the tally is not in the crash file — and reads
N/A. The focus pair, which the partial carries, is the precedent this does not follow.
**A side effect of region 4's poll (layout 4).** `GetDesc` every 500 ms also refreshes the chain's output size, which
catches a `ResizeBuffers1` the hook inventory does not have: a title that resizes through it now splits its segments at the
change and reads "settings changed mid-session" (FR-6.4), which is what it was.
**Where it is shown** (`08_UI`): the session summary's Display card and line, the game page's last measured session and
its Sessions column, three Trend metrics — *Exclusive fullscreen share %*, *Borderless share %*, *Windowed share %*, every
tier, and a mode switch is not a mid-session change for them (switching resizes the swap chain; the share is what that
switch was) — three Compare rows, never ranked, and the CSV's `# display:` line (§Export schema) and the JSON's aggregates.
## Per-process VRAM (Tier 1)
`vramUsedMb` from `IDXGIAdapter3::QueryVideoMemoryInfo(LOCAL)` inside the game = **this game's** usage and budget. **MiB, truncating, and it must use the same divisor as `vramBudgetMb`** — the two are compared, and mismatched rounding would put a systematic bias into `budget_exceeded_pct`. Residual: a flip within 1 MiB of the budget, 0.004% of a 24 GiB card. Stored as its own series and clearly labelled apart from the adapter-wide figure from `18_GPU_VENDOR_APIS`. Aggregates: avg, max, and `budget_exceeded_pct` (share of samples where `CurrentUsage > Budget`, i.e. the driver was likely evicting — a genuinely useful stutter explanation).
@@ -700,6 +764,7 @@ Per session over 1 Hz samples: `avg` (mean of non-null), `max`. Sensor timeline
| Path tracing | heuristic, confidence-scored, never asserted | not available |
| Per-process VRAM | exact | not available |
| PC latency | as reported by Reflex | 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 |
| CPU temperature | sensor-inherent ±1–2 °C, needs LHM + PawnIO + elevation. **Read since 2026-09-21** (`Telemetry.LhmCpuTemperatureReader`: the package sensor, else the hottest core) and **unmeasured on real hardware** — no elevated run with PawnIO has been taken (`20_OPEN_QUESTIONS` §CPU) | same |
| CPU load | **time busy over elapsed, every logical processor** (`GetSystemTimes`, 1 Hz, unprivileged; since 2026-09-21). Not Task Manager's "utility", which is frequency-scaled and exceeds 100 under turbo — the two are different numbers and this one is stated as what it is. Null on a session's first tick (no interval yet), never 0 | same |
@@ -732,4 +797,4 @@ Per-column sources, and what a *Tier-2* export does instead:
| `vram_mb` | `vram_proc` per-frame blob. Note the value is refreshed at 1 Hz (`17_HOOK_ENGINE` §Memory) so it is a held sample, not a per-frame measurement — the header block says so | `N/A` |
| `reflex_latency_us` | `latency_us` blob; **finalize must write it** | `N/A` |
Plus a `#`-prefixed header block: game, date, **capture tier**, api, present mode, hardware snapshot, segment list, the tri-state flags with their sources, and the note that `vram_mb` is 1 Hz-sampled. The tier belongs in the header because a Tier-2 export is missing whole columns and anyone reading it later must know why.
Plus a `#`-prefixed header block: game, date, **capture tier**, api, present mode, swap effect, **the display line** (beta.10: `# display:` with each mode's milliseconds, the changes, the source and the window / back buffer / monitor sizes, or `N/A` for a session recorded before — §Display mode; a mode is the session's, not a frame's, so it is not a column), hardware snapshot, segment list, the tri-state flags with their sources, and the note that `vram_mb` is 1 Hz-sampled. The tier belongs in the header because a Tier-2 export is missing whole columns and anyone reading it later must know why.
+2 -1
View File
@@ -291,6 +291,7 @@ What the Agent checks **before** asking the guard is the thing the native side s
> **The PAIR, because zero is not a finding.** A process owning no top-level window at all — `hook-harness` presents to a composition swapchain and has none — is unfocused on every tick of every run. Reporting that as focus loss would fire on every integration run and teach the reader to ignore the line, which is the could-not-look/looked-and-found-nothing collision `FlRtTier` and `upscalerQuality` already exist to avoid.
>
> **It is attribution, never the guard.** What refuses a mixed window is `FgWindow.BatchRefusal`, computed from the records alone, so a caller that never wires focus still cannot publish an averaged ratio. Focus is what lets the report name the cause.
- **Each drain tick also samples the display mode (beta.10)** — `Application.Capture.DisplaySampler` on the same tick as focus: shared-memory region 4 (the presenting chain's window, back buffer, swap effect and exclusive state, as the Overlay last asked them) and the window's geometry from outside (`IDisplayProbe`, `Infrastructure.Display.WindowGeometryProbe`), classified and added up by the time each sample stood for; a paused tick drops the interval it ends. The last sample is closed before the last drain, and the tally rides out on `CaptureOutcome.Display`. **The Tier-2 hold samples too**, once per hold tick (1 s): the window only — by the pinned pid when the loop holds one, else by every process running the executable in the watcher's snapshot (`ITargetResolver.PidsOf`, image path only — never a name), still opening nothing. The recorder writes the tally on the row's skeleton, so both tiers store it (`03_METRICS` §Display mode, `06_DATA_MODEL` 0016).
- **Dropped records are computed here, not read from the header.** The Overlay has no reader index and cannot know whether a slot it overwrites was consumed. The Agent owns the read index, so it owns the accounting: when `writeIndex - readIndex > capacity`, add the excess to the session's data-quality counter and resume at `writeIndex - capacity`. A non-zero value means the Agent stalled for over ~16 s — log it, surface it as a session warning, never silently accept it.
> **That sentence is true only because the read index is seeded from the writer at
@@ -311,7 +312,7 @@ What the Agent checks **before** asking the guard is the thing the native side s
| Thread | Cadence | Owns | Touches |
|---|---|---|---|
| **Session loop** (`CaptureSession.RunAsync`, one async loop per session) | `Task.Delay(100 ms)` drain ticks; the 30 s guard scan is awaited inline | The ring reader, for the life of the session — drain, `PublishGuardResult`, `SetPaused`, `RequestLogFlush` — and the record buffer it fills | Samples foreground per tick, drains the telemetry queue per tick (PR-D), writes `.partial` itself (PR-D) |
| **Session loop** (`CaptureSession.RunAsync`, one async loop per session) | `Task.Delay(100 ms)` drain ticks; the 30 s guard scan is awaited inline | The ring reader, for the life of the session — drain, `PublishGuardResult`, `SetPaused`, `RequestLogFlush` — and the record buffer it fills | Samples foreground and the display mode per tick (beta.10), drains the telemetry queue per tick (PR-D), writes `.partial` itself (PR-D) |
| **Telemetry** (`fl-telemetry`, `TelemetryPoller`, one per session) | 1 Hz, never faster than 500 ms | Its own `ConcurrentQueue` of `TelemetrySample` | Reads the composite source only; L2 has a thread of its own inside the library, and the composite is read from this thread and no other |
| **Watcher** (built 2026-09-10, PR-F: `CaptureOrchestrator.RunAsync` on a `PeriodicTimer(1 s)`) | 1 Hz process snapshot | The watcher's events and the running-session table — ~~`PollOnceAsync` is their only writer; there is no `Channel`, because there is no second consumer~~ **since 2026-09-13 (P3 PR-1b) the table has one lock**: `PollOnceAsync` on the timer, `LaunchAsync` and `StopSession` from the pipe's tasks (HANDOFF §P3 D12 as built — two commands do not justify a channel); the sessions themselves never take it | The `games` rows (one read per poll) and never the ring; each session it starts runs on its own task |
| **Finalize** (PR-D) | Once, on the session loop's task | The one SQLite connection, behind a `SemaphoreSlim(1)` | `ApplicationStopping` cancels the loop; finalize gets a grace window, then the `.partial` stays for recovery |
+6 -1
View File
@@ -26,11 +26,16 @@ Derived in the Agent from the record stream; the mapping is in `03_METRICS`. Sum
| Reflex on + PC latency | NVAPI Reflex hooks |
| 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) |
> **Not built, 2026-09-15:** four rows above have no writer yet — HDR output, Reflex and PC latency, per-process
> VRAM, and PSO compilation events. The Overlay never sets their measured bits, so every calculator over them
> returns nothing and the columns stay null; `legal/ACCURACY.md` lists them as not measured. This table is the
> design; the block is the state.
>
> **2026-09-27 (beta.10):** the first row's *swap effect* has a writer since schema 0016 — region 4's `GetDesc`, stored
> in `sessions.swap_effect` as a name (`flip_discard`, …) — and the display-mode row is new. **Present mode has none**,
> and the block above did not list it: `sessions.present_mode` is null on every row, and the pages say N/A.
> **"present-count delta" is removed from the FG row, and it was not merely unreliable —
> it was structurally zero.** `03_METRICS` §Frame Generation retired that rung on
@@ -42,7 +47,7 @@ Derived in the Agent from the record stream; the mapping is in `03_METRICS`. Sum
> stale-by-not-being-touched failure this project keeps recording; `06_DATA_MODEL`'s
> `fg_source` enum carried the same value and is corrected in the same pass.
~~Tier-2 sessions have `upscaler = unknown`, resolutions `N/A`, RT `N/A`, and an FG mode only if cadence resolves it.~~ **Simpler since 2026-08-28: a Tier-2 session detects NOTHING.** It has no frames, so cadence has nothing to run over. `upscaler`, resolutions, RT and FG all read `N/A`, and the static-hint tier (below) is the only thing that says anything about such a title — which it labels *inference*, never measurement.
~~Tier-2 sessions have `upscaler = unknown`, resolutions `N/A`, RT `N/A`, and an FG mode only if cadence resolves it.~~ **Simpler since 2026-08-28: a Tier-2 session detects NOTHING.** It has no frames, so cadence has nothing to run over. `upscaler`, resolutions, RT and FG all read `N/A`, and the static-hint tier (below) is the only thing that says anything about such a title — which it labels *inference*, never measurement. **The one exception since beta.10 is how its window was shown** (the display-mode row), which the Agent reads from outside the game in either tier.
## Static hints — rules engine
+26 -1
View File
@@ -274,7 +274,23 @@ CREATE TABLE sessions (
avg_cpu_temp REAL, max_cpu_temp REAL,
avg_gpu_temp REAL, max_gpu_temp REAL, max_gpu_hotspot REAL,
avg_gpu_load REAL, avg_cpu_load REAL, avg_ram_mb REAL,
avg_gpu_power_w REAL, throttle_pct REAL
avg_gpu_power_w REAL, throttle_pct REAL,
-- schema 0016 (2026-09-27, beta.10): the display mode, both tiers (03_METRICS §Display mode). Milliseconds per mode,
-- each sample standing for the time until the next (100 ms hooked, 1 s at Tier 2), a pause not counted; nowindow is
-- outside every share. NULL before, on a session recovered from its .partial file, and where the loop never sampled —
-- N/A, never 0. Written on the recorder's SKELETON: a Tier-2 session never reaches the aggregator.
display_exclusive_ms INTEGER, -- the swap chain SAID exclusive (DXGI only)
display_borderless_ms INTEGER, -- covers its monitor, the chain said not exclusive
display_windowed_ms INTEGER,
display_covers_ms INTEGER, -- covers its monitor and nothing could say which ("fullscreen or borderless")
display_minimized_ms INTEGER,
display_nowindow_ms INTEGER, -- no window could be read
display_changes INTEGER, -- mode changes between samples
display_source TEXT, -- swapchain | opengl | window: the strongest witness any sample had
display_window_w INTEGER, display_window_h INTEGER, -- client area, in the mode that lasted longest
display_buffer_w INTEGER, display_buffer_h INTEGER, -- the swap chain's back buffer, same mode
display_monitor_w INTEGER, display_monitor_h INTEGER, display_monitor_hz INTEGER
);
CREATE INDEX ix_sessions_game_started ON sessions(game_id, started_at DESC);
@@ -551,6 +567,15 @@ Sequential embedded SQL (`Migrations/0001_init.sql`, `0002_*.sql`, …), applied
> were, and the last does not fail the migration (`CASE WHEN json_valid(…)`, since SQLite promises no order for `AND`).
> `LatestVersion` is 15; `LedgerDatabaseTests.ScriptFifteenAddsTheWitnessAndRemovesOnlyTheOldRulesDetectedDigit`.
> **`0016_display_mode.sql` (beta.10, 2026-09-27) — how the game was shown.** Fifteen `sessions.display_*` columns
> (`03_METRICS` §Display mode): milliseconds in each mode, the changes, the witness, and the window / back buffer / monitor
> sizes in the mode that lasted longest. ADD COLUMN only, no data change: a session recorded before reads N/A. Written by
> the recorder on the row's skeleton (`Recording.SessionDisplayColumns.WithDisplay`), so a Tier-2 session — which never
> reaches the aggregator — has them too; `sessions.swap_effect`, a column since 0001, gets its first writer from the same
> facts. `SessionRowColumns` is hand-edited (its generator is not in the repository) and reads by name. `LatestVersion` is
> 16; `LedgerDatabaseTests.ScriptSixteenAddsTheDisplayColumnsAndAnEarlierSessionHasNone`,
> `SqliteSessionRepositoryTests.ASessionRoundTripsColumnForColumn`.
> **Every open used to migrate, and one that should not have did — 2026-09-16.** The Agent's `--console sessions`,
> a verb that prints, was run against the owner's ledger while the file on disk was at schema 2 and applied 0003 and
> 0004 to it. `LedgerDatabase.OpenReadOnlyAsync` exists since that day: an existing file, `PRAGMA query_only`, no
+13 -1
View File
@@ -259,6 +259,15 @@ All screens are `Page`s registered with the navigation page provider and navigat
2. **Frametime** — ScottPlot timeline of selected session (decimated), stutter markers, sensor overlay toggle (temp on right axis).
3. **Distribution** — FPS histogram + percentile curve of selected session(s).
4. **Trend** — metric-over-date line (selector: Native avg / Displayed avg / 1% Low / 0.1% Low / max GPU temp), vertical **hardware-change markers** with tooltip "GPU driver 572.16 → 576.02" (FR-6.3).
> **The display mode, beta.10 (FR-7.4, `03_METRICS` §Display mode).** The **Last session measured** row adds how that
> session was shown — the mode that lasted longest with its share and the window's size (`Display: Borderless 92% ·
> 2560×1440`); the **Sessions** tab has a *Display* column for every session, Tier 2 included (the mode shown longest,
> with a tooltip carrying every share, the changes, the window on its monitor, the back buffer and the witness), `N/A`
> for a session recorded before; the **Trend** has three more metrics — *Exclusive fullscreen share %*, *Borderless
> share %*, *Windowed share %* — over every session whatever its tier, never left out as a mid-session change (a mode
> switch resizes the swap chain, and the share is what that switch was), with no exclusive or borderless point for a
> session that had any time nothing could split (`Services.DisplayText`, `Charts.TrendSeriesBuilder.DisplayShare`).
5. **Sensors** — temp/load/power/VRAM timelines per session; per-process VRAM and adapter-wide VRAM as separate, differently-labelled series.
6. **Latency** *(Tier 1 + Reflex only)* — PC latency timeline, avg/p95.
@@ -303,7 +312,7 @@ All screens are `Page`s registered with the navigation page provider and navigat
> PNGs have an opaque background (`ChartTheme.SavePng`: the window's colour under the transparent figure).
### Session summary (secondary `FluentWindow`, also the post-session toast target)
Stat cards (Avg uses `FpsReadout`, Median, 1% Low, 0.1% Low, Min/Max, σ, stutter %, duration), TriState chips, API/PresentMode/upscaler line, crash `InfoBar` (Severity=Error) when `crashed`, frametime chart, sensor strip, tags/notes editor, Export buttons.
Stat cards (Avg uses `FpsReadout`, Median, 1% Low, 0.1% Low, Min/Max, σ, stutter %, duration, **Display** — beta.10: the mode shown longest with its share and the window's size, both tiers), TriState chips, API/PresentMode/upscaler line, **the display line** (beta.10: every mode's share, the changes, the window on its monitor at its refresh rate, the back buffer and swap effect, and what the facts rested on — "the swap chain said whether it was exclusive" or "from the window alone: exclusive fullscreen cannot be told from borderless"; absent for a session recorded before), crash `InfoBar` (Severity=Error) when `crashed`, frametime chart, sensor strip, tags/notes editor, Export buttons.
> **Built 2026-09-14 (P3 PR-6).** `Windows/SessionSummaryWindow` (a secondary `FluentWindow` with its own
> `ContentDialogHost`), opened from a Sessions-tab row (double-click or Open) and from the Dashboard's recent
@@ -404,6 +413,9 @@ Session picker (2–5, cross-game allowed) → overlaid percentile curves + stat
> separate rows (never one column), Median, the lows, stutter time %, max GPU °C, duration — with the best
> value of each row bold and accent-coloured (higher wins for FPS, lower for temperature and stutter; N/A is
> never best), and a Tier-2 session's cells at N/A. Export PNG through `Plot.SavePng`.
>
> **beta.10:** three rows after Duration — *Display mode* (every share), *Window* and *Monitor* (with its refresh
> rate) — facts, not scores: no mode is better than another, so none is ever marked best, and every tier has them.
### Logs
Tail view of `ui-*.log` / `agent-*.log` (toggle), level filter, search (`ui:AutoSuggestBox`), pause-scroll; buttons: Open logs folder, Export bug bundle (routes to 10_LOGGING flow).
@@ -4,6 +4,7 @@ using FrameLedger.Application.Consent;
using FrameLedger.Application.Persistence;
using FrameLedger.Application.Recording;
using FrameLedger.Application.Telemetry;
using FrameLedger.Infrastructure.Display;
using FrameLedger.Infrastructure.Telemetry;
namespace FrameLedger.Agent.Composition;
@@ -37,6 +38,7 @@ internal sealed class AgentRecording
private readonly IDriverProfileSource _profiles;
private readonly IUserModeExceptionSwitch _exceptions;
private readonly IOverlayToleranceChannel _tolerance;
private readonly WindowGeometryProbe _display = new();
private readonly UserModeExceptionLapsePolicy _exceptionLapse;
public AgentRecording(
@@ -186,7 +188,9 @@ internal sealed class AgentRecording
_killSwitch,
_pause,
_exceptions,
_tolerance);
_tolerance,
// beta.10: the game's window, read out of process on the loop's ticks (03_METRICS §Display mode).
_display);
/// <summary>The session and its collaborators, wired the only way the Agent allows; the recorder supplies the observer.</summary>
private sealed class Factory(AgentRecording owner, int seconds, IProcessLauncher? launcher) : ICaptureSessionFactory
+12
View File
@@ -40,4 +40,16 @@ public enum TrendMetric
/// of the session, so it is treated as a mid-session change: left out by default, drawn marked when those are included.
/// </summary>
FgFactor,
/// <summary>
/// The three below are beta.10's (<c>03_METRICS</c> §Display mode): the share of the session's observed time in a mode,
/// every session whatever its tier — the window is read out of process. Exclusive fullscreen and borderless have a point
/// only where the whole observed time could be told apart; a window that covered its monitor while nothing could ask the
/// swap chain counts as neither.
/// </summary>
DisplayExclusiveShare,
DisplayBorderlessShare,
DisplayWindowedShare,
}
@@ -2,6 +2,7 @@ using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using FrameLedger.App.Services;
using FrameLedger.Application.Persistence;
using FrameLedger.Domain.Display;
using FrameLedger.Domain.Sessions;
namespace FrameLedger.App.Charts;
@@ -44,13 +45,20 @@ public static class TrendSeriesBuilder
/// <summary>How many sessions FR-6.4 leaves out at the default setting.</summary>
public static int ExcludedCount(IReadOnlyList<SessionRow> rows) => ExcludedCount(rows, TrendMetric.PresentedFps);
/// <summary>Whether a session can have a point for <paramref name="metric"/>: a frame rate needs the hooks; the machine is every session's.</summary>
/// <summary>
/// Whether a session can have a point for <paramref name="metric"/>: a frame rate needs the hooks; the machine is every
/// session's, and so is the display mode (beta.10) — the window is read out of process whether or not anything was hooked.
/// </summary>
public static bool Counts(SessionRow row, TrendMetric metric)
{
ArgumentNullException.ThrowIfNull(row);
return row.Tier == CaptureTier.Hooked || IsMachineMetric(metric);
return row.Tier == CaptureTier.Hooked || IsMachineMetric(metric) || IsDisplayMetric(metric);
}
/// <summary>The display-mode shares (beta.10).</summary>
public static bool IsDisplayMetric(TrendMetric metric) =>
metric is TrendMetric.DisplayExclusiveShare or TrendMetric.DisplayBorderlessShare or TrendMetric.DisplayWindowedShare;
/// <summary>The metrics that are telemetry, recorded by every session whatever its tier.</summary>
public static bool IsMachineMetric(TrendMetric metric) => metric is TrendMetric.MaxGpuTemp or TrendMetric.AvgGpuLoad or TrendMetric.AvgGpuPower
or TrendMetric.AvgCpuLoad or TrendMetric.MaxCpuTemp or TrendMetric.AvgRam;
@@ -68,6 +76,13 @@ public static class TrendSeriesBuilder
public static bool IsPartial(SessionRow row, TrendMetric metric)
{
ArgumentNullException.ThrowIfNull(row);
// A display share is the whole session's by construction (beta.10): switching between fullscreen and a window resizes
// the swap chain, which is exactly what marks a session "settings changed" — the share is what that change was.
if (IsDisplayMetric(metric))
{
return false;
}
// A steady state (CLAUDE.md rule 6, 2026-09-17) is the factor's AND the Native / Displayed rates beside it: all three
// describe the state the session spent most of its generating time in, never the whole session (beta.8).
return row.SettingsChangedMidSession
@@ -101,10 +116,27 @@ public static class TrendSeriesBuilder
TrendMetric.MaxCpuTemp => row.MaxCpuTemp,
TrendMetric.AvgRam => row.AvgRamMb,
TrendMetric.FgFactor => readout.Kind == FpsReadoutKind.Generated ? readout.Factor : null,
TrendMetric.DisplayExclusiveShare => DisplayShare(row, DisplayMode.ExclusiveFullscreen),
TrendMetric.DisplayBorderlessShare => DisplayShare(row, DisplayMode.Borderless),
TrendMetric.DisplayWindowedShare => DisplayShare(row, DisplayMode.Windowed),
_ => null,
};
}
/// <summary>
/// A mode's share of the session's observed time (0–100), or null: no display facts on the row, no window ever read, or —
/// for exclusive fullscreen and borderless — time the two could not be told apart, which would make either share a guess.
/// </summary>
private static double? DisplayShare(SessionRow row, DisplayMode mode)
{
if (DisplayText.Of(row) is not { ObservedMs: > 0 } display)
{
return null;
}
return mode is DisplayMode.ExclusiveFullscreen or DisplayMode.Borderless && !display.ExclusivityKnown ? null : display.SharePercent(mode);
}
/// <summary>
/// One marker per day that changed (beta.8): every difference found on that day in one label, line after line — two
/// labels at one position were drawn over each other.
@@ -256,6 +256,14 @@
<DataGridTextColumn Header="{x:Static res:Strings.Sessions_Col_Resolution}" Binding="{Binding ResolutionText}" />
<DataGridTextColumn Header="{x:Static res:Strings.Sessions_Col_GpuTemp}" Binding="{Binding GpuTempText}" />
<DataGridTextColumn Header="{x:Static res:Strings.Sessions_Col_Api}" Binding="{Binding ApiText}" />
<!-- beta.10: both tiers; the tooltip carries every share, the window, the back buffer and the source -->
<DataGridTemplateColumn Header="{x:Static res:Strings.Sessions_Col_Display}">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate DataType="{x:Type vm:SessionItemViewModel}">
<TextBlock Text="{Binding DisplayModeText}" ToolTip="{Binding DisplayModeTooltip}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate DataType="{x:Type vm:SessionItemViewModel}">
+167
View File
@@ -0,0 +1,167 @@
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using FrameLedger.Application.Persistence;
using FrameLedger.Application.Recording;
using FrameLedger.Domain.Display;
namespace FrameLedger.App.Services;
/// <summary>
/// A session's display facts as the pages say them (beta.10, <c>03_METRICS</c> §Display mode): the mode that lasted longest
/// with its share, every mode's share, and the sizes and the source behind them. A mode is never named more certainly than
/// its source allows — a window that covered its monitor while nothing could ask the swap chain is "Fullscreen or
/// borderless", never either.
/// </summary>
[SuppressMessage("Performance", "CA1863:Use 'CompositeFormat'", Justification = "the format strings are resources that follow the UI culture, which changes at runtime")]
public static class DisplayText
{
/// <summary>The order the shares are said in: the fullscreen end first.</summary>
private static readonly DisplayMode[] _order =
[DisplayMode.ExclusiveFullscreen, DisplayMode.Borderless, DisplayMode.CoversScreen, DisplayMode.Windowed, DisplayMode.Minimized];
/// <summary>The row's display facts, or null for a row that has none (written before beta.10, or recovered from a crash file).</summary>
public static DisplaySummary? Of(SessionRow row) => SessionDisplayColumns.DisplayOf(row);
public static string ModeName(DisplayMode mode) => mode switch
{
DisplayMode.ExclusiveFullscreen => Strings.Display_Mode_Exclusive,
DisplayMode.Borderless => Strings.Display_Mode_Borderless,
DisplayMode.CoversScreen => Strings.Display_Mode_CoversScreen,
DisplayMode.Windowed => Strings.Display_Mode_Windowed,
DisplayMode.Minimized => Strings.Display_Mode_Minimized,
_ => Strings.Display_Mode_NoWindow,
};
/// <summary>
/// The mode that lasted longest and its share (<c>Borderless 92%</c>); "No window" when a window was never read; N/A for a
/// row without display facts.
/// </summary>
public static string Headline(DisplaySummary? display)
{
if (display is null)
{
return Strings.Common_NotAvailable;
}
return display.Dominant is { } mode
? Share(mode, display.SharePercent(mode))
: display.MinimizedMs > 0 ? Share(DisplayMode.Minimized, display.SharePercent(DisplayMode.Minimized)) : Strings.Display_Mode_NoWindow;
}
/// <summary>Every mode the session spent time in, fullscreen end first (<c>Exclusive fullscreen 8% · Borderless 92%</c>).</summary>
public static string Shares(DisplaySummary? display)
{
if (display is null)
{
return Strings.Common_NotAvailable;
}
string[] parts = [.. _order.Where(m => display.SharePercent(m) is > 0).Select(m => Share(m, display.SharePercent(m)))];
return parts.Length == 0 ? Strings.Display_Mode_NoWindow : string.Join(" · ", parts);
}
/// <summary>The window's client size in the mode that lasted longest, or N/A.</summary>
public static string Window(DisplaySummary? display) =>
display is { WindowWidth: > 0 and int w, WindowHeight: > 0 and int h } ? Size(w, h) : Strings.Common_NotAvailable;
/// <summary>The monitor the window was on, with its refresh rate when known, or N/A.</summary>
public static string Monitor(DisplaySummary? display) => display switch
{
{ MonitorWidth: > 0 and int w, MonitorHeight: > 0 and int h, MonitorHz: > 0 and int hz }
=> string.Format(CultureInfo.CurrentCulture, Strings.Display_SizeHz_Format, w, h, hz),
{ MonitorWidth: > 0 and int w, MonitorHeight: > 0 and int h } => Size(w, h),
_ => Strings.Common_NotAvailable,
};
/// <summary>
/// Everything the row says about the display, as one line for the session summary and the tooltips: the shares, the
/// changes, the window on its monitor, the back buffer and its swap effect, and what it all rested on. Null for a row
/// without display facts.
/// </summary>
public static string? Line(DisplaySummary? display)
{
if (display is null)
{
return null;
}
var parts = new List<string> { Shares(display) };
if (display.Changes > 0)
{
parts.Add(display.Changes == 1
? Strings.Display_Changes_One
: string.Format(CultureInfo.CurrentCulture, Strings.Display_Changes_Format, display.Changes));
}
if (display is { WindowWidth: > 0 and int ww, WindowHeight: > 0 and int wh })
{
parts.Add(display is { MonitorWidth: > 0 and int mw, MonitorHeight: > 0 and int mh }
? display.MonitorHz is > 0 and int hz
? string.Format(CultureInfo.CurrentCulture, Strings.Display_WindowOnMonitorHz_Format, ww, wh, mw, mh, hz)
: string.Format(CultureInfo.CurrentCulture, Strings.Display_WindowOnMonitor_Format, ww, wh, mw, mh)
: string.Format(CultureInfo.CurrentCulture, Strings.Display_Window_Format, ww, wh));
}
if (display is { BufferWidth: > 0 and uint bw, BufferHeight: > 0 and uint bh })
{
parts.Add(display.SwapEffect is { Length: > 0 } effect
? string.Format(CultureInfo.CurrentCulture, Strings.Display_BufferEffect_Format, bw, bh, effect)
: string.Format(CultureInfo.CurrentCulture, Strings.Display_Buffer_Format, bw, bh));
}
if (SourceText(display.Source) is { } source)
{
parts.Add(source);
}
return string.Format(CultureInfo.CurrentCulture, Strings.Display_Line_Format, string.Join(" · ", parts));
}
/// <summary>What the facts rested on, said with what it means for exclusive fullscreen; null when no window was read.</summary>
public static string? SourceText(string? source) => source switch
{
DisplaySource.SwapChain => Strings.Display_Source_SwapChain,
DisplaySource.OpenGl => Strings.Display_Source_OpenGl,
DisplaySource.Window => Strings.Display_Source_Window,
_ => null,
};
/// <summary>
/// The row's display facts for the CSV's <c># display:</c> line — InvariantCulture and the stored names, as every export
/// line is, so a file reads the same in every UI language.
/// </summary>
public static string ExportLine(DisplaySummary? display)
{
if (display is null)
{
return "N/A (not recorded: a session recorded before beta.10, or recovered from its crash file)";
}
CultureInfo inv = CultureInfo.InvariantCulture;
string Pair(int? w, int? h) => w is > 0 && h is > 0 ? w.Value.ToString(inv) + "x" + h.Value.ToString(inv) : "n/a";
string buffer = display is { BufferWidth: > 0 and uint bw, BufferHeight: > 0 and uint bh } ? bw.ToString(inv) + "x" + bh.ToString(inv) : "n/a";
string hz = display.MonitorHz is > 0 and int r ? "@" + r.ToString(inv) : string.Empty;
return string.Join("; ",
"exclusive_ms=" + display.ExclusiveMs.ToString(inv),
"borderless_ms=" + display.BorderlessMs.ToString(inv),
"covers_ms=" + display.CoversMs.ToString(inv),
"windowed_ms=" + display.WindowedMs.ToString(inv),
"minimized_ms=" + display.MinimizedMs.ToString(inv),
"nowindow_ms=" + display.NoWindowMs.ToString(inv),
"changes=" + display.Changes.ToString(inv),
"source=" + (display.Source ?? "n/a"),
"window=" + Pair(display.WindowWidth, display.WindowHeight),
"buffer=" + buffer,
"monitor=" + Pair(display.MonitorWidth, display.MonitorHeight) + hz);
}
/// <summary>A share as a person reads it: whole percent, and "&lt;1%" for time that was there but rounds to none.</summary>
internal static string Percent(double share) => share is > 0 and < 0.5
? "<1%"
: Math.Round(share, MidpointRounding.AwayFromZero).ToString("0", CultureInfo.CurrentCulture) + "%";
private static string Share(DisplayMode mode, double? share) =>
share is double s ? string.Format(CultureInfo.CurrentCulture, Strings.Display_Share_Format, ModeName(mode), Percent(s)) : ModeName(mode);
private static string Size(int w, int h) => string.Format(CultureInfo.CurrentCulture, Strings.Display_Size_Format, w, h);
}
@@ -108,6 +108,9 @@ public sealed class SessionExporter
}
w.WriteLine("# api: " + (row.Api ?? "N/A") + "; present_mode: " + (row.PresentMode ?? "N/A") + "; swap_effect: " + (row.SwapEffect ?? "N/A"));
// beta.10 (03_METRICS §Display mode): milliseconds per mode, both tiers — a header line, because the per-frame columns
// are 03_METRICS' fixed list and a mode is the session's, not a frame's.
w.WriteLine("# display: " + DisplayText.ExportLine(DisplayText.Of(row)));
w.WriteLine("# hardware: " + (hardware is null ? "N/A" : string.Join("; ", new[] { hardware.CpuName, hardware.GpuName, hardware.GpuDriver, hardware.OsBuild, hardware.DisplayRes }.Where(static s => !string.IsNullOrEmpty(s)))));
w.WriteLine("# rt: " + row.RtFlag + " (" + (row.RtSource ?? "n/a") + "); pt: " + row.PtFlag + " (" + (row.PtSource ?? "n/a") + "); rr: " + row.RrFlag + " (" + (row.RrSource ?? "n/a") + ")");
w.WriteLine("# fg_mode: " + row.FgMode + "; fg_source: " + (row.FgSource ?? "n/a") + "; presented_qualifier: " + (row.PresentedQualifier ?? "n/a"));
+84
View File
@@ -130,16 +130,19 @@ public static class Strings
nameof(Compare_Legend_Format),
nameof(Compare_Metric_AvgCpuLoad),
nameof(Compare_Metric_AvgGpuLoad),
nameof(Compare_Metric_Display),
nameof(Compare_Metric_Displayed),
nameof(Compare_Metric_Duration),
nameof(Compare_Metric_MaxCpuTemp),
nameof(Compare_Metric_MaxGpuTemp),
nameof(Compare_Metric_Median),
nameof(Compare_Metric_Monitor),
nameof(Compare_Metric_Native),
nameof(Compare_Metric_P01Low),
nameof(Compare_Metric_P1Low),
nameof(Compare_Metric_Presented),
nameof(Compare_Metric_StutterPct),
nameof(Compare_Metric_Window),
nameof(Compare_Mixed_Body),
nameof(Compare_Mixed_Legend),
nameof(Compare_Mixed_Proceed),
@@ -180,6 +183,26 @@ public static class Strings
nameof(Dashboard_Totals_Playtime),
nameof(Dashboard_Totals_ThisWeek),
nameof(Diag_Written_Format),
nameof(Display_Buffer_Format),
nameof(Display_BufferEffect_Format),
nameof(Display_Changes_Format),
nameof(Display_Changes_One),
nameof(Display_Line_Format),
nameof(Display_Mode_Borderless),
nameof(Display_Mode_CoversScreen),
nameof(Display_Mode_Exclusive),
nameof(Display_Mode_Minimized),
nameof(Display_Mode_NoWindow),
nameof(Display_Mode_Windowed),
nameof(Display_Share_Format),
nameof(Display_Size_Format),
nameof(Display_SizeHz_Format),
nameof(Display_Source_OpenGl),
nameof(Display_Source_SwapChain),
nameof(Display_Source_Window),
nameof(Display_Window_Format),
nameof(Display_WindowOnMonitor_Format),
nameof(Display_WindowOnMonitorHz_Format),
nameof(EditGame_Detected),
nameof(EditGame_Name),
nameof(EditGame_Notes),
@@ -600,6 +623,7 @@ public static class Strings
nameof(Session_UnderException_Format),
nameof(Sessions_Col_Api),
nameof(Sessions_Col_Date),
nameof(Sessions_Col_Display),
nameof(Sessions_Col_Displayed),
nameof(Sessions_Col_Duration),
nameof(Sessions_Col_Exit),
@@ -728,6 +752,7 @@ public static class Strings
nameof(Summary_Show_Sensors),
nameof(Summary_Stat_Avg),
nameof(Summary_Stat_Cpu),
nameof(Summary_Stat_Display),
nameof(Summary_Stat_Duration),
nameof(Summary_Stat_Gpu),
nameof(Summary_Stat_LoadTemp_Format),
@@ -797,7 +822,10 @@ public static class Strings
nameof(Trend_Metric_AvgGpuLoad),
nameof(Trend_Metric_AvgGpuPower),
nameof(Trend_Metric_AvgRam),
nameof(Trend_Metric_DisplayBorderless),
nameof(Trend_Metric_Displayed),
nameof(Trend_Metric_DisplayExclusive),
nameof(Trend_Metric_DisplayWindowed),
nameof(Trend_Metric_FgFactor),
nameof(Trend_Metric_Label),
nameof(Trend_Metric_MaxCpuTemp),
@@ -1049,6 +1077,8 @@ public static class Strings
public static string Compare_Metric_AvgGpuLoad => ResourceManager.GetString(nameof(Compare_Metric_AvgGpuLoad), Culture) ?? nameof(Compare_Metric_AvgGpuLoad);
public static string Compare_Metric_Display => ResourceManager.GetString(nameof(Compare_Metric_Display), Culture) ?? nameof(Compare_Metric_Display);
public static string Compare_Metric_Displayed => ResourceManager.GetString(nameof(Compare_Metric_Displayed), Culture) ?? nameof(Compare_Metric_Displayed);
public static string Compare_Metric_Duration => ResourceManager.GetString(nameof(Compare_Metric_Duration), Culture) ?? nameof(Compare_Metric_Duration);
@@ -1059,6 +1089,8 @@ public static class Strings
public static string Compare_Metric_Median => ResourceManager.GetString(nameof(Compare_Metric_Median), Culture) ?? nameof(Compare_Metric_Median);
public static string Compare_Metric_Monitor => ResourceManager.GetString(nameof(Compare_Metric_Monitor), Culture) ?? nameof(Compare_Metric_Monitor);
public static string Compare_Metric_Native => ResourceManager.GetString(nameof(Compare_Metric_Native), Culture) ?? nameof(Compare_Metric_Native);
public static string Compare_Metric_P01Low => ResourceManager.GetString(nameof(Compare_Metric_P01Low), Culture) ?? nameof(Compare_Metric_P01Low);
@@ -1069,6 +1101,8 @@ public static class Strings
public static string Compare_Metric_StutterPct => ResourceManager.GetString(nameof(Compare_Metric_StutterPct), Culture) ?? nameof(Compare_Metric_StutterPct);
public static string Compare_Metric_Window => ResourceManager.GetString(nameof(Compare_Metric_Window), Culture) ?? nameof(Compare_Metric_Window);
public static string Compare_Mixed_Body => ResourceManager.GetString(nameof(Compare_Mixed_Body), Culture) ?? nameof(Compare_Mixed_Body);
public static string Compare_Mixed_Legend => ResourceManager.GetString(nameof(Compare_Mixed_Legend), Culture) ?? nameof(Compare_Mixed_Legend);
@@ -1149,6 +1183,46 @@ public static class Strings
public static string Diag_Written_Format => ResourceManager.GetString(nameof(Diag_Written_Format), Culture) ?? nameof(Diag_Written_Format);
public static string Display_Buffer_Format => ResourceManager.GetString(nameof(Display_Buffer_Format), Culture) ?? nameof(Display_Buffer_Format);
public static string Display_BufferEffect_Format => ResourceManager.GetString(nameof(Display_BufferEffect_Format), Culture) ?? nameof(Display_BufferEffect_Format);
public static string Display_Changes_Format => ResourceManager.GetString(nameof(Display_Changes_Format), Culture) ?? nameof(Display_Changes_Format);
public static string Display_Changes_One => ResourceManager.GetString(nameof(Display_Changes_One), Culture) ?? nameof(Display_Changes_One);
public static string Display_Line_Format => ResourceManager.GetString(nameof(Display_Line_Format), Culture) ?? nameof(Display_Line_Format);
public static string Display_Mode_Borderless => ResourceManager.GetString(nameof(Display_Mode_Borderless), Culture) ?? nameof(Display_Mode_Borderless);
public static string Display_Mode_CoversScreen => ResourceManager.GetString(nameof(Display_Mode_CoversScreen), Culture) ?? nameof(Display_Mode_CoversScreen);
public static string Display_Mode_Exclusive => ResourceManager.GetString(nameof(Display_Mode_Exclusive), Culture) ?? nameof(Display_Mode_Exclusive);
public static string Display_Mode_Minimized => ResourceManager.GetString(nameof(Display_Mode_Minimized), Culture) ?? nameof(Display_Mode_Minimized);
public static string Display_Mode_NoWindow => ResourceManager.GetString(nameof(Display_Mode_NoWindow), Culture) ?? nameof(Display_Mode_NoWindow);
public static string Display_Mode_Windowed => ResourceManager.GetString(nameof(Display_Mode_Windowed), Culture) ?? nameof(Display_Mode_Windowed);
public static string Display_Share_Format => ResourceManager.GetString(nameof(Display_Share_Format), Culture) ?? nameof(Display_Share_Format);
public static string Display_Size_Format => ResourceManager.GetString(nameof(Display_Size_Format), Culture) ?? nameof(Display_Size_Format);
public static string Display_SizeHz_Format => ResourceManager.GetString(nameof(Display_SizeHz_Format), Culture) ?? nameof(Display_SizeHz_Format);
public static string Display_Source_OpenGl => ResourceManager.GetString(nameof(Display_Source_OpenGl), Culture) ?? nameof(Display_Source_OpenGl);
public static string Display_Source_SwapChain => ResourceManager.GetString(nameof(Display_Source_SwapChain), Culture) ?? nameof(Display_Source_SwapChain);
public static string Display_Source_Window => ResourceManager.GetString(nameof(Display_Source_Window), Culture) ?? nameof(Display_Source_Window);
public static string Display_Window_Format => ResourceManager.GetString(nameof(Display_Window_Format), Culture) ?? nameof(Display_Window_Format);
public static string Display_WindowOnMonitor_Format => ResourceManager.GetString(nameof(Display_WindowOnMonitor_Format), Culture) ?? nameof(Display_WindowOnMonitor_Format);
public static string Display_WindowOnMonitorHz_Format => ResourceManager.GetString(nameof(Display_WindowOnMonitorHz_Format), Culture) ?? nameof(Display_WindowOnMonitorHz_Format);
public static string EditGame_Detected => ResourceManager.GetString(nameof(EditGame_Detected), Culture) ?? nameof(EditGame_Detected);
public static string EditGame_Name => ResourceManager.GetString(nameof(EditGame_Name), Culture) ?? nameof(EditGame_Name);
@@ -1989,6 +2063,8 @@ public static class Strings
public static string Sessions_Col_Date => ResourceManager.GetString(nameof(Sessions_Col_Date), Culture) ?? nameof(Sessions_Col_Date);
public static string Sessions_Col_Display => ResourceManager.GetString(nameof(Sessions_Col_Display), Culture) ?? nameof(Sessions_Col_Display);
public static string Sessions_Col_Displayed => ResourceManager.GetString(nameof(Sessions_Col_Displayed), Culture) ?? nameof(Sessions_Col_Displayed);
public static string Sessions_Col_Duration => ResourceManager.GetString(nameof(Sessions_Col_Duration), Culture) ?? nameof(Sessions_Col_Duration);
@@ -2245,6 +2321,8 @@ public static class Strings
public static string Summary_Stat_Cpu => ResourceManager.GetString(nameof(Summary_Stat_Cpu), Culture) ?? nameof(Summary_Stat_Cpu);
public static string Summary_Stat_Display => ResourceManager.GetString(nameof(Summary_Stat_Display), Culture) ?? nameof(Summary_Stat_Display);
public static string Summary_Stat_Duration => ResourceManager.GetString(nameof(Summary_Stat_Duration), Culture) ?? nameof(Summary_Stat_Duration);
public static string Summary_Stat_Gpu => ResourceManager.GetString(nameof(Summary_Stat_Gpu), Culture) ?? nameof(Summary_Stat_Gpu);
@@ -2383,8 +2461,14 @@ public static class Strings
public static string Trend_Metric_AvgRam => ResourceManager.GetString(nameof(Trend_Metric_AvgRam), Culture) ?? nameof(Trend_Metric_AvgRam);
public static string Trend_Metric_DisplayBorderless => ResourceManager.GetString(nameof(Trend_Metric_DisplayBorderless), Culture) ?? nameof(Trend_Metric_DisplayBorderless);
public static string Trend_Metric_Displayed => ResourceManager.GetString(nameof(Trend_Metric_Displayed), Culture) ?? nameof(Trend_Metric_Displayed);
public static string Trend_Metric_DisplayExclusive => ResourceManager.GetString(nameof(Trend_Metric_DisplayExclusive), Culture) ?? nameof(Trend_Metric_DisplayExclusive);
public static string Trend_Metric_DisplayWindowed => ResourceManager.GetString(nameof(Trend_Metric_DisplayWindowed), Culture) ?? nameof(Trend_Metric_DisplayWindowed);
public static string Trend_Metric_FgFactor => ResourceManager.GetString(nameof(Trend_Metric_FgFactor), Culture) ?? nameof(Trend_Metric_FgFactor);
public static string Trend_Metric_Label => ResourceManager.GetString(nameof(Trend_Metric_Label), Culture) ?? nameof(Trend_Metric_Label);
+112
View File
@@ -677,6 +677,86 @@
<value>{0}×{1}</value>
<comment>review</comment>
</data>
<data name="Display_Mode_Exclusive" xml:space="preserve">
<value>排他的フルスクリーン</value>
<comment>review</comment>
</data>
<data name="Display_Mode_Borderless" xml:space="preserve">
<value>ボーダーレス</value>
<comment>review</comment>
</data>
<data name="Display_Mode_CoversScreen" xml:space="preserve">
<value>フルスクリーンまたはボーダーレス</value>
<comment>review</comment>
</data>
<data name="Display_Mode_Windowed" xml:space="preserve">
<value>ウィンドウ</value>
<comment>review</comment>
</data>
<data name="Display_Mode_Minimized" xml:space="preserve">
<value>最小化</value>
<comment>review</comment>
</data>
<data name="Display_Mode_NoWindow" xml:space="preserve">
<value>ウィンドウを読み取れず</value>
<comment>review</comment>
</data>
<data name="Display_Share_Format" xml:space="preserve">
<value>{0} {1}</value>
<comment>review</comment>
</data>
<data name="Display_Size_Format" xml:space="preserve">
<value>{0}×{1}</value>
<comment>review</comment>
</data>
<data name="Display_SizeHz_Format" xml:space="preserve">
<value>{0}×{1} @ {2} Hz</value>
<comment>review</comment>
</data>
<data name="Display_Changes_One" xml:space="preserve">
<value>1 回切り替え</value>
<comment>review</comment>
</data>
<data name="Display_Changes_Format" xml:space="preserve">
<value>{0} 回切り替え</value>
<comment>review</comment>
</data>
<data name="Display_Window_Format" xml:space="preserve">
<value>ウィンドウ {0}×{1}</value>
<comment>review</comment>
</data>
<data name="Display_WindowOnMonitor_Format" xml:space="preserve">
<value>{2}×{3} のモニター上のウィンドウ {0}×{1}</value>
<comment>review</comment>
</data>
<data name="Display_WindowOnMonitorHz_Format" xml:space="preserve">
<value>{2}×{3}・{4} Hz のモニター上のウィンドウ {0}×{1}</value>
<comment>review</comment>
</data>
<data name="Display_Buffer_Format" xml:space="preserve">
<value>バックバッファー {0}×{1}</value>
<comment>review</comment>
</data>
<data name="Display_BufferEffect_Format" xml:space="preserve">
<value>バックバッファー {0}×{1}({2})</value>
<comment>review</comment>
</data>
<data name="Display_Source_SwapChain" xml:space="preserve">
<value>排他かどうかはスワップチェーンが報告</value>
<comment>review</comment>
</data>
<data name="Display_Source_OpenGl" xml:space="preserve">
<value>OpenGL:排他的フルスクリーンとボーダーレスは区別できません</value>
<comment>review</comment>
</data>
<data name="Display_Source_Window" xml:space="preserve">
<value>ウィンドウのみから:排他的フルスクリーンとボーダーレスは区別できません</value>
<comment>review</comment>
</data>
<data name="Display_Line_Format" xml:space="preserve">
<value>表示:{0}</value>
<comment>review</comment>
</data>
<data name="Format_Temperature_Format" xml:space="preserve">
<value>{0:0} °C</value>
<comment>review</comment>
@@ -957,6 +1037,10 @@
<value>API</value>
<comment>review</comment>
</data>
<data name="Sessions_Col_Display" xml:space="preserve">
<value>表示</value>
<comment>review</comment>
</data>
<data name="Sessions_Col_Date" xml:space="preserve">
<value>日付</value>
<comment>review</comment>
@@ -1329,6 +1413,18 @@
<value>時間</value>
<comment>review</comment>
</data>
<data name="Compare_Metric_Display" xml:space="preserve">
<value>表示モード</value>
<comment>review</comment>
</data>
<data name="Compare_Metric_Window" xml:space="preserve">
<value>ウィンドウ</value>
<comment>review</comment>
</data>
<data name="Compare_Metric_Monitor" xml:space="preserve">
<value>モニター</value>
<comment>review</comment>
</data>
<data name="Compare_Metric_MaxGpuTemp" xml:space="preserve">
<value>GPU 最高 °C</value>
<comment>review</comment>
@@ -2396,6 +2492,18 @@
<value>FG倍率 ×</value>
<comment>review</comment>
</data>
<data name="Trend_Metric_DisplayExclusive" xml:space="preserve">
<value>排他的フルスクリーンの割合 %</value>
<comment>review</comment>
</data>
<data name="Trend_Metric_DisplayBorderless" xml:space="preserve">
<value>ボーダーレスの割合 %</value>
<comment>review</comment>
</data>
<data name="Trend_Metric_DisplayWindowed" xml:space="preserve">
<value>ウィンドウの割合 %</value>
<comment>review</comment>
</data>
<data name="Sensors_Series_CpuTemp" xml:space="preserve">
<value>CPU °C</value>
<comment>review</comment>
@@ -2428,6 +2536,10 @@
<value>CPU</value>
<comment>review</comment>
</data>
<data name="Summary_Stat_Display" xml:space="preserve">
<value>表示</value>
<comment>review</comment>
</data>
<data name="Summary_Stat_LoadTemp_Format" xml:space="preserve">
<value>平均 {0} · 最大 {1}</value>
<comment>review</comment>
+84
View File
@@ -513,6 +513,66 @@
<data name="Format_Resolution_Single_Format" xml:space="preserve">
<value>{0}×{1}</value>
</data>
<data name="Display_Mode_Exclusive" xml:space="preserve">
<value>Exclusive fullscreen</value>
</data>
<data name="Display_Mode_Borderless" xml:space="preserve">
<value>Borderless</value>
</data>
<data name="Display_Mode_CoversScreen" xml:space="preserve">
<value>Fullscreen or borderless</value>
</data>
<data name="Display_Mode_Windowed" xml:space="preserve">
<value>Windowed</value>
</data>
<data name="Display_Mode_Minimized" xml:space="preserve">
<value>Minimized</value>
</data>
<data name="Display_Mode_NoWindow" xml:space="preserve">
<value>No window read</value>
</data>
<data name="Display_Share_Format" xml:space="preserve">
<value>{0} {1}</value>
</data>
<data name="Display_Size_Format" xml:space="preserve">
<value>{0}×{1}</value>
</data>
<data name="Display_SizeHz_Format" xml:space="preserve">
<value>{0}×{1} @ {2} Hz</value>
</data>
<data name="Display_Changes_One" xml:space="preserve">
<value>changed once</value>
</data>
<data name="Display_Changes_Format" xml:space="preserve">
<value>changed {0} times</value>
</data>
<data name="Display_Window_Format" xml:space="preserve">
<value>window {0}×{1}</value>
</data>
<data name="Display_WindowOnMonitor_Format" xml:space="preserve">
<value>window {0}×{1} on a {2}×{3} monitor</value>
</data>
<data name="Display_WindowOnMonitorHz_Format" xml:space="preserve">
<value>window {0}×{1} on a {2}×{3} monitor at {4} Hz</value>
</data>
<data name="Display_Buffer_Format" xml:space="preserve">
<value>back buffer {0}×{1}</value>
</data>
<data name="Display_BufferEffect_Format" xml:space="preserve">
<value>back buffer {0}×{1} ({2})</value>
</data>
<data name="Display_Source_SwapChain" xml:space="preserve">
<value>the swap chain said whether it was exclusive</value>
</data>
<data name="Display_Source_OpenGl" xml:space="preserve">
<value>OpenGL: exclusive fullscreen cannot be told from borderless</value>
</data>
<data name="Display_Source_Window" xml:space="preserve">
<value>from the window alone: exclusive fullscreen cannot be told from borderless</value>
</data>
<data name="Display_Line_Format" xml:space="preserve">
<value>Display: {0}</value>
</data>
<data name="Format_Temperature_Format" xml:space="preserve">
<value>{0:0} °C</value>
</data>
@@ -723,6 +783,9 @@
<data name="Sessions_Col_Api" xml:space="preserve">
<value>API</value>
</data>
<data name="Sessions_Col_Display" xml:space="preserve">
<value>Display</value>
</data>
<data name="Sessions_Col_Date" xml:space="preserve">
<value>Date</value>
</data>
@@ -1002,6 +1065,15 @@
<data name="Compare_Metric_Duration" xml:space="preserve">
<value>Duration</value>
</data>
<data name="Compare_Metric_Display" xml:space="preserve">
<value>Display mode</value>
</data>
<data name="Compare_Metric_Window" xml:space="preserve">
<value>Window</value>
</data>
<data name="Compare_Metric_Monitor" xml:space="preserve">
<value>Monitor</value>
</data>
<data name="Compare_Metric_MaxGpuTemp" xml:space="preserve">
<value>Max GPU °C</value>
</data>
@@ -1806,6 +1878,15 @@ Open the log folder?</value>
<data name="Trend_Metric_FgFactor" xml:space="preserve">
<value>FG factor ×</value>
</data>
<data name="Trend_Metric_DisplayExclusive" xml:space="preserve">
<value>Exclusive fullscreen share %</value>
</data>
<data name="Trend_Metric_DisplayBorderless" xml:space="preserve">
<value>Borderless share %</value>
</data>
<data name="Trend_Metric_DisplayWindowed" xml:space="preserve">
<value>Windowed share %</value>
</data>
<data name="Sensors_Series_CpuTemp" xml:space="preserve">
<value>CPU °C</value>
</data>
@@ -1830,6 +1911,9 @@ Open the log folder?</value>
<data name="Summary_Stat_Cpu" xml:space="preserve">
<value>CPU</value>
</data>
<data name="Summary_Stat_Display" xml:space="preserve">
<value>Display</value>
</data>
<data name="Summary_Stat_LoadTemp_Format" xml:space="preserve">
<value>{0} avg · {1} max</value>
</data>
+84
View File
@@ -508,6 +508,66 @@
<data name="Format_Resolution_Single_Format" xml:space="preserve">
<value>{0}×{1}</value>
</data>
<data name="Display_Mode_Exclusive" xml:space="preserve">
<value>Toàn màn hình độc quyền</value>
</data>
<data name="Display_Mode_Borderless" xml:space="preserve">
<value>Không viền</value>
</data>
<data name="Display_Mode_CoversScreen" xml:space="preserve">
<value>Toàn màn hình hoặc không viền</value>
</data>
<data name="Display_Mode_Windowed" xml:space="preserve">
<value>Cửa sổ</value>
</data>
<data name="Display_Mode_Minimized" xml:space="preserve">
<value>Thu nhỏ</value>
</data>
<data name="Display_Mode_NoWindow" xml:space="preserve">
<value>Không đọc được cửa sổ</value>
</data>
<data name="Display_Share_Format" xml:space="preserve">
<value>{0} {1}</value>
</data>
<data name="Display_Size_Format" xml:space="preserve">
<value>{0}×{1}</value>
</data>
<data name="Display_SizeHz_Format" xml:space="preserve">
<value>{0}×{1} @ {2} Hz</value>
</data>
<data name="Display_Changes_One" xml:space="preserve">
<value>đổi 1 lần</value>
</data>
<data name="Display_Changes_Format" xml:space="preserve">
<value>đổi {0} lần</value>
</data>
<data name="Display_Window_Format" xml:space="preserve">
<value>cửa sổ {0}×{1}</value>
</data>
<data name="Display_WindowOnMonitor_Format" xml:space="preserve">
<value>cửa sổ {0}×{1} trên màn hình {2}×{3}</value>
</data>
<data name="Display_WindowOnMonitorHz_Format" xml:space="preserve">
<value>cửa sổ {0}×{1} trên màn hình {2}×{3} ở {4} Hz</value>
</data>
<data name="Display_Buffer_Format" xml:space="preserve">
<value>back buffer {0}×{1}</value>
</data>
<data name="Display_BufferEffect_Format" xml:space="preserve">
<value>back buffer {0}×{1} ({2})</value>
</data>
<data name="Display_Source_SwapChain" xml:space="preserve">
<value>swap chain cho biết có độc quyền hay không</value>
</data>
<data name="Display_Source_OpenGl" xml:space="preserve">
<value>OpenGL: không phân biệt được toàn màn hình độc quyền với không viền</value>
</data>
<data name="Display_Source_Window" xml:space="preserve">
<value>chỉ từ cửa sổ: không phân biệt được toàn màn hình độc quyền với không viền</value>
</data>
<data name="Display_Line_Format" xml:space="preserve">
<value>Hiển thị: {0}</value>
</data>
<data name="Format_Temperature_Format" xml:space="preserve">
<value>{0:0} °C</value>
</data>
@@ -718,6 +778,9 @@
<data name="Sessions_Col_Api" xml:space="preserve">
<value>API</value>
</data>
<data name="Sessions_Col_Display" xml:space="preserve">
<value>Hiển thị</value>
</data>
<data name="Sessions_Col_Date" xml:space="preserve">
<value>Ngày</value>
</data>
@@ -997,6 +1060,15 @@
<data name="Compare_Metric_Duration" xml:space="preserve">
<value>Thời lượng</value>
</data>
<data name="Compare_Metric_Display" xml:space="preserve">
<value>Chế độ hiển thị</value>
</data>
<data name="Compare_Metric_Window" xml:space="preserve">
<value>Cửa sổ</value>
</data>
<data name="Compare_Metric_Monitor" xml:space="preserve">
<value>Màn hình</value>
</data>
<data name="Compare_Metric_MaxGpuTemp" xml:space="preserve">
<value>GPU tối đa °C</value>
</data>
@@ -1801,6 +1873,15 @@ Mở thư mục log?</value>
<data name="Trend_Metric_FgFactor" xml:space="preserve">
<value>Hệ số FG ×</value>
</data>
<data name="Trend_Metric_DisplayExclusive" xml:space="preserve">
<value>Tỉ lệ toàn màn hình độc quyền %</value>
</data>
<data name="Trend_Metric_DisplayBorderless" xml:space="preserve">
<value>Tỉ lệ không viền %</value>
</data>
<data name="Trend_Metric_DisplayWindowed" xml:space="preserve">
<value>Tỉ lệ cửa sổ %</value>
</data>
<data name="Sensors_Series_CpuTemp" xml:space="preserve">
<value>CPU °C</value>
</data>
@@ -1825,6 +1906,9 @@ Mở thư mục log?</value>
<data name="Summary_Stat_Cpu" xml:space="preserve">
<value>CPU</value>
</data>
<data name="Summary_Stat_Display" xml:space="preserve">
<value>Hiển thị</value>
</data>
<data name="Summary_Stat_LoadTemp_Format" xml:space="preserve">
<value>TB {0} · tối đa {1}</value>
</data>
@@ -193,6 +193,11 @@ public sealed partial class CompareViewModel : ObservableObject
Rows.Add(Row(Strings.Compare_Metric_AvgCpuLoad, rows, static r => r.AvgCpuLoad, Formats.Percent, higherIsBetter: null));
Rows.Add(Row(Strings.Compare_Metric_MaxCpuTemp, rows, static r => r.MaxCpuTemp, Formats.Temperature, higherIsBetter: false));
Rows.Add(new CompareRowViewModel(Strings.Compare_Metric_Duration, [.. rows.Select(static r => new CompareCell(Formats.Duration(r.DurationSeconds), false))]));
// beta.10: how each session was shown, both tiers. Facts, not scores: no mode is better than another, so none is best.
Rows.Add(new CompareRowViewModel(Strings.Compare_Metric_Display, [.. rows.Select(static r => new CompareCell(DisplayText.Shares(DisplayText.Of(r)), false))]));
Rows.Add(new CompareRowViewModel(Strings.Compare_Metric_Window, [.. rows.Select(static r => new CompareCell(DisplayText.Window(DisplayText.Of(r)), false))]));
Rows.Add(new CompareRowViewModel(Strings.Compare_Metric_Monitor, [.. rows.Select(static r => new CompareCell(DisplayText.Monitor(DisplayText.Of(r)), false))]));
}
/// <summary>
@@ -329,6 +329,9 @@ public sealed partial class GameDetailViewModel : ObservableObject
new(TrendMetric.MaxCpuTemp, Strings.Trend_Metric_MaxCpuTemp),
new(TrendMetric.AvgRam, Strings.Trend_Metric_AvgRam),
new(TrendMetric.FgFactor, Strings.Trend_Metric_FgFactor),
new(TrendMetric.DisplayExclusiveShare, Strings.Trend_Metric_DisplayExclusive),
new(TrendMetric.DisplayBorderlessShare, Strings.Trend_Metric_DisplayBorderless),
new(TrendMetric.DisplayWindowedShare, Strings.Trend_Metric_DisplayWindowed),
];
/// <summary>The selected session's decoded series (null: none selected, Tier 2, or swept).</summary>
@@ -915,6 +918,15 @@ public sealed partial class GameDetailViewModel : ObservableObject
{
Measured.Add(chip.Text);
}
// beta.10: how that session was shown — the mode that lasted longest and the window's size.
if (DisplayText.Of(lastHooked) is { } display)
{
string window = DisplayText.Window(display);
string headline = DisplayText.Headline(display);
Measured.Add(string.Format(CultureInfo.CurrentCulture, Strings.Display_Line_Format,
string.Equals(window, Strings.Common_NotAvailable, StringComparison.Ordinal) ? headline : headline + " · " + window));
}
}
private void PresentHooking(GameRow row)
@@ -37,6 +37,10 @@ public sealed class SessionItemViewModel
P01LowText = IsHooked ? Formats.Fps(row.P01LowFps) : Strings.Common_NotAvailable;
ResolutionText = IsHooked ? Formats.Resolution(row.RenderW, row.RenderH, row.OutputW, row.OutputH) + " · " + Formats.Upscaler(row.Upscaler, row.UpscalerQuality, row.UpscalerDriverReported) : Strings.Common_NotAvailable;
GpuTempText = Formats.Temperature(row.MaxGpuTemp);
// beta.10: both tiers — the window is read out of process whether or not the game was hooked.
Domain.Display.DisplaySummary? display = DisplayText.Of(row);
DisplayModeText = DisplayText.Headline(display);
DisplayModeTooltip = DisplayText.Line(display);
ApiText = IsHooked ? Formats.Api(row.Api) : Strings.Common_NotAvailable;
ExitText = Formats.ExitStatusText(row.ExitStatus);
IsCrashed = row.ExitStatus == ExitStatus.Crashed;
@@ -76,6 +80,12 @@ public sealed class SessionItemViewModel
public string GpuTempText { get; }
/// <summary>The mode the session was shown in longest, with its share; N/A for a row recorded before beta.10.</summary>
public string DisplayModeText { get; }
/// <summary>Every share, the window on its monitor, the back buffer and the source; null for a row without display facts.</summary>
public string? DisplayModeTooltip { get; }
public string ApiText { get; }
public string ExitText { get; }
@@ -82,6 +82,13 @@ public sealed partial class SessionSummaryViewModel : ObservableObject
[ObservableProperty]
private string? _exceptionLine;
/// <summary>
/// How the game was shown (beta.10, schema 0016): every mode's share, the window on its monitor, the back buffer and what
/// the facts rested on — in either tier; null for a row recorded before, or recovered from its crash file.
/// </summary>
[ObservableProperty]
private string? _displayLine;
/// <summary>Tier 2's payload (2026-09-22): why this session measured nothing, from the row's notes; empty for a hooked row.</summary>
[ObservableProperty]
private string _tier2Reason = string.Empty;
@@ -338,6 +345,7 @@ public sealed partial class SessionSummaryViewModel : ObservableObject
LibrariesLine = LoadedLibraries(row.RuntimeModulesJson, Game.Libraries);
DriverProfileLine = NvidiaOverrides.ProfileLine(row.DriverProfileJson);
DriverStateLine = NvidiaOverrides.DriverLine(row.NgxDriverWordsJson);
DisplayLine = DisplayText.Line(DisplayText.Of(row));
Tags = _annotation is null ? string.Empty : string.Join(", ", _annotation.Tags);
Notes = _annotation?.Notes ?? string.Empty;
HasDisplayed = Series?.HasGenerated == true;
@@ -363,6 +371,12 @@ public sealed partial class SessionSummaryViewModel : ObservableObject
? string.Format(CultureInfo.CurrentCulture, Strings.Summary_Stat_Stutter_Format, count, pct) : Strings.Common_NotAvailable));
Stats.Add(new StatCardModel(Strings.Summary_Stat_Duration, Formats.Duration(row.DurationSeconds)));
// beta.10, both tiers: the mode the game was shown in longest, and the window's size in it.
Domain.Display.DisplaySummary? display = DisplayText.Of(row);
string window = DisplayText.Window(display);
Stats.Add(new StatCardModel(Strings.Summary_Stat_Display, DisplayText.Headline(display),
string.Equals(window, Strings.Common_NotAvailable, StringComparison.Ordinal) ? null : window));
// The machine, both tiers: telemetry is what a not-hooked session still has. Load is the average, temperature the peak.
Stats.Add(new StatCardModel(Strings.Summary_Stat_Gpu, string.Format(CultureInfo.CurrentCulture, Strings.Summary_Stat_LoadTemp_Format, Formats.Percent(row.AvgGpuLoad), Formats.Temperature(row.MaxGpuTemp))));
Stats.Add(new StatCardModel(Strings.Summary_Stat_Cpu, string.Format(CultureInfo.CurrentCulture, Strings.Summary_Stat_LoadTemp_Format, Formats.Percent(row.AvgCpuLoad), Formats.Temperature(row.MaxCpuTemp))));
@@ -40,6 +40,9 @@
<ui:TextBlock Appearance="Secondary" TextWrapping="Wrap" Text="{Binding ViewModel.ExitLine}" />
<ui:TextBlock Appearance="Secondary" TextWrapping="Wrap" Text="{Binding ViewModel.ExceptionLine}"
Visibility="{Binding ViewModel.ExceptionLine, Converter={StaticResource NullToCollapsed}}" />
<!-- beta.10: how the game was shown, in either tier (03_METRICS §Display mode) -->
<ui:TextBlock Appearance="Secondary" TextWrapping="Wrap" Text="{Binding ViewModel.DisplayLine}"
Visibility="{Binding ViewModel.DisplayLine, Converter={StaticResource NullToCollapsed}}" />
<ui:TextBlock Appearance="Tertiary" TextWrapping="Wrap" Text="{Binding ViewModel.HardwareLine}" />
<ui:TextBlock Appearance="Tertiary" TextWrapping="Wrap" Text="{Binding ViewModel.LibrariesLine}"
Visibility="{Binding ViewModel.LibrariesLine, Converter={StaticResource NullToCollapsed}}" />
@@ -106,4 +106,10 @@ public sealed record CaptureOutcome
/// game's, so the crash witness applies even where no pid was ever held.
/// </summary>
public bool HeldUnhooked { get; init; }
/// <summary>
/// How the game was shown and for how long (beta.10, <c>03_METRICS</c> §Display mode), sampled on the loop's own ticks —
/// hooked and held alike. Null when the loop never sampled (no probe composed, or it ended before its first tick).
/// </summary>
public Domain.Display.DisplaySummary? Display { get; init; }
}
@@ -46,7 +46,8 @@ public sealed class CaptureSession(
IKillSwitch? killSwitch = null,
ICapturePauseSource? pause = null,
IUserModeExceptionSwitch? exceptions = null,
IOverlayToleranceChannel? tolerance = null)
IOverlayToleranceChannel? tolerance = null,
IDisplayProbe? display = null)
{
/// <summary>Start one session, or say why not.</summary>
/// <remarks>
@@ -158,6 +159,10 @@ public sealed class CaptureSession(
// The ticks carry the refusal with the pid the loop holds, if any (2026-09-23: the pipe announces a held session from
// its first tick). A hooking-off hold never opened the process and says 0.
CaptureProgress held = CaptureProgress.Held(refusal with { TargetPid = pid ?? 0 });
// The display mode at Tier 2 too (beta.10): the window only — nothing was injected, so nothing can say whether the
// game was exclusive. A hold that never opened the process finds the game by its image path in the watcher's
// snapshot, and still opens nothing.
var sampler = new DisplaySampler(display);
while (!stop.IsCancellationRequested)
{
bool running = alive is not null ? !alive.HasExited : resolver.IsRunning(normalisedExePath);
@@ -166,12 +171,14 @@ public sealed class CaptureSession(
break;
}
sampler.Sample(pid is { } p ? [p] : resolver.PidsOf(normalisedExePath), region: null, paused: false);
observer?.Tick(held);
await Task.Delay(options.HoldInterval, ct).ConfigureAwait(false);
}
sampler.Finish(paused: false);
observer?.Tick(held);
return refusal with { HeldUnhooked = true, TargetPid = pid ?? 0, ExitCode = alive?.ExitCode };
return refusal with { HeldUnhooked = true, TargetPid = pid ?? 0, ExitCode = alive?.ExitCode, Display = sampler.Summary() };
}
/// <summary>Launch mode (P1 item 2): start the consented executable, then the same session.</summary>
@@ -364,7 +371,7 @@ public sealed class CaptureSession(
{
// D33: every re-scan names the family the injection named, and nothing else.
var supervisor = new GuardSupervisor(guard, toleratedFamily);
var state = new DrainState(new ModuleTally(modules, ngx));
var state = new DrainState(new ModuleTally(modules, ngx), new DisplaySampler(display));
SessionEndReason end = await SuperviseAsync(pid, alive, sink, supervisor, state, ct, stop).ConfigureAwait(false);
// On a safety unhook the verdict that matters is the one that FIRED mid-session, not the pass that
@@ -392,6 +399,7 @@ public sealed class CaptureSession(
TotalGaps = sink.TotalGaps,
DrainTicks = state.Focus.Ticks,
ForegroundTicks = state.Focus.Foreground,
Display = state.Display.Summary(),
};
}
@@ -452,7 +460,7 @@ public sealed class CaptureSession(
while (mayContinue)
{
ApplyPause(sink, state);
state.Focus.Sample(alive.IsForeground);
SampleWindow(pid, alive, sink, state);
DrainInto(sink, buffer, state);
observer?.Tick(state.Progress(sink, supervisor));
@@ -481,8 +489,10 @@ public sealed class CaptureSession(
}
// ONE LAST SNAPSHOT before the last drain, so a module that loaded after the final scan is
// still named; on TargetExited it reads nothing, which the tally counts rather than hides.
// still named; on TargetExited it reads nothing, which the tally counts rather than hides. The last
// display sample stands until here (beta.10).
state.Loaded.Take(pid);
state.Display.Finish(state.Paused);
// ONE LAST DRAIN ON EVERY PATH, including the faulted one — that is the whole point of catching
// the mid-loop throw rather than letting it leave the method. Then let go promptly: holding the
@@ -496,6 +506,16 @@ public sealed class CaptureSession(
return state.KillSwitchStopped ? SessionEndReason.KillSwitchEngaged : Conclude(end, faulted, mayContinue);
}
/// <summary>
/// The two out-of-process questions each tick asks about the game's window: whether it owns the foreground (the focus
/// pair) and how it is shown (beta.10, the display mode — region 4 plus the window's geometry).
/// </summary>
private static void SampleWindow(int pid, ITargetLiveness alive, ICaptureSink sink, DrainState state)
{
state.Focus.Sample(alive.IsForeground);
state.Display.Sample([pid], sink.DisplayState, state.Paused);
}
/// <summary>
/// The native log, before letting go (<c>17_HOOK_ENGINE</c> §Native logging): the Overlay's watchdog flushes
/// on its next tick, so the request is followed by one tick's grace — only while the target is alive to act
@@ -612,7 +632,7 @@ public sealed class CaptureSession(
}
/// <summary>Everything one session accumulates, owned by the loop; the observer reads it between ticks.</summary>
private sealed class DrainState(ModuleTally loaded)
private sealed class DrainState(ModuleTally loaded, DisplaySampler display)
{
/// <summary>Set when a scan boundary found FR-2.4's switch on and published the stop (P2 PR-F).</summary>
public bool KillSwitchStopped { get; set; }
@@ -635,6 +655,9 @@ public sealed class CaptureSession(
public FocusTally Focus { get; } = new();
/// <summary>The display mode, sampled every tick beside the focus (beta.10).</summary>
public DisplaySampler Display { get; } = display;
public ModuleTally Loaded { get; } = loaded;
public CaptureProgress Progress(ICaptureSink sink, GuardSupervisor supervisor) => new()
@@ -0,0 +1,108 @@
using System.Diagnostics;
using FrameLedger.Domain.Display;
using FrameLedger.Shared;
namespace FrameLedger.Application.Capture;
/// <summary>
/// The display mode, sampled on the capture loop's own ticks (beta.10, <c>03_METRICS</c> §Display mode): what the injected
/// component said about the swap chain (shared-memory region 4) and what the game's window looks like from outside
/// (<see cref="IDisplayProbe"/>), classified, and added up by the time each sample stood for.
/// </summary>
/// <remarks>
/// <para>
/// <b>A sample stands for the time until the next one.</b> Hooked, the loop ticks every 100 ms; held at Tier 2, every
/// second — so the tally is in milliseconds, not ticks, and a session's shares mean the same whichever loop ran it. The last
/// sample is closed by <see cref="Finish"/>.
/// </para>
/// <para>
/// <b>A pause is not time.</b> An interval that ends on a paused tick is dropped, the rule the frame series follows (a pause
/// is a gap, beta.8).
/// </para>
/// <para>
/// <b>A stale swap-chain sample says nothing about now.</b> The component samples only on a real present; a minimised game
/// issues only occlusion probes, which the hook drops. A region-4 sample older than <see cref="FreshFor"/> keeps its window
/// but loses its exclusive bits.
/// </para>
/// </remarks>
public sealed class DisplaySampler(IDisplayProbe? probe, Func<long>? clock = null)
{
/// <summary>How long a region-4 sample says anything about the swap chain's exclusive state.</summary>
public static readonly TimeSpan FreshFor = TimeSpan.FromSeconds(2);
private readonly DisplayTally _tally = new();
private readonly Func<long> _clock = clock ?? Stopwatch.GetTimestamp;
private DisplayObservation? _previous;
private long _previousAt;
/// <summary>Samples once; the sample before it is added for the time between the two.</summary>
/// <param name="pids">The game's processes: the pinned one, or every process running its executable (Tier 2).</param>
/// <param name="region">Region 4, when the loop is attached to a ring; null at Tier 2.</param>
/// <param name="paused">Whether the session is paused at this tick.</param>
public void Sample(IReadOnlyCollection<int> pids, FlDisplayState? region, bool paused)
{
ArgumentNullException.ThrowIfNull(pids);
long now = _clock();
Close(now, paused);
if (probe is null)
{
return;
}
SwapChainView? chain = ViewOf(region, now);
WindowView? window = probe.Observe(pids, chain?.Hwnd ?? 0);
_previous = DisplayModeClassifier.Classify(chain, window);
_previousAt = now;
}
/// <summary>Closes the last sample at the session's end.</summary>
public void Finish(bool paused) => Close(_clock(), paused);
/// <summary>The session's display facts, or null when nothing was ever sampled.</summary>
public DisplaySummary? Summary() => _tally.Any ? _tally.Summary() : null;
/// <summary>Region 4 as the classifier needs it, or null when the component described nothing.</summary>
public static SwapChainView? ViewOf(FlDisplayState? region, long nowTimestamp)
{
if (region is not { } r || (r.Flags & FlDisplayFlags.Sampled) == FlDisplayFlags.None)
{
return null;
}
long at = unchecked((long)r.SampleQpc);
bool fresh = nowTimestamp >= at && nowTimestamp - at < (long)(FreshFor.TotalSeconds * Stopwatch.Frequency);
return new SwapChainView(
Hwnd: r.Hwnd,
ExclusiveKnown: (r.Flags & FlDisplayFlags.ExclusiveKnown) != FlDisplayFlags.None,
Exclusive: (r.Flags & FlDisplayFlags.Exclusive) != FlDisplayFlags.None,
OpenGl: (r.Flags & FlDisplayFlags.OpenGl) != FlDisplayFlags.None,
BufferWidth: r.BufferWidth,
BufferHeight: r.BufferHeight,
SwapEffect: SwapEffectName(r.SwapEffect),
Fresh: fresh);
}
/// <summary>
/// <c>DXGI_SWAP_EFFECT</c> by name, from region 4's value-plus-one (0 = not read — the vendor's DISCARD is 0); an effect
/// this build does not know is named by its number rather than guessed.
/// </summary>
public static string? SwapEffectName(uint plusOne) => plusOne switch
{
0 => null,
1 => "discard",
2 => "sequential",
4 => "flip_sequential",
5 => "flip_discard",
_ => "effect_" + (plusOne - 1).ToString(System.Globalization.CultureInfo.InvariantCulture),
};
private void Close(long now, bool paused)
{
if (_previous is { } previous && !paused)
{
_tally.Add(previous, (now - _previousAt) * 1000 / Stopwatch.Frequency);
}
_previous = null;
}
}
@@ -0,0 +1,21 @@
using FrameLedger.Domain.Display;
namespace FrameLedger.Application.Capture;
/// <summary>
/// The game's window, read out of the game's process (beta.10, <c>03_METRICS</c> §Display mode): the same class of question
/// the focus sample asks — documented user32 calls about a top-level window — and nothing belonging to the game (CLAUDE.md
/// rule 4 is about game memory). Infrastructure's <c>Display.WindowGeometryProbe</c> is the one implementation.
/// </summary>
public interface IDisplayProbe
{
/// <summary>
/// The window the game is shown in: <paramref name="hwnd"/> when the injected component named one and it still belongs
/// to one of <paramref name="pids"/> (a window handle is reused after its window is gone), else the largest visible,
/// uncloaked top-level window any of <paramref name="pids"/> owns. Null when there is none — a composition-only process,
/// a game still loading, one on another desktop.
/// </summary>
/// <param name="pids">The game's processes: the pinned one when the loop holds it, else every process running its executable.</param>
/// <param name="hwnd">The window the swap chain presents to, from shared-memory region 4; 0 when none was named.</param>
WindowView? Observe(IReadOnlyCollection<int> pids, ulong hwnd);
}
@@ -18,4 +18,12 @@ public interface ITargetResolver
/// it only decides how long duration and telemetry accrue.
/// </summary>
bool IsRunning(string normalisedExePath);
/// <summary>
/// The processes running <paramref name="normalisedExePath"/> by their IMAGE PATH in the watcher's snapshot (beta.10) —
/// never by file name, the mistake 2026-09-23 fixed for the hold's clock — so a Tier-2 hold can find the game's window
/// without opening a process. Empty where no watcher runs, none matched, or every match's path was unreadable: the
/// display sample then says "no window", never another program's.
/// </summary>
IReadOnlyList<int> PidsOf(string normalisedExePath);
}
@@ -271,4 +271,45 @@ public sealed record SessionRow
public double? AvgGpuPowerW { get; init; }
public double? ThrottlePct { get; init; }
// --- Schema 0016 (beta.10): the display mode (03_METRICS §Display mode), both tiers. Null on a row written before it,
// on one recovered from a .partial file (the tally is not in the crash file), and where the loop never sampled.
/// <summary>Milliseconds the swap chain said exclusive fullscreen.</summary>
public long? DisplayExclusiveMs { get; init; }
/// <summary>Milliseconds the window covered its monitor and the swap chain said not exclusive.</summary>
public long? DisplayBorderlessMs { get; init; }
public long? DisplayWindowedMs { get; init; }
/// <summary>Milliseconds the window covered its monitor and nothing could say whether it was exclusive.</summary>
public long? DisplayCoversMs { get; init; }
public long? DisplayMinimizedMs { get; init; }
/// <summary>Milliseconds no window of the game could be read — outside every share.</summary>
public long? DisplayNoWindowMs { get; init; }
public long? DisplayChanges { get; init; }
/// <summary>A <c>Domain.Display.DisplaySource</c> id: <c>swapchain</c>, <c>opengl</c> or <c>window</c>.</summary>
public string? DisplaySource { get; init; }
/// <summary>The window's client size in the longest-lasting shown mode.</summary>
public int? DisplayWindowW { get; init; }
public int? DisplayWindowH { get; init; }
/// <summary>The swap chain's back buffer in that mode.</summary>
public int? DisplayBufferW { get; init; }
public int? DisplayBufferH { get; init; }
/// <summary>The monitor the window was on in that mode, and its refresh rate.</summary>
public int? DisplayMonitorW { get; init; }
public int? DisplayMonitorH { get; init; }
public int? DisplayMonitorHz { get; init; }
}
@@ -0,0 +1,72 @@
using FrameLedger.Application.Persistence;
using FrameLedger.Domain.Display;
namespace FrameLedger.Application.Recording;
/// <summary>
/// A session's display facts onto its row (schema 0016, beta.10). On the recorder's SKELETON, not the aggregator's
/// columns: a Tier-2 session never reaches the aggregator, and its window is exactly what it still has to say.
/// </summary>
public static class SessionDisplayColumns
{
/// <summary><paramref name="row"/> with <paramref name="display"/>'s columns; the row unchanged when nothing was sampled.</summary>
public static SessionRow WithDisplay(this SessionRow row, DisplaySummary? display)
{
ArgumentNullException.ThrowIfNull(row);
if (display is null)
{
return row;
}
return row with
{
DisplayExclusiveMs = display.ExclusiveMs,
DisplayBorderlessMs = display.BorderlessMs,
DisplayWindowedMs = display.WindowedMs,
DisplayCoversMs = display.CoversMs,
DisplayMinimizedMs = display.MinimizedMs,
DisplayNoWindowMs = display.NoWindowMs,
DisplayChanges = display.Changes,
DisplaySource = display.Source,
DisplayWindowW = display.WindowWidth,
DisplayWindowH = display.WindowHeight,
DisplayBufferW = display.BufferWidth is { } bw ? (int)Math.Min(bw, int.MaxValue) : null,
DisplayBufferH = display.BufferHeight is { } bh ? (int)Math.Min(bh, int.MaxValue) : null,
DisplayMonitorW = display.MonitorWidth,
DisplayMonitorH = display.MonitorHeight,
DisplayMonitorHz = display.MonitorHz,
// sessions.swap_effect had a column since 0001 and no writer: the swap chain's own description is one now.
SwapEffect = display.SwapEffect ?? row.SwapEffect,
};
}
/// <summary>The row's display facts back as a summary, or null for a row that has none (written before, or never sampled).</summary>
public static DisplaySummary? DisplayOf(SessionRow row)
{
ArgumentNullException.ThrowIfNull(row);
if (row.DisplayExclusiveMs is null && row.DisplayWindowedMs is null && row.DisplayNoWindowMs is null)
{
return null;
}
return new DisplaySummary
{
ExclusiveMs = row.DisplayExclusiveMs ?? 0,
BorderlessMs = row.DisplayBorderlessMs ?? 0,
WindowedMs = row.DisplayWindowedMs ?? 0,
CoversMs = row.DisplayCoversMs ?? 0,
MinimizedMs = row.DisplayMinimizedMs ?? 0,
NoWindowMs = row.DisplayNoWindowMs ?? 0,
Changes = (int)(row.DisplayChanges ?? 0),
Source = row.DisplaySource,
WindowWidth = row.DisplayWindowW,
WindowHeight = row.DisplayWindowH,
BufferWidth = row.DisplayBufferW is { } bw ? (uint)bw : null,
BufferHeight = row.DisplayBufferH is { } bh ? (uint)bh : null,
MonitorWidth = row.DisplayMonitorW,
MonitorHeight = row.DisplayMonitorH,
MonitorHz = row.DisplayMonitorHz,
SwapEffect = row.SwapEffect,
};
}
}
@@ -288,7 +288,7 @@ public sealed class SessionRecorder : ISessionRecorder
ForegroundTicks = hooked ? o.ForegroundTicks : null,
GuardTicksPublished = hooked ? o.GuardTicksPublished : null,
AcExceptionFamily = hooked ? o.ExceptionFamily : null,
};
}.WithDisplay(o.Display);
}
private static AggregationInput Hooked(CaptureOutcome o, long qpcFrequency) => new()
@@ -47,4 +47,17 @@ public sealed class LatestProcessSnapshot
return false;
}
/// <summary>
/// The pids whose image path is <paramref name="normalisedExePath"/> in the latest snapshot (beta.10, the display
/// sample of a Tier-2 hold) — by path only: a process whose path could not be read is not claimed, since its window
/// could be another program's. Empty when there is no snapshot yet.
/// </summary>
public IReadOnlyList<int> PidsOf(string normalisedExePath)
{
ArgumentException.ThrowIfNullOrWhiteSpace(normalisedExePath);
return Current is { } snapshot
? [.. snapshot.Where(p => p.ImagePath is { } image && string.Equals(image, normalisedExePath, StringComparison.OrdinalIgnoreCase)).Select(static p => p.Pid)]
: [];
}
}
@@ -4,6 +4,7 @@ using FrameLedger.Application.Consent;
using FrameLedger.Application.Recording;
using FrameLedger.Infrastructure.AntiCheat;
using FrameLedger.Infrastructure.Capture;
using FrameLedger.Infrastructure.Display;
using FrameLedger.Infrastructure.Telemetry;
namespace FrameLedger.CaptureHost.Capture;
@@ -44,6 +45,7 @@ internal sealed class HostSessionFactory(IGameConsentStore store, int seconds, I
new RuntimeModuleSnapshot(CensusNames.ModuleFileNames),
_ngx,
launcher ?? new ProcessLauncher(),
observer);
observer,
display: new WindowGeometryProbe());
}
}
@@ -0,0 +1,29 @@
namespace FrameLedger.Domain.Display;
/// <summary>
/// How a game was being shown at one sample (beta.10, <c>03_METRICS</c> §Display mode). The names are stored in no column —
/// each mode has its own milliseconds column — but they are the words the product uses.
/// </summary>
public enum DisplayMode
{
/// <summary>No window of the game could be found or read at this sample.</summary>
NoWindow = 0,
/// <summary>The game's window was minimised.</summary>
Minimized,
/// <summary>The swap chain SAID exclusive fullscreen (<c>GetFullscreenState</c>, DXGI only).</summary>
ExclusiveFullscreen,
/// <summary>The window's client area covers its whole monitor and the swap chain said it was not exclusive.</summary>
Borderless,
/// <summary>
/// The window's client area covers its whole monitor and nothing could say whether it was exclusive — OpenGL, Vulkan,
/// a game that was not hooked. "Borderless or fullscreen", never counted as either.
/// </summary>
CoversScreen,
/// <summary>The window's client area does not cover its monitor.</summary>
Windowed,
}
@@ -0,0 +1,51 @@
namespace FrameLedger.Domain.Display;
/// <summary>
/// One sample's display mode (beta.10, owner request: "detect the window size and whether the game runs full-screen,
/// borderless or windowed", <c>03_METRICS</c> §Display mode), from what the swap chain said and what the window looks like.
/// </summary>
/// <remarks>
/// <para>
/// <b>The ladder.</b> No window and no exclusive swap chain → <see cref="DisplayMode.NoWindow"/>; a minimised window →
/// <see cref="DisplayMode.Minimized"/>; a recent sample in which the swap chain SAID exclusive →
/// <see cref="DisplayMode.ExclusiveFullscreen"/>; a client area covering its monitor → <see cref="DisplayMode.Borderless"/>
/// when the chain said it was not exclusive, <see cref="DisplayMode.CoversScreen"/> when nothing could say (OpenGL, Vulkan,
/// a game that was not hooked); anything else → <see cref="DisplayMode.Windowed"/>.
/// </para>
/// <para>
/// <b>What "exclusive" means here</b> is what the game asked DXGI for. Windows may still present such a game through its
/// compositor ("fullscreen optimizations"), which only a trace session can see and FrameLedger has none (<c>LIMITATIONS.md</c>);
/// and a game's menu can call a borderless window "Fullscreen" — the swap chain's answer is the one reported.
/// </para>
/// </remarks>
public static class DisplayModeClassifier
{
public static DisplayObservation Classify(SwapChainView? chain, WindowView? window)
{
bool exclusiveKnown = chain is { ExclusiveKnown: true, Fresh: true };
bool exclusive = exclusiveKnown && chain.GetValueOrDefault().Exclusive;
string? source = SourceOf(chain, window, exclusiveKnown);
uint? bufferWidth = chain is { BufferWidth: > 0 } c ? c.BufferWidth : null;
uint? bufferHeight = chain is { BufferHeight: > 0 } d ? d.BufferHeight : null;
string? swapEffect = chain?.SwapEffect;
if (window is not { } w)
{
// An exclusive chain with a window we could not read is still exclusive: the chain said so.
DisplayMode alone = exclusive ? DisplayMode.ExclusiveFullscreen : DisplayMode.NoWindow;
return new DisplayObservation(alone, alone == DisplayMode.NoWindow ? null : source, null, bufferWidth, bufferHeight, null, null, swapEffect);
}
DisplayMode mode = w.Minimized ? DisplayMode.Minimized
: exclusive ? DisplayMode.ExclusiveFullscreen
: w.CoversMonitor ? (exclusiveKnown ? DisplayMode.Borderless : DisplayMode.CoversScreen)
: DisplayMode.Windowed;
return new DisplayObservation(mode, source, w.Client, bufferWidth, bufferHeight, w.Monitor, w.MonitorHz, swapEffect);
}
private static string? SourceOf(SwapChainView? chain, WindowView? window, bool exclusiveKnown) =>
exclusiveKnown ? DisplaySource.SwapChain
: chain is { OpenGl: true } ? DisplaySource.OpenGl
: window is not null ? DisplaySource.Window
: null;
}
@@ -0,0 +1,20 @@
namespace FrameLedger.Domain.Display;
/// <summary>One sample's classification and the sizes it was made from; null sizes were not read.</summary>
/// <param name="Mode">How the game was being shown.</param>
/// <param name="Source">A <see cref="DisplaySource"/> id, or null when nothing was read (<see cref="DisplayMode.NoWindow"/>).</param>
/// <param name="Client">The window's client area, when a window was read.</param>
/// <param name="BufferWidth">The swap chain's back buffer, when the injected component described one.</param>
/// <param name="BufferHeight">Its height.</param>
/// <param name="Monitor">The monitor the window was on.</param>
/// <param name="MonitorHz">That monitor's refresh rate.</param>
/// <param name="SwapEffect">The swap chain's swap effect name, when described.</param>
public readonly record struct DisplayObservation(
DisplayMode Mode,
string? Source,
ScreenRect? Client,
uint? BufferWidth,
uint? BufferHeight,
ScreenRect? Monitor,
int? MonitorHz,
string? SwapEffect);
@@ -0,0 +1,26 @@
namespace FrameLedger.Domain.Display;
/// <summary>
/// What a session's display facts rested on (<c>sessions.display_source</c>, schema 0016). Stored ids; the strongest one any
/// sample of the session had wins, because it decides which shares can be told apart.
/// </summary>
public static class DisplaySource
{
/// <summary>A DXGI swap chain was asked whether it was exclusive: fullscreen and borderless can be told apart.</summary>
public const string SwapChain = "swapchain";
/// <summary>An OpenGL stream named its window; exclusivity cannot be asked.</summary>
public const string OpenGl = "opengl";
/// <summary>Only the window was read (Vulkan, a game that was not hooked); exclusivity cannot be asked.</summary>
public const string Window = "window";
/// <summary>How strong a source is: a session keeps the strongest its samples had.</summary>
public static int Strength(string? source) => source switch
{
SwapChain => 3,
OpenGl => 2,
Window => 1,
_ => 0,
};
}
@@ -0,0 +1,92 @@
namespace FrameLedger.Domain.Display;
/// <summary>
/// A session's display facts (<c>sessions.display_*</c>, schema 0016): how long each mode lasted, how often the mode
/// changed, what the facts rested on, and the sizes seen in the mode that lasted longest. Both tiers have one.
/// </summary>
public sealed record DisplaySummary
{
public long ExclusiveMs { get; init; }
public long BorderlessMs { get; init; }
public long WindowedMs { get; init; }
/// <summary>Time the window covered its monitor and nothing could say whether it was exclusive.</summary>
public long CoversMs { get; init; }
public long MinimizedMs { get; init; }
/// <summary>Time no window of the game could be read — not a mode, and outside every share.</summary>
public long NoWindowMs { get; init; }
/// <summary>How many times the mode differed from the sample before (not counting samples with no window).</summary>
public int Changes { get; init; }
/// <summary>The strongest <see cref="DisplaySource"/> any sample had; null when no window was ever read.</summary>
public string? Source { get; init; }
/// <summary>The window's client size in the longest-lasting shown mode.</summary>
public int? WindowWidth { get; init; }
public int? WindowHeight { get; init; }
/// <summary>The swap chain's back buffer in that mode, when the injected component described one.</summary>
public uint? BufferWidth { get; init; }
public uint? BufferHeight { get; init; }
/// <summary>The monitor the window was on in that mode.</summary>
public int? MonitorWidth { get; init; }
public int? MonitorHeight { get; init; }
public int? MonitorHz { get; init; }
/// <summary>The swap chain's swap effect name, as last described.</summary>
public string? SwapEffect { get; init; }
/// <summary>The time a window was read in any shown or minimised mode: the denominator of every share.</summary>
public long ObservedMs => ExclusiveMs + BorderlessMs + WindowedMs + CoversMs + MinimizedMs;
/// <summary>Whether exclusive fullscreen and borderless can be told apart for the whole observed time.</summary>
public bool ExclusivityKnown => CoversMs == 0 && ObservedMs > 0;
/// <summary>The share of observed time in <paramref name="mode"/>, 0–100; null when nothing was observed.</summary>
public double? SharePercent(DisplayMode mode)
{
long observed = ObservedMs;
if (observed <= 0)
{
return null;
}
long ms = mode switch
{
DisplayMode.ExclusiveFullscreen => ExclusiveMs,
DisplayMode.Borderless => BorderlessMs,
DisplayMode.Windowed => WindowedMs,
DisplayMode.CoversScreen => CoversMs,
DisplayMode.Minimized => MinimizedMs,
_ => 0,
};
return 100.0 * ms / observed;
}
/// <summary>The shown mode (not minimised) that lasted longest, or null when none was observed.</summary>
public DisplayMode? Dominant
{
get
{
(DisplayMode Mode, long Ms)[] shown =
[
(DisplayMode.ExclusiveFullscreen, ExclusiveMs),
(DisplayMode.Borderless, BorderlessMs),
(DisplayMode.CoversScreen, CoversMs),
(DisplayMode.Windowed, WindowedMs),
];
(DisplayMode mode, long ms) = shown.MaxBy(static s => s.Ms);
return ms > 0 ? mode : null;
}
}
}
@@ -0,0 +1,78 @@
namespace FrameLedger.Domain.Display;
/// <summary>
/// A session's display samples, accumulated by the TIME each one stood for (beta.10): the capture loop samples every drain
/// tick (100 ms) while hooked and every hold tick (1 s) at Tier 2, and a sample counts for the wall time until the next —
/// so the two rates add up in one unit. Time the session was paused is not added (a pause is a gap, <c>03_METRICS</c>).
/// </summary>
public sealed class DisplayTally
{
private readonly Dictionary<DisplayMode, long> _ms = [];
private readonly Dictionary<DisplayMode, DisplayObservation> _last = [];
private DisplayMode? _previous;
private int _changes;
private string? _source;
private string? _swapEffect;
/// <summary>Adds one sample that stood for <paramref name="elapsedMs"/> milliseconds (negative is treated as 0).</summary>
public void Add(DisplayObservation observation, long elapsedMs)
{
long ms = Math.Max(0, elapsedMs);
_ms[observation.Mode] = _ms.GetValueOrDefault(observation.Mode) + ms;
_last[observation.Mode] = observation;
if (DisplaySource.Strength(observation.Source) > DisplaySource.Strength(_source))
{
_source = observation.Source;
}
if (observation.SwapEffect is { } effect)
{
_swapEffect = effect;
}
if (observation.Mode != DisplayMode.NoWindow)
{
if (_previous is { } before && before != observation.Mode)
{
_changes++;
}
_previous = observation.Mode;
}
}
/// <summary>Whether any sample was added at all (a session that never sampled stores no display facts).</summary>
public bool Any => _ms.Count > 0;
public DisplaySummary Summary()
{
var summary = new DisplaySummary
{
ExclusiveMs = _ms.GetValueOrDefault(DisplayMode.ExclusiveFullscreen),
BorderlessMs = _ms.GetValueOrDefault(DisplayMode.Borderless),
WindowedMs = _ms.GetValueOrDefault(DisplayMode.Windowed),
CoversMs = _ms.GetValueOrDefault(DisplayMode.CoversScreen),
MinimizedMs = _ms.GetValueOrDefault(DisplayMode.Minimized),
NoWindowMs = _ms.GetValueOrDefault(DisplayMode.NoWindow),
Changes = _changes,
Source = _source,
SwapEffect = _swapEffect,
};
if (summary.Dominant is not { } dominant || !_last.TryGetValue(dominant, out DisplayObservation seen))
{
return summary;
}
return summary with
{
WindowWidth = seen.Client?.Width,
WindowHeight = seen.Client?.Height,
BufferWidth = seen.BufferWidth,
BufferHeight = seen.BufferHeight,
MonitorWidth = seen.Monitor?.Width,
MonitorHeight = seen.Monitor?.Height,
MonitorHz = seen.MonitorHz,
};
}
}
@@ -0,0 +1,14 @@
using System.Runtime.InteropServices;
namespace FrameLedger.Domain.Display;
/// <summary>A rectangle in screen coordinates, right and bottom exclusive (the Win32 <c>RECT</c> convention).</summary>
[StructLayout(LayoutKind.Auto)]
public readonly record struct ScreenRect(int Left, int Top, int Right, int Bottom)
{
public int Width => Math.Max(0, Right - Left);
public int Height => Math.Max(0, Bottom - Top);
public bool IsEmpty => Width == 0 || Height == 0;
}
@@ -0,0 +1,26 @@
namespace FrameLedger.Domain.Display;
/// <summary>
/// What the injected component said about the presenting swap chain (shared-memory region 4, <c>07_IPC</c>), as the
/// classifier needs it. Never read from the game's memory: the component asked two getters on the chain the game passed.
/// </summary>
/// <param name="Hwnd">The window the chain presents to; 0 for a composition chain.</param>
/// <param name="ExclusiveKnown">Whether the chain was asked (DXGI only; OpenGL and Vulkan have nothing to ask).</param>
/// <param name="Exclusive">What it said; meaningless unless <paramref name="ExclusiveKnown"/>.</param>
/// <param name="OpenGl">Described from an OpenGL stream.</param>
/// <param name="BufferWidth">The back buffer (DXGI) or client area (OpenGL).</param>
/// <param name="BufferHeight">The back buffer's height.</param>
/// <param name="SwapEffect">The swap effect's name (<c>flip_discard</c>, …), or null when not read.</param>
/// <param name="Fresh">
/// Whether the sample is recent (under 2 s old). A minimised game issues only presents the hook drops before sampling, so a
/// stale sample says nothing about now — its exclusive bits are treated as unknown.
/// </param>
public readonly record struct SwapChainView(
ulong Hwnd,
bool ExclusiveKnown,
bool Exclusive,
bool OpenGl,
uint BufferWidth,
uint BufferHeight,
string? SwapEffect,
bool Fresh);
@@ -0,0 +1,24 @@
namespace FrameLedger.Domain.Display;
/// <summary>
/// What user32 said about the game's top-level window, read OUT of the game's process by the capture agent (beta.10): the
/// same class of question <c>GetForegroundWindow</c> answers for the focus sample, and nothing belonging to the game.
/// Coordinates are physical pixels on the virtual screen (the reader is per-monitor DPI aware while it asks).
/// </summary>
/// <param name="Minimized">The window was minimised (<c>IsIconic</c>).</param>
/// <param name="Client">The client area, in screen coordinates.</param>
/// <param name="Monitor">The whole monitor the window is on (not its work area).</param>
/// <param name="MonitorHz">The monitor's current refresh rate, or null when the mode could not be read.</param>
public readonly record struct WindowView(bool Minimized, ScreenRect Client, ScreenRect Monitor, int? MonitorHz)
{
/// <summary>
/// Whether the client area covers the whole monitor, within one pixel on each edge: what a borderless window and an
/// exclusive-fullscreen one both do, and a maximised window with a title bar and a taskbar does not.
/// </summary>
public bool CoversMonitor =>
!Monitor.IsEmpty
&& Client.Left <= Monitor.Left + 1
&& Client.Top <= Monitor.Top + 1
&& Client.Right >= Monitor.Right - 1
&& Client.Bottom >= Monitor.Bottom - 1;
}
@@ -91,6 +91,9 @@ public sealed class TargetResolver : ITargetResolver
return null;
}
/// <inheritdoc />
public IReadOnlyList<int> PidsOf(string normalisedExePath) => _latest?.PidsOf(normalisedExePath) ?? [];
/// <inheritdoc />
public bool IsRunning(string normalisedExePath)
{
@@ -0,0 +1,187 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using FrameLedger.Application.Capture;
using FrameLedger.Domain.Display;
using Windows.Win32;
using Windows.Win32.Foundation;
using Windows.Win32.Graphics.Dwm;
using Windows.Win32.Graphics.Gdi;
using Windows.Win32.UI.HiDpi;
using Windows.Win32.UI.WindowsAndMessaging;
namespace FrameLedger.Infrastructure.Display;
/// <summary>
/// The game's window, read OUT of its process (beta.10, <c>03_METRICS</c> §Display mode): whether it is minimised, its
/// client area in screen coordinates, the monitor it is on and that monitor's refresh rate. Documented user32 questions
/// about a top-level window — the focus sample's class of call (<c>Io.ForegroundWindowProbe</c>) — and nothing belonging to
/// the game: no handle to its process, no memory (CLAUDE.md rule 4).
/// </summary>
/// <remarks>
/// <para>
/// <b>Per-monitor DPI aware while it asks.</b> The Agent has no manifest and runs DPI-unaware, and Windows virtualises the
/// coordinates a DPI-unaware process reads of another process's window — a borderless game on a 150 % monitor would read as
/// a window two-thirds its size. The thread is made per-monitor aware (V2) for the calls and put back, so nothing else in the
/// Agent changes.
/// </para>
/// <para>
/// <b>Which window.</b> The one the swap chain presents to when the injected component named it and it still belongs to the
/// game (a handle is reused once its window is gone), taken to its top-level ancestor — an engine may render into a child.
/// Otherwise the largest visible, uncloaked, non-tool top-level window of any of the game's processes: a Chromium-based
/// title's window belongs to its browser process while another process presents (HANDOFF §Traps), and every process
/// running the game's executable counts.
/// </para>
/// </remarks>
public sealed class WindowGeometryProbe : IDisplayProbe
{
/// <summary><c>DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2</c>, which winuser.h defines as <c>((DPI_AWARENESS_CONTEXT)-4)</c>.</summary>
private static readonly DPI_AWARENESS_CONTEXT _perMonitorAwareV2 = new(-4);
/// <inheritdoc />
public unsafe WindowView? Observe(IReadOnlyCollection<int> pids, ulong hwnd)
{
ArgumentNullException.ThrowIfNull(pids);
if (pids.Count == 0)
{
return null;
}
DPI_AWARENESS_CONTEXT previous = PInvoke.SetThreadDpiAwarenessContext(_perMonitorAwareV2);
try
{
HWND window = hwnd != 0 ? Root(new HWND((nint)hwnd), pids) : default;
if (window.IsNull)
{
window = Largest(pids);
}
return window.IsNull ? null : Read(window);
}
finally
{
if (previous != default)
{
PInvoke.SetThreadDpiAwarenessContext(previous);
}
}
}
/// <summary>The top-level ancestor of <paramref name="window"/> when it is a live window of one of <paramref name="pids"/>; else null.</summary>
private static HWND Root(HWND window, IReadOnlyCollection<int> pids)
{
if (!PInvoke.IsWindow(window))
{
return default;
}
HWND root = PInvoke.GetAncestor(window, GET_ANCESTOR_FLAGS.GA_ROOT);
HWND top = root.IsNull ? window : root;
return OwnerIn(top, pids) ? top : default;
}
private static unsafe bool OwnerIn(HWND window, IReadOnlyCollection<int> pids)
{
uint owner = 0;
return PInvoke.GetWindowThreadProcessId(window, &owner) != 0 && pids.Contains((int)owner);
}
private static unsafe HWND Largest(IReadOnlyCollection<int> pids)
{
var search = new Search(pids);
GCHandle handle = GCHandle.Alloc(search);
try
{
PInvoke.EnumWindows(&Visit, (LPARAM)GCHandle.ToIntPtr(handle));
}
finally
{
handle.Free();
}
return search.Best;
}
[UnmanagedCallersOnly(CallConvs = [typeof(CallConvStdcall)])]
private static unsafe BOOL Visit(HWND window, LPARAM state)
{
var search = (Search)GCHandle.FromIntPtr(state).Target!;
if (!PInvoke.IsWindowVisible(window) || !OwnerIn(window, search.Pids) || IsToolWindow(window) || IsCloaked(window))
{
return true;
}
RECT client;
if (PInvoke.GetClientRect(window, &client))
{
long area = (long)(client.right - client.left) * (client.bottom - client.top);
if (area > search.BestArea || (search.Best.IsNull && PInvoke.IsIconic(window)))
{
search.Best = window;
search.BestArea = area;
}
}
return true;
}
private static bool IsToolWindow(HWND window) =>
((WINDOW_EX_STYLE)(nuint)PInvoke.GetWindowLongPtr(window, WINDOW_LONG_PTR_INDEX.GWL_EXSTYLE)).HasFlag(WINDOW_EX_STYLE.WS_EX_TOOLWINDOW);
private static unsafe bool IsCloaked(HWND window)
{
// Read through a pointer the call writes: DWMWA_CLOAKED is non-zero for a window another virtual desktop or the
// shell hides, which is visible to IsWindowVisible and to nobody else.
uint* cloaked = stackalloc uint[1];
return PInvoke.DwmGetWindowAttribute(window, DWMWINDOWATTRIBUTE.DWMWA_CLOAKED, cloaked, sizeof(uint)).Succeeded && *cloaked != 0;
}
private static unsafe WindowView? Read(HWND window)
{
bool minimized = PInvoke.IsIconic(window);
RECT client;
if (!PInvoke.GetClientRect(window, &client))
{
return null;
}
var topLeft = new System.Drawing.Point(client.left, client.top);
var bottomRight = new System.Drawing.Point(client.right, client.bottom);
if (!PInvoke.ClientToScreen(window, &topLeft) || !PInvoke.ClientToScreen(window, &bottomRight))
{
return null;
}
HMONITOR monitor = PInvoke.MonitorFromWindow(window, MONITOR_FROM_FLAGS.MONITOR_DEFAULTTONEAREST);
var info = new MONITORINFOEXW();
info.monitorInfo.cbSize = (uint)sizeof(MONITORINFOEXW);
if (monitor.IsNull || !PInvoke.GetMonitorInfo(monitor, (MONITORINFO*)&info))
{
return null;
}
RECT m = info.monitorInfo.rcMonitor;
return new WindowView(
minimized,
new ScreenRect(topLeft.X, topLeft.Y, bottomRight.X, bottomRight.Y),
new ScreenRect(m.left, m.top, m.right, m.bottom),
RefreshOf(info.szDevice.ToString()));
}
/// <summary>The monitor's current refresh rate, or null — 0 and 1 mean "the hardware default" per DEVMODEW, not a number.</summary>
private static unsafe int? RefreshOf(string device)
{
var mode = new DEVMODEW { dmSize = (ushort)sizeof(DEVMODEW) };
return PInvoke.EnumDisplaySettings(device, ENUM_DISPLAY_SETTINGS_MODE.ENUM_CURRENT_SETTINGS, ref mode) && mode.dmDisplayFrequency > 1
? (int)mode.dmDisplayFrequency
: null;
}
private sealed class Search(IReadOnlyCollection<int> pids)
{
public IReadOnlyCollection<int> Pids { get; } = pids;
public HWND Best { get; set; }
public long BestArea { get; set; } = -1;
}
}
@@ -37,3 +37,24 @@ MINIDUMP_TYPE
GetSystemTimes
GlobalMemoryStatusEx
MEMORYSTATUSEX
// The game's window, read OUT of its process for the display mode (beta.10, Display.WindowGeometryProbe; 03_METRICS
// Display mode): documented questions about a top-level window, the focus sample's class of call, never the game's memory.
IsWindow
IsWindowVisible
IsIconic
GetWindowThreadProcessId
GetAncestor
GET_ANCESTOR_FLAGS
GetClientRect
ClientToScreen
GetWindowLongPtr
WINDOW_LONG_PTR_INDEX
WINDOW_EX_STYLE
EnumWindows
MonitorFromWindow
MONITOR_FROM_FLAGS
GetMonitorInfo
MONITORINFOEXW
DwmGetWindowAttribute
DWMWINDOWATTRIBUTE
SetThreadDpiAwarenessContext
@@ -0,0 +1,27 @@
-- 0016 (2026-09-27, beta.10, owner request: "detect the game's window size and whether it runs full-screen, borderless or
-- windowed, and how much of the time"): a session's display facts (03_METRICS §Display mode).
--
-- Milliseconds per mode, sampled on the capture loop's own ticks — every 100 ms hooked, every second held at Tier 2 — each
-- sample standing for the time until the next, a pause not counted. `covers` is a window covering its monitor that nothing
-- could say was exclusive or not (OpenGL, Vulkan, Tier 2); `nowindow` is time no window of the game could be read, and is
-- outside every share. The sizes are the ones seen in the mode that lasted longest. `display_source` is the strongest thing
-- any sample rested on: swapchain (DXGI asked), opengl, window (geometry only).
--
-- NULL on every row written before, on a session recovered from its .partial file (the tally is not in the crash file) and
-- where the loop never sampled. ADD COLUMN only.
ALTER TABLE sessions ADD COLUMN display_exclusive_ms INTEGER;
ALTER TABLE sessions ADD COLUMN display_borderless_ms INTEGER;
ALTER TABLE sessions ADD COLUMN display_windowed_ms INTEGER;
ALTER TABLE sessions ADD COLUMN display_covers_ms INTEGER;
ALTER TABLE sessions ADD COLUMN display_minimized_ms INTEGER;
ALTER TABLE sessions ADD COLUMN display_nowindow_ms INTEGER;
ALTER TABLE sessions ADD COLUMN display_changes INTEGER;
ALTER TABLE sessions ADD COLUMN display_source TEXT;
ALTER TABLE sessions ADD COLUMN display_window_w INTEGER;
ALTER TABLE sessions ADD COLUMN display_window_h INTEGER;
ALTER TABLE sessions ADD COLUMN display_buffer_w INTEGER;
ALTER TABLE sessions ADD COLUMN display_buffer_h INTEGER;
ALTER TABLE sessions ADD COLUMN display_monitor_w INTEGER;
ALTER TABLE sessions ADD COLUMN display_monitor_h INTEGER;
ALTER TABLE sessions ADD COLUMN display_monitor_hz INTEGER;
@@ -13,10 +13,10 @@ namespace FrameLedger.Infrastructure.Persistence;
internal static class SessionRowColumns
{
public const string Insert =
"INSERT INTO sessions (session_guid, game_id, snapshot_id, started_at, ended_at, duration_s, qpc_epoch, qpc_frequency, capture_tier, capture_mode, capture_notes, ac_exception_family, late_attach, telemetry_source, overlay_build_id, exit_status, drain_ticks, foreground_ticks, records_before_attach, dxgi_presents_before_hook, gap_count, guard_ticks_published, launch_wait_ms, api, present_mode, swap_effect, hdr_flag, hdr_source, sync_interval_mode, upscaler, upscaler_quality, upscaler_sharpness, upscaler_driver_reported, render_w, render_h, output_w, output_h, upscale_ratio, settings_changed_midsession, fg_mode, fg_source, fg_factor, fg_driver_reported, fg_runtime_census, fg_none_withheld_reason, fg_refusal, fg_refusal_detail, fg_factor_scope, fg_steady_share, presented_fps, presented_qualifier, dxgi_unseen_total, dxgi_present_samples, displayed_counted_by, sl_tag_census, sl_interposer_version, runtime_modules, driver_profile, executable_markers, ngx_driver_words, rt_flag, rt_source, pt_flag, pt_source, pt_confidence, rr_flag, rr_source, rt_frame_pct, rays_per_pixel, rt_pso_count, rt_tier, hooks_installed_mask, raster_pso_count, frame_count, app_frame_count, displayed_frame_count, dropped_frames, native_fps, displayed_fps, median_fps, p1_low_fps, p01_low_fps, displayed_p1_low_fps, min_fps, max_fps, frametime_stddev_ms, stutter_count, stutter_time_pct, pso_stutter_pct, reflex_active, latency_avg_us, latency_p95_us, dropped_records, fault_count, data_quality_warnings, writer_status_at_end, early_stop_family, loader_signals, vram_proc_avg_mb, vram_proc_max_mb, vram_budget_exceeded_pct, vram_adapter_max_mb, avg_cpu_temp, max_cpu_temp, avg_gpu_temp, max_gpu_temp, max_gpu_hotspot, avg_gpu_load, avg_cpu_load, avg_ram_mb, avg_gpu_power_w, throttle_pct) "
+ "VALUES (@session_guid, @game_id, @snapshot_id, @started_at, @ended_at, @duration_s, @qpc_epoch, @qpc_frequency, @capture_tier, @capture_mode, @capture_notes, @ac_exception_family, @late_attach, @telemetry_source, @overlay_build_id, @exit_status, @drain_ticks, @foreground_ticks, @records_before_attach, @dxgi_presents_before_hook, @gap_count, @guard_ticks_published, @launch_wait_ms, @api, @present_mode, @swap_effect, @hdr_flag, @hdr_source, @sync_interval_mode, @upscaler, @upscaler_quality, @upscaler_sharpness, @upscaler_driver_reported, @render_w, @render_h, @output_w, @output_h, @upscale_ratio, @settings_changed_midsession, @fg_mode, @fg_source, @fg_factor, @fg_driver_reported, @fg_runtime_census, @fg_none_withheld_reason, @fg_refusal, @fg_refusal_detail, @fg_factor_scope, @fg_steady_share, @presented_fps, @presented_qualifier, @dxgi_unseen_total, @dxgi_present_samples, @displayed_counted_by, @sl_tag_census, @sl_interposer_version, @runtime_modules, @driver_profile, @executable_markers, @ngx_driver_words, @rt_flag, @rt_source, @pt_flag, @pt_source, @pt_confidence, @rr_flag, @rr_source, @rt_frame_pct, @rays_per_pixel, @rt_pso_count, @rt_tier, @hooks_installed_mask, @raster_pso_count, @frame_count, @app_frame_count, @displayed_frame_count, @dropped_frames, @native_fps, @displayed_fps, @median_fps, @p1_low_fps, @p01_low_fps, @displayed_p1_low_fps, @min_fps, @max_fps, @frametime_stddev_ms, @stutter_count, @stutter_time_pct, @pso_stutter_pct, @reflex_active, @latency_avg_us, @latency_p95_us, @dropped_records, @fault_count, @data_quality_warnings, @writer_status_at_end, @early_stop_family, @loader_signals, @vram_proc_avg_mb, @vram_proc_max_mb, @vram_budget_exceeded_pct, @vram_adapter_max_mb, @avg_cpu_temp, @max_cpu_temp, @avg_gpu_temp, @max_gpu_temp, @max_gpu_hotspot, @avg_gpu_load, @avg_cpu_load, @avg_ram_mb, @avg_gpu_power_w, @throttle_pct) RETURNING id";
"INSERT INTO sessions (session_guid, game_id, snapshot_id, started_at, ended_at, duration_s, qpc_epoch, qpc_frequency, capture_tier, capture_mode, capture_notes, ac_exception_family, late_attach, telemetry_source, overlay_build_id, exit_status, drain_ticks, foreground_ticks, records_before_attach, dxgi_presents_before_hook, gap_count, guard_ticks_published, launch_wait_ms, api, present_mode, swap_effect, hdr_flag, hdr_source, sync_interval_mode, upscaler, upscaler_quality, upscaler_sharpness, upscaler_driver_reported, render_w, render_h, output_w, output_h, upscale_ratio, settings_changed_midsession, fg_mode, fg_source, fg_factor, fg_driver_reported, fg_runtime_census, fg_none_withheld_reason, fg_refusal, fg_refusal_detail, fg_factor_scope, fg_steady_share, presented_fps, presented_qualifier, dxgi_unseen_total, dxgi_present_samples, displayed_counted_by, sl_tag_census, sl_interposer_version, runtime_modules, driver_profile, executable_markers, ngx_driver_words, rt_flag, rt_source, pt_flag, pt_source, pt_confidence, rr_flag, rr_source, rt_frame_pct, rays_per_pixel, rt_pso_count, rt_tier, hooks_installed_mask, raster_pso_count, frame_count, app_frame_count, displayed_frame_count, dropped_frames, native_fps, displayed_fps, median_fps, p1_low_fps, p01_low_fps, displayed_p1_low_fps, min_fps, max_fps, frametime_stddev_ms, stutter_count, stutter_time_pct, pso_stutter_pct, reflex_active, latency_avg_us, latency_p95_us, dropped_records, fault_count, data_quality_warnings, writer_status_at_end, early_stop_family, loader_signals, vram_proc_avg_mb, vram_proc_max_mb, vram_budget_exceeded_pct, vram_adapter_max_mb, avg_cpu_temp, max_cpu_temp, avg_gpu_temp, max_gpu_temp, max_gpu_hotspot, avg_gpu_load, avg_cpu_load, avg_ram_mb, avg_gpu_power_w, throttle_pct, display_exclusive_ms, display_borderless_ms, display_windowed_ms, display_covers_ms, display_minimized_ms, display_nowindow_ms, display_changes, display_source, display_window_w, display_window_h, display_buffer_w, display_buffer_h, display_monitor_w, display_monitor_h, display_monitor_hz) "
+ "VALUES (@session_guid, @game_id, @snapshot_id, @started_at, @ended_at, @duration_s, @qpc_epoch, @qpc_frequency, @capture_tier, @capture_mode, @capture_notes, @ac_exception_family, @late_attach, @telemetry_source, @overlay_build_id, @exit_status, @drain_ticks, @foreground_ticks, @records_before_attach, @dxgi_presents_before_hook, @gap_count, @guard_ticks_published, @launch_wait_ms, @api, @present_mode, @swap_effect, @hdr_flag, @hdr_source, @sync_interval_mode, @upscaler, @upscaler_quality, @upscaler_sharpness, @upscaler_driver_reported, @render_w, @render_h, @output_w, @output_h, @upscale_ratio, @settings_changed_midsession, @fg_mode, @fg_source, @fg_factor, @fg_driver_reported, @fg_runtime_census, @fg_none_withheld_reason, @fg_refusal, @fg_refusal_detail, @fg_factor_scope, @fg_steady_share, @presented_fps, @presented_qualifier, @dxgi_unseen_total, @dxgi_present_samples, @displayed_counted_by, @sl_tag_census, @sl_interposer_version, @runtime_modules, @driver_profile, @executable_markers, @ngx_driver_words, @rt_flag, @rt_source, @pt_flag, @pt_source, @pt_confidence, @rr_flag, @rr_source, @rt_frame_pct, @rays_per_pixel, @rt_pso_count, @rt_tier, @hooks_installed_mask, @raster_pso_count, @frame_count, @app_frame_count, @displayed_frame_count, @dropped_frames, @native_fps, @displayed_fps, @median_fps, @p1_low_fps, @p01_low_fps, @displayed_p1_low_fps, @min_fps, @max_fps, @frametime_stddev_ms, @stutter_count, @stutter_time_pct, @pso_stutter_pct, @reflex_active, @latency_avg_us, @latency_p95_us, @dropped_records, @fault_count, @data_quality_warnings, @writer_status_at_end, @early_stop_family, @loader_signals, @vram_proc_avg_mb, @vram_proc_max_mb, @vram_budget_exceeded_pct, @vram_adapter_max_mb, @avg_cpu_temp, @max_cpu_temp, @avg_gpu_temp, @max_gpu_temp, @max_gpu_hotspot, @avg_gpu_load, @avg_cpu_load, @avg_ram_mb, @avg_gpu_power_w, @throttle_pct, @display_exclusive_ms, @display_borderless_ms, @display_windowed_ms, @display_covers_ms, @display_minimized_ms, @display_nowindow_ms, @display_changes, @display_source, @display_window_w, @display_window_h, @display_buffer_w, @display_buffer_h, @display_monitor_w, @display_monitor_h, @display_monitor_hz) RETURNING id";
public const string Select = "SELECT id, session_guid, game_id, snapshot_id, started_at, ended_at, duration_s, qpc_epoch, qpc_frequency, capture_tier, capture_mode, capture_notes, ac_exception_family, late_attach, telemetry_source, overlay_build_id, exit_status, drain_ticks, foreground_ticks, records_before_attach, dxgi_presents_before_hook, gap_count, guard_ticks_published, launch_wait_ms, api, present_mode, swap_effect, hdr_flag, hdr_source, sync_interval_mode, upscaler, upscaler_quality, upscaler_sharpness, upscaler_driver_reported, render_w, render_h, output_w, output_h, upscale_ratio, settings_changed_midsession, fg_mode, fg_source, fg_factor, fg_driver_reported, fg_runtime_census, fg_none_withheld_reason, fg_refusal, fg_refusal_detail, fg_factor_scope, fg_steady_share, presented_fps, presented_qualifier, dxgi_unseen_total, dxgi_present_samples, displayed_counted_by, sl_tag_census, sl_interposer_version, runtime_modules, driver_profile, executable_markers, ngx_driver_words, rt_flag, rt_source, pt_flag, pt_source, pt_confidence, rr_flag, rr_source, rt_frame_pct, rays_per_pixel, rt_pso_count, rt_tier, hooks_installed_mask, raster_pso_count, frame_count, app_frame_count, displayed_frame_count, dropped_frames, native_fps, displayed_fps, median_fps, p1_low_fps, p01_low_fps, displayed_p1_low_fps, min_fps, max_fps, frametime_stddev_ms, stutter_count, stutter_time_pct, pso_stutter_pct, reflex_active, latency_avg_us, latency_p95_us, dropped_records, fault_count, data_quality_warnings, writer_status_at_end, early_stop_family, loader_signals, vram_proc_avg_mb, vram_proc_max_mb, vram_budget_exceeded_pct, vram_adapter_max_mb, avg_cpu_temp, max_cpu_temp, avg_gpu_temp, max_gpu_temp, max_gpu_hotspot, avg_gpu_load, avg_cpu_load, avg_ram_mb, avg_gpu_power_w, throttle_pct FROM sessions";
public const string Select = "SELECT id, session_guid, game_id, snapshot_id, started_at, ended_at, duration_s, qpc_epoch, qpc_frequency, capture_tier, capture_mode, capture_notes, ac_exception_family, late_attach, telemetry_source, overlay_build_id, exit_status, drain_ticks, foreground_ticks, records_before_attach, dxgi_presents_before_hook, gap_count, guard_ticks_published, launch_wait_ms, api, present_mode, swap_effect, hdr_flag, hdr_source, sync_interval_mode, upscaler, upscaler_quality, upscaler_sharpness, upscaler_driver_reported, render_w, render_h, output_w, output_h, upscale_ratio, settings_changed_midsession, fg_mode, fg_source, fg_factor, fg_driver_reported, fg_runtime_census, fg_none_withheld_reason, fg_refusal, fg_refusal_detail, fg_factor_scope, fg_steady_share, presented_fps, presented_qualifier, dxgi_unseen_total, dxgi_present_samples, displayed_counted_by, sl_tag_census, sl_interposer_version, runtime_modules, driver_profile, executable_markers, ngx_driver_words, rt_flag, rt_source, pt_flag, pt_source, pt_confidence, rr_flag, rr_source, rt_frame_pct, rays_per_pixel, rt_pso_count, rt_tier, hooks_installed_mask, raster_pso_count, frame_count, app_frame_count, displayed_frame_count, dropped_frames, native_fps, displayed_fps, median_fps, p1_low_fps, p01_low_fps, displayed_p1_low_fps, min_fps, max_fps, frametime_stddev_ms, stutter_count, stutter_time_pct, pso_stutter_pct, reflex_active, latency_avg_us, latency_p95_us, dropped_records, fault_count, data_quality_warnings, writer_status_at_end, early_stop_family, loader_signals, vram_proc_avg_mb, vram_proc_max_mb, vram_budget_exceeded_pct, vram_adapter_max_mb, avg_cpu_temp, max_cpu_temp, avg_gpu_temp, max_gpu_temp, max_gpu_hotspot, avg_gpu_load, avg_cpu_load, avg_ram_mb, avg_gpu_power_w, throttle_pct, display_exclusive_ms, display_borderless_ms, display_windowed_ms, display_covers_ms, display_minimized_ms, display_nowindow_ms, display_changes, display_source, display_window_w, display_window_h, display_buffer_w, display_buffer_h, display_monitor_w, display_monitor_h, display_monitor_hz FROM sessions";
public static Dictionary<string, object?> Parameters(SessionRow s)
{
@@ -25,10 +25,11 @@ internal static class SessionRowColumns
Parameters1(d, s);
Parameters2(d, s);
Parameters3(d, s);
Parameters4(d, s);
return d;
}
public static SessionRow Read(DbDataReader r) => Read3(Read2(Read1(Read0(r), r), r), r);
public static SessionRow Read(DbDataReader r) => Read4(Read3(Read2(Read1(Read0(r), r), r), r), r);
private static void Parameters0(Dictionary<string, object?> d, SessionRow s)
@@ -259,6 +260,26 @@ internal static class SessionRowColumns
StutterCount = L(r, "stutter_count"),
};
// Schema 0016 (beta.10): the display mode (03_METRICS §Display mode).
private static void Parameters4(Dictionary<string, object?> d, SessionRow s)
{
d["display_exclusive_ms"] = s.DisplayExclusiveMs;
d["display_borderless_ms"] = s.DisplayBorderlessMs;
d["display_windowed_ms"] = s.DisplayWindowedMs;
d["display_covers_ms"] = s.DisplayCoversMs;
d["display_minimized_ms"] = s.DisplayMinimizedMs;
d["display_nowindow_ms"] = s.DisplayNoWindowMs;
d["display_changes"] = s.DisplayChanges;
d["display_source"] = s.DisplaySource;
d["display_window_w"] = s.DisplayWindowW;
d["display_window_h"] = s.DisplayWindowH;
d["display_buffer_w"] = s.DisplayBufferW;
d["display_buffer_h"] = s.DisplayBufferH;
d["display_monitor_w"] = s.DisplayMonitorW;
d["display_monitor_h"] = s.DisplayMonitorH;
d["display_monitor_hz"] = s.DisplayMonitorHz;
}
private static SessionRow Read3(SessionRow row, DbDataReader r) => row with
{
StutterTimePct = D(r, "stutter_time_pct"),
@@ -288,6 +309,26 @@ internal static class SessionRowColumns
ThrottlePct = D(r, "throttle_pct"),
};
// Schema 0016 (beta.10): the display mode.
private static SessionRow Read4(SessionRow row, DbDataReader r) => row with
{
DisplayExclusiveMs = L(r, "display_exclusive_ms"),
DisplayBorderlessMs = L(r, "display_borderless_ms"),
DisplayWindowedMs = L(r, "display_windowed_ms"),
DisplayCoversMs = L(r, "display_covers_ms"),
DisplayMinimizedMs = L(r, "display_minimized_ms"),
DisplayNoWindowMs = L(r, "display_nowindow_ms"),
DisplayChanges = L(r, "display_changes"),
DisplaySource = S(r, "display_source"),
DisplayWindowW = I(r, "display_window_w"),
DisplayWindowH = I(r, "display_window_h"),
DisplayBufferW = I(r, "display_buffer_w"),
DisplayBufferH = I(r, "display_buffer_h"),
DisplayMonitorW = I(r, "display_monitor_w"),
DisplayMonitorH = I(r, "display_monitor_h"),
DisplayMonitorHz = I(r, "display_monitor_hz"),
};
public static string ExitStatusText(ExitStatus status) => Vocabulary.ExitStatusText(status);
public static ExitStatus ParseExitStatus(string text) => text switch
@@ -120,6 +120,13 @@ public sealed class CompareViewModelTests
presented.Cells.Should().OnlyContain(static c => c.Text == "N/A", "these sessions measured FG as none, so the Native row has them and this one does not");
CompareRowViewModel native = vm.Rows.Single(r => string.Equals(r.Metric, "Native FPS", StringComparison.Ordinal));
native.Cells.Skip(1).Should().OnlyContain(static c => c.Text == "60");
// beta.10: the display rows are facts, not scores — none is best, and a row recorded before says N/A.
foreach (string metric in new[] { "Display mode", "Window", "Monitor" })
{
CompareRowViewModel display = vm.Rows.Single(r => string.Equals(r.Metric, metric, StringComparison.Ordinal));
display.Cells.Should().OnlyContain(static c => c.Text == "N/A" && !c.IsBest);
}
}
finally
{
@@ -0,0 +1,101 @@
using System.Globalization;
using FluentAssertions;
using FrameLedger.App.Services;
using FrameLedger.Domain.Display;
namespace FrameLedger.App.Tests;
/// <summary>
/// The display facts as the pages say them (beta.10, <c>03_METRICS</c> §Display mode): never more certain than the source,
/// a share that was there never rounded to nothing, and N/A for a row that has none.
/// </summary>
[Collection(StringsCultureCollection.Name)]
public sealed class DisplayTextTests
{
private static T InEnglish<T>(Func<T> read)
{
CultureInfo? previous = Strings.Culture;
CultureInfo current = CultureInfo.CurrentCulture;
Strings.Culture = CultureInfo.GetCultureInfo("en");
CultureInfo.CurrentCulture = CultureInfo.GetCultureInfo("en-US");
try
{
return read();
}
finally
{
Strings.Culture = previous;
CultureInfo.CurrentCulture = current;
}
}
[Fact]
public void TheHeadlineIsTheModeShownLongestWithItsShare() => InEnglish(() =>
{
DisplayText.Headline(new DisplaySummary { ExclusiveMs = 30_000, BorderlessMs = 70_000 }).Should().Be("Borderless 70%");
DisplayText.Headline(new DisplaySummary { CoversMs = 10_000 }).Should().Be("Fullscreen or borderless 100%");
DisplayText.Headline(new DisplaySummary { MinimizedMs = 5_000 }).Should().Be("Minimized 100%", "a session spent minimised says so rather than 'no window'");
DisplayText.Headline(new DisplaySummary { NoWindowMs = 5_000 }).Should().Be("No window read");
DisplayText.Headline(null).Should().Be("N/A");
return 0;
});
[Fact]
public void SharesAreSaidFullscreenEndFirstAndATraceIsNeverRoundedAway() => InEnglish(() =>
{
var display = new DisplaySummary { WindowedMs = 99_800, ExclusiveMs = 200 };
DisplayText.Shares(display).Should().Be("Exclusive fullscreen <1% · Windowed 100%");
DisplayText.Shares(null).Should().Be("N/A");
return 0;
});
[Fact]
public void TheSizesAreSaidOnlyWhenTheyWereRead() => InEnglish(() =>
{
var display = new DisplaySummary { WindowedMs = 1, WindowWidth = 1280, WindowHeight = 720, MonitorWidth = 2560, MonitorHeight = 1440 };
DisplayText.Window(display).Should().Be("1280×720");
DisplayText.Monitor(display).Should().Be("2560×1440", "no refresh rate was read");
DisplayText.Monitor(display with { MonitorHz = 60 }).Should().Be("2560×1440 @ 60 Hz");
DisplayText.Window(new DisplaySummary()).Should().Be("N/A");
DisplayText.Monitor(null).Should().Be("N/A");
return 0;
});
[Fact]
public void TheLineNamesWhatTheFactsRestedOn() => InEnglish(() =>
{
var display = new DisplaySummary
{
ExclusiveMs = 60_000,
Changes = 3,
Source = DisplaySource.SwapChain,
BufferWidth = 3840,
BufferHeight = 2160,
SwapEffect = "flip_discard",
};
DisplayText.Line(display).Should().Be("Display: Exclusive fullscreen 100% · changed 3 times · back buffer 3840×2160 (flip_discard)"
+ " · the swap chain said whether it was exclusive");
DisplayText.Line(null).Should().BeNull();
return 0;
});
[Fact]
public void TheExportLineIsInvariant()
{
CultureInfo current = CultureInfo.CurrentCulture;
CultureInfo.CurrentCulture = CultureInfo.GetCultureInfo("de-DE");
try
{
DisplayText.ExportLine(new DisplaySummary { WindowedMs = 1_234_567, MonitorWidth = 1920, MonitorHeight = 1080 })
.Should().Be("exclusive_ms=0; borderless_ms=0; covers_ms=0; windowed_ms=1234567; minimized_ms=0; nowindow_ms=0; changes=0; source=n/a;"
+ " window=n/a; buffer=n/a; monitor=1920x1080");
}
finally
{
CultureInfo.CurrentCulture = current;
}
}
}
@@ -149,6 +149,44 @@ public sealed class GameDetailViewModelTests
}
}
/// <summary>
/// beta.10 (<c>03_METRICS</c> §Display mode): the last measured session says how it was shown, and every session row —
/// Tier 2 included — has its display column, N/A for one recorded before.
/// </summary>
[Fact]
public async Task TheLastSessionAndEverySessionRowSayHowTheGameWasShown()
{
CultureInfo? previous = Strings.Culture;
Strings.Culture = CultureInfo.GetCultureInfo("en");
try
{
await using ScratchLedger s = await ScratchLedger.OpenAsync();
GameRow game = await s.GameAsync("Expedition");
DateTimeOffset t0 = DateTimeOffset.FromUnixTimeMilliseconds(1_700_000_000_000);
await s.SessionAsync(game.Id, t0, hooked: false, display: new FrameLedger.Domain.Display.DisplaySummary { WindowedMs = 60_000, WindowWidth = 1280, WindowHeight = 720 });
await s.SessionAsync(game.Id, t0.AddHours(1), display: new FrameLedger.Domain.Display.DisplaySummary
{
BorderlessMs = 92_000,
ExclusiveMs = 8_000,
Source = "swapchain",
WindowWidth = 2560,
WindowHeight = 1440,
});
await s.SessionAsync(game.Id, t0.AddHours(-1));
(GameDetailViewModel vm, _, _, _, _) = await BuildAsync(s, game.Id);
vm.Measured.Should().Contain("Display: Borderless 92% · 2560×1440");
vm.Sessions.Select(static r => r.DisplayModeText).Should().Equal("Borderless 92%", "Windowed 100%", "N/A");
vm.Sessions[0].DisplayModeTooltip.Should().StartWith("Display: Exclusive fullscreen 8% · Borderless 92%");
vm.Sessions[2].DisplayModeTooltip.Should().BeNull();
}
finally
{
Strings.Culture = previous;
}
}
/// <summary>The Supports row (P4 PR-1): what the Agent's detection sweep wrote, as product names, and nothing measured.</summary>
[Fact]
public async Task TheSupportsRowReadsWhatTheDetectionSweepWrote()
+3 -1
View File
@@ -40,7 +40,7 @@ internal sealed class ScratchLedger : IAsyncDisposable
}
public async Task<long> SessionAsync(long gameId, DateTimeOffset startedAt, int seconds = 600, bool hooked = true, string fgMode = "none", double? native = 60, double? displayed = null, double? factor = null, ExitStatus exit = ExitStatus.Normal, string? fgRefusal = null, double? presented = null, string? qualifier = null,
IReadOnlyList<SensorBlob>? sensors = null)
IReadOnlyList<SensorBlob>? sensors = null, FrameLedger.Domain.Display.DisplaySummary? display = null, bool settingsChanged = false)
{
long snapshotId = await new SqliteHardwareSnapshotRepository(Db).EnsureAsync(new HardwareSnapshot { GpuName = "G" }, startedAt, TestContext.Current.CancellationToken).ConfigureAwait(false);
var row = new SessionRow
@@ -73,7 +73,9 @@ internal sealed class ScratchLedger : IAsyncDisposable
RtSource = hooked ? "measured" : null,
P1LowFps = hooked ? 48 : null,
MaxGpuTemp = 71,
SettingsChangedMidSession = settingsChanged,
};
row = FrameLedger.Application.Recording.SessionDisplayColumns.WithDisplay(row, display);
return await Sessions.InsertFinalizedAsync(new FinalizedSession { Row = row, Sensors = sensors ?? [] }, TestContext.Current.CancellationToken).ConfigureAwait(false);
}
@@ -68,6 +68,7 @@ public sealed class SessionExporterTests
string[] lines = writer.ToString().Split(Environment.NewLine, StringSplitOptions.RemoveEmptyEntries);
lines.Should().Contain(static l => l.StartsWith("# capture_tier: 2", StringComparison.Ordinal) && l.Contains("no per-frame rows", StringComparison.Ordinal));
lines[^1].Should().Be(SessionExporter.CsvColumns, "the column line is the last line: nothing was measured");
lines.Should().Contain("# display: N/A (not recorded: a session recorded before beta.10, or recovered from its crash file)");
SessionExportDocument doc = SessionExporter.Document(row, game, null, [], await s.Annotations.FindAsync(id, Ct));
using var stream = new MemoryStream();
@@ -82,4 +83,45 @@ public sealed class SessionExporterTests
json.RootElement.GetProperty("game").GetString().Should().Be("Alpha");
_ = CaptureTier.NotHooked;
}
/// <summary>beta.10: the CSV's <c># display:</c> line is the stored milliseconds by name, invariant in every UI language.</summary>
[Fact]
public async Task TheDisplayHeaderLineIsTheStoredMillisecondsByName()
{
CultureInfo? previous = CultureInfo.CurrentCulture;
CultureInfo.CurrentCulture = CultureInfo.GetCultureInfo("vi-VN");
try
{
await using ScratchLedger s = await ScratchLedger.OpenAsync();
GameRow game = await s.GameAsync("Alpha");
long id = await s.SessionAsync(game.Id, DateTimeOffset.UtcNow, display: new FrameLedger.Domain.Display.DisplaySummary
{
ExclusiveMs = 1_500,
BorderlessMs = 60_000,
Changes = 2,
Source = FrameLedger.Domain.Display.DisplaySource.SwapChain,
WindowWidth = 2560,
WindowHeight = 1440,
BufferWidth = 2560,
BufferHeight = 1440,
MonitorWidth = 2560,
MonitorHeight = 1440,
MonitorHz = 165,
SwapEffect = "flip_discard",
});
SessionRow row = (await s.Sessions.FindByIdAsync(id, Ct))!;
using var writer = new StringWriter(CultureInfo.InvariantCulture);
SessionExporter.WriteCsv(writer, row, game, null, [], null);
writer.ToString().Split(Environment.NewLine).Should().Contain(
"# display: exclusive_ms=1500; borderless_ms=60000; covers_ms=0; windowed_ms=0; minimized_ms=0; nowindow_ms=0; changes=2; source=swapchain;"
+ " window=2560x1440; buffer=2560x1440; monitor=2560x1440@165");
writer.ToString().Should().Contain("swap_effect: flip_discard", "the swap chain's own description is sessions.swap_effect's first writer");
}
finally
{
CultureInfo.CurrentCulture = previous;
}
}
}
@@ -58,7 +58,7 @@ public sealed class SessionSummaryViewModelTests
vm.NotFound.Should().BeFalse();
vm.IsHooked.Should().BeTrue();
vm.Series.Should().NotBeNull();
vm.Stats.Should().HaveCount(10, "eight frame statistics, then the machine: GPU and CPU (2026-09-21)");
vm.Stats.Should().HaveCount(11, "eight frame statistics, the display mode (beta.10), then the machine: GPU and CPU (2026-09-21)");
vm.Stats.Single(c => string.Equals(c.Label, "CPU", StringComparison.Ordinal)).Value.Should().Be("N/A avg · N/A max", "this row carries no CPU reading: N/A, never 0%");
vm.Stats.Single(c => string.Equals(c.Label, "Median", StringComparison.Ordinal)).Value.Should().Be("60");
vm.Stats.Single(c => string.Equals(c.Label, "1% Low", StringComparison.Ordinal)).Value.Should().Be("48");
@@ -198,4 +198,51 @@ public sealed class SessionSummaryViewModelTests
Strings.Culture = previous;
}
}
/// <summary>
/// beta.10 (<c>03_METRICS</c> §Display mode): the Display card and line, in either tier — the mode shown longest with its
/// share, every share, the window on its monitor and what it rested on. A window nothing could ask about is "Fullscreen or
/// borderless", never either.
/// </summary>
[Fact]
public async Task TheDisplayCardAndLineSayHowTheGameWasShownInEitherTier()
{
CultureInfo? previous = Strings.Culture;
Strings.Culture = CultureInfo.GetCultureInfo("en");
try
{
await using ScratchLedger s = await ScratchLedger.OpenAsync();
GameRow game = await s.GameAsync("Alpha");
long tier2 = await s.SessionAsync(game.Id, DateTimeOffset.UtcNow, hooked: false, display: new FrameLedger.Domain.Display.DisplaySummary
{
CoversMs = 90_000,
MinimizedMs = 10_000,
NoWindowMs = 5_000,
Changes = 1,
Source = FrameLedger.Domain.Display.DisplaySource.Window,
WindowWidth = 1920,
WindowHeight = 1080,
MonitorWidth = 1920,
MonitorHeight = 1080,
MonitorHz = 144,
});
SessionSummaryViewModel vm = Build(s);
await vm.LoadAsync(tier2, Ct);
StatCardModel card = vm.Stats.Single(c => string.Equals(c.Label, "Display", StringComparison.Ordinal));
card.Value.Should().Be("Fullscreen or borderless 90%", "time without a window is outside every share");
card.Suffix.Should().Be("1920×1080");
vm.DisplayLine.Should().Be("Display: Fullscreen or borderless 90% · Minimized 10% · changed once · window 1920×1080 on a 1920×1080 monitor at 144 Hz"
+ " · from the window alone: exclusive fullscreen cannot be told from borderless");
SessionSummaryViewModel before = Build(s);
await before.LoadAsync(await s.SessionAsync(game.Id, DateTimeOffset.UtcNow.AddHours(-1)), Ct);
before.Stats.Single(c => string.Equals(c.Label, "Display", StringComparison.Ordinal)).Value.Should().Be("N/A", "a row without display facts reads N/A");
before.DisplayLine.Should().BeNull();
}
finally
{
Strings.Culture = previous;
}
}
}
@@ -189,4 +189,46 @@ public sealed class TrendSeriesBuilderTests
Strings.Culture = previous;
}
}
private static SessionRow Shown(int day, bool hooked, Domain.Display.DisplaySummary? display, bool midSession = false) =>
Application.Recording.SessionDisplayColumns.WithDisplay(Row(day, 1, hooked: hooked, midSession: midSession), display);
/// <summary>
/// beta.10 (<c>03_METRICS</c> §Display mode): the display shares are every session's — the window is read out of process
/// whether or not anything was hooked — and a session whose settings changed is NOT left out: switching between fullscreen
/// and a window resizes the swap chain, which is exactly what marks it, and the share is the whole session's by construction.
/// </summary>
[Fact]
public void DisplaySharesAreEverySessionsAndAModeSwitchIsNotAMidSessionChange()
{
SessionRow[] rows =
[
Shown(1, hooked: true, new() { ExclusiveMs = 25_000, BorderlessMs = 75_000, Source = "swapchain" }, midSession: true),
Shown(2, hooked: false, new() { CoversMs = 80_000, WindowedMs = 20_000, Source = "window" }),
Shown(3, hooked: true, display: null),
];
TrendSeriesBuilder.Points(rows, TrendMetric.DisplayExclusiveShare, includeMidSessionChanges: false).Select(static p => p.Value).Should().Equal(25.0);
TrendSeriesBuilder.Points(rows, TrendMetric.DisplayBorderlessShare, includeMidSessionChanges: false).Select(static p => p.Value).Should().Equal(75.0);
TrendSeriesBuilder.Points(rows, TrendMetric.DisplayWindowedShare, includeMidSessionChanges: false).Select(static p => p.Value).Should().Equal(0.0, 20.0);
TrendSeriesBuilder.ExcludedCount(rows, TrendMetric.DisplayExclusiveShare).Should().Be(0);
TrendSeriesBuilder.Points(rows, TrendMetric.DisplayExclusiveShare, includeMidSessionChanges: false).Single().SettingsChangedMidSession.Should().BeFalse();
}
[Fact]
public void ExclusiveAndBorderlessHaveNoPointWhereTheyCouldNotBeToldApart()
{
SessionRow covered = Shown(1, hooked: false, new() { CoversMs = 60_000, Source = "window" });
SessionRow partly = Shown(2, hooked: true, new() { BorderlessMs = 50_000, CoversMs = 10_000, Source = "swapchain" });
foreach (SessionRow row in new[] { covered, partly })
{
TrendSeriesBuilder.ValueOf(row, TrendMetric.DisplayExclusiveShare).Should().BeNull("a share of time that could have been either would be a guess");
TrendSeriesBuilder.ValueOf(row, TrendMetric.DisplayBorderlessShare).Should().BeNull();
TrendSeriesBuilder.ValueOf(row, TrendMetric.DisplayWindowedShare).Should().Be(0.0, "windowed is told from the window alone");
}
TrendSeriesBuilder.ValueOf(Shown(3, hooked: true, new() { NoWindowMs = 9_000 }), TrendMetric.DisplayWindowedShare)
.Should().BeNull("no window was ever read, so there is no share of anything");
}
}
@@ -96,6 +96,8 @@ public sealed class CaptureSessionLaunchTests : IAsyncDisposable
}
public bool IsRunning(string normalisedExePath) => false;
public IReadOnlyList<int> PidsOf(string normalisedExePath) => [];
}
private async Task<IGameConsentStore> StoreAsync(bool consented)
@@ -7,6 +7,7 @@ using FrameLedger.Application.Recording;
using FrameLedger.Application.Tests.AntiCheat;
using FrameLedger.Domain.AntiCheat;
using FrameLedger.Domain.Consent;
using FrameLedger.Domain.Display;
using FrameLedger.Domain.Sessions;
using FrameLedger.Infrastructure.Persistence;
using FrameLedger.Shared;
@@ -145,7 +146,10 @@ public sealed class CaptureSessionTests : IAsyncDisposable
public FlShmHandshake Handshake => default;
public FlDisplayState? DisplayState => null;
/// <summary>Region 4 as the Overlay would publish it (beta.10); null reads as a writer that described nothing.</summary>
public FlDisplayState? Display { get; set; }
public FlDisplayState? DisplayState => Display;
public long TotalDropped { get; set; }
@@ -245,7 +249,7 @@ public sealed class CaptureSessionTests : IAsyncDisposable
}
}
private sealed class FixedResolver(int? pid, SessionEndReason reason, int runningTicks = 0) : ITargetResolver
private sealed class FixedResolver(int? pid, SessionEndReason reason, int runningTicks = 0, IReadOnlyList<int>? pids = null) : ITargetResolver
{
private int _running = runningTicks;
@@ -260,6 +264,20 @@ public sealed class CaptureSessionTests : IAsyncDisposable
/// <summary>The name clock of a hold that never opened the process: "running" for so many checks, then gone.</summary>
public bool IsRunning(string normalisedExePath) => _running-- > 0;
public IReadOnlyList<int> PidsOf(string normalisedExePath) => pids ?? [];
}
/// <summary>The window reader (beta.10): what each tick asked it, and one fixed answer.</summary>
private sealed class RecordingProbe(WindowView? answer) : IDisplayProbe
{
public List<(int[] Pids, ulong Hwnd)> Calls { get; } = [];
public WindowView? Observe(IReadOnlyCollection<int> pids, ulong hwnd)
{
Calls.Add(([.. pids], hwnd));
return answer;
}
}
private sealed class TickCounter : ICaptureObserver
@@ -309,7 +327,7 @@ public sealed class CaptureSessionTests : IAsyncDisposable
private static CaptureSession Loop(IGameConsentStore store, CountingGuard guard, FakeSink? sink,
FakeLiveness? alive = null, int? pid = _pid, SessionEndReason resolveReason = SessionEndReason.Running,
CaptureOptions? options = null, IKillSwitch? killSwitch = null, ICapturePauseSource? pause = null,
IUserModeExceptionSwitch? exceptions = null, IOverlayToleranceChannel? tolerance = null) =>
IUserModeExceptionSwitch? exceptions = null, IOverlayToleranceChannel? tolerance = null, IDisplayProbe? display = null) =>
new(store,
new HookedCaptureGate(guard),
guard,
@@ -328,7 +346,8 @@ public sealed class CaptureSessionTests : IAsyncDisposable
killSwitch: killSwitch,
pause: pause,
exceptions: exceptions,
tolerance: tolerance);
tolerance: tolerance,
display: display);
private static readonly bool[] _pauseThenResume = [true, false];
@@ -1030,7 +1049,8 @@ public sealed class CaptureSessionTests : IAsyncDisposable
/// <summary>The loop with an explicit resolver and liveness: the Tier-2 hold's two clocks (2026-09-22).</summary>
private static CaptureSession With(IGameConsentStore store, CountingGuard guard, FixedResolver resolver, FakeLiveness? alive = null,
ICaptureObserver? observer = null, bool hold = true, IUserModeExceptionSwitch? exceptions = null, IOverlayToleranceChannel? tolerance = null) =>
ICaptureObserver? observer = null, bool hold = true, IUserModeExceptionSwitch? exceptions = null, IOverlayToleranceChannel? tolerance = null,
IDisplayProbe? display = null) =>
new(store, new HookedCaptureGate(guard), guard, resolver,
new DelegateLivenessSource(_ => alive ?? new FakeLiveness()),
new DelegateRingAttacher(_ => (null, ShmAttachRefusal.BuildIdMismatch)),
@@ -1043,7 +1063,8 @@ public sealed class CaptureSessionTests : IAsyncDisposable
},
observer: observer,
exceptions: exceptions,
tolerance: tolerance);
tolerance: tolerance,
display: display);
/// <summary>
/// Tier 2 as a session (2026-09-22; <c>04_CAPTURE</c> §Tier selection): a row whose hooking is off is decided BEFORE the
@@ -1281,4 +1302,80 @@ public sealed class CaptureSessionTests : IAsyncDisposable
channel.Disposed.Should().BeGreaterThan(0);
(await store.FindAsync(_exe, TestContext.Current.CancellationToken)).BlockedReason.Should().Contain("NEPKernel.sys");
}
private static readonly ScreenRect _monitor = new(0, 0, 2560, 1440);
/// <summary>
/// beta.10 (<c>03_METRICS</c> §Display mode): a hooked session samples the display on every drain tick — region 4 for the
/// swap chain's own answer, the window by the handle region 4 names and the pid the loop holds — and the outcome carries
/// the tally the recorder writes.
/// </summary>
[Fact]
public async Task AHookedSessionTalliesTheDisplayFromRegionFourAndTheWindow()
{
IGameConsentStore store = await StoreWithAsync();
using var sink = new FakeSink
{
Display = new FlDisplayState
{
Flags = FlDisplayFlags.Sampled | FlDisplayFlags.ExclusiveKnown,
Hwnd = 0x1234,
BufferWidth = 2560,
BufferHeight = 1440,
SwapEffect = 4, // FLIP_SEQUENTIAL (3), stored plus one
SampleQpc = (ulong)Stopwatch.GetTimestamp(),
},
};
var probe = new RecordingProbe(new WindowView(false, _monitor, _monitor, 165));
CaptureOutcome r = await Loop(store, new CountingGuard(), sink, display: probe)
.RunAsync(_exe, Fingerprint, "payload.dll", TestContext.Current.CancellationToken);
probe.Calls.Should().NotBeEmpty().And.OnlyContain(static c => c.Hwnd == 0x1234 && c.Pids.Length == 1 && c.Pids[0] == _pid,
"the window is the one the swap chain presents to, checked against the process the loop holds");
r.Display.Should().NotBeNull();
r.Display!.BorderlessMs.Should().BeGreaterThan(0, "covering the monitor while the chain said not exclusive is borderless");
r.Display.ExclusiveMs.Should().Be(0);
r.Display.CoversMs.Should().Be(0, "the chain was asked, so the mode is not left undecided");
r.Display.Source.Should().Be(DisplaySource.SwapChain);
r.Display.SwapEffect.Should().Be("flip_sequential");
(r.Display.WindowWidth, r.Display.BufferWidth, r.Display.MonitorHz).Should().Be((2560, 2560u, 165));
}
/// <summary>
/// beta.10: a Tier-2 session has its display mode too — the window only, found by the executable's image path in the
/// watcher's snapshot for a hold that never opened the process, and never said to be exclusive or borderless.
/// </summary>
[Fact]
public async Task ATierTwoHoldTalliesTheWindowOfEveryProcessRunningTheExecutable()
{
var resolver = new FixedResolver(_pid, SessionEndReason.Running, runningTicks: 3, pids: [777, 778]);
var probe = new RecordingProbe(new WindowView(false, _monitor, _monitor, 60));
CaptureOutcome r = await With(await StoreWithAsync(enabled: false), new CountingGuard(), resolver, display: probe)
.RunAsync(_exe, Fingerprint, "payload.dll", TestContext.Current.CancellationToken);
r.HeldUnhooked.Should().BeTrue();
probe.Calls.Should().HaveCount(3).And.OnlyContain(static c => c.Hwnd == 0 && c.Pids.SequenceEqual(new[] { 777, 778 }),
"nothing was injected to name a window, so every process running the executable is looked at, once per held tick");
r.Display.Should().NotBeNull();
r.Display!.ExclusiveMs.Should().Be(0, "exclusive fullscreen is the swap chain's answer, and nothing asked it");
r.Display.BorderlessMs.Should().Be(0);
r.Display.WindowedMs.Should().Be(0);
r.Display.Source.Should().Be(DisplaySource.Window);
r.Display.ExclusivityKnown.Should().BeFalse();
r.Display.Dominant.Should().Be(DisplayMode.CoversScreen, "a window covering its monitor that nothing could ask about is fullscreen OR borderless");
r.Display.MonitorHz.Should().Be(60);
}
[Fact]
public async Task WithoutAProbeNoDisplayIsRecorded()
{
using var sink = new FakeSink();
CaptureOutcome r = await Loop(await StoreWithAsync(), new CountingGuard(), sink)
.RunAsync(_exe, Fingerprint, "payload.dll", TestContext.Current.CancellationToken);
r.Display.Should().BeNull("the operator host composes no window reader, and an absent reader is not a session without a window");
}
}
@@ -0,0 +1,173 @@
using System.Diagnostics;
using FluentAssertions;
using FrameLedger.Application.Capture;
using FrameLedger.Domain.Display;
using FrameLedger.Shared;
namespace FrameLedger.Application.Tests.Capture;
/// <summary>
/// The display mode's sampling (beta.10, <c>03_METRICS</c> §Display mode): a sample stands for the time until the next, a
/// pause is not time, and a stale swap-chain sample says nothing about exclusivity — on a clock the test moves.
/// </summary>
public sealed class DisplaySamplerTests
{
private static readonly ScreenRect _monitor = new(0, 0, 1920, 1080);
private static readonly WindowView _covering = new(false, _monitor, _monitor, 144);
private static readonly WindowView _windowed = new(false, new ScreenRect(100, 100, 1380, 820), _monitor, 144);
private static readonly int[] _pid = [4242];
private sealed class Clock
{
public long Now { get; set; } = 1_000_000;
public void Advance(TimeSpan by) => Now += (long)(by.TotalSeconds * Stopwatch.Frequency);
}
private sealed class SwitchableProbe : IDisplayProbe
{
public WindowView? Answer { get; set; }
public List<ulong> Hwnds { get; } = [];
public WindowView? Observe(IReadOnlyCollection<int> pids, ulong hwnd)
{
Hwnds.Add(hwnd);
return Answer;
}
}
private static FlDisplayState Region(long sampleQpc, bool exclusive, ulong hwnd = 0x42) => new()
{
Flags = FlDisplayFlags.Sampled | FlDisplayFlags.ExclusiveKnown | (exclusive ? FlDisplayFlags.Exclusive : FlDisplayFlags.None),
Hwnd = hwnd,
BufferWidth = 1920,
BufferHeight = 1080,
SwapEffect = 5, // FLIP_DISCARD (4), stored plus one
SampleQpc = (ulong)sampleQpc,
};
[Fact]
public void EachSampleStandsForTheTimeUntilTheNextAndTheLastIsClosedByFinish()
{
var clock = new Clock();
var probe = new SwitchableProbe { Answer = _covering };
var sampler = new DisplaySampler(probe, () => clock.Now);
sampler.Sample(_pid, Region(clock.Now, exclusive: true), paused: false);
clock.Advance(TimeSpan.FromMilliseconds(300));
sampler.Sample(_pid, Region(clock.Now, exclusive: false), paused: false);
clock.Advance(TimeSpan.FromMilliseconds(700));
sampler.Finish(paused: false);
DisplaySummary summary = sampler.Summary()!;
summary.ExclusiveMs.Should().Be(300);
summary.BorderlessMs.Should().Be(700);
summary.Changes.Should().Be(1);
summary.Dominant.Should().Be(DisplayMode.Borderless);
summary.SharePercent(DisplayMode.ExclusiveFullscreen).Should().BeApproximately(30, 0.001);
summary.SwapEffect.Should().Be("flip_discard");
summary.Source.Should().Be(DisplaySource.SwapChain);
probe.Hwnds.Should().Equal(0x42ul, 0x42ul);
}
/// <summary>
/// The loop reads the pause at each tick, so an interval that ends on a paused tick is dropped: the pause is excluded to
/// within one tick at each edge — 100 ms hooked — the way the frame series' gap is.
/// </summary>
[Fact]
public void AnIntervalThatEndsOnAPausedTickIsNotCounted()
{
var clock = new Clock();
var sampler = new DisplaySampler(new SwitchableProbe { Answer = _windowed }, () => clock.Now);
bool[] pausedAt = [false, false, true, true, false];
foreach (bool paused in pausedAt)
{
sampler.Sample(_pid, region: null, paused);
clock.Advance(TimeSpan.FromSeconds(1));
}
sampler.Finish(paused: false);
sampler.Summary()!.WindowedMs.Should().Be(3000, "five seconds sampled, two of them ending on a paused tick");
}
[Fact]
public void AStaleSwapChainSampleKeepsItsWindowButLosesItsExclusiveBits()
{
var clock = new Clock();
var sampler = new DisplaySampler(new SwitchableProbe { Answer = _covering }, () => clock.Now);
long sampledAt = clock.Now;
clock.Advance(DisplaySampler.FreshFor + TimeSpan.FromMilliseconds(1));
sampler.Sample(_pid, Region(sampledAt, exclusive: true), paused: false);
clock.Advance(TimeSpan.FromSeconds(1));
sampler.Finish(paused: false);
DisplaySummary summary = sampler.Summary()!;
summary.ExclusiveMs.Should().Be(0, "a minimised game presents only what the hook drops, so an old 'exclusive' says nothing about now");
summary.CoversMs.Should().Be(1000);
}
[Fact]
public void AnExclusiveChainWhoseWindowCannotBeReadIsStillExclusive()
{
var clock = new Clock();
var sampler = new DisplaySampler(new SwitchableProbe { Answer = null }, () => clock.Now);
sampler.Sample(_pid, Region(clock.Now, exclusive: true), paused: false);
clock.Advance(TimeSpan.FromSeconds(1));
sampler.Sample(_pid, Region(clock.Now, exclusive: false), paused: false);
clock.Advance(TimeSpan.FromSeconds(1));
sampler.Finish(paused: false);
DisplaySummary summary = sampler.Summary()!;
summary.ExclusiveMs.Should().Be(1000);
summary.NoWindowMs.Should().Be(1000, "not exclusive and no window is no answer at all");
summary.ObservedMs.Should().Be(1000, "time without a window is outside every share");
}
[Fact]
public void WithoutAProbeNothingIsSampled()
{
var sampler = new DisplaySampler(probe: null);
sampler.Sample(_pid, region: null, paused: false);
sampler.Finish(paused: false);
sampler.Summary().Should().BeNull();
}
[Theory]
[InlineData(0u, null)]
[InlineData(1u, "discard")]
[InlineData(2u, "sequential")]
[InlineData(4u, "flip_sequential")]
[InlineData(5u, "flip_discard")]
[InlineData(9u, "effect_8")]
public void TheSwapEffectIsNamedFromItsValuePlusOne(uint stored, string? expected) =>
DisplaySampler.SwapEffectName(stored).Should().Be(expected, "0 is 'not read', because DXGI_SWAP_EFFECT_DISCARD is itself 0");
[Fact]
public void ARegionThatDescribedNothingIsNoSwapChain()
{
DisplaySampler.ViewOf(new FlDisplayState { Flags = FlDisplayFlags.None, Hwnd = 7 }, 0).Should().BeNull();
DisplaySampler.ViewOf(null, 0).Should().BeNull();
}
[Fact]
public void AnOpenGlRegionHasNoExclusiveAnswer()
{
long now = Stopwatch.GetTimestamp();
SwapChainView view = DisplaySampler.ViewOf(new FlDisplayState { Flags = FlDisplayFlags.Sampled | FlDisplayFlags.OpenGl, Hwnd = 9, SampleQpc = (ulong)now }, now)!.Value;
view.OpenGl.Should().BeTrue();
view.ExclusiveKnown.Should().BeFalse();
DisplayModeClassifier.Classify(view, _covering).Mode.Should().Be(DisplayMode.CoversScreen);
DisplayModeClassifier.Classify(view, _covering).Source.Should().Be(DisplaySource.OpenGl);
}
}
@@ -10,6 +10,7 @@ using FrameLedger.Application.Tests.AntiCheat;
using FrameLedger.Application.Tests.Capture;
using FrameLedger.Domain.AntiCheat;
using FrameLedger.Domain.Consent;
using FrameLedger.Domain.Display;
using FrameLedger.Domain.Sessions;
using FrameLedger.Infrastructure.Persistence;
using FrameLedger.Shared;
@@ -154,6 +155,8 @@ public sealed class SessionRecorderTests : IAsyncDisposable
}
public bool IsRunning(string normalisedExePath) => false;
public IReadOnlyList<int> PidsOf(string normalisedExePath) => [];
}
private sealed class FakePoller(SteppingClock? steps = null) : ITelemetryPoller
@@ -191,8 +194,14 @@ public sealed class SessionRecorderTests : IAsyncDisposable
public IDisposable? TryPublish(int pid, string family) => new MemoryStream();
}
/// <summary>The window reader (beta.10), answering the same window on every tick.</summary>
private sealed class FixedWindow(WindowView? answer) : IDisplayProbe
{
public WindowView? Observe(IReadOnlyCollection<int> pids, ulong hwnd) => answer;
}
private sealed class Factory(IGameConsentStore store, FakeGuard guard, SteppingClock clock, int records, FakeLiveness liveness,
IUserModeExceptionSwitch? exceptions = null) : ICaptureSessionFactory
IUserModeExceptionSwitch? exceptions = null, IDisplayProbe? display = null) : ICaptureSessionFactory
{
public CaptureSession Create(ICaptureObserver observer) => new(
store, new HookedCaptureGate(guard), guard, new FixedResolver(),
@@ -209,7 +218,8 @@ public sealed class SessionRecorderTests : IAsyncDisposable
},
observer: observer,
exceptions: exceptions,
tolerance: exceptions is null ? null : new OpenChannel());
tolerance: exceptions is null ? null : new OpenChannel(),
display: display);
}
private sealed class NoCrashEvents : ICrashEventSource
@@ -257,7 +267,7 @@ public sealed class SessionRecorderTests : IAsyncDisposable
}
private async Task<Harness> MakeAsync(bool consented = true, AntiCheatVerdict? verdict = null, int records = 3_000, FakeLiveness? liveness = null, bool poller = true,
bool clockStepsOnDrain = false, IDriverProfileSource? profiles = null, bool excepted = false)
bool clockStepsOnDrain = false, IDriverProfileSource? profiles = null, bool excepted = false, IDisplayProbe? display = null)
{
_db ??= await LedgerDatabase.OpenAsync(Path.Combine(_dir, LedgerPaths.DatabaseFileName), ct: TestContext.Current.CancellationToken).ConfigureAwait(false);
var store = new SqliteGameConsentStore(_db);
@@ -282,7 +292,7 @@ public sealed class SessionRecorderTests : IAsyncDisposable
var sessions = new FakeSessionRepository();
var partials = new FakePartialSessionStore();
var recorder = new SessionRecorder(
new Factory(store, guard, clock, records, liveness ?? _alive, excepted ? new FakeExceptionSwitch(on: true) : null),
new Factory(store, guard, clock, records, liveness ?? _alive, excepted ? new FakeExceptionSwitch(on: true) : null, display),
games, new FakeSnapshots(), new FixedHardware(), partials,
new SessionFinalizer(sessions, new RawSeriesCodec()), new NoCrashEvents(),
_ => poller ? new FakePoller(clockStepsOnDrain ? clock : null) : null, clock,
@@ -556,4 +566,49 @@ public sealed class SessionRecorderTests : IAsyncDisposable
h.Sessions.Stored.Single().Row.TelemetrySource.Should().BeNull();
h.Sessions.Stored.Single().Sensors.Should().BeEmpty();
}
private static readonly ScreenRect _screen = new(0, 0, 1920, 1080);
/// <summary>
/// beta.10 (<c>03_METRICS</c> §Display mode): a Tier-2 row carries the window it was shown in. The columns are on the
/// recorder's skeleton, not the aggregator's — a Tier-2 session never reaches the aggregator, and the window is exactly
/// what it still has to say.
/// </summary>
[Fact]
public async Task ATierTwoRowCarriesTheWindowItWasShownIn()
{
Harness h = await MakeAsync(verdict: AntiCheatVerdict.Refused(AntiCheatRefusalReason.BlockedDriver, "Riot Vanguard", "vgk.sys"), clockStepsOnDrain: true,
display: new FixedWindow(new WindowView(false, _screen, _screen, 144)));
RecordedSession r = await h.Recorder.RecordAsync(Request(), TestContext.Current.CancellationToken);
r.Finalize.Status.Should().Be(FinalizeStatus.Saved);
SessionRow row = h.Sessions.Stored.Single().Row;
row.Tier.Should().Be(CaptureTier.NotHooked);
row.DisplayCoversMs.Should().BeGreaterThan(0, "a window covering its monitor that nothing could ask about");
row.DisplayExclusiveMs.Should().Be(0);
row.DisplayBorderlessMs.Should().Be(0);
row.DisplaySource.Should().Be(DisplaySource.Window);
(row.DisplayWindowW, row.DisplayWindowH, row.DisplayMonitorHz).Should().Be((1920, 1080, 144));
row.DisplayBufferW.Should().BeNull("nothing was injected to describe a swap chain");
SessionDisplayColumns.DisplayOf(row)!.Dominant.Should().Be(DisplayMode.CoversScreen);
}
[Fact]
public async Task AHookedRowKeepsItsDisplayThroughTheAggregatorAndARowWithoutAReaderHasNone()
{
Harness withReader = await MakeAsync(display: new FixedWindow(new WindowView(false, new ScreenRect(10, 10, 1290, 730), _screen, 60)));
Harness without = await MakeAsync();
await withReader.Recorder.RecordAsync(Request(), TestContext.Current.CancellationToken);
await without.Recorder.RecordAsync(Request(), TestContext.Current.CancellationToken);
SessionRow hooked = withReader.Sessions.Stored.Single().Row;
hooked.Tier.Should().Be(CaptureTier.Hooked);
hooked.DisplayWindowedMs.Should().BeGreaterThan(0);
(hooked.DisplayWindowW, hooked.DisplayWindowH).Should().Be((1280, 720));
SessionRow plain = without.Sessions.Stored.Single().Row;
plain.DisplayWindowedMs.Should().BeNull("no reader, no display facts — N/A, never a zero");
SessionDisplayColumns.DisplayOf(plain).Should().BeNull();
}
}
@@ -40,4 +40,20 @@ public sealed class LatestProcessSnapshotTests
latest.Contains(_game).Should().BeTrue("a process we cannot identify must not end a hold early");
latest.Contains(@"C:\Games\Other\other.exe").Should().BeFalse();
}
/// <summary>
/// beta.10: the Tier-2 hold's display sample looks at the windows of the processes running THIS executable — by image
/// path only. Unlike the clock, a process whose path could not be read is not claimed: its window could be another
/// program's, and a wrong window is a wrong mode, where a missing one is "no window".
/// </summary>
[Fact]
public void ThePidsAreThoseRunningThisExecutableByPathAndNeverAnUnreadableOne()
{
var latest = new LatestProcessSnapshot();
latest.PidsOf(_game).Should().BeEmpty("no snapshot yet");
latest.Publish([Proc(1, @"D:\another\Game.exe"), Proc(2, _game.ToUpperInvariant()), Proc(3, null), Proc(4, _game)]);
latest.PidsOf(_game).Should().Equal(2, 4);
}
}
@@ -0,0 +1,134 @@
using FluentAssertions;
using FrameLedger.Domain.Display;
namespace FrameLedger.Domain.Tests.Display;
/// <summary>
/// The display-mode ladder and its time tally (beta.10, <c>03_METRICS</c> §Display mode): what one sample is, and what a
/// session's samples add up to.
/// </summary>
public sealed class DisplayModeTests
{
private static readonly ScreenRect _monitor = new(0, 0, 2560, 1440);
private static WindowView Window(ScreenRect client, bool minimized = false) => new(minimized, client, _monitor, 144);
private static SwapChainView Chain(bool known = true, bool exclusive = false, bool fresh = true, bool openGl = false) =>
new(Hwnd: 0x1234, ExclusiveKnown: known, Exclusive: exclusive, OpenGl: openGl, BufferWidth: 2560, BufferHeight: 1440,
SwapEffect: openGl ? null : "flip_discard", Fresh: fresh);
[Fact]
public void AnExclusiveChainIsExclusiveFullscreen() =>
DisplayModeClassifier.Classify(Chain(exclusive: true), Window(_monitor)).Mode.Should().Be(DisplayMode.ExclusiveFullscreen);
[Fact]
public void ACoveringWindowOnANonExclusiveChainIsBorderless()
{
DisplayObservation o = DisplayModeClassifier.Classify(Chain(), Window(_monitor));
o.Mode.Should().Be(DisplayMode.Borderless);
o.Source.Should().Be(DisplaySource.SwapChain);
o.Client.Should().Be(_monitor);
o.BufferWidth.Should().Be(2560u);
o.MonitorHz.Should().Be(144);
o.SwapEffect.Should().Be("flip_discard");
}
/// <summary>OpenGL, Vulkan and a game that was not hooked cannot be asked: a covering window is "borderless or fullscreen".</summary>
[Fact]
public void ACoveringWindowNobodyCouldAskAboutCoversTheScreen()
{
DisplayModeClassifier.Classify(null, Window(_monitor)).Should().Match<DisplayObservation>(o =>
o.Mode == DisplayMode.CoversScreen && o.Source == DisplaySource.Window);
DisplayModeClassifier.Classify(Chain(known: false, openGl: true), Window(_monitor)).Should().Match<DisplayObservation>(o =>
o.Mode == DisplayMode.CoversScreen && o.Source == DisplaySource.OpenGl);
}
/// <summary>A sample older than 2 s says nothing about now: a minimised game presents only probes the hook drops.</summary>
[Fact]
public void AStaleExclusiveSampleIsNotExclusive() =>
DisplayModeClassifier.Classify(Chain(exclusive: true, fresh: false), Window(_monitor)).Mode.Should().Be(DisplayMode.CoversScreen);
[Theory]
[InlineData(100, 100, 1700, 1000)] // a window in the middle of the screen
[InlineData(0, 31, 2560, 1400)] // a maximised window: title bar above, taskbar below
public void AClientAreaThatDoesNotCoverTheMonitorIsWindowed(int left, int top, int right, int bottom) =>
DisplayModeClassifier.Classify(Chain(), Window(new ScreenRect(left, top, right, bottom))).Mode.Should().Be(DisplayMode.Windowed);
[Fact]
public void OnePixelShortOnAnEdgeStillCovers() =>
DisplayModeClassifier.Classify(Chain(), Window(new ScreenRect(1, 0, 2559, 1440))).Mode.Should().Be(DisplayMode.Borderless);
[Fact]
public void AMinimisedWindowIsMinimisedWhateverTheChainLastSaid() =>
DisplayModeClassifier.Classify(Chain(exclusive: true), Window(_monitor, minimized: true)).Mode.Should().Be(DisplayMode.Minimized);
[Fact]
public void NoWindowIsNoWindowUnlessTheChainSaidExclusive()
{
DisplayModeClassifier.Classify(null, null).Should().Match<DisplayObservation>(o => o.Mode == DisplayMode.NoWindow && o.Source == null);
DisplayModeClassifier.Classify(Chain(), null).Mode.Should().Be(DisplayMode.NoWindow);
DisplayModeClassifier.Classify(Chain(exclusive: true), null).Mode.Should().Be(DisplayMode.ExclusiveFullscreen);
}
/// <summary>Two sampling rates, one unit: a 100 ms tick and a 1 s tick each stand for the time until the next.</summary>
[Fact]
public void TheTallyAddsTimeAndTheSharesIgnoreTimeWithNoWindow()
{
var tally = new DisplayTally();
DisplayObservation exclusive = DisplayModeClassifier.Classify(Chain(exclusive: true), Window(_monitor));
DisplayObservation windowed = DisplayModeClassifier.Classify(Chain(), Window(new ScreenRect(100, 100, 1380, 820)));
DisplayObservation none = DisplayModeClassifier.Classify(null, null);
for (int i = 0; i < 30; i++)
{
tally.Add(exclusive, 100); // 3 s hooked at 100 ms
}
tally.Add(none, 5_000); // 5 s with no window: outside every share
tally.Add(windowed, 1_000); // 1 s of a windowed hold tick
tally.Add(exclusive, -50); // a clock that went backwards adds nothing
DisplaySummary s = tally.Summary();
s.ExclusiveMs.Should().Be(3_000);
s.WindowedMs.Should().Be(1_000);
s.NoWindowMs.Should().Be(5_000);
s.ObservedMs.Should().Be(4_000);
s.SharePercent(DisplayMode.ExclusiveFullscreen).Should().Be(75.0);
s.SharePercent(DisplayMode.Windowed).Should().Be(25.0);
s.Changes.Should().Be(2, "exclusive → windowed → exclusive; the sample with no window is not a mode");
s.Dominant.Should().Be(DisplayMode.ExclusiveFullscreen);
s.WindowWidth.Should().Be(2560, "the sizes are the longest-lasting mode's");
s.MonitorHz.Should().Be(144);
s.Source.Should().Be(DisplaySource.SwapChain);
s.ExclusivityKnown.Should().BeTrue();
}
[Fact]
public void ASessionWhoseExclusivityWasUnknownForAMomentSaysSo()
{
var tally = new DisplayTally();
tally.Add(DisplayModeClassifier.Classify(Chain(), Window(_monitor)), 900);
tally.Add(DisplayModeClassifier.Classify(null, Window(_monitor)), 100);
DisplaySummary s = tally.Summary();
s.BorderlessMs.Should().Be(900);
s.CoversMs.Should().Be(100);
s.ExclusivityKnown.Should().BeFalse();
s.Source.Should().Be(DisplaySource.SwapChain, "the strongest source any sample had");
}
[Fact]
public void NothingObservedHasNoSharesAndNoSizes()
{
var tally = new DisplayTally();
tally.Any.Should().BeFalse();
tally.Add(DisplayModeClassifier.Classify(null, null), 1_000);
DisplaySummary s = tally.Summary();
s.SharePercent(DisplayMode.Windowed).Should().BeNull();
s.Dominant.Should().BeNull();
s.WindowWidth.Should().BeNull();
s.Source.Should().BeNull();
}
}
@@ -0,0 +1,85 @@
using System.Diagnostics;
using System.Globalization;
using System.Text.RegularExpressions;
using FluentAssertions;
using FrameLedger.Domain.Display;
using FrameLedger.Infrastructure.Display;
namespace FrameLedger.Infrastructure.Tests.Display;
/// <summary>
/// The window reader against a real window in another process (beta.10, <c>03_METRICS</c> §Display mode):
/// <c>hook-harness --hold-presenting-hwnd</c> makes a top-level window with a swap chain on it and prints the handle. Nothing
/// is injected — the reader asks user32 about a window from outside, as the Agent does.
/// </summary>
/// <remarks>
/// The harness's window is never shown (a hosted runner has nothing to show it on), so the positive case goes through the
/// NAMED handle, the path region 4 feeds; the largest-visible-window search is exercised by what it must not find. A
/// machine with no window station or no monitor skips, and says so.
/// </remarks>
public sealed partial class WindowGeometryProbeTests
{
private static string Harness => Path.Combine(AppContext.BaseDirectory, "hook-harness.exe");
[GeneratedRegex(@"hwnd=0x(?<hwnd>[0-9a-fA-F]+) width=(?<w>\d+) height=(?<h>\d+)", RegexOptions.None, 1000)]
private static partial Regex FixtureLine();
[Fact]
public async Task TheNamedWindowIsReadWhenItsOwnerIsAmongThePidsAndRefusedWhenNot()
{
CancellationToken ct = TestContext.Current.CancellationToken;
File.Exists(Harness).Should().BeTrue("hook-harness.exe must be staged beside the test binary (FrameLedger.DrainFixtures.targets); run build.ps1 native first");
using Process harness = Process.Start(new ProcessStartInfo(Harness, "--hold-presenting-hwnd 15")
{
UseShellExecute = false,
CreateNoWindow = true,
RedirectStandardOutput = true,
})!;
try
{
Match? fixture = null;
while (fixture is null && await harness.StandardOutput.ReadLineAsync(ct).ConfigureAwait(true) is { } line)
{
Assert.SkipWhen(line.Contains("[SKIP]", StringComparison.Ordinal), "the harness could not make a window with a swap chain here: " + line.Trim());
Match m = FixtureLine().Match(line);
fixture = m.Success ? m : null;
}
fixture.Should().NotBeNull("the harness prints the window it made before it starts presenting");
ulong hwnd = ulong.Parse(fixture!.Groups["hwnd"].Value, NumberStyles.HexNumber, CultureInfo.InvariantCulture);
var probe = new WindowGeometryProbe();
WindowView? view = probe.Observe([harness.Id], hwnd);
Assert.SkipWhen(view is null, "no monitor to place the window on in this session");
view!.Value.Minimized.Should().BeFalse();
view.Value.Client.IsEmpty.Should().BeFalse("the harness's window has a client area");
view.Value.Monitor.IsEmpty.Should().BeFalse();
view.Value.CoversMonitor.Should().BeFalse("a 320×200 window covers no monitor");
DisplayModeClassifier.Classify(null, view).Mode.Should().Be(DisplayMode.Windowed);
// The same handle asked about a process that does not own it: a handle is reused once its window is gone, so
// one that belongs to someone else is not the game's — and this test process shows no window of its own.
probe.Observe([Environment.ProcessId], hwnd).Should().BeNull();
probe.Observe([], hwnd).Should().BeNull("no process, no window");
}
finally
{
try
{
if (!harness.HasExited)
{
harness.Kill(entireProcessTree: true);
}
}
catch (InvalidOperationException)
{
// Exited between the check and the kill.
}
}
}
[Fact]
public void AHandleThatIsNoWindowIsNotRead() =>
new WindowGeometryProbe().Observe([Environment.ProcessId], 0xDEAD_0000_BEEF).Should().BeNull();
}
@@ -134,6 +134,46 @@ public sealed class LedgerDatabaseTests
cancellationToken: Ct)).ConfigureAwait(false);
}
/// <summary>
/// Schema 0016 (2026-09-27, beta.10): the display mode's fifteen columns, ADD COLUMN only — a session written before it
/// has none of them (N/A, never a zero), and a new one writes and reads each.
/// </summary>
[Fact]
public async Task ScriptSixteenAddsTheDisplayColumnsAndAnEarlierSessionHasNone()
{
await using LedgerFixture f = await LedgerFixture.OpenAsync();
MigrationRunner.LatestVersion.Should().BeGreaterThanOrEqualTo(16);
long gameId = (await new SqliteGameRepository(f.Db).EnsureAsync(
new() { ExePath = @"C:\Games\D\d.exe", SizeBytes = 1, MtimeUnixMs = 2 }, "D", Ct).ConfigureAwait(true)).Id;
long snapshotId = await new SqliteHardwareSnapshotRepository(f.Db).EnsureAsync(new HardwareSnapshot { GpuName = "g" }, DateTimeOffset.UnixEpoch, Ct)
.ConfigureAwait(true);
string path = f.Path;
await f.Db.DisposeAsync().ConfigureAwait(true);
var c15 = new SqliteConnection(new SqliteConnectionStringBuilder { DataSource = path, Pooling = false }.ToString());
await using (c15.ConfigureAwait(true))
{
await c15.OpenAsync(Ct).ConfigureAwait(true);
await RewindToAsync(c15, 15).ConfigureAwait(true);
await c15.ExecuteAsync(new CommandDefinition(
"INSERT INTO sessions (session_guid, game_id, snapshot_id, started_at, ended_at, duration_s, qpc_epoch, qpc_frequency, capture_tier, capture_mode, exit_status, frame_count, app_frame_count, displayed_frame_count, dropped_frames) "
+ "VALUES ('00000000-0000-0000-0000-000000000016', @gameId, @snapshotId, 0, 60000, 60, 0, 10000000, 2, 'attach', 'normal', 0, 0, 0, 0)",
new { gameId, snapshotId }, cancellationToken: Ct)).ConfigureAwait(true);
}
LedgerDatabase migrated = await LedgerDatabase.OpenAsync(path, ct: Ct).ConfigureAwait(true);
await using (migrated.ConfigureAwait(true))
{
migrated.SchemaVersion.Should().Be(MigrationRunner.LatestVersion);
long columns = await migrated.ReadAsync((c, ct) => c.ExecuteScalarAsync<long>(new CommandDefinition(
"SELECT COUNT(*) FROM pragma_table_info('sessions') WHERE substr(name, 1, 8) = 'display_'", cancellationToken: ct)), Ct).ConfigureAwait(true);
columns.Should().Be(15);
SessionRow before = (await new SqliteSessionRepository(migrated).FindAsync(Guid.Parse("00000000-0000-0000-0000-000000000016"), Ct).ConfigureAwait(true))!;
before.DisplayExclusiveMs.Should().BeNull("a session recorded before beta.10 has no display facts, and reads N/A");
before.DisplaySource.Should().BeNull();
before.DisplayMonitorHz.Should().BeNull();
}
}
/// <summary>
/// Schema 0015 (2026-09-27, beta.10): <c>games.engine_version_source</c>, and the bare "4"/"5" the old Unreal rule wrote
/// removed — only where detection wrote it. A value the user typed, one with no provenance badge, another engine's, and a
@@ -56,6 +56,23 @@ public sealed class SqliteSessionRepositoryTests
MedianFps = 60.5,
P1LowFps = 48.2,
ReflexActive = true,
SwapEffect = "flip_discard",
// Schema 0016 (beta.10): the display mode, every column set so the round trip covers each.
DisplayExclusiveMs = 1_000,
DisplayBorderlessMs = 80_000,
DisplayWindowedMs = 7_000,
DisplayCoversMs = 0,
DisplayMinimizedMs = 2_000,
DisplayNoWindowMs = 500,
DisplayChanges = 3,
DisplaySource = "swapchain",
DisplayWindowW = 2560,
DisplayWindowH = 1440,
DisplayBufferW = 2560,
DisplayBufferH = 1440,
DisplayMonitorW = 2560,
DisplayMonitorH = 1440,
DisplayMonitorHz = 165,
};
private static FrameBlobs Frames(int n) => new()
@@ -129,6 +146,17 @@ public sealed class SqliteSessionRepositoryTests
Mode = CaptureMode.Attach,
ExitStatus = ExitStatus.Normal,
CaptureNotes = "RefusedHookNotEnabled",
// beta.10: a Tier-2 session still has its window (schema 0016), and nothing to say about a swap chain.
DisplayCoversMs = 118_000,
DisplayMinimizedMs = 2_000,
DisplayExclusiveMs = 0,
DisplayBorderlessMs = 0,
DisplayWindowedMs = 0,
DisplayNoWindowMs = 0,
DisplayChanges = 2,
DisplaySource = "window",
DisplayWindowW = 1920,
DisplayWindowH = 1080,
};
await repo.InsertFinalizedAsync(new FinalizedSession { Row = row }, Ct);
@@ -141,6 +169,8 @@ public sealed class SqliteSessionRepositoryTests
back.RtFlag.Should().Be("na");
back.Upscaler.Should().BeNull();
back.CaptureNotes.Should().Be("RefusedHookNotEnabled");
(back.DisplayCoversMs, back.DisplayMinimizedMs, back.DisplayChanges, back.DisplaySource).Should().Be((118_000L, 2_000L, 2L, "window"));
(back.DisplayWindowW, back.DisplayBufferW, back.DisplayMonitorHz).Should().Be((1920, (int?)null, (int?)null));
(await repo.FindFramesAsync(back.Id, Ct)).Should().BeNull();
}