Compare commits
8
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d628b19d4d
|
||
|
|
e0bfbe6edf | ||
|
|
c4318b69d5 | ||
|
|
42fb21bb18 | ||
|
|
3e810d1aa6 | ||
|
|
b7d655078c | ||
|
|
4fbc14e698 | ||
|
|
7cd933f62d |
No files matched your search
+151
-4
@@ -59,10 +59,12 @@ dotnet_diagnostic.MA0011.severity = warning
|
||||
# and GenerateDocumentationFile is on for the shipping ones.
|
||||
dotnet_diagnostic.CS1591.severity = suggestion
|
||||
|
||||
# --- ReSharper inspections: what Qodana reads (docs/13_CI_CD.md §Qodana, D93) ---
|
||||
# Qodana Community for .NET is ReSharper's InspectCode, and InspectCode reads these keys - so does Rider or ReSharper
|
||||
# in the editor, which is why they are here and not in qodana.yaml: the same list everywhere. An inspection is off
|
||||
# only where it argues with a choice this project made; each line says which. Everything else it reports is fixed.
|
||||
# --- ReSharper inspections: what Qodana reads (docs/13_CI_CD.md §Qodana, D93 and D100) ---
|
||||
# Qodana's linters run ReSharper's engine - Qodana for .NET since 2026-11-11, the Community linter before it - and the
|
||||
# engine reads these keys; so does Rider or ReSharper in the editor, which is why they are here and not in
|
||||
# qodana.yaml: the same list everywhere. An inspection is off only where it argues with a choice this project made;
|
||||
# each line says which. Everything else it reports is fixed. (What is NOT ReSharper's - a whole severity, the
|
||||
# IntelliJ platform's Markdown and XML inspections, JetBrains' security rules - has no key here and is in qodana.yaml.)
|
||||
[*.{cs,xaml}]
|
||||
# The compiler's missing-XML-comment warning, already a suggestion above (CS1591): InspectCode reports suggestions.
|
||||
resharper_c_sharp_warnings_cs1591_highlighting = none
|
||||
@@ -147,6 +149,12 @@ resharper_redundant_empty_switch_section_highlighting = none
|
||||
# A binding path through a null yields no value, and the template shows nothing: that is the design.
|
||||
resharper_xaml_possible_null_reference_exception_highlighting = none
|
||||
|
||||
[*.resx]
|
||||
# A vi or ja value that equals the English one is deliberate: product and technology names, units and format strings
|
||||
# are not translated, and a ja safety string is the English verbatim until a reviewer signs it (docs/09_I18N.md;
|
||||
# tools/resx-audit.ps1 holds that rule). 271 results on Qodana for .NET's first run.
|
||||
resharper_overridden_with_same_value_highlighting = none
|
||||
|
||||
[src/FrameLedger.App/**.cs]
|
||||
# WPF codegen constraints, not style choices. The generated App.g.cs and
|
||||
# *.g.cs partials declare these types public, so making them internal is a
|
||||
@@ -176,3 +184,142 @@ resharper_collection_never_updated_local_highlighting = none
|
||||
resharper_unused_method_return_value_local_highlighting = none
|
||||
resharper_redundant_assignment_highlighting = none
|
||||
resharper_return_type_can_be_not_nullable_highlighting = none
|
||||
|
||||
# --- ReSharper C++ inspections: what Qodana's native report reads (docs/13_CI_CD.md §Qodana, D99 and D100) ---
|
||||
# The native report runs ReSharper's C++ engine, and with it the clang-tidy checks and clang diagnostics that engine
|
||||
# bundles (the keys that say clang_tidy). The native code is built by MSVC alone, with /W4 /WX; what clang says about
|
||||
# code it never compiles is read here as advice. An inspection is off only where it argues with a choice this project
|
||||
# made, and each line says which; everything else the report found was fixed.
|
||||
[src/native/**.{cpp,h,inl}]
|
||||
# Where the compiler pads a struct. Information, not a fault: the layouts that matter are asserted (static_assert on
|
||||
# sizes and offsets in fl_shm.h, and the mirror test against fl-layout-dump).
|
||||
resharper_cpp_clang_tidy_clang_diagnostic_padded_highlighting = none
|
||||
# MSVC's own keywords - __try/__except (rule 5's guard around every hook body), __declspec, __stdcall. This code is
|
||||
# built by MSVC and by nothing else.
|
||||
resharper_cpp_clang_tidy_clang_diagnostic_language_extension_token_highlighting = none
|
||||
# A function looked up by name - GetProcAddress, vkGetInstanceProcAddr, a vtable slot - comes back as a pointer to
|
||||
# another function type and is cast to its real one: that is the API. Through void* is how the cast says it is meant.
|
||||
resharper_cpp_clang_tidy_clang_diagnostic_cast_function_type_strict_highlighting = none
|
||||
resharper_cpp_clang_tidy_bugprone_casting_through_void_highlighting = none
|
||||
# Memory read as something else - a COM object as its vtable, a relay's bytes as an address - says reinterpret_cast,
|
||||
# also where static_cast from void* would compile.
|
||||
resharper_cpp_reinterpret_cast_from_void_ptr_highlighting = none
|
||||
# It proposes std::cmp_less for a comparison whose sides differ in sign. The comparisons it found cast one side
|
||||
# explicitly, and the compiler's own sign warnings (C4018, C4388, C4389) are errors in this build.
|
||||
resharper_cpp_clang_tidy_modernize_use_integer_sign_comparison_highlighting = none
|
||||
# A `default:` under a switch that names every enumerator is deliberate: a value outside the enumeration - a corrupt
|
||||
# one, a future one - takes the refusing arm instead of falling out of the switch.
|
||||
resharper_cpp_clang_tidy_clang_diagnostic_covered_switch_default_highlighting = none
|
||||
# "Not eliding copy on return": a verdict returned from a const local is copied. It is a few words wide.
|
||||
resharper_cpp_clang_tidy_clang_diagnostic_nrvo_highlighting = none
|
||||
# A type that owns a handle deletes its copies or declares none; the moves are then not generated either, which is
|
||||
# what is wanted. Four more `= delete` lines would say nothing the destructor did not.
|
||||
resharper_cpp_clang_tidy_cppcoreguidelines_special_member_functions_highlighting = none
|
||||
# An enumeration zero-initialised (`D3D_FEATURE_LEVEL got{}`) is an out parameter cleared before the call that fills it.
|
||||
resharper_cpp_clang_tidy_bugprone_invalid_enum_default_initialization_highlighting = none
|
||||
# An enumeration's width is part of a layout or of the atomic word it is stored in, not a size to be minimised.
|
||||
resharper_cpp_clang_tidy_performance_enum_size_highlighting = none
|
||||
# "Possibly unused #include": a file that calls std::memset includes <cstring>, also when <windows.h> already brought
|
||||
# it in. What it reported was of that kind, or a header named again inside a conditional block, but for two that
|
||||
# nothing used; those were removed.
|
||||
resharper_cpp_unused_include_directive_highlighting = none
|
||||
# A function another file calls by a declaration of its own (the harness's Hold* functions), an entry point the
|
||||
# loader calls by name (DllMain), a placeholder a target links: "can be made static" reads one file.
|
||||
resharper_cpp_use_internal_linkage_highlighting = none
|
||||
# "Can be made const": a parameter or a method through which the code acts on a device, a ring or a handle is not
|
||||
# const because the type system would allow it; and a local that is already const gains nothing from constexpr - for a
|
||||
# std::string it would hold only while the text fits the small-string buffer.
|
||||
resharper_cpp_parameter_may_be_const_ptr_or_ref_highlighting = none
|
||||
resharper_cpp_member_function_may_be_const_highlighting = none
|
||||
resharper_cpp_variable_can_be_made_constexpr_highlighting = none
|
||||
# THE ENGINE MISREADS THESE. (1) `std::atomic_ref<T>{x}.fetch_or(bit)` is reported as an expression without side
|
||||
# effects; the side effect is the call. (2) A Win32, D3D12 or ffx-api structure is zero-initialised and then filled
|
||||
# field by field - the reserved fields must stay zero - and is handed to the API by its address or its header's: the
|
||||
# engine reports the initialiser as always rewritten and the fields as assigned and never used. (3) A test of a
|
||||
# constexpr function (`Check(F(a) == b && G(a) == c, ...)`) has the engine evaluate it and call one side redundant.
|
||||
resharper_cpp_expression_without_side_effects_highlighting = none
|
||||
resharper_cpp_initialized_value_is_always_rewritten_highlighting = none
|
||||
resharper_cpp_assigned_value_is_never_used_highlighting = none
|
||||
resharper_cpp_redundant_boolean_expression_argument_highlighting = none
|
||||
# Proposals to restate working code in a newer idiom - a range-for, std::ranges, any_of, starts_with, std::min, a raw
|
||||
# string, an if with an initialiser, emplace_back. The native code is written to be read beside the hook path: an
|
||||
# index and a plain loop, the same in the guard, its tests and the probes.
|
||||
resharper_cpp_clang_tidy_modernize_loop_convert_highlighting = none
|
||||
resharper_cpp_clang_tidy_modernize_use_ranges_highlighting = none
|
||||
resharper_cpp_use_range_algorithm_highlighting = none
|
||||
resharper_cpp_clang_tidy_readability_use_anyofallof_highlighting = none
|
||||
resharper_cpp_clang_tidy_modernize_use_starts_ends_with_highlighting = none
|
||||
resharper_cpp_clang_tidy_readability_use_std_min_max_highlighting = none
|
||||
resharper_cpp_clang_tidy_modernize_raw_string_literal_highlighting = none
|
||||
resharper_cpp_clang_tidy_modernize_use_emplace_highlighting = none
|
||||
resharper_cpp_clang_tidy_modernize_return_braced_init_list_highlighting = none
|
||||
resharper_cpp_use_associative_contains_highlighting = none
|
||||
resharper_cpp_too_wide_scope_highlighting = none
|
||||
resharper_cpp_if_can_be_replaced_by_constexpr_if_highlighting = none
|
||||
|
||||
# A structure Windows defines and this SDK's headers do not give (RTL_PROCESS_MODULE_INFORMATION,
|
||||
# PROCESS_MEMORY_COUNTERS_EX2), and a test's stand-in for a Vulkan dispatchable object, are declared field for field:
|
||||
# the fields nothing names are what puts the others at their offsets.
|
||||
[src/native/{FrameLedger.Injector/src/fl_guard_sources.cpp,FrameLedger.ProcessStats/src/fl_process_stats.cpp,tools/fl-probe-guard/main.cpp,tests/vklayer_test.cpp}]
|
||||
resharper_cpp_declarator_never_used_highlighting = none
|
||||
|
||||
# The linter's compiler, not the build's: NVAPI's header makes NvU32 `unsigned int` under clang and `unsigned long`
|
||||
# under MSVC, which is the compiler that builds this probe - and `%lu` is right for it.
|
||||
[src/native/tools/fl-probe-nvapi/main.cpp]
|
||||
resharper_cpp_clang_tidy_clang_diagnostic_format_highlighting = none
|
||||
|
||||
# --- the probes, the harness and the tests ---
|
||||
[src/native/{tools,tests}/**.{cpp,h}]
|
||||
# printf, fprintf, fputs, fclose: a probe prints what it found and a test prints why it failed; neither has anything
|
||||
# to do about a failed write to its own console.
|
||||
resharper_cpp_clang_tidy_cert_err33_c_highlighting = none
|
||||
# atoi on the harness's own arguments, which its tests write: a number that does not parse is 0, and the run that
|
||||
# asked for it fails on its own assertion.
|
||||
resharper_cpp_clang_tidy_bugprone_unchecked_string_to_number_conversion_highlighting = none
|
||||
# A printf-shaped helper (`Note(fmt, ...)`): the attribute clang proposes is not MSVC's, and a parameter pack would
|
||||
# be a second implementation of printf.
|
||||
resharper_cpp_clang_tidy_modernize_avoid_variadic_functions_highlighting = none
|
||||
resharper_cpp_clang_tidy_clang_diagnostic_missing_format_attribute_highlighting = none
|
||||
# `&pointer` handed to an API that takes `void*` (ReadProcessMemory, a memcpy of a vtable slot, a Streamline array of
|
||||
# constants): the conversion is the call's own.
|
||||
resharper_cpp_clang_tidy_bugprone_multi_level_implicit_pointer_conversion_highlighting = none
|
||||
# A test builds a handle or an address from a number, on purpose: a fake one, or one read from another process.
|
||||
resharper_cpp_clang_tidy_performance_no_int_to_ptr_highlighting = none
|
||||
# A macro that pastes its argument into a name (FL_DEV(vkGetDeviceQueue)) cannot put it in parentheses.
|
||||
resharper_cpp_clang_tidy_bugprone_macro_parentheses_highlighting = none
|
||||
# A test's fixture: a global with a std::string in it, a memcpy into a byte buffer that is not a string, two strings
|
||||
# added in an assertion's message.
|
||||
resharper_cpp_clang_tidy_bugprone_throwing_static_initialization_highlighting = none
|
||||
resharper_cpp_clang_tidy_bugprone_not_null_terminated_result_highlighting = none
|
||||
resharper_cpp_clang_tidy_performance_inefficient_string_concatenation_highlighting = none
|
||||
# layout_test checks facts the compiler already knows - a constant's length, a bit-field's range - at run time, so
|
||||
# that a failure prints which one: the branch that cannot be taken is the test passing.
|
||||
resharper_cpp_unreachable_code_highlighting = none
|
||||
resharper_cpp_clang_tidy_clang_diagnostic_unreachable_code_highlighting = none
|
||||
resharper_cpp_clang_tidy_clang_diagnostic_tautological_value_range_compare_highlighting = none
|
||||
|
||||
# --- CODE LOADED INTO A GAME: the Overlay, the Vulkan layer, the shared-memory headers ---
|
||||
# D100: here only a defect is fixed, in a pull request of its own with the hook's overhead measured (rule 5,
|
||||
# 14_TESTING §Hook overhead). The report found none. What it did say about these files, each kept as it is:
|
||||
[src/native/{FrameLedger.Overlay,FrameLedger.VkLayer,FrameLedger.Shm}/**.{cpp,h,inl}]
|
||||
# Arms with the same body are different cases, each with its own comment saying why it reads as it does.
|
||||
resharper_cpp_clang_tidy_bugprone_branch_clone_highlighting = none
|
||||
# MinHook's MH_ALL_HOOKS is NULL, by its header.
|
||||
resharper_cpp_zero_constant_can_be_replaced_with_nullptr_highlighting = none
|
||||
# Kept on purpose, each with its reason beside it in dllmain.cpp: a retired enumerator whose bit must not be reused;
|
||||
# slSetTag, deprecated by a header whose replacement no measured module exports.
|
||||
resharper_cpp_enumerator_never_used_highlighting = none
|
||||
resharper_cpp_clang_tidy_clang_diagnostic_deprecated_declarations_highlighting = none
|
||||
|
||||
# DEAD CODE, FOUND AND NOT REMOVED: nothing calls dllmain.cpp's LogNoteW. D100 changes code loaded into a game for
|
||||
# a defect only, so taking it out is the owner's to order (HANDOFF, the native report's section) and not this
|
||||
# report's to do. Until then this one file is not read for an unused function. Remove this section with it.
|
||||
[src/native/FrameLedger.Overlay/src/dllmain.cpp]
|
||||
resharper_cpp_declarator_never_used_highlighting = none
|
||||
resharper_cpp_clang_tidy_clang_diagnostic_unused_function_highlighting = none
|
||||
|
||||
# The guard's rule matcher, which the Overlay compiles too. ResolveTolerance clears its out parameter with memset, as
|
||||
# ResetRules does: a Tolerance is flags with default member initialisers, which is all "non-trivially default
|
||||
# constructible" means here, and zero is what those initialisers say.
|
||||
[src/native/FrameLedger.Injector/{src/fl_ac_rules.cpp,include/fl_ac_rules.h}]
|
||||
resharper_cpp_clang_tidy_bugprone_raw_memory_call_on_non_trivial_type_highlighting = none
|
||||
+117
-21
@@ -1,28 +1,31 @@
|
||||
# Qodana (owner decision D93, 2026-11-10; docs/13_CI_CD.md §Qodana).
|
||||
# Qodana (owner decisions D93, 2026-11-10, and D99, 2026-11-11; docs/13_CI_CD.md §Qodana).
|
||||
#
|
||||
# JetBrains' template for the Qodana Scan action, changed where FrameLedger differs
|
||||
# and each change said here:
|
||||
#
|
||||
# - The linter is Qodana Community for .NET (qodana.yaml names it and says why): a
|
||||
# Linux container, which is why this job alone runs on ubuntu-latest in a
|
||||
# Windows-only project. EnableWindowsTargeting lets the .NET SDK there build and
|
||||
# load projects whose target is Windows; it is passed to the container rather than
|
||||
# written into Directory.Build.props, because no build of the product is meant to
|
||||
# run anywhere but Windows.
|
||||
# - The action is pinned to a commit (v2026.2.2, the newest; the template names
|
||||
# v2026.1), as every action that is not GitHub's own is here.
|
||||
# - The linter is Qodana for .NET (Rider's engine) in NATIVE mode, on a Windows
|
||||
# runner: the projects target Windows, and the linter then builds and loads them
|
||||
# with the SDK this job installs from global.json - no container, and no
|
||||
# EnableWindowsTargeting. qodana.yaml names the linter and the mode; nothing is
|
||||
# passed as an action argument. (Until beta.37 this was the Community linter in a
|
||||
# Linux container, the one Linux job this repository had.)
|
||||
# - The action is pinned to a commit, as every action that is not GitHub's own is
|
||||
# here.
|
||||
# - Permissions are the ones the job uses: it reads the repository, writes a check
|
||||
# run with the annotations and one comment on the pull request. The template's
|
||||
# `contents: write` is for pushing quick-fixes, which this job never does.
|
||||
# - A workflow of its own, as JetBrains advises, and ADVISORY: `main`'s required
|
||||
# contexts stay `check` and the two `analyze` jobs. A problem Qodana finds, or a
|
||||
# Qodana Cloud outage, is a red job beside a green `check`, never a blocked merge.
|
||||
# contexts stay `check` and the two `analyze` jobs. A problem Qodana finds, a
|
||||
# Qodana Cloud outage or a lapsed licence is a red job beside a green `check`,
|
||||
# never a blocked merge.
|
||||
# - Two jobs, two reports (D99): `managed` reads the solution - the C#, the XAML and
|
||||
# what Rider's plugins read around it - and reports to the Qodana Cloud project
|
||||
# `frameledger`; `native` reads the C++ of src/native through a Visual Studio
|
||||
# solution CMake generates for it, with settings of its own (qodana-native.yaml),
|
||||
# and reports to `frameledger-cpp`. Neither reads what the other does. The pull
|
||||
# request's comment and annotations are the managed job's alone.
|
||||
# - `main` only: the `alpha` branch is main's source under another release line
|
||||
# (docs/13_CI_CD.md §The alpha line), and main's is what is analysed.
|
||||
# - INTERIM since beta.37 (D94, 2026-11-11): main builds on .NET 11, which the
|
||||
# linter's image does not carry (SDKs 8 to 10), so qodana.yaml's `bootstrap`
|
||||
# installs the SDK global.json names into the container first. The Ultimate
|
||||
# linter's pull request replaces this job with one on Windows.
|
||||
|
||||
name: Qodana
|
||||
|
||||
@@ -40,7 +43,8 @@ concurrency:
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
qodana:
|
||||
managed:
|
||||
name: Qodana (managed)
|
||||
# A pull request from this repository, or a push or a dispatch. QODANA_TOKEN
|
||||
# reaches neither a fork's pull request nor Dependabot's, and their token cannot
|
||||
# write the check run or the comment.
|
||||
@@ -48,7 +52,7 @@ jobs:
|
||||
github.event_name != 'pull_request' ||
|
||||
(github.event.pull_request.head.repo.full_name == github.repository &&
|
||||
github.event.pull_request.user.login != 'dependabot[bot]')
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: windows-latest
|
||||
timeout-minutes: 60
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -64,19 +68,111 @@ jobs:
|
||||
# A full history is required for pull request analysis.
|
||||
fetch-depth: 0
|
||||
|
||||
# Native mode runs the linter in this job's environment, so the SDK it loads
|
||||
# the projects with is this one. No MSVC step here on purpose: it exports
|
||||
# Platform=x64, which MSBuild reads as a solution platform (build.ps1's
|
||||
# Clear-VcxprojPlatform).
|
||||
- name: Set up .NET
|
||||
uses: actions/setup-dotnet@v6
|
||||
with:
|
||||
global-json-file: global.json
|
||||
|
||||
# Restored only: `check` saves this cache, under the same key.
|
||||
- name: Restore the NuGet cache
|
||||
uses: actions/cache/restore@v6
|
||||
with:
|
||||
path: ~/.nuget/packages
|
||||
key: nuget-${{ runner.os }}-${{ hashFiles('**/Directory.Packages.props', 'global.json') }}
|
||||
restore-keys: nuget-${{ runner.os }}-
|
||||
|
||||
# Built before it is inspected: a build that fails is then one red step with
|
||||
# the compiler's own message, not a report of thousands of unresolved symbols.
|
||||
# The native DLLs are absent here, so the .targets that copy them warn and the
|
||||
# build goes on, as on a fresh clone.
|
||||
- name: Build what the linter loads
|
||||
shell: pwsh
|
||||
run: |
|
||||
dotnet build FrameLedger.slnx -c Release
|
||||
if ($LASTEXITCODE -ne 0) { throw 'the build failed' }
|
||||
|
||||
# pr-mode false: the whole solution every time, so a pull request and `main`
|
||||
# are judged by the same list. upload-result: the SARIF and the linter's log
|
||||
# as an artifact of the run, for a reader with no Qodana Cloud account.
|
||||
# Caches are saved from `main` only (a pull request reads them): one per
|
||||
# branch would crowd the repository's cache quota, which NuGet's share.
|
||||
# Caches are saved from `main` only (a pull request reads them), under keys of
|
||||
# this job's own: one per branch would crowd the repository's cache quota,
|
||||
# which NuGet's share.
|
||||
- name: Qodana Scan
|
||||
uses: JetBrains/qodana-action@3e8d76ff0e0241618abd808682f426afe84bab3f # v2026.2.2
|
||||
with:
|
||||
pr-mode: false
|
||||
upload-result: true
|
||||
artifact-name: qodana-report
|
||||
cache-default-branch-only: true
|
||||
env-vars-to-linter: EnableWindowsTargeting
|
||||
primary-cache-key: qodana-managed-${{ github.ref_name }}-${{ github.sha }}
|
||||
additional-cache-key: qodana-managed-main
|
||||
env:
|
||||
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
|
||||
QODANA_ENDPOINT: 'https://qodana.cloud'
|
||||
EnableWindowsTargeting: 'true'
|
||||
|
||||
native:
|
||||
name: Qodana (native)
|
||||
# The same condition as `managed`, for the same reason: QODANA_TOKEN_NATIVE
|
||||
# reaches neither a fork's pull request nor Dependabot's.
|
||||
if: >-
|
||||
github.event_name != 'pull_request' ||
|
||||
(github.event.pull_request.head.repo.full_name == github.repository &&
|
||||
github.event.pull_request.user.login != 'dependabot[bot]')
|
||||
runs-on: windows-latest
|
||||
timeout-minutes: 60
|
||||
# No annotations and no comment from this job (below), so it writes nothing.
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
fetch-depth: 0
|
||||
|
||||
# global.json sits above the solution, and the linter resolves it.
|
||||
- name: Set up .NET
|
||||
uses: actions/setup-dotnet@v6
|
||||
with:
|
||||
global-json-file: global.json
|
||||
|
||||
# The Visual Studio generator finds the toolset itself: no MSVC step. Configure
|
||||
# fetches MinHook, Catch2 and jsmn into the build tree, as the gate's does.
|
||||
- name: Generate the solution and the one generated header
|
||||
shell: pwsh
|
||||
working-directory: src/native
|
||||
run: |
|
||||
cmake --version
|
||||
cmake --preset x64-vs-analysis
|
||||
if ($LASTEXITCODE -ne 0) { throw 'cmake configure failed' }
|
||||
cmake --build --preset x64-vs-analysis --target fl_ac_floor_gen
|
||||
if ($LASTEXITCODE -ne 0) { throw 'generating the blocklist floor failed' }
|
||||
if (-not (Test-Path ../../build/native/x64-vs-analysis/FrameLedgerNative.slnx)) {
|
||||
Get-ChildItem ../../build/native/x64-vs-analysis -Filter 'FrameLedgerNative.*' | ForEach-Object { Write-Host $_.Name }
|
||||
throw 'CMake did not write FrameLedgerNative.slnx (qodana-native.yaml names it)'
|
||||
}
|
||||
|
||||
# A report of its own: its own settings file, results folder, artifact, cache
|
||||
# keys and Qodana Cloud project. The pull request's comment and annotations are
|
||||
# the managed job's; a second job of the same linter would overwrite them.
|
||||
- name: Qodana Scan
|
||||
uses: JetBrains/qodana-action@3e8d76ff0e0241618abd808682f426afe84bab3f # v2026.2.2
|
||||
with:
|
||||
args: --config qodana-native.yaml
|
||||
results-dir: ${{ runner.temp }}/qodana-native/results
|
||||
cache-dir: ${{ runner.temp }}/qodana-native/caches
|
||||
pr-mode: false
|
||||
upload-result: true
|
||||
artifact-name: qodana-report-native
|
||||
cache-default-branch-only: true
|
||||
primary-cache-key: qodana-native-${{ github.ref_name }}-${{ github.sha }}
|
||||
additional-cache-key: qodana-native-main
|
||||
post-pr-comment: false
|
||||
use-annotations: false
|
||||
env:
|
||||
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN_NATIVE }}
|
||||
QODANA_ENDPOINT: 'https://qodana.cloud'
|
||||
+1
-1
@@ -9,7 +9,7 @@ barrier. It is written for the person who has just met one; the details for deve
|
||||
FrameLedger is a desktop program: its own window, its dialogs, its document windows, the icon by the clock and the
|
||||
notices Windows shows for it. It draws nothing inside a game, so it cannot make a game itself any easier to use.
|
||||
|
||||
*Beta software: this page describes version 0.1.0-beta.37. In the app: Help ▸ Accessibility.*
|
||||
*Beta software: this page describes version 0.1.0-beta.38. In the app: Help ▸ Accessibility.*
|
||||
|
||||
## What FrameLedger aims for
|
||||
|
||||
|
||||
@@ -35,12 +35,91 @@ numeric core and does not move; the heading is the full version — corrected 20
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
|
||||
- **"Advanced metrics" is planned, and its inventory is written — nothing reads it yet.** The owner asked for a
|
||||
setting, *Thông số nâng cao*, with a navigation item of its own that shows as much as the NVAPI and Streamline
|
||||
headers and PawnIO make available, each value under what it belongs to: one game session, or the PC. This pull
|
||||
request is the first of that train and changes nothing you can see or record. It adds the list everything else in
|
||||
the train reads — `AdvancedMetricCatalog`, 137 entries: what the Agent will read from NVAPI and
|
||||
LibreHardwareMonitor (the card's firmware, architecture and cores; its memory with evictions and promotions; its
|
||||
utilisation by domain; what a display can do with HDR and variable refresh; the driver's profile; and, as
|
||||
administrator with PawnIO, the processor per core, the motherboard, the memory modules and the drives'
|
||||
temperatures), what can only be read inside a game and waits for a later release, **and what is never read with the
|
||||
reason** — a serial number, a display's EDID, the list of programs that are encoding, the camera's position, what
|
||||
a vendor's licence closes. `docs/18_GPU_VENDOR_APIS.md` §Advanced metrics holds the design, the owner's decisions
|
||||
D101–D108 and the same list as a table; a test fails when the table and the catalog differ in either direction.
|
||||
|
||||
- **The NVIDIA bridge can read what Advanced metrics will show — and nothing calls it yet.**
|
||||
`FrameLedger.NvapiBridge.dll`, the library the Agent loads into its own process and never into a game, gains five
|
||||
reads (its ABI 3): the card's facts — firmware version, architecture, ray-tracing and tensor core counts, base and
|
||||
boost clocks, its memory sizes, the driver's package; what it says now — free and used video memory with evictions
|
||||
and promotions, the frame-buffer, video and bus utilisation, the performance state, the encoder's load; what each
|
||||
connected display can do with HDR and variable refresh; the state of the display a game presents on; and every
|
||||
setting of a driver profile. On the development PC's RTX 5080 all twenty facts and eight of the ten live groups
|
||||
answer — the card has no board or power-supply temperature sensor, so those two will read N/A.
|
||||
**It reads no identifier**: no serial number, no unique id, no display EDID, and not which programs are encoding.
|
||||
- **"The bridge never calls a setter" is now a build check.** A new gate, `tools/nvapi-readonly-check.ps1`, compares
|
||||
every NVAPI call in the bridge's source with a committed list of forty-four reads, in both directions, and refuses a
|
||||
name that sets, saves, restores, registers or controls something — or returns an identifier — even when someone
|
||||
adds it to the list.
|
||||
|
||||
- **The reader behind Advanced metrics exists, was measured on a real PC, and is still not switched on.** One
|
||||
reader for the whole Agent, on a thread of its own, that runs only while a session or the page needs it: NVIDIA's
|
||||
figures every second, and every sensor LibreHardwareMonitor has for the graphics card — each fan and its duty, the
|
||||
core voltage, PCI Express traffic, the load of every engine. When the Agent runs as administrator with PawnIO
|
||||
installed it will also read the processor per core, the memory and the motherboard's sensor chip.
|
||||
**A drive's temperature is not read**: the library cannot list drives without touching removable ones, so that
|
||||
group is never opened and the value will read N/A with that reason.
|
||||
- **`FrameLedger.CaptureHost probe-advanced`** (a developer tool, not shipped): runs that reader for a few seconds
|
||||
on your own rights and prints everything it read and what it cost. On the development PC it read 35 facts and 58
|
||||
values a second — and showed that one refresh of the sensor library takes 14 ms of processor time, so the reader
|
||||
refreshes it every five seconds, where NVIDIA's own figures (0.4 ms) stay at one a second.
|
||||
|
||||
- **The ledger can hold Advanced metrics — and holds none yet.** Schema 23 adds two tables: one for the facts of
|
||||
the PC, stored once per distinct set, and one for what a session recorded with the option on knows — its own
|
||||
facts, which sources answered and why the others did not, and the statistics of its extra series. Nothing is
|
||||
added to the session row itself, so what the JSON export and a bug bundle carry does not grow. The extra series
|
||||
are stored beside the others under names of their own, with a real "no reading" for a second in which a sensor
|
||||
was not read. One hour of them is about 0.2 MB. **A session recorded with the option off stores nothing of this**,
|
||||
and the option does not exist yet. *A 0.1.0-beta.38 cannot open a ledger a later build has migrated.*
|
||||
|
||||
- **Settings ▸ Recording ▸ Advanced metrics — the switch exists, off by default.** On, the capture agent reads more
|
||||
from the graphics driver and the hardware sensors during a session and stores it with the session: the graphics
|
||||
card's memory, load, clocks, fans, voltages and power in detail, what each display can do with HDR and variable
|
||||
refresh and what the game's display did, the driver's settings for the game — and, when the agent runs as
|
||||
administrator with PawnIO installed, the processor per core, the memory and the motherboard's sensors. **Off,
|
||||
nothing more is read or stored**, and the shared reader is not even started. It applies from the next session, and
|
||||
a session recorded while it was off is not filled in later. NVIDIA's figures are read once a second, the sensors
|
||||
every five. **No page shows what is stored yet** — that is the next pull requests' — and none of it is in an
|
||||
export or a bug report.
|
||||
- **The terms window shows the Privacy Policy 2.15 and the Disclaimer 2.15 once.** The Privacy Policy names what
|
||||
Advanced metrics reads and stores, only while it is on, and what it never reads: a serial number, a display's
|
||||
identification data, a list of other programs. The Disclaimer's two sentences about PawnIO and about running the
|
||||
agent as administrator said "the CPU temperature"; they now also name the processor's, the memory's and the
|
||||
motherboard's sensors, read with Advanced metrics on. The same sentence changed in Settings, the first run, the
|
||||
administrator dialog, the guide and `LIMITATIONS.md`.
|
||||
|
||||
### Changed
|
||||
|
||||
- **A crash file from a newer build no longer loses its tail in an older one.** The file a session writes as it goes
|
||||
(so that a crash keeps what was recorded) is made of chunks; a reader that met a chunk of a kind it did not know
|
||||
stopped there. It now passes over a whole chunk it does not know and reads on.
|
||||
|
||||
### Fixed
|
||||
|
||||
- **A sentence in the documents that kept a function from being called.** `docs/18_GPU_VENDOR_APIS.md` said the
|
||||
vendored NVAPI headers do not declare `NvAPI_GPU_GetMemoryInfoEx`. They do — in `nvapi_lite_common.h`, which
|
||||
`nvapi.h` includes; the search that found nothing had looked in `nvapi.h` alone. The row is corrected, and the
|
||||
bridge will call it for the advanced memory rows. Nothing about the memory figures FrameLedger shows today changes.
|
||||
|
||||
## Releases
|
||||
|
||||
Newest first. Each file holds that release's section exactly as it stood here.
|
||||
|
||||
| Version | Date | Notes |
|
||||
|---|---|---|
|
||||
| `0.1.0-beta.38` | 2026-11-11 | [`docs/changelog/0.1.0-beta.38.md`](docs/changelog/0.1.0-beta.38.md) |
|
||||
| `0.1.0-alpha.4` | 2026-11-11 | [`docs/changelog/0.1.0-alpha.4.md`](docs/changelog/0.1.0-alpha.4.md) |
|
||||
| `0.1.0-beta.37` | 2026-11-11 | [`docs/changelog/0.1.0-beta.37.md`](docs/changelog/0.1.0-beta.37.md) |
|
||||
| `0.1.0-beta.36` | 2026-11-10 | [`docs/changelog/0.1.0-beta.36.md`](docs/changelog/0.1.0-beta.36.md) |
|
||||
|
||||
@@ -73,9 +73,12 @@ RELEASE_LINE # `main`, or `alpha` on the alpha branch (D73, 20
|
||||
build.ps1 # the quality gate; CI runs this identical script
|
||||
SonarQube.Analysis.xml # SonarCloud's settings for ci.yml's sonarcloud job (D68, 2026-10-25; it replaced
|
||||
.config/dotnet-tools.json # .sonarcloud.properties) and the scanner it runs — 13_CI_CD §SonarCloud
|
||||
qodana.yaml # Qodana's settings for .github/workflows/qodana.yml (D93, 2026-11-10): the linter, the
|
||||
# solution, a gate of zero problems; the inspections' severities are .editorconfig's
|
||||
# resharper_* keys — 13_CI_CD §Qodana
|
||||
qodana-native.yaml # the same for the native job: the C++ of src/native, through the Visual Studio solution
|
||||
# CMake writes for it (preset x64-vs-analysis), a report of its own (D99)
|
||||
qodana.yaml # Qodana's settings for the managed job of .github/workflows/qodana.yml (D93; Qodana for
|
||||
# .NET on the Ultimate licence since 2026-11-11, D99): the linter, the solution, a gate
|
||||
# of zero problems, and what is switched off that .editorconfig has no key for —
|
||||
# ReSharper's inspections are .editorconfig's resharper_* keys (D100) — 13_CI_CD §Qodana
|
||||
src/
|
||||
native/
|
||||
FrameLedger.Overlay/ # C++20 DLL injected into the game (hooks + ring writer + optional overlay)
|
||||
@@ -100,7 +103,19 @@ src/
|
||||
# composes it from, SessionEndReason, the census/NGX/marker facts;
|
||||
# and Recording/ since 2026-09-10 (PR-D): SessionRecorder,
|
||||
# SessionAggregator + FgLadder, SessionFinalizer, the .partial
|
||||
# writer and PartialRecovery, ExitStatusMapper, the crash policy
|
||||
# writer and PartialRecovery, ExitStatusMapper, the crash policy;
|
||||
# and Advanced/ since 2026-11-11 (D101): AdvancedMetricCatalog, the one
|
||||
# list "Advanced metrics" reads - what is read, and what is not with the
|
||||
# reason (18_GPU_VENDOR_APIS §Advanced metrics) - and the value model
|
||||
# (AdvancedValue / AdvancedFact / AdvancedReading / AdvancedSnapshot) and
|
||||
# the port IAdvancedHardware. Infrastructure implements it: AdvancedHardwareHub
|
||||
# (one reader for the Agent, on its own thread, only while held - D107) over
|
||||
# NvapiAdvancedReader (the bridge's ABI 3) and LhmAdvancedReader (LhmGroups:
|
||||
# the card; as administrator with PawnIO the processor, memory and board -
|
||||
# never storage, D103). The Agent composes it since the switch, `telemetry.advanced`
|
||||
# (PR-5, 2026-11-11: off by default; on, a session holds the hub). Recording/
|
||||
# AdvancedSessionBuilder stores what a session's samples carried (schema 0023:
|
||||
# machine_profiles + session_advanced, adv.* series with NaN for a gap, D102).
|
||||
FrameLedger.Infrastructure/ # SQLite, shm reader, vendor APIs, injector interop, parsers,
|
||||
# and Capture/ (PR-C): ShmRingAttacher/ShmCaptureSink over the
|
||||
# reader, HeldProcessLivenessSource, TargetResolver (path only,
|
||||
@@ -151,7 +166,9 @@ tools/ # accuracy-check, changelog-check, chokepoint-che
|
||||
# versioninfo-check, vklayer-blastradius, fps-impact-runbook,
|
||||
# wiki-build (beta.17: builds and checks the wiki; the wiki-check gate),
|
||||
# buildid-check (beta.18: the release's build id in the shipped natives),
|
||||
# docs-split-check (beta.24, D66: CHANGELOG/HANDOFF and their parts agree)
|
||||
# docs-split-check (beta.24, D66: CHANGELOG/HANDOFF and their parts agree),
|
||||
# nvapi-readonly-check (D108, 2026-11-11: every NVAPI call of the bridge is on
|
||||
# nvapi-allowed-calls.txt, and none there writes or identifies)
|
||||
# (six names added 2026-10-04)
|
||||
# (PowerShell). This line used to name three, one of which
|
||||
# — resx-audit — ~~does not exist~~ exists since 2026-09-13 with
|
||||
@@ -178,9 +195,9 @@ Dependency direction: `App/Agent → Application → Domain`; **`Application →
|
||||
|
||||
## Coding conventions
|
||||
|
||||
**C# —** `Nullable enable`, `TreatWarningsAsErrors`, `AnalysisLevel latest-all`, file-scoped namespaces, Roslynator + Meziantou + VS Threading analyzers, `dotnet format` clean. Qodana Community for .NET (ReSharper's inspections) reads the C# and the XAML in an advisory workflow of its own, with a gate of zero problems *(since 2026-11-10, D93 — `13_CI_CD` §Qodana)*: fix what it reports, or switch the inspection off in `.editorconfig` with the reason beside it — never in `qodana.yaml`, never without one. Async suffixed `Async`, `ConfigureAwait(false)` off the UI. All user-visible strings from `.resx`. Timestamps UTC (unix-ms in SQLite); QPC ticks only inside the capture pipeline.
|
||||
**C# —** `Nullable enable`, `TreatWarningsAsErrors`, `AnalysisLevel latest-all`, file-scoped namespaces, Roslynator + Meziantou + VS Threading analyzers, `dotnet format` clean. Qodana reads the C# and the XAML in an advisory workflow of its own, with a gate of zero problems *(since 2026-11-10, D93; Qodana for .NET on the Ultimate licence since 2026-11-11, D99 — `13_CI_CD` §Qodana)*: fix what it reports, or switch the inspection off with the reason on the line above, **in the place the engine that raised it reads** *(D100)* — one of ReSharper's (C#, XAML, `.resx`, the C++) in `.editorconfig`; what has no key there (the hints as a severity, the Markdown and XML inspections, the files JetBrains' security rules were read in) in `qodana.yaml` — never anywhere else, never without a reason. A new file that starts a process fails `ProcessStartSitesTests`, and Qodana's security rule reports it: read what it starts and where the path and the arguments come from, then list it in the test, in `qodana.yaml` and in `13_CI_CD` §Qodana. Async suffixed `Async`, `ConfigureAwait(false)` off the UI. All user-visible strings from `.resx`. Timestamps UTC (unix-ms in SQLite); QPC ticks only inside the capture pipeline.
|
||||
|
||||
**C++ —** `clang-format` (LLVM base, 4-space, 120 col) enforced in CI. No STL containers that allocate in hook paths. No `std::mutex` in hook paths. `-D_HAS_EXCEPTIONS=0` in the Overlay target. Every hook entry point wrapped per the `FL_HOOK_GUARD` macro (`17_HOOK_ENGINE`). Static analysis: ~~`/analyze` + clang-tidy (`bugprone-*`, `cert-*`, `concurrency-*`)~~ CodeQL (`codeql.yml`, a required check); `/analyze` and clang-tidy are not configured *(corrected 2026-10-04)*. SonarCloud analyses the C++ too, from CMake's compilation database, in `ci.yml`'s advisory `sonarcloud` job *(since 2026-10-25, D68 — `13_CI_CD` §SonarCloud)*.
|
||||
**C++ —** `clang-format` (LLVM base, 4-space, 120 col) enforced in CI. No STL containers that allocate in hook paths. No `std::mutex` in hook paths. `-D_HAS_EXCEPTIONS=0` in the Overlay target. Every hook entry point wrapped per the `FL_HOOK_GUARD` macro (`17_HOOK_ENGINE`). Static analysis: ~~`/analyze` + clang-tidy (`bugprone-*`, `cert-*`, `concurrency-*`)~~ CodeQL (`codeql.yml`, a required check); `/analyze` and clang-tidy are not configured *(corrected 2026-10-04)*. SonarCloud analyses the C++ too, from CMake's compilation database, in `ci.yml`'s advisory `sonarcloud` job *(since 2026-10-25, D68 — `13_CI_CD` §SonarCloud)*. Qodana reads it as well, in a report of its own *(since 2026-11-11, D99: ReSharper's C++ inspections and the clang-tidy checks they run, advisory, a gate of zero — `13_CI_CD` §Qodana)*: fix what it reports, or switch the inspection off in `.editorconfig` with the reason above it; **in code loaded into a game only a defect is fixed**, in a pull request of its own with the overhead measured *(D100)*.
|
||||
|
||||
**Licence header —** every first-party source file (`.cs .cpp .h .inl .ps1 .xaml`) opens with two comment lines, `SPDX-License-Identifier: GPL-3.0-only` and `Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE` (beta.12, owner decision D45). GPLv3 §7 requires additional terms to be named in the source files, and `NOTICE` holds them — (b) preserve the notices, (c) mark modified versions, (e) no trademark rights in the name. `tools/notice-check.ps1` is a `build.ps1` gate; `-Fix` writes a missing header. `src/native/third_party/` is excluded.
|
||||
|
||||
|
||||
+24
-2
@@ -5,7 +5,7 @@ hooking on for — and reading the graphics calls the game makes. That is why it
|
||||
resolution, the upscaler, frame generation and ray tracing apart. It is also where its limits come from. This
|
||||
page lists them in plain words; each item links to the document that has the details.
|
||||
|
||||
*Beta software: this page describes version 0.1.0-beta.37.*
|
||||
*Beta software: this page describes version 0.1.0-beta.38.*
|
||||
|
||||
## Games it will not measure
|
||||
|
||||
@@ -173,6 +173,27 @@ shown is recorded too, from outside the game. ([Capture](docs/04_CAPTURE.md))
|
||||
- **CPU temperature** needs *Run the agent as administrator* and the separately installed PawnIO driver, and
|
||||
has not been verified on real hardware yet. CPU load is the time the processor was busy — not Task
|
||||
Manager's "utility" figure, which can exceed 100%. ([Telemetry](docs/18_GPU_VENDOR_APIS.md))
|
||||
- **Advanced metrics** (since 0.1.0-beta.39; Settings ▸ Recording, off by default) stores more of what the graphics
|
||||
driver and the sensors report with each session. Its limits:
|
||||
- **A session recorded while it was off is not filled in later**, and switching it on applies from the next session.
|
||||
- **The driver's own figures** — the card's firmware and architecture, its memory in detail, what a display can do
|
||||
with HDR and variable refresh, the driver's settings for the game — exist on **NVIDIA** cards only. On other cards
|
||||
they read N/A; the card's sensors (fans, voltages, loads) are read on every brand, and none has been tested on an
|
||||
AMD or Intel card.
|
||||
- **The sensors are read every five seconds**, NVIDIA's figures every second; between two readings a sensor has no
|
||||
value, and its last one is not repeated.
|
||||
- **The processor's, the memory's and the motherboard's sensors** need *Run the agent as administrator* and the
|
||||
separately installed PawnIO driver, and **have never been read on real hardware**. Without them they read N/A
|
||||
with the reason.
|
||||
- **A drive's temperature is not read at all**: the sensor library cannot list drives without touching removable
|
||||
ones. Power supplies, fan controllers and batteries are not read either.
|
||||
- **No serial number and no display identification data (EDID) is read**, so two PCs with the same parts look the
|
||||
same.
|
||||
- **None of these readings has been checked against another tool**, and they are **not in an export or a bug
|
||||
report**.
|
||||
- **No screen shows them yet** — the page comes with the release.
|
||||
|
||||
([Telemetry](docs/18_GPU_VENDOR_APIS.md#advanced-metrics-owner-decisions-d101d108-2026-11-11))
|
||||
- **Whether the graphics card was held back by its power limit or by heat** (since 0.1.0-beta.14) is known only on
|
||||
NVIDIA cards, and only as it was at each once-a-second reading. On other cards it reads N/A.
|
||||
- **Frames per watt** (since 0.1.0-beta.14) counts the game's own frames — never generated ones — against the graphics
|
||||
@@ -183,7 +204,8 @@ shown is recorded too, from outside the game. ([Capture](docs/04_CAPTURE.md))
|
||||
|
||||
Off by default. When on, **Windows asks every time the agent starts** and names an unknown publisher, because
|
||||
FrameLedger is not signed. It lets FrameLedger open games that run as administrator and read the CPU
|
||||
temperature; it does not bypass anti-cheat, does not open protected processes, and does not make games you
|
||||
temperature — with Advanced metrics on, also the processor's, the memory's and the motherboard's sensors — where
|
||||
PawnIO is installed; it does not bypass anti-cheat, does not open protected processes, and does not make games you
|
||||
start from FrameLedger run as administrator. **The risk:** FrameLedger is installed in your user folder, so a
|
||||
program running under your account could replace its files and would then run as administrator the next time
|
||||
you accept the prompt. Turn it on only if you trust everything that runs under your account.
|
||||
|
||||
@@ -12,8 +12,8 @@ app too (Help ▸ User guide, Help ▸ Limitations, Help ▸ Accessibility), and
|
||||
[wiki](https://github.com/poli0981/frameledger/wiki) with the developer pages.
|
||||
|
||||
<!-- accuracy-block:begin -->
|
||||
> ⚠ **What FrameLedger actually measures today — 2026-11-06.** The software is a beta; its latest
|
||||
> **beta is `0.1.0-beta.37`** (2026-11-11), an unsigned installer built from that tag with its
|
||||
> ⚠ **What FrameLedger actually measures today — 2026-11-11.** The software is a beta; its latest
|
||||
> **beta is `0.1.0-beta.38`** (2026-11-11), an unsigned installer built from that tag with its
|
||||
> checksums published beside it (alphas — experimental builds that try a newer .NET — are published apart). The source holds the desktop app
|
||||
> (library, store import, charts, settings) and the background Agent, which records a session when a
|
||||
> game in the library runs (unless you switched its recording off), injects only into games you enabled
|
||||
@@ -102,6 +102,13 @@ app too (Help ▸ User guide, Help ▸ Limitations, Help ▸ Accessibility), and
|
||||
> Windows once a second and charted. Processor temperature is read only when the Agent runs as
|
||||
> administrator — an option, off by default, for which Windows asks at every start of the Agent — with
|
||||
> PawnIO installed, and that reading has not yet been checked on real hardware; everywhere else it is `N/A`.
|
||||
> - **Advanced metrics (since beta.39; off unless you switch it on in Settings):** with it on, a session also stores
|
||||
> what the graphics driver and the sensor library report about the hardware — the graphics card's memory, load,
|
||||
> clocks, fans, voltages and power in detail, what a display can do, the driver's settings for the game — as they
|
||||
> report it: NVIDIA's figures once a second, the sensor library's every five seconds. None of these readings has
|
||||
> been checked against another tool. The processor's, the memory's and the motherboard's need the Agent as
|
||||
> administrator with PawnIO and have never been read on real hardware; a drive's temperature is not read. No
|
||||
> screen of the App shows them yet.
|
||||
> - **Safety:** every pre-injection check runs before injection, including the signed-by-a-known-vendor
|
||||
> half of the suspicious-module rule. During every capture the Agent re-runs the checks every 30 s and
|
||||
> stops capturing on a refusal: a Direct3D or OpenGL game's hooks are removed, and the Vulkan layer
|
||||
@@ -178,7 +185,7 @@ Elevation is **optional — for everything.** Hooked capture is the normal path
|
||||
|
||||
## Install
|
||||
|
||||
> **The latest beta is `v0.1.0-beta.37` (2026-11-11); before it `v0.1.0-beta.36` (2026-11-10), `v0.1.0-beta.35` (2026-11-09), `v0.1.0-beta.34` (2026-11-06), `v0.1.0-beta.33` (2026-11-03), `v0.1.0-beta.32` (2026-10-31), `v0.1.0-beta.31` (2026-10-26), `v0.1.0-beta.30` (2026-10-26), `v0.1.0-beta.29` (2026-10-25), `v0.1.0-beta.28` (2026-10-20), `v0.1.0-beta.27` (2026-10-20), `v0.1.0-beta.26` (2026-10-19), `v0.1.0-beta.25` (2026-10-19), `v0.1.0-beta.24` (2026-10-19), `v0.1.0-beta.23` (2026-10-14), `v0.1.0-beta.22` (2026-10-13), `v0.1.0-beta.21` (2026-10-13), `v0.1.0-beta.20` (2026-10-12), `v0.1.0-beta.19` (2026-10-12), `v0.1.0-beta.18` (2026-10-07), `v0.1.0-beta.17` (2026-10-07), `v0.1.0-beta.16` (2026-10-06), `v0.1.0-beta.15` (2026-10-06), `v0.1.0-beta.14` (2026-10-06), `v0.1.0-beta.13` (2026-10-04), `v0.1.0-beta.12` (2026-10-04), `v0.1.0-beta.11` (2026-10-03), `v0.1.0-beta.10` (2026-09-28), `v0.1.0-beta.9` (2026-09-26), `v0.1.0-beta.8` (2026-09-25), `v0.1.0-beta.7` (2026-09-23), `v0.1.0-beta.6` (2026-09-23), `v0.1.0-beta.5` (2026-09-22), `v0.1.0-beta.4` (2026-09-21), `v0.1.0-beta.3` (2026-09-21), `v0.1.0-beta.2` (2026-09-17) and `v0.1.0-beta.1` (2026-09-16).** They are pre-releases: read the notes of the one you install — `CHANGELOG.md` links each release's own file under `docs/changelog/` — for what it measures, what it does not yet, and how to update, before installing. A source build is `docs/12_BUILD.md`.
|
||||
> **The latest beta is `v0.1.0-beta.38` (2026-11-11); before it `v0.1.0-beta.37` (2026-11-11), `v0.1.0-beta.36` (2026-11-10), `v0.1.0-beta.35` (2026-11-09), `v0.1.0-beta.34` (2026-11-06), `v0.1.0-beta.33` (2026-11-03), `v0.1.0-beta.32` (2026-10-31), `v0.1.0-beta.31` (2026-10-26), `v0.1.0-beta.30` (2026-10-26), `v0.1.0-beta.29` (2026-10-25), `v0.1.0-beta.28` (2026-10-20), `v0.1.0-beta.27` (2026-10-20), `v0.1.0-beta.26` (2026-10-19), `v0.1.0-beta.25` (2026-10-19), `v0.1.0-beta.24` (2026-10-19), `v0.1.0-beta.23` (2026-10-14), `v0.1.0-beta.22` (2026-10-13), `v0.1.0-beta.21` (2026-10-13), `v0.1.0-beta.20` (2026-10-12), `v0.1.0-beta.19` (2026-10-12), `v0.1.0-beta.18` (2026-10-07), `v0.1.0-beta.17` (2026-10-07), `v0.1.0-beta.16` (2026-10-06), `v0.1.0-beta.15` (2026-10-06), `v0.1.0-beta.14` (2026-10-06), `v0.1.0-beta.13` (2026-10-04), `v0.1.0-beta.12` (2026-10-04), `v0.1.0-beta.11` (2026-10-03), `v0.1.0-beta.10` (2026-09-28), `v0.1.0-beta.9` (2026-09-26), `v0.1.0-beta.8` (2026-09-25), `v0.1.0-beta.7` (2026-09-23), `v0.1.0-beta.6` (2026-09-23), `v0.1.0-beta.5` (2026-09-22), `v0.1.0-beta.4` (2026-09-21), `v0.1.0-beta.3` (2026-09-21), `v0.1.0-beta.2` (2026-09-17) and `v0.1.0-beta.1` (2026-09-16).** They are pre-releases: read the notes of the one you install — `CHANGELOG.md` links each release's own file under `docs/changelog/` — for what it measures, what it does not yet, and how to update, before installing. A source build is `docs/12_BUILD.md`.
|
||||
|
||||
1. Download the latest `FrameLedger.App-win-Setup.exe` from [Releases](https://github.com/poli0981/frameledger/releases). It installs into `%LOCALAPPDATA%\FrameLedger.App`; your data stays in `%LOCALAPPDATA%\FrameLedger`, and uninstalling asks before touching it.
|
||||
2. SmartScreen may warn — releases are not code-signed (free, open-source project). Verify the SHA-256 checksum published with each release, then **More info → Run anyway**.
|
||||
|
||||
@@ -479,6 +479,16 @@ function Invoke-ProjectGates {
|
||||
# beta.24 (D66): CHANGELOG.md and docs/HANDOFF.md keep their paths as the index of their parts under docs/changelog/
|
||||
# and docs/handoff/. A released section left in CHANGELOG.md, a release file whose heading is not its name or that
|
||||
# links relatively, or an index and its files that do not name each other both ways is red here.
|
||||
# 2026-11-11 (D108): "the bridge never calls a setter" was a sentence in docs/18 a reviewer checked by reading one
|
||||
# file. With Advanced metrics the bridge calls forty-four NVAPI entry points, and the header declares a setter beside
|
||||
# almost every getter: each call is held to tools/nvapi-allowed-calls.txt, in both directions, and a writer or a
|
||||
# reader of an identifier (D104) is red even when the list names it. Text only - it runs with or without the native
|
||||
# build.
|
||||
Write-Step 'nvapi-readonly-check'
|
||||
$nvapiTool = Join-Path $repo 'tools/nvapi-readonly-check.ps1'
|
||||
Invoke-Checked 'nvapi-readonly-check (self-test)' { & $nvapiTool -SelfTest }
|
||||
Invoke-Checked 'nvapi-readonly-check' { & $nvapiTool -RepoRoot $repo }
|
||||
|
||||
Write-Step 'docs-split-check'
|
||||
$splitTool = Join-Path $repo 'tools/docs-split-check.ps1'
|
||||
Invoke-Checked 'docs-split-check (self-test)' { & $splitTool -SelfTest }
|
||||
|
||||
@@ -162,7 +162,7 @@ The profile's own folder is refused there.)*
|
||||
- **ADR-8:** **No evasion, ever** (`19_SAFETY` §What we will never build). This is an architectural constraint, not a preference — it defines what "correct" means for this codebase.
|
||||
- **ADR-9:** Elevation demoted from required to optional; the Agent runs as a standard user by default.
|
||||
**Chosen, not inherited, since beta.10 (owner decision D34, 2026-09-27):** Settings ▸ Capture agent ▸ *Run the agent as
|
||||
administrator* (`capture.run_elevated`, off by default, a versioned disclosure — `agent-admin-dialog/1` — before it turns
|
||||
administrator* (`capture.run_elevated`, off by default, a versioned disclosure — `agent-admin-dialog/2` *(`/1` until 2026-11-11, when Advanced metrics widened what the option adds — D101)* — before it turns
|
||||
on). With it on, **Windows is asked every time the Agent starts** — a UAC prompt owned by the App's window when the App
|
||||
starts it, flashing on the taskbar when the logon task does — and there is no silent path: no "highest privileges" task,
|
||||
no service. The elevated Agent is started for one user (`--serve --for-user <SID>`) and refuses to run as another
|
||||
|
||||
+2
-1
@@ -53,6 +53,7 @@ Requirement IDs (`FR-x`, `NFR-x`) are referenced by other docs, commits, and tes
|
||||
- FR-5.3 Charts handle ≥ 500k points via min/max decimation; zoom/pan; PNG export.
|
||||
- FR-5.4 Native/Displayed toggle wherever FG data exists.
|
||||
- FR-5.5 Stutter markers annotated with cause when known (`PSO compile`, `VRAM budget exceeded`).
|
||||
- FR-5.6 *(owner decision D101, 2026-11-11)* **Advanced metrics**: an option, off by default, and a page of its own that shows what the vendor interfaces make available — NVAPI, LibreHardwareMonitor through PawnIO, and in later releases Streamline and FidelityFX inside the game — each value under what it belongs to, the PC or one session, and each value that is not read listed with the reason. Off means nothing more is read or stored. `18_GPU_VENDOR_APIS` §Advanced metrics is the design and the inventory. *(Not built: the catalog exists, nothing reads it yet.)*
|
||||
|
||||
### FR-6 History & comparison
|
||||
- FR-6.1 Sessions table per game: date, duration, tier badge, Native, Displayed, FG×, lows, resolution + upscaler, RT/PT/RR chips, crash badge, tags.
|
||||
@@ -104,7 +105,7 @@ Draw live FPS/frametime/upscaler info inside the game. Only for games already ho
|
||||
## Non-functional requirements
|
||||
|
||||
- **NFR-1 Game-side overhead:** ≤ 1 µs per present, ≤ 8 MB resident, measured game FPS impact ≤ 0.5% vs uninstrumented.
|
||||
- **NFR-2 Agent overhead:** ≤ 1% of one core during capture, ≤ 150 MB working set, ~0% idle.
|
||||
- **NFR-2 Agent overhead:** ≤ 1% of one core during capture, ≤ 150 MB working set, ~0% idle. *(D101, 2026-11-11: the limits hold with Advanced metrics on — FR-5.6. Its reads run on a thread of their own, the slow ones seldom, and with no game running only while its page is open (D107), so "~0% idle" is not spent on it. **Unmeasured** until the owner's run with the option on and off, `HANDOFF` §Owner-only.)*
|
||||
- **NFR-3 Stability:** faults **originating in our own hook bodies** are contained by `FL_HOOK_GUARD`, counted, and self-disable the Overlay after 3 occurrences; the safety-unhook path completes within one frame. The Overlay adds no allocation, lock, syscall or logging to the present path.
|
||||
|
||||
> This deliberately does **not** say "must never crash a game" (`20_OPEN_QUESTIONS` §H8). SEH containment cannot reliably catch stack overflow, cannot intercept `__fastfail` — and `-D_HAS_EXCEPTIONS=0` converts a would-be STL throw into exactly that (`spike-notes.md` §H3) — and does not help when the game installs a vectored exception handler that runs first. An absolute promise the mechanism cannot support does not belong in a requirement, and must stay out of user-facing text: the Disclaimer already says injection carries risk, and that wording is the honest one.
|
||||
|
||||
+49
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
`%LOCALAPPDATA%\FrameLedger\ledger.db`. Pragmas: `journal_mode=WAL`, `synchronous=NORMAL`, `foreign_keys=ON`, `busy_timeout=5000`. `Microsoft.Data.Sqlite` + Dapper; all writes in explicit transactions.
|
||||
|
||||
**Writer ownership:** Agent writes `sessions`, `session_segments`, `frame_blobs`, `sensor_blobs`, `hardware_snapshots`, the hook-state columns on `games`, **and since P4 PR-1 (2026-09-14) the *detected* columns on `games`** — `engine`, `engine_version`, `platform` under the per-field provenance rule (`05_DETECTION` §Caching: a `user` field is never touched), `capability_flags` whole, and the cache key `detection_rules_version` / `detection_exe_size_bytes` / `detection_exe_mtime_ms`, and since schema 0011 (2026-09-25) the executable's own facts `exe_machine` / `exe_file_version` / `exe_product_version` / `library_versions`, written whole like the flags — through `IGameRepository.ApplyDetectionAsync` only. The UI and the Agent were both already writers of `games`; this adds columns to the Agent's half, not a third writer (HANDOFF §P4). **And since P4 PR-4 the UI's library import writes `platform`, `store_id` and `game_version` through `ApplyStoreMetadataAsync`** — the same per-field provenance rule, badged `detected` (a store's record is not the user's typing), on columns the UI already owned. **And since 2026-09-23 the Agent's relocator merges two entries for one executable under two drive letters** (`IGameMerge`, HANDOFF D26, `19_SAFETY` §A moved drive is the same executable): in one transaction it re-parents the dropped entry's `sessions` to the survivor (before the delete — `sessions.game_id` cascades), carries a block or a crash auto-disable still in force to the survivor (`hook_enabled` only ever to 0; `hook_blocked_reason` is copied, never originated or cleared), adds the crash counts, deletes the dropped `games` row, and then moves the survivor to the file's path (after the delete — `exe_path` is UNIQUE). It was the one Agent write that deletes a `games` row until beta.19; it never touches a consent column. **And since beta.19 (2026-10-12, D55) the Agent removes an entry whose game is no longer installed** (`IGamePrune`, `SqliteGamePrune`, asked by the detection sweep through `UninstalledEntryPrune`): one `DELETE` that holds every stored condition in the same statement — the same row at the same path, `removed_at` NULL, no session stored (`NOT EXISTS` on `sessions` — nothing cascades), no `hook_blocked_reason`, `hook_prescan_state` not `blocked`, no `ac_exception_at` and no `ac_exception_trial_failed_at` — behind `retention.remove_uninstalled_games`; a block, a grant and D38's mark are never removed with their entry (`19_SAFETY` §What a finding does to the game, *What clears it*). **And since 2026-09-23 the UI writes `record_sessions`** (schema 0009, FR-1.6): the entry's recording switch, which the Agent only reads — off, the watcher does not watch for the program. The script's one data change switches it off for entries an old import made for Steam's own tools (`SteamLibrarySource.KnownTools`, the ids as of the script); a twin merge keeps it off when either twin had it off. **And since 2026-09-25 the Agent's pre-scan of the library (`19_SAFETY` §What a finding does to the game) writes the hook-state columns of every entry, not only of those the user asked to hook** — `hook_prescan_state`, and on a finding `hook_enabled = 0` and `hook_blocked_reason` — and its own key, `hook_prescan_rules_version` / `hook_prescan_exe_size_bytes` / `hook_prescan_exe_mtime_ms` (schema 0010), through `IGameConsentStore.RecordPreScanAsync` only: columns that were already the Agent's, never over a block, never a new row. **And since 2026-09-26 (schema 0014, D33) the Agent writes the user-mode exception's columns** — `ac_exception_*` on `games` through `IGameConsentStore` only (eligibility from the sweep, a grant from the `SetAntiCheatException` command, every end), and `sessions.ac_exception_family` with the session — the grant only after the user accepted its disclosure in the UI, which asks and never writes. **And since 2026-10-03 (beta.11, D40) the Agent deletes sessions on request** — every session of one game or of every game, `DeleteSessions` over the pipe, through `ISessionRepository.DeleteSessionsAsync` in one transaction (segments, blobs and annotations cascade), never while one is being recorded; the UI asks and never deletes a session row itself *(for Delete all sessions; FR-1.4's removal is the App's own cascade, above — corrected 2026-10-04)*. **Maintenance (P4 PR-7) adds no writer:** the retention sweep on demand is the Agent's, asked over the pipe; the UI's `VACUUM` rewrites pages with the same contents and changes no row (§Retention built note). UI writes `games` (user-editable fields — since P3 PR-3 that is the FR-1.3 metadata, the `*_default` tri-states, and `removed_at`; ~~never a `hook_*` column~~ **and two downgrades** *(corrected 2026-10-04)*: *Change executable* (2026-09-21, `GameLibrary.ChangeExecutableAsync`) turns hooking off, clears the consent and pre-scan columns and ends an exception grant — it never writes a block or a grant — and *Remove game ▸ DeLine truncated
|
||||
**Writer ownership:** Agent writes `sessions`, `session_segments`, `frame_blobs`, `sensor_blobs`, `hardware_snapshots`, *(since schema 0023, 2026-11-11)* `machine_profiles` and `session_advanced`, the hook-state columns on `games`, **and since P4 PR-1 (2026-09-14) the *detected* columns on `games`** — `engine`, `engine_version`, `platform` under the per-field provenance rule (`05_DETECTION` §Caching: a `user` field is never touched), `capability_flags` whole, and the cache key `detection_rules_version` / `detection_exe_size_bytes` / `detection_exe_mtime_ms`, and since schema 0011 (2026-09-25) the executable's own facts `exe_machine` / `exe_file_version` / `exe_product_version` / `library_versions`, written whole like the flags — through `IGameRepository.ApplyDetectionAsync` only. The UI and the Agent were both already writers of `games`; this adds columns to the Agent's half, not a third writer (HANDOFF §P4). **And since P4 PR-4 the UI's library import writes `platform`, `store_id` and `game_version` through `ApplyStoreMetadataAsync`** — the same per-field provenance rule, badged `detected` (a store's record is not the user's typing), on columns the UI already owned. **And since 2026-09-23 the Agent's relocator merges two entries for one executable under two drive letters** (`IGameMerge`, HANDOFF D26, `19_SAFETY` §A moved drive is the same executable): in one transaction it re-parents the dropped entry's `sessions` to the survivor (before the delete — `sessions.game_id` cascades), carries a block or a crash auto-disable still in force to the survivor (`hook_enabled` only ever to 0; `hook_blocked_reason` is copied, never originated or cleared), adds the crash counts, deletes the dropped `games` row, and then moves the survivor to the file's path (after the delete — `exe_path` is UNIQUE). It was the one Agent write that deletes a `games` row until beta.19; it never touches a consent column. **And since beta.19 (2026-10-12, D55) the Agent removes an entry whose game is no longer installed** (`IGamePrune`, `SqliteGamePrune`, asked by the detection sweep through `UninstalledEntryPrune`): one `DELETE` that holds every stored condition in the same statement — the same row at the same path, `removed_at` NULL, no session stored (`NOT EXISTS` on `sessions` — nothing cascades), no `hook_blocked_reason`, `hook_prescan_state` not `blocked`, no `ac_exception_at` and no `ac_exception_trial_failed_at` — behind `retention.remove_uninstalled_games`; a block, a grant and D38's mark are never removed with their entry (`19_SAFETY` §What a finding does to the game, *What clears it*). **And since 2026-09-23 the UI writes `record_sessions`** (schema 0009, FR-1.6): the entry's recording switch, which the Agent only reads — off, the watcher does not watch for the program. The script's one data change switches it off for entries an old import made for Steam's own tools (`SteamLibrarySource.KnownTools`, the ids as of the script); a twin merge keeps it off when either twin had it off. **And since 2026-09-25 the Agent's pre-scan of the library (`19_SAFETY` §What a finding does to the game) writes the hook-state columns of every entry, not only of those the user asked to hook** — `hook_prescan_state`, and on a finding `hook_enabled = 0` and `hook_blocked_reason` — and its own key, `hook_prescan_rules_version` / `hook_prescan_exe_size_bytes` / `hook_prescan_exe_mtime_ms` (schema 0010), through `IGameConsentStore.RecordPreScanAsync` only: columns that were already the Agent's, never over a block, never a new row. **And since 2026-09-26 (schema 0014, D33) the Agent writes the user-mode exception's columns** — `ac_exception_*` on `games` through `IGameConsentStore` only (eligibility from the sweep, a grant from the `SetAntiCheatException` command, every end), and `sessions.ac_exception_family` with the session — the grant only after the user accepted its disclosure in the UI, which asks and never writes. **And since 2026-10-03 (beta.11, D40) the Agent deletes sessions on request** — every session of one game or of every game, `DeleteSessions` over the pipe, through `ISessionRepository.DeleteSessionsAsync` in one transaction (segments, blobs and annotations cascade), never while one is being recorded; the UI asks and never deletes a session row itself *(for Delete all sessions; FR-1.4's removal is the App's own cascade, above — corrected 2026-10-04)*. **Maintenance (P4 PR-7) adds no writer:** the retention sweep on demand is the Agent's, asked over the pipe; the UI's `VACUUM` rewrites pages with the same contents and changes no row (§Retention built note). UI writes `games` (user-editable fields — since P3 PR-3 that is the FR-1.3 metadata, the `*_default` tri-states, and `removed_at`; ~~never a `hook_*` column~~ **and two downgrades** *(corrected 2026-10-04)*: *Change executable* (2026-09-21, `GameLibrary.ChangeExecutableAsync`) turns hooking off, clears the consent and pre-scan columns and ends an excepLine truncated
|
||||
|
||||
## Schema (v2 — hook architecture)
|
||||
|
||||
@@ -399,6 +399,9 @@ CREATE TABLE sensor_blobs (
|
||||
-- beta.14 (D49) also gpu_core_clock|gpu_mem_clock (MHz), gpu_fan (RPM), gpu_mem_temp (°C)
|
||||
-- and gpu_power_limit|gpu_thermal_limit (100 or 0 per tick, NVIDIA only) — a series name
|
||||
-- needs no migration
|
||||
-- since schema 0023 (2026-11-11, D102) also the ADVANCED series, every one under a name
|
||||
-- that starts with `adv.` (Application.Advanced.AdvancedMetricCatalog): NaN, not -1,
|
||||
-- for a tick with no reading, and read by FindAdvancedSensorsAsync only
|
||||
-- cpu_load / ram_mb / cpu_temp and sessions.avg_cpu_load, avg_cpu_temp, max_cpu_temp,
|
||||
-- avg_ram_mb were in schema 0001 with NO producer until 2026-09-21 (Telemetry.SystemTelemetrySource
|
||||
-- on the poller's tick). Rows before that date hold NULL, which is what they measured; no migration.
|
||||
@@ -464,6 +467,7 @@ switch's rule); integers are invariant-culture within an inclusive range; choice
|
||||
| `capture.run_elevated` | bool | `0` | | The App when it starts the Agent, and an Agent the logon task started — both BEFORE the Agent exists, through `Infrastructure.Startup.RunElevatedSetting` (one row, `PRAGMA query_only`, no version gate, anything but `1` is off) (D34, beta.10): on, Windows is asked for administrator rights at every Agent start (`01_ARCHITECTURE` ADR-9) |
|
||||
| `capture.min_session_s` | int | `30` | 5–600 | Agent, per session (FR-3.6) |
|
||||
| `telemetry.interval_ms` | int | `1000` | 500–2000 | Agent, per session (FR-3.5) |
|
||||
| `telemetry.advanced` | bool | `0` | | Agent, per session (FR-5.6, owner decision D101, 2026-11-11): **Advanced metrics**. On, a session holds the Agent's shared reader and stores its `adv.*` series and its `session_advanced` row (schema 0023); off — and any row that is not exactly `1` — nothing more is read or stored, and a session recorded while off has no row. Settings ▸ Recording (`18_GPU_VENDOR_APIS` §The switch) |
|
||||
| `retention.raw_sessions_per_game` | int | `20` | 0–10000; **0 = unlimited** | Agent, per session (§Retention) |
|
||||
| `retention.remove_uninstalled_games` | bool | `1` | | Agent, at every detection sweep (beta.19, D55, FR-1.8): on, an entry whose executable has been gone for ten minutes — its drive connected, the folder it was installed in still there — and that has no session and no anti-cheat block or exception is removed; off, it stays and reads *Not installed* (D41's behaviour) |
|
||||
| `update.channel` | choice | ~~`stable`~~ `auto` (beta.14, D47) | `auto` · `stable` · `beta` | UI (P4 PR-5 reads it: `beta` = GitHub pre-releases too; `auto` follows the running copy, a pre-release asking for pre-releases — `11_UPDATER` §The update audit) |
|
||||
@@ -491,6 +495,18 @@ Because Tier-1 and Tier-2 sessions carry different fields, every query that comp
|
||||
> axis (a gap's interval is stored as 0), so a series still drifts ahead of its sensors past each gap.
|
||||
> Sensor series are aligned to `t_ms` (milliseconds from `qpc_epoch`) and a tick with no reading is stored as
|
||||
> **−1** — never 0, which would be a reading — because temperatures, loads, power and memory are never negative.
|
||||
>
|
||||
> **The advanced series are the exception, and say so by their name (schema 0023, owner decision D102).** A series
|
||||
> whose name starts with `adv.` stores **NaN** for a tick with no reading: a motherboard's −12 V rail is negative, so
|
||||
> −1 cannot mark a gap, and most of its ticks are gaps — the sensor library is read every fifth. They go through a
|
||||
> second encoder, `ISeriesCodec.EncodeSparseFloat32`, which allows NaN and still refuses an infinity; **the rule
|
||||
> above is not relaxed**: `EncodeFloat32` throws on a NaN as before, because a frame time has no gaps. Both decode
|
||||
> with `DecodeFloat32`. `ISessionRepository.FindSensorsAsync` — what every summary, chart and export reads — leaves
|
||||
> the `adv.` rows out (`series NOT LIKE 'adv.%'`), since those readers drop every negative value as "no reading";
|
||||
> `FindAdvancedSensorsAsync` returns them with `t_ms` first. One session stores at most 256 of them
|
||||
> (`AdvancedSessionBuilder.MaxSeries`); what is beyond is counted in its directory, not stored.
|
||||
> **Size, measured 2026-11-11** on values shaped like the dev box's reader (17 series with a reading every tick, 41
|
||||
> with one every fifth): one hour is 816 KiB raw and **189 KiB stored** — well inside NFR-5's 3 MB an hour.
|
||||
|
||||
## The `.partial` file
|
||||
|
||||
@@ -513,6 +529,16 @@ Because Tier-1 and Tier-2 sessions carry different fields, every query that comp
|
||||
> | 6 `Note` | wall clock + UTF-8 text: a state transition | each transition |
|
||||
> | 7 `Touches` | N × `i64` QPC at which the host touched the target | each flush |
|
||||
> | 8 `SensorsWide` | the same samples under a 32-bit presence mask that carries the game process's memory (D43) | each flush, since beta.12 *(row added 2026-10-04)* |
|
||||
> | 9 `SensorsAdvanced` | the advanced readings of the samples of the type-8 chunk before it (D101): `u16` names, then per name `u16` bytes and UTF-8; `u32` samples, then per sample `i64` QPC, `u16` readings and per reading `u16` name, `f64` value. Each chunk carries its own names, so it reads without any earlier chunk | each flush **in which a sample carries any** — with Advanced metrics off, never; the file is then byte for byte what it was (2026-11-11) |
|
||||
> | 10 `AdvancedContext` | UTF-8 JSON (`AdvancedJson.OfContext`): the PC's facts, the session's, its series' directory, each source's state; the last one wins | the first flush after the recorder set it, and again only when it changed (2026-11-11) |
|
||||
>
|
||||
> **A chunk of a type the reader does not know is skipped, not the end of the file (owner decision D106,
|
||||
> 2026-11-11).** Its length and checksum have been verified by then, so it is a whole chunk a newer build wrote.
|
||||
> Until that day `_ => false` ended the read there, and a build one release older lost everything after the first
|
||||
> new chunk — the price types 9 and 10 would have charged a beta.38 reading a beta.39 file. A chunk of a KNOWN type
|
||||
> that does not parse still ends the read: that is a torn or a wrong file, not a newer one.
|
||||
> (`PartialSessionFileAdvancedTests`: an unknown type between two known ones; the same with its checksum broken;
|
||||
> a kill at every byte offset of a file that holds both new types.)
|
||||
>
|
||||
> Recovery (`PartialRecovery`): a file whose guid is already a row is deleted (the finalize had landed);
|
||||
> one under the minimum session length is discarded; one with no readable header is dropped; the rest
|
||||
@@ -718,6 +744,28 @@ Sequential embedded SQL (`Migrations/0001_init.sql`, `0002_*.sql`, …), applied
|
||||
> from its crash file (which carries no module list). `LatestVersion` is 21;
|
||||
> `LedgerDatabaseTests.ScriptTwentyOneAddsTheModuleSourcesColumnAndAnEarlierSessionHasNone`, the repository round trip.
|
||||
|
||||
> **`0023_advanced_metrics.sql` (2026-11-11, owner decisions D101 and D102) — what Advanced metrics stores.** Two
|
||||
> tables and **no column on `sessions`** — the first `CREATE TABLE` since 0001. Every read of a `sessions` row, the
|
||||
> JSON export and the bug bundle carry the whole row, and a driver profile does not belong in a bug bundle.
|
||||
> `machine_profiles(id, hash UNIQUE, facts_json, captured_at)` holds the facts of the PC, one row per distinct set
|
||||
> (`hash` = SHA-256 of `facts_json`); it stands beside `hardware_snapshots`, not in it, because that table's hash
|
||||
> feeds the trend's hardware-change markers and a set of facts that exists only while an option is on would raise a
|
||||
> marker each time the option is switched. `session_advanced(session_id PRIMARY KEY → sessions ON DELETE CASCADE,
|
||||
> machine_profile_id → machine_profiles, facts_json, stats_json, series_json)` holds one row per session **recorded
|
||||
> with the option on**: its facts and each source's state, the statistics of its advanced series (the form of
|
||||
> `sensor_stats_json`), and the directory of the series that are members of a family. **A session recorded with the
|
||||
> option off has no row** — that absence is how the App says "the option was off when this was recorded" rather than
|
||||
> "nothing answered" — and is never given one. The JSON is `Application.Advanced.AdvancedJson`'s (camel case, nulls
|
||||
> left out, a status by its name); writing is strict, reading is tolerant, and **only a fact whose catalog entry is
|
||||
> read may be written** (`AdvancedJson.Storable`), so no identifier reaches either table (D104). A session deleted
|
||||
> takes its row with it; a profile no session points to is left, as a hardware snapshot is; the retention sweep
|
||||
> removes a session's `adv.` series with its other raw series and keeps its row. Written by the Agent only, in the
|
||||
> session's own transaction (`SqliteSessionRepository.InsertAdvancedAsync`). `LatestVersion` is 23;
|
||||
> `LedgerDatabaseTests.ScriptTwentyThreeCreatesTheTwoAdvancedTablesAndAnEarlierSessionHasNoRow` (whose helper now
|
||||
> undoes a script's `CREATE TABLE` and `CREATE INDEX` as well as its `ADD COLUMN`), the repository's four cases.
|
||||
> **Nothing produces a row yet**: the option that switches the reader on is the next pull request's.
|
||||
> **A beta.38 cannot open a ledger a later build migrated.**
|
||||
|
||||
> **`0022_dlss_nr.sql` (beta.34, 2026-11-06, owner decision D84) — DLSS 5's neural rendering, measured.** One REAL column,
|
||||
> ADD COLUMN only: `dlss_nr_pct`, the share (0–100) of the presents that drained a Streamline evaluation on which the game
|
||||
> evaluated `kFeatureDLSS_NR` (`Domain.Metrics.NeuralRendering`). Written by the recorder's aggregation
|
||||
|
||||
+12
-1
@@ -851,6 +851,17 @@ Tail view of `ui-*.log` / `agent-*.log` (toggle), level filter, search (`ui:Auto
|
||||
> `PagesLoadTests`.
|
||||
|
||||
### Settings
|
||||
> **Advanced metrics (2026-11-11, owner decision D101; Advanced PR-5).** The Recording section has **Advanced metrics**
|
||||
> (`telemetry.advanced`, off by default, off in a viewer like every setting the Agent reads): one `ui:CardControl` with a
|
||||
> `ToggleSwitch`, under *Raw series kept per game*. Its text says what is read, that off reads and stores nothing more,
|
||||
> that it applies from the next session and that an earlier session is not filled in. The Agent reads it at each
|
||||
> session's start, so the row gets the usual "Applied. The capture agent reads it at the next session" strip. **No page
|
||||
> shows what it stores yet** — the navigation item and the page are PR-7's (D105). With it, three texts that said what
|
||||
> an Agent running as administrator adds with PawnIO now name the processor's, the memory's and the motherboard's
|
||||
> sensors beside the CPU temperature: the Agent section's elevation line, the first run's Agent step, and the admin
|
||||
> mode's disclosure (`agent-admin-dialog/2`). Tests: `SettingsViewModelTests.AdvancedMetricsIsOffByDefaultAndItsToggleIsPersisted`,
|
||||
> `ViewerModeTests.EverySettingTheAgentReadsIsOffInAViewer`, `GuideDocumentsTests.TheSettingsPageOfTheGuideNamesEverySetting`.
|
||||
>
|
||||
> **beta.23 (owner decisions D60/D61).** The Games section has, under the Play button, **Show game artwork**
|
||||
> (`ui.game_art`, on) and **Colour the game page from its artwork** (`ui.game_art_tint`, on; disabled while the first is
|
||||
> off) — the game page's artwork and its band's colour (§Games › Game detail, *The header's cover*). Neither downloads
|
||||
@@ -891,7 +902,7 @@ Agent section: elevation state with a plain explanation of what elevation *optio
|
||||
|
||||
> **The admin mode, beta.10 (owner decision D34; `01_ARCHITECTURE` ADR-9).** The Agent section has a switch, *Run the agent
|
||||
> as administrator* (`capture.run_elevated`, off by default). Turning it on opens a `ContentDialog`
|
||||
> (`Services.AgentAdminPrompt`, text `FrameLedger.Shared`'s `Safety_AdminMode_*`, version `agent-admin-dialog/1` in its
|
||||
> (`Services.AgentAdminPrompt`, text `FrameLedger.Shared`'s `Safety_AdminMode_*`, version `agent-admin-dialog/2` *(`/1` until 2026-11-11, when Advanced metrics widened what the option adds — D101)* in its
|
||||
> corner) whose primary button is enabled only by ticking "I understand…" and whose default button keeps standard rights;
|
||||
> declined, nothing is written. Either way the row is written and the Agent restarts — asked to stop over the pipe, its
|
||||
> instance lock waited out, the connection's next round starting it the new way — **except under a running session**,
|
||||
|
||||
@@ -20,6 +20,11 @@ cmake --preset x64-release
|
||||
cmake --build --preset x64-release
|
||||
```
|
||||
|
||||
A third preset, **`x64-vs-analysis`** *(2026-11-11)*, builds nothing that ships: it has CMake write a Visual Studio
|
||||
solution (`build/native/x64-vs-analysis/FrameLedgerNative.slnx`, generator "Visual Studio 18 2026", tests and tools
|
||||
on) for Qodana's native report, which reads C++ through a solution (`13_CI_CD` §Qodana). It needs Visual Studio 18;
|
||||
the gate and the release never use it.
|
||||
|
||||
Targets:
|
||||
- `FrameLedger.Overlay` → `FrameLedger.Overlay.dll`
|
||||
- `FrameLedger.VkLayer` → `FrameLedger.VkLayer.dll` + `VkLayer_FRAMELEDGER_overlay.json`
|
||||
@@ -404,6 +409,7 @@ Seven self-test cases, both directions; `./tools/notice-check.ps1 -Fix` writes a
|
||||
13d. **`tools/wiki-build.ps1 -SelfTest`, then `-Check`** (beta.17, owner decisions D53/D54, 2026-10-07) — assembles the GitHub Wiki from `wiki/`, `guide/`, `LIMITATIONS.md` and (beta.35) `ACCESSIBILITY.md` into a temporary folder, as `wiki.yml` does at a release (`13_CI_CD` §wiki.yml), and fails on a link to a file, folder or section that does not exist, two sources for one page, a page that neither Home nor the sidebar leads to, a sidebar that lists the guide in another order than `guide/README.md`, a backticked repository path in a `wiki/` page that names nothing, and a version number written into a `wiki/` page (the footer says which release the wiki shows). ~~Nine~~ Ten self-test cases since beta.35 (the statement's page, D88), both directions
|
||||
14. `tools/changelog-check.ps1 -SelfTest` — nine cases, five expected RED. The live half needs a pull request's changed-file list and is supplied by `ci.yml`
|
||||
14b. `tools/release-notes.ps1 -SelfTest` — five cases over a fixture changelog (a dated and an undated section, a missing one, a prefix that must not match, an empty one), and since beta.24 three over a temporary tree: a version with its own `docs/changelog/<version>.md` is read from it, one without from `CHANGELOG.md`, a prefix of a file name is not that file. The live half needs a tag's version and runs in `release.yml`, where a missing or empty section is a red release (P4 PR-5)
|
||||
14e. **`tools/nvapi-readonly-check.ps1 -SelfTest`, then live** (owner decision D108, 2026-11-11) — every `NvAPI_*` call in `src/native/FrameLedger.NvapiBridge/src/fl_nvapi_bridge.cpp`, the one translation unit that links `nvapi64.lib` into a shipped binary, is on `tools/nvapi-allowed-calls.txt` and every name there is called; a name that sets, saves, restores, deletes, registers, resets, enables, disables or controls something is red **even when the list names it**, and so is one that returns an identifier (D104) — three reads the verb rule would refuse are exempt by name, each with its reason. Comments and string literals are taken out first, so a setter named in the comment that says it is never called is not a call. Seventeen self-test cases, both directions. Text only: it runs with or without the native build. `18_GPU_VENDOR_APIS` §Runtime policy's "never call a setter", which was a sentence until the bridge went from fourteen calls to forty-four
|
||||
14d. **`tools/docs-split-check.ps1 -SelfTest`, then live** (beta.24, owner decision D66) — `CHANGELOG.md` holds no released section beside `[Unreleased]`; each `docs/changelog/<version>.md` holds one `## ` heading, its own `## [<version>] - date`, and no relative link (the App renders release notes as `CHANGELOG.md`); `CHANGELOG.md` and the files under `docs/changelog/`, and `docs/HANDOFF.md` and the files under `docs/handoff/` — and since PR-5 `docs/20_OPEN_QUESTIONS.md` and `docs/open-questions/`, `docs/spike-notes.md` and `docs/spike-notes/` — name each other in both directions. Eleven self-test cases, both directions
|
||||
14c. **`tools/buildid-check.ps1 -SelfTest`** (beta.18) — eight cases, both directions: a binary built from a dirty tree (`-dirty`, or the short form's `+`), one with no id, a missing one, and an expected id that is dirty or not an id are red. The live half needs the release's clean-checkout id and runs in `release.yml` over the published tree (§Release-time token substitution)
|
||||
15. `tools/resx-audit.ps1` — ~~**skipped loudly; it does not exist, and no `.resx` file does either**~~ **built 2026-09-13 (P3 PR-2)**: `-SelfTest` first (11 fixture cases, both directions), then the live pass over every `Strings.resx` family under `src/` — key sets equal across en/vi/ja, `Safety_*` in `ja` marked for review or signed, `Strings.Designer.cs` current with `tools/resx-gen.ps1`. A tree with no family is red (`09_I18N` §Translation workflow)
|
||||
|
||||
+186
-6
@@ -124,11 +124,14 @@ FrameLedger uses the **`poli0981/.github` ops repo** where its templates fit, an
|
||||
read `net10.0`; and for a construct it has not met, a pull request's run is not the evidence — a
|
||||
`workflow_dispatch` on the branch is, §C# 15 and the analyses.)*
|
||||
|
||||
### `qodana.yml` — push to `main`, pull requests into `main`, `workflow_dispatch` · **repo-local, built 2026-11-10 (D93)**
|
||||
- One job, `qodana`, on `ubuntu-latest` — the only Linux job in this repository, because the linter is a Linux
|
||||
container: `JetBrains/qodana-action` (pinned to `v2026.2.2`'s commit; Dependabot moves the pin) runs Qodana Community
|
||||
for .NET over `FrameLedger.slnx` with `qodana.yaml`'s settings. §Qodana below says what it reads, what was changed
|
||||
from JetBrains' template and where an inspection is switched off.
|
||||
### `qodana.yml` — push to `main`, pull requests into `main`, `workflow_dispatch` · **repo-local, built 2026-11-10 (D93); Qodana for .NET since 2026-11-11 (D99)**
|
||||
- ~~One job, `qodana`, on `ubuntu-latest` — the only Linux job in this repository, because the linter is a Linux
|
||||
container~~ Two jobs, on `windows-latest`, each a report of its own: **`native`** (*Qodana (native)*) has CMake
|
||||
write a Visual Studio solution and reads the C++ of `src/native` with `qodana-native.yaml`'s settings; and
|
||||
`managed` (*Qodana (managed)*): `JetBrains/qodana-action` (pinned to
|
||||
`v2026.2.2`'s commit; Dependabot moves the pin) runs **Qodana for .NET** in native mode over `FrameLedger.slnx`
|
||||
with `qodana.yaml`'s settings, after a `dotnet build`. No job here runs on Linux any more. §Qodana below says what
|
||||
it reads, what was changed from JetBrains' template and where an inspection is switched off.
|
||||
- **Advisory, with a gate of zero problems:** one problem turns the job red; it is not a required context.
|
||||
- `permissions: contents: read, checks: write, pull-requests: write` — the annotations and the one comment; granted to
|
||||
the job, the workflow grants none.
|
||||
@@ -487,7 +490,184 @@ on `src/FrameLedger.Infrastructure/**/*` and `src/FrameLedger.Shared/**/*`, so n
|
||||
stop reappearing on pull requests. *(Since D68 the `S8417` and `S6640` rows are `SonarQube.Analysis.xml`'s, in the
|
||||
repository; `S6232`'s are not — a union read outside `LARGE_INTEGER` would be a finding — and its 24 stay marked.)*
|
||||
|
||||
## Qodana — `qodana.yml`, a workflow of its own (owner decision D93, 2026-11-10)
|
||||
## Qodana — `qodana.yml`, a workflow of its own (owner decisions D93, 2026-11-10; D99 and D100, 2026-11-11)
|
||||
|
||||
**Since 2026-11-11 the linter is Qodana for .NET, on the Ultimate licence (D99).** The owner took an Ultimate licence for
|
||||
the Qodana Cloud organisation and asked for Qodana over every language. So the linter is **Qodana for .NET**
|
||||
(`qodana-dotnet`: Rider's engine) where it was the Community one, in **native mode** on a Windows runner: no container,
|
||||
the projects built and loaded with the SDK the job installs from `global.json`, and no `EnableWindowsTargeting`.
|
||||
`qodana.yaml` names the linter and the mode (`withinDocker: false`); nothing is an action argument, so `qodana scan` on
|
||||
a developer's PC reads the same file. The job is `managed` — *Qodana (managed)* in a pull request's checks: checkout,
|
||||
`setup-dotnet`, the NuGet cache restored, `dotnet build -c Release` first — so that a build that fails is one red step
|
||||
with the compiler's own message, not a report of unresolved symbols — then the action, pinned by commit. No MSVC step,
|
||||
on purpose: it exports `Platform=x64`, which MSBuild reads as a solution platform. The linter's log says what the token
|
||||
bought: "Qodana license plan: Ultimate", and the Qodana Cloud project it is linked to (`frameledger`). Still advisory,
|
||||
still a gate of zero, still `main` and its pull requests alone. From here down to *As it was built* is the job as it
|
||||
is; below that is D93's own account, which is now history.
|
||||
|
||||
**Two reports (D99).** Asked how to gather the C# and the C++, the owner chose two reports from the start, and made a
|
||||
second Qodana Cloud project (`frameledger-cpp`, the `QODANA_TOKEN_NATIVE` secret). The managed report leaves
|
||||
`src/native` out; the native one (*The native report*, below) reads nothing else, so every file is in exactly one.
|
||||
|
||||
**What is read, and by what.**
|
||||
|
||||
| What | Read by | |
|
||||
|---|---|---|
|
||||
| The C#, XAML and `.resx` of the thirteen projects | `managed` | ReSharper's engine, as under D93 |
|
||||
| Markdown and XML around the solution | `managed` | the IntelliJ platform's own inspections — 23 and 10 results on the first run |
|
||||
| JetBrains' security rules over the C# — pattern rules for a process start, an SQL text and the like | `managed` | new with this linter (its OpenGrep plugin) — 36 results on the first run, every one read; the files they were read in are listed in `qodana.yaml`, so a new one is reported |
|
||||
| The C++ of `src/native` | `native` | ReSharper's C++ engine and the clang-tidy checks it bundles, over a Visual Studio solution CMake writes for it |
|
||||
| JSON and YAML, the workflows among them | nothing reported | whether the profile inspects them and found nothing, or does not inspect them, was not established; CodeQL's `actions` language reads the workflows |
|
||||
| PowerShell (`build.ps1`, `tools/`), CMake files, the HLSL shader | no linter of JetBrains' reads them here | SonarCloud reads the PowerShell |
|
||||
|
||||
**The first runs on this linter, and what was done (2026-11-11).** Run 42923079119 — the job with no settings beyond the
|
||||
solution: **3,953 problems** in 92 inspections, and 3,607 of them **hints**: the lowest level an IDE has, which the
|
||||
editor offers without underlining anything (this linter files them as `TYPO`, Qodana as *Low*). Meziantou's "name the
|
||||
parameter" 1,084 times, a trailing comma 979, a XAML binding whose `DataContext` the engine cannot know 414, the MVVM
|
||||
Toolkit's partial-property proposal 224, "invert `if`" 114 — and every other Roslyn analyzer message below the level
|
||||
this build makes an error. **Hints are off as a severity**, one group in `qodana.yaml` (`severity:TYPO`): the Community
|
||||
linter never reported them, and D93's rule is about warnings and suggestions. With that, run 42928814104: **347**.
|
||||
|
||||
| What | n | Done |
|
||||
|---|---|---|
|
||||
| `OverriddenWithSameValue` — a vi or ja value equal to the English one | 271 | off in `.editorconfig` (`[*.resx]`): product and technology names, units and format strings are not translated, and a ja safety string is the English verbatim until a reviewer signs it |
|
||||
| `csharp_injection_rule-CommandInjection` — a process started with something that is not a literal | 35 | **read, one by one** (below): 11 places in `src`, 24 in tests; one place was hardened. The rule stays on, and the files read are left out of the plugin's inspection by path in `qodana.yaml` (*How the security rules are scoped*, below), so a new file that starts a process is reported |
|
||||
| `MarkdownIncorrectTableFormatting` | 20 | off in `qodana.yaml`: Rider wants columns padded to one width; these tables are written to be diffed |
|
||||
| `XmlHighlighting` in `src/FrameLedger.App/app.manifest` | 10 | that file ignored for that inspection: the linter has no schema for a Windows application manifest |
|
||||
| `UnusedVariable.Compiler` and `RedundantUsingDirective` in `PrimaryDisplay.cs` | 6 | **the linter's own fault**, and the file is left as it is: resolving `PInvoke.EnumDisplaySettings(null, …)` — the `null`-to-`PCWSTR` conversion — the engine of this linter's build (QDNET-262.12299) fails an internal assertion (`IsStandardImplicitConversionFromExpression(conversion.Kind)`, in its `backend.log`), loses the method, and reports its three locals and the file's three usings as unused. The compiler builds the file with warnings as errors, and InspectCode 2026.2.3.1 and 2026.3.0 report nothing in it. Those two inspections are excluded for that one file in `qodana.yaml`, to be removed when a linter build reads it |
|
||||
| `MarkdownUnresolvedHeaderReference` | 3 | off in `qodana.yaml`: all three resolve on GitHub, whose anchor rule the linter does not follow (`#display-mode--both-tiers-beta10`) |
|
||||
| `csharp_injection_rule-SQLInjection` | 1 | the same: the one place assigns a constant command text and binds every value as a parameter, as every statement in this repository does; its file is listed with the others |
|
||||
| `RedundantBoolCompare`, in a test | 1 | fixed — the expression also carried a clause its first half implied |
|
||||
|
||||
With those settled, run 42940926340 (2026-11-11, this pull request's branch, the whole solution): **no problem
|
||||
reported** — the gate's zero, on this linter.
|
||||
|
||||
**How the security rules are scoped — by the plugin's one inspection, not by a rule.** Every result of the
|
||||
OpenGrep plugin's several hundred rules is produced by one inspection, `OpenGrepInspection`; a rule's own id
|
||||
(`csharp_injection_rule-CommandInjection`) is in the report and is honoured nowhere. Three runs measured it — a
|
||||
profile entry's `ignore` (42932842462), an `exclude` path under the rule's id (42935752891), `enabled: false`
|
||||
on the rule (42938295264): all 36 results stood each time, and the linter's log shows why — the plugin hands its
|
||||
server every rule file whatever the profile says. What the plugin's inspection does honour is a path: an
|
||||
`exclude` entry named `OpenGrepInspection` (its scopes are in the report's `log/effective.profile.xml`). So the
|
||||
eleven files of `src` the results were read in, and `tests`, are listed there — and in the run above the
|
||||
inspection was performed on 943 files, where it had been 1,308, and reported nothing: it is on, and it reads
|
||||
what is not listed. The price is stated in `qodana.yaml`: a listed file is left out of **all** of the plugin's
|
||||
rules, not only the one that fired. The plugin is also most of the job's time — about six of its fifteen
|
||||
minutes.
|
||||
|
||||
**A second tripwire, in the gate: `ProcessStartSitesTests`.** Qodana is advisory, and its rule is a pattern for
|
||||
`Process.Start`. The test sweeps `src` for every way a process is started here — `Process.Start`, a
|
||||
`ProcessStartInfo`, `CreateProcessWithTokenW` through CsWin32, and the registration of the logon task — and fails
|
||||
on a file that is not in its list, until that file has been read and listed. `Startup/UnelevatedProcess`, which
|
||||
the rule never saw, is in it.
|
||||
|
||||
**Every place that starts a process, as read on 2026-11-11.** The rule is a pattern, not a data flow: it reports any
|
||||
`Process.Start` whose argument is not a literal. What matters at each is what is started and where its path and
|
||||
arguments come from.
|
||||
|
||||
| Place | What it starts | Where the path and the arguments come from |
|
||||
|---|---|---|
|
||||
| `App/Services/AgentLauncher` | `FrameLedger.Agent.exe` | the file beside the App (`AppContext.BaseDirectory`); arguments the App builds (`--serve`, the data folder) |
|
||||
| `App/Services/AgentTool` | the same Agent, with one maintenance flag | a constant at each of its two callers (`--install-task`, the Settings page's flags) |
|
||||
| `Infrastructure/Startup/AgentElevation` | the Agent, elevated (`runas`) | the Agent's own path; `--serve --for-user <this user's SID>` |
|
||||
| `Infrastructure/Startup/LogonTask` | nothing itself — it registers the logon task, whose action Windows starts at sign-in | the Agent's path and constant arguments (`--serve`), into a Task Scheduler definition for this user, at the lowest privileges |
|
||||
| `Infrastructure/Diagnostics/CrashDumpWriter` | this process's own executable, as the dumper | `Environment.ProcessPath`; an `ArgumentList`, no shell |
|
||||
| `Infrastructure/Capture/ProcessLauncher` | the game | the executable the user added and enabled hooking for, and the launch arguments the user wrote for it; no shell |
|
||||
| `App/Services/ShellStarter` | a game, directly or through its store (`steam://…`, `explorer.exe shell:AppsFolder\<AUMID>`) | the launch `GamePlayer` resolves from the record of a game the user added (D59, D80) |
|
||||
| `App/Services/Explorer` | `explorer.exe` on a folder or a file | a quoted path of FrameLedger's own: the data folder, the logs, a bug report's zip, the licences folder |
|
||||
| `App/Services/ShellUrlOpener` | the browser or the mail client | the project's own pages, or a Markdown link `MarkdownLinks` has already held to `http`, `https` and `mailto`. **Hardened here**: the opener now refuses any other scheme itself (`ShellUrlOpenerTests`) — the shell runs whatever it is handed, and a `file:` address is a program |
|
||||
| `App/ViewModels/SettingsViewModel` | the browser | one constant address |
|
||||
| `Infrastructure/Startup/UnelevatedProcess` | the Agent or a game with the shell's token, from an elevated process (`CreateProcessWithTokenW`) | its two callers above, `AgentLauncher` and `ProcessLauncher` — not a `Process.Start`, so the rule did not see it; the sweep does |
|
||||
|
||||
None takes a value from outside the PC or from a file FrameLedger did not write, except the game's own path and
|
||||
arguments — which starting the game the user chose is.
|
||||
|
||||
**The native report — `qodana-native.yaml`, the job `native` (D99, 2026-11-11).** The C++ of `src/native`, read by
|
||||
the same linter — Qodana for .NET, whose C++ is ReSharper C++ — in native mode on a Windows runner. It is the only
|
||||
linter of JetBrains' that can: the native layer is MSVC-only, and the two C/C++ linters (`qodana-cpp`,
|
||||
`qodana-clang`) are Linux images. It reads C++ through a Visual Studio solution, and `src/native` is a CMake tree, so
|
||||
the job has CMake write one first: the preset **`x64-vs-analysis`** (generator "Visual Studio 18 2026", tests and
|
||||
tools on) puts `FrameLedgerNative.slnx` under `build/native/x64-vs-analysis`, and the job builds from it the one
|
||||
target whose output is a header (`fl_ac_floor_gen`, the blocklist floor). Nothing else is compiled, and nothing from
|
||||
that tree ships. Then the action, with `--config qodana-native.yaml`: the solution, `RelWithDebInfo` and `x64` — the
|
||||
flags the shipped binaries are built with — and, left out by path, what is not FrameLedger's code (the build tree,
|
||||
`third_party`, the vendor stubs, a compiled shader as a byte array). Its own results folder, cache keys and artifact
|
||||
(`qodana-report-native`), and the Qodana Cloud project `frameledger-cpp` through `QODANA_TOKEN_NATIVE`. It posts no
|
||||
comment and no annotations — a second job of the same linter would overwrite the managed job's — so its result is the
|
||||
job's own status and its report. Advisory, and a gate of zero, like the other.
|
||||
|
||||
**What it runs** is ReSharper's C++ inspections and, through them, the clang-tidy checks and clang diagnostics that
|
||||
engine bundles. clang never builds this code — MSVC does, with `/W4 /WX` — so what clang says is read as advice. Every
|
||||
one of them has a key in `.editorconfig` (`resharper_cpp_…_highlighting`; a clang-tidy check's is
|
||||
`resharper_cpp_clang_tidy_<check>_highlighting`), so D100's rule holds without a second file: no `.clang-tidy`.
|
||||
|
||||
**Its first runs, and what was done.** Run 42923079119: **4,695 problems**, 4,040 of them hints, which are off as on
|
||||
the managed side. Run 42928814104: **655** — **494 distinct**, because a source file compiled into three targets is
|
||||
reported three times.
|
||||
|
||||
| What | distinct | Done |
|
||||
|---|---|---|
|
||||
| A choice this code made, off for the native tree: where the compiler pads a struct (46); MSVC's own keywords, `__try` among them (54); a function pointer got by name cast to its real type, through `void*` (55); `reinterpret_cast` where memory is read as something else (5); `std::cmp_less` proposed for comparisons that already cast (20); a `default:` under a full enum switch (3); a copied verdict (4); the moves of a type that owns a handle (11); a zeroed out-parameter enum (8); an enum's width (5); "can be made const / constexpr / static" (52); "possibly unused `#include`" (15) | 278 | off in `.editorconfig`, each with its reason. Of the fifteen includes two were unused and were removed; the others are a file including what it uses although another header already brings it |
|
||||
| A newer idiom proposed for working code — a range-for, `std::ranges`, `any_of`, `starts_with`, a raw string, an `if` with an initialiser | 53 | off: the native code is written to be read beside the hook path, an index and a plain loop |
|
||||
| **The engine misreading**: `std::atomic_ref<T>::fetch_or` as an expression without side effects (7); a Win32, D3D12 or ffx-api structure zero-initialised and then filled field by field as "always rewritten" and "assigned, never used" (15); a test of a `constexpr` function as a redundant argument (3) | 25 | off, with what the engine gets wrong written beside the keys |
|
||||
| Fields nothing names, in a structure Windows defines and the SDK's headers do not give (`RTL_PROCESS_MODULE_INFORMATION`, `PROCESS_MEMORY_COUNTERS_EX2`) and in a test's stand-in for a Vulkan object | 25 | off for those four files: the fields are what puts the others at their offsets |
|
||||
| `%lu` with an `NvU32`, in `fl-probe-nvapi` | 19 | off for that file: NVAPI's header makes `NvU32` an `unsigned int` under clang and an `unsigned long` under MSVC — the linter's compiler, not the build's |
|
||||
| The probes, the harness and the tests: an unchecked `printf` (35), `atoi` on the harness's own arguments (20), a `&pointer` handed to a `void*` parameter (7), a printf-shaped helper (4), a fake handle built from a number (4), a test's fixtures (4), `layout_test`'s run-time checks of compile-time facts (3), a macro that pastes a name (1) | 78 | off for `tools` and `tests` |
|
||||
| Code loaded into a game (below) | 7 | kept as it is, off for those files; one of them is dead code, recorded for the owner |
|
||||
| **Fixed**: `sizeof(a) / sizeof(a[0])` → `std::size(a)` (4); a multiplication done in a narrower type than the one it is stored in or compared with (2: a constant in the guard's sources, a test); a member function, and a type alias, nothing used (3) | 9 | in the code; none changes what a shipped binary does |
|
||||
|
||||
With those settled, run 42942068024 — the first with these settings — reported **one** problem: `LogNoteW`, now by
|
||||
ReSharper's own inspection where clang's had said it before (below). And run 42943094415 (2026-11-11, this pull
|
||||
request's branch): **no problem reported** — the gate's zero, in the native report too.
|
||||
|
||||
**Code loaded into a game — the Overlay, the Vulkan layer, the shared-memory headers, the guard's rule matcher.**
|
||||
D100: there only a defect is fixed, in a pull request of its own with the hook's overhead measured (rule 5,
|
||||
`14_TESTING` §Hook overhead), and a proposal about style is not acted on. About a quarter of the 655 results were in
|
||||
those files; nearly all of them are the tree-wide kinds above. **The report found no defect there.** What is
|
||||
particular to them, read and kept: two `if` chains whose arms have the same body and are different cases, each with
|
||||
its comment (`dllmain.cpp`); MinHook's `MH_ALL_HOOKS`, which is `NULL` by its header; a retired enumerator kept so
|
||||
that its bit is not reused; `slSetTag`, deprecated by a header whose replacement no measured module exports;
|
||||
`ResolveTolerance` clearing its out-parameter with `memset`, as `ResetRules` does — a `Tolerance` is flags whose
|
||||
default initialisers are zero. And one thing that is not as it should be: **`LogNoteW` in `dllmain.cpp`, which nothing
|
||||
calls** — dead code. It is not a defect, so D100 leaves its removal to the owner (HANDOFF); until then that one file
|
||||
is not read for an unused function (`.editorconfig` says so, in a section to be removed with it).
|
||||
|
||||
**"Zero" has to mean "analysed".** A report with no problem cannot tell a clean tree from one the linter did not
|
||||
read. So the settings were proved on a branch that puts back three of the things fixed here — the unused alias, the
|
||||
unused member function, the narrow multiplication. Run 42942390715 reported exactly those three, each by the
|
||||
inspection that had found it the first time (`CppTypeAliasNeverUsed` in `tools/fl-probe-interposer/main.cpp`;
|
||||
`clang-diagnostic-unused-member-function` and `bugprone-implicit-widening-of-multiplication-result` in
|
||||
`tests/ring_test.cpp`), and `LogNoteW`, and nothing else. The branch was deleted. Do the same before trusting a
|
||||
zero after a change to the preset, the settings or the linter's version.
|
||||
|
||||
**What it does not read.** CMake files and PowerShell have no inspection in this linter (SonarCloud reads the
|
||||
PowerShell); the HLSL shader and the `.def` file are not C++. CodeQL (`analyze (cpp, manual)`, a required check) and
|
||||
SonarCloud go on reading the C++ as before: this is a third reader, and the only one of the three that is ReSharper's.
|
||||
|
||||
**Where an inspection is switched off: by the engine that raised it (D100, amending D93's "never in `qodana.yaml`").**
|
||||
What Qodana reports is fixed, unless the inspection argues with a choice this project made; then it is off, with the
|
||||
reason on the line above — in the place the engine that raised it reads:
|
||||
|
||||
- **ReSharper's** — the C#, the XAML, the `.resx`, and the C++ of the native report with the clang-tidy checks it
|
||||
runs — in **`.editorconfig`** (`resharper_*_highlighting`), where Rider and ReSharper in the editor read it too:
|
||||
sixty-four keys for the managed code, fifty-four lines for the C++, some of them for a folder or a file alone.
|
||||
- **What has no key there** — in **`qodana.yaml`**: a whole severity (the hints) and the IntelliJ platform's Markdown
|
||||
and XML inspections under `profile.inspections`; under `exclude`, by inspection and path, the files JetBrains'
|
||||
security rules were read in and a file the linter itself fails on.
|
||||
- **What is not FrameLedger's code** is left out by path (`exclude`): `SonarQube.Analysis.xml`'s list, for its reasons.
|
||||
|
||||
**What it does not use, and what happens if the licence lapses.** Quick-fixes (the linter would push commits — the job
|
||||
has no `contents: write`, and a change nobody read is not wanted), code coverage in Qodana (the gate's coverage and
|
||||
SonarCloud's already read the same reports) and FlexInspect are Ultimate features this job leaves alone. Without a
|
||||
valid licence the linter does not start, so the job is red — advisory, never a blocked merge; the way back is
|
||||
`linter: qodana-cdnet` with the job on `ubuntu-latest`, as it ran until beta.37.
|
||||
|
||||
**Running it on a developer's PC.** `qodana scan` in the repository root reads `qodana.yaml`, downloads the linter and
|
||||
needs the project's token in `QODANA_TOKEN` — the Ultimate linter checks the licence. Without a token, InspectCode
|
||||
still gives ReSharper's part (*As it was built*, below), with `--toolset-path` at the 11.0 SDK's `MSBuild.dll`; the
|
||||
Markdown, XML and security results are the Rider linter's alone.
|
||||
|
||||
**As it was built — the Community linter, 2026-11-10 to beta.37 (D93).** Kept as written; where it says *is*, read *was*.
|
||||
|
||||
**D93 — Qodana reads the C# and the XAML from CI.** The owner made the project on Qodana Cloud, set the `QODANA_TOKEN`
|
||||
secret (2026-11-10) and asked for Qodana in CI from the workflow JetBrains gives, changed where it had to be, with what
|
||||
|
||||
+414
-2
@@ -145,7 +145,7 @@ L1 gives no temperatures on its own (unless the D3DKMT probe pans out). That is
|
||||
|
||||
`LibreHardwareMonitorLib` ≥ 0.9.6, consumed as an **unmodified NuGet package**. It already implements per-vendor GPU sensor access internally — which means the vendor-interop licensing problem is one LHM has solved upstream, under a licence that works for us. That is the entire reason this layer exists.
|
||||
|
||||
- `Computer` opened with `IsGpuEnabled` always; ~~`IsCpuEnabled` + `IsMemoryEnabled` only when the Agent is elevated and PawnIO is available~~ nothing else, ever — the CPU temperature uses a separate `Computer` (below) (corrected 2026-10-04).
|
||||
- `Computer` opened with `IsGpuEnabled` always; ~~`IsCpuEnabled` + `IsMemoryEnabled` only when the Agent is elevated and PawnIO is available~~ nothing else, ever — the CPU temperature uses a separate `Computer` (below) (corrected 2026-10-04). *(2026-11-11: still true of THIS layer's `Computer`. Advanced metrics opens a third one, of its own — the graphics card, and as administrator with PawnIO the processor, memory and motherboard groups; D103, §Advanced metrics. Storage, the power supply, controllers, the battery and the network are opened by nothing.)*
|
||||
- Poll on a dedicated thread: `computer.Accept(updateVisitor)` then read mapped sensors. Never faster than 500 ms; default 1000 ms.
|
||||
- Sensor mapping by `SensorType` + name heuristics per vendor (`GPU Core`, `GPU Hot Spot`, `GPU Memory`, `GPU Package Power`, …), kept in `SensorMap.cs` with unit tests against captured sensor-tree fixtures.
|
||||
- **P0 verification items:** (a) which fields LHM actually returns per vendor on real hardware — fill the capability matrix below — **NVIDIA filled 2026-09-03, AMD/Intel deferred (§R5/§R6)**; (b) ~~whether GPU-only usage works **without** elevation and without PawnIO (expected yes, since GPU sensors go through user-mode vendor paths, but confirm — it determines whether the default unelevated Agent has temperatures at all)~~ — **confirmed 2026-09-03, §M5 row R1**: eight fields unelevated, the same eight elevated, PawnIO never opened; (c) ~~confirm LHM's sources are not marked with MPL-2.0 Exhibit B~~ — **done, 2026-08-02: clear.** No source file applies the notice; the only repository hit is the `LICENSE` template itself, and every file we depend on carries the permissive Exhibit A. Method and evidence in `docs/spike-notes.md` §0. Re-check on every version bump, and check *source headers*, never the LICENSE file — MPL-2.0's own text contains Exhibit B as a template, so grepping the licence finds it in every MPL project ever published.
|
||||
@@ -204,6 +204,8 @@ Still resolve **entry points defensively at runtime**: `nvapi64.dll` may be abse
|
||||
> **Not in this build, stated so nobody infers it from the table below:** VRAM (`FlNvSample.vram` is
|
||||
> reserved and its bit is never set — see the Memory row), power, hotspot temperature, per-domain
|
||||
> utilisation beyond the GPU domain, and anything Reflex (§M8: a hook fact, not a poller field).
|
||||
> *(2026-11-11: still true of `FlNvSample`, the 1 Hz telemetry layer's struct. The memory figures and the other
|
||||
> three utilisation domains are read since ABI 3 — below — into structs of their own, for Advanced metrics only.)*
|
||||
>
|
||||
> **ABI 2 (2026-09-25, beta.8): the driver profile, read-only.** The owner asked whether the NVIDIA App overrides a
|
||||
> game's DLSS (frame generation, ray reconstruction, the model preset). The NVIDIA App writes those overrides into the
|
||||
@@ -222,6 +224,39 @@ Still resolve **entry points defensively at runtime**: `nvapi64.dll` may be abse
|
||||
> ctest `fl_nvapi_bridge` (argument refusals, DEGRADED before init, the global profile of the test's own executable on
|
||||
> a GPU machine) and `NvapiBridgeMirrorTests` (`FlNvDriverProfileSize`, ABI 2).
|
||||
>
|
||||
> **ABI 3 (2026-11-11, owner decision D101): what "Advanced metrics" reads.** Five reads, each a struct with its
|
||||
> size first and a `present` mask, and each call behind it a query: `FlNvReadFacts` (what is true of the card whatever
|
||||
> is running — its type, bus, PCI ids, VBIOS version, architecture, core counts, the base and boost clocks, the
|
||||
> sensor's range, `NvAPI_GPU_GetMemoryInfoEx`'s four sizes, the frame-buffer sizes, the driver's package and base
|
||||
> branch, NVAPI's interface version, the chipset), `FlNvReadLive` (the same memory call's free figure with evictions
|
||||
> and promotions, the frame-buffer, video and bus utilisation, the video clock, the P-state, the board and
|
||||
> power-supply temperatures where the card has them, the throttle word, the encoder's session count and averages),
|
||||
> `FlNvReadDisplays` (per connected display: HDR formats and luminances, variable-refresh support, the adaptive-sync
|
||||
> flags), `FlNvSessionDisplay` (the display a GDI device name names: its variable-refresh state and the colour space
|
||||
> the driver reports for one process) and `FlNvProfileSettings` (every setting of the global profile, or only what a
|
||||
> game's own profile sets — a game no profile names is answered `GLOBAL` with nothing listed, never with the PC's
|
||||
> settings). No struct of ABI 2 changed size; `FL_NV_FIELD_VRAM` stays clear.
|
||||
>
|
||||
> **No identifier has an entry point** (D104): not `NvAPI_GPU_GetBoardInfo`, `NvAPI_GPU_GetUUID`, an EDID read, or
|
||||
> `NvAPI_GPU_GetEncoderSessionsInfo`, which lists WHICH programs encode. A display is passed on by its place in the
|
||||
> driver's list; NVAPI's display id is a handle of this boot and is neither stored nor shown.
|
||||
>
|
||||
> **Read-only is now a gate** (D108): `tools/nvapi-readonly-check.ps1` holds every `NvAPI_*` call of the bridge's
|
||||
> source to `tools/nvapi-allowed-calls.txt` in both directions — forty-four names — and refuses a name that sets,
|
||||
> saves, restores, registers or controls something, or that returns an identifier, **even when the list names it**.
|
||||
> Managed: `INvapiAdvancedBridge` (a port of its own beside `INvapiBridge`; `NativeNvapiBridge` implements both, and a
|
||||
> DLL that predates ABI 3 answers `Unavailable` rather than throwing) and `NvapiAdvancedReader`, which turns the five
|
||||
> structs into the catalog's facts and readings — every `nvapi.` entry whose reach is `Agent`, and no other, held by
|
||||
> `NvapiAdvancedReaderTests` in both directions. **Nothing composes the reader yet**: no Agent code calls it.
|
||||
>
|
||||
> **Measured on the dev box the day it was written** (RTX 5080, a driver of base branch `R620`, ctest `fl_nvapi_bridge`'s
|
||||
> AVAILABLE branch — `20_OPEN_QUESTIONS` §M12): all twenty facts answer (`present = 0xFFFFF`: discrete, desktop, PCI
|
||||
> Express, 84 ray-tracing and 336 tensor cores, base 2295 / boost 2670 MHz, 16,303 MiB dedicated, a DCH Game Ready
|
||||
> driver); eight of the ten live groups answer (`0x33F`) — **the board and power-supply temperatures do not exist on
|
||||
> this card**, as the memory temperature does not, and read N/A; the one display answers all four groups; the global
|
||||
> profile lists 24 settings. One thing the header had wrong: it misspells `NV_ENCODER_STATISTICS_VER` as
|
||||
> `NNV_ENCODER_STATISTICS_VER`, so the bridge names `NV_ENCODER_STATISTICS_VER1`.
|
||||
>
|
||||
> **The ctest could not fail on a GPU machine until the same day.** `fl_nvapi_bridge` was registered with
|
||||
> `PASS_REGULAR_EXPRESSION` alone, which makes ctest ignore the exit code: the AVAILABLE branch's reference-counting
|
||||
> check (two references, two releases, then a read expected to work) failed on every machine with an NVIDIA GPU while
|
||||
@@ -234,7 +269,7 @@ Still resolve **entry points defensively at runtime**: `nvapi64.dll` may be abse
|
||||
| Temperatures | `NvAPI_GPU_GetThermalSettings` (+ extended thermal query for hotspot/memory where available). **Bridge (2026-09-10):** the public enumeration only — core is the `GPU` target; memory is the `MEMORY` target when the driver lists one, and on the RTX 5080 it does not (bit clear → `null`); hotspot is not read |
|
||||
| Utilisation | `NvAPI_GPU_GetDynamicPstatesInfoEx` (GPU / FB / VID / BUS domains). **Bridge (2026-09-10):** the GPU domain only, as `loadPct` |
|
||||
| Clocks | `NvAPI_GPU_GetAllClockFrequencies` — **bridge (2026-09-10):** current graphics and memory clocks |
|
||||
| Memory | `NvAPI_GPU_GetMemoryInfoEx` — **not `NvAPI_GPU_GetMemoryInfo`**, which this table named until 2026-08-05. The vendored headers mark it `__nvapi_deprecated_function` ("deprecated in release 520"), so under `/W4 /WX` a call to it fails the native build. **Neither is called (2026-09-10):** the vendored `nvapi.h` (`cd6918f6`) does not declare `GetMemoryInfoEx` at all — the deprecation message names a function the same header set does not ship — so the bridge's `vram` field is **reserved**, its bit is never set, and VRAM stays L1's PDH adapter counter. Taking a newer header set is the way to change that, not a call to the deprecated one |
|
||||
| Memory | `NvAPI_GPU_GetMemoryInfoEx` — **not `NvAPI_GPU_GetMemoryInfo`**, which this table named until 2026-08-05. The vendored headers mark it `__nvapi_deprecated_function` ("deprecated in release 520"), so under `/W4 /WX` a call to it fails the native build. **Neither is called (2026-09-10):** ~~the vendored `nvapi.h` (`cd6918f6`) does not declare `GetMemoryInfoEx` at all — the deprecation message names a function the same header set does not ship~~ — so the bridge's `vram` field is **reserved**, its bit is never set, and VRAM stays L1's PDH adapter counter. ~~Taking a newer header set is the way to change that, not a call to the deprecated one~~ **Corrected 2026-11-11: the vendored set does declare it** — `nvapi_lite_common.h:600`, which `nvapi.h` includes, with `NV_GPU_MEMORY_INFO_EX_V1` above it and its id in `nvapi_interface.h`; the search that found nothing looked in `nvapi.h` alone. It was not called because of that sentence, from 2026-09-10 until now. The bridge calls it from ABI 3 for the advanced memory rows (§Advanced metrics); `FlNvSample.vram` stays reserved, so which layer fills the base `vram_adapter` series does not change |
|
||||
| **Throttle reasons** | `NvAPI_GPU_GetPerfDecreaseInfo` — not available from L1 or L2. **Bridge (2026-09-10):** the raw reason mask, and 0 is a measurement (no reason), not a clear bit |
|
||||
| Driver version | `NvAPI_SYS_GetDriverAndBranchVersion` — **bridge (2026-09-10):** `FlNvDriverVersion`, surfaced as `616.64 (r616_41)` |
|
||||
| **NGX per-process state** | `NvAPI_NGX_GetNGXOverrideState` (R570+) — the driver's feedback word per DLSS feature for a PID, read OUT OF PROCESS by `fl-probe-nvapi --ngx-state` and, since 2026-09-06, by the capture host beside each module snapshot — **in-process through the bridge since 2026-09-10** (`NvapiNgxStateProbe`; the spawn is retired and the words, the merge and the printed block are unchanged). Measured: the SR word's `CREATED \| EVALUATE` is set without an NVIDIA-app override; the FG word follows DLSS-G once created (`CREATED \| EVALUATE` at ×4, corrected the same day — the first reading was blind because it was early), the multiplier bits stay clear; `scalingRatio` is 0 even under an override. Identity only, SR and FG (`03_METRICS` §Upscaling) — and, since beta.24 (D63), the mode an NVIDIA App override set where the word says it applied; its `performanceMode` is in NGX's own numbering (Silent Hill 2, 2026-10-13: the App's Ultra Performance, profile value 5, reported as 3). *(Beta.27: never read after the game has gone — that reading, the last, had cleared `CREATED \| EVALUATE` on every stored session — and the two bits stand once a reading carried them: `03_METRICS` §The driver-reported rung.)* |
|
||||
@@ -493,3 +528,380 @@ alone could never catch.
|
||||
> (`NvapiTelemetrySource` over `FrameLedger.NvapiBridge.dll`, §L3). §M5 in particular (do LHM GPU
|
||||
> sensors work unelevated, without PawnIO?) decided whether the default unelevated
|
||||
> Agent has temperatures at all — **it does, on NVIDIA; row R1 above.**
|
||||
|
||||
## Advanced metrics (owner decisions D101–D108, 2026-11-11)
|
||||
|
||||
The owner asked for a setting, *"Thông số nâng cao"* (Advanced metrics), with a navigation item of its own, that shows
|
||||
as much as the Streamline and NVAPI headers and PawnIO make available — numbers, tables, charts — **with each value
|
||||
assigned to what it belongs to: one game session, or the PC**. Asked while planning, the owner chose: everything
|
||||
that can be reached inside a game as well, in stages, the route refused on 2026-08-09 re-examined; stored in full with
|
||||
the session; off by default, and off means nothing more is read; and the page never asks for administrator rights
|
||||
itself. This section is the design those answers gave, the decisions taken with it, and the inventory.
|
||||
|
||||
**Nothing here is built by the pull request that wrote it** except the catalog
|
||||
(`FrameLedger.Application.Advanced.AdvancedMetricCatalog`) and this section. Each later pull request of the train
|
||||
states here what it built.
|
||||
|
||||
### The decisions
|
||||
|
||||
- **D101 — the option.** `telemetry.advanced`, off by default, read by the Agent at each session's start. **Off means
|
||||
not read**: no additional call to NVAPI or LibreHardwareMonitor, nothing more stored, and the navigation item is
|
||||
hidden. A session recorded while it was off shows N/A for everything here — it is not filled in afterwards.
|
||||
- **D102 — where it is stored.** In two tables of their own (schema 0023), not in new columns of `sessions`: every
|
||||
read of a `sessions` row, the JSON export and the bug bundle carry the whole row, and a driver profile does not
|
||||
belong in a bug bundle. `machine_profiles` holds the facts of the PC, one row per distinct set, and a session points
|
||||
to the row that was true when it ran — the trend's hardware-change markers and `hardware_snapshots` are untouched.
|
||||
`session_advanced` holds one session's facts, its series' statistics and their directory. The series themselves go
|
||||
to `sensor_blobs` under names that start with `adv.`, **with NaN for a tick that has no reading**: the fixed series
|
||||
store −1 there and their readers drop every negative value, which would silently eat a −12 V rail.
|
||||
- **D103 — LibreHardwareMonitor's other groups.** CPU, memory and motherboard (its sensor chip and embedded
|
||||
controller) are opened **only when the Agent already runs as administrator and PawnIO is installed** — the existing
|
||||
admin mode (D34); the page says what is missing and links to that setting. **Refused**: the power-supply and
|
||||
fan-controller groups, which make the library search every USB HID device. **Deferred**: the battery group — and
|
||||
**storage**. The plan had storage in, temperature only and internal drives only, with one outcome written down
|
||||
before any run: *if the group cannot be opened without touching removable drives, it stays closed*. It cannot: the
|
||||
library's `StorageGroup` (0.9.6, read 2026-11-11) lists every drive through DiskInfoToolkit's `ReloadStorages` with
|
||||
no filter by bus, and subscribes to drives being plugged in afterwards. So `lhm.storage.*` is `Deferred`, a drive's
|
||||
temperature reads N/A, and `LhmGroups` — the only way this code can name a group to open — has no member for it
|
||||
(`20_OPEN_QUESTIONS` §M13). This amends §L2's "nothing else, ever" from the pull request that opened the three.
|
||||
- **D104 — identifiers are never read.** The card's board serial number and unique id, a display's EDID, and the list
|
||||
of programs that are encoding. They are named in the inventory so the page can say so; a test holds that no stored
|
||||
JSON has their keys. This is the only part of "everything" left out on purpose.
|
||||
- **D105 — the navigation item** is the last of the pane's items; Ctrl+1 to Ctrl+5 keep their pages and **Ctrl+6**
|
||||
opens it only while the option is on.
|
||||
- **D106 — the `.partial` file skips what it does not know.** A chunk of an unknown type whose checksum is right is
|
||||
passed over; until now it ended the read, so a build one release older lost everything after the first new chunk.
|
||||
- **D107 — with no game running**, the Agent reads sensors only while the page is open, through one reader shared
|
||||
with the sessions, closed again some seconds after the last use. A PC idling with FrameLedger in the tray reads
|
||||
nothing (NFR-2's "~0% idle").
|
||||
- **D108 — read-only, by a gate.** §Runtime policy's "never call a setter" becomes a build check: every `NvAPI_*`
|
||||
call in the bridge's source is compared with a committed list, in both directions, and a name that changes
|
||||
something or returns an identifier is refused whatever the list says. An entry point that both reads and writes by
|
||||
a command argument — the colour and info-frame controls — is refused like a writer: the check reads names, not
|
||||
arguments, and nothing on the list is one. *(Built with ABI 3: `tools/nvapi-readonly-check.ps1`.)*
|
||||
|
||||
### The reader (built 2026-11-11; composed by the Agent since the switch)
|
||||
|
||||
`Application.Advanced.IAdvancedHardware` is the port: `Acquire()` keeps the reader running until the handle is let
|
||||
go, `Latest` is the last tick without waiting, `ReadSessionFacts` reads one session's facts on the caller's thread.
|
||||
`Infrastructure.Telemetry.AdvancedHardwareHub` implements it — **one reader for the whole Agent, on a thread of its
|
||||
own (`fl-advanced`), running only while somebody holds it** and for a linger after, so that two sessions in a row,
|
||||
or a session ending as the page opens, do not close and reopen the sensors (D107). The Agent records several
|
||||
sessions at once, each with a poller; a reader per session would open the motherboard's sensor chip as many times.
|
||||
|
||||
What runs on that thread is `AdvancedHardwareReader`: NVAPI through `NvapiAdvancedReader`, and
|
||||
`LhmAdvancedReader` over a `Computer` of its own, opened with `LhmAdvancedReader.GroupsFor(elevated, pawnIo)` —
|
||||
`LhmGroups`, an enum that has a member for the four groups this project may open and for no other. Each sensor is a
|
||||
member of a catalog family by the device at the top of its tree and its type (`LhmAdvancedMap.FamilyOf`); its series
|
||||
is named from the library's own identifier (`/lpc/nct6798d/0/voltage/3` → `adv.lhm.board.voltage.lpc_nct6798d_0_3`)
|
||||
and labelled with the hardware's words. A sensor with no family is not read.
|
||||
|
||||
- **A source that is not there is a state** (`AdvancedSources`): no NVIDIA driver, not administrator, PawnIO
|
||||
missing. Never an exception, and never a value in its place.
|
||||
- **A device that throws twice is left alone** until the reader opens again; the others go on. The library's own
|
||||
traversal stops at the first exception, so each top-level device is refreshed in a guard of its own.
|
||||
- **NVAPI answering with no field, twice running, after it had answered**: released and initialised again, once
|
||||
(`20_OPEN_QUESTIONS` §M12).
|
||||
- **The cadence was set by a measurement, before anything composed the reader.** `FrameLedger.CaptureHost
|
||||
probe-advanced` runs this reader on the caller's own rights and prints what it read and what it cost. On the dev
|
||||
box (RTX 5080, unelevated, 2026-11-11): 35 facts and 58 readings a tick — 17 from NVAPI, 41 from the card's sensors;
|
||||
**one NVAPI live read costs 0.4 ms of processor time; one refresh of LibreHardwareMonitor's graphics-card group
|
||||
costs 14 ms (62 ms elapsed)**. Once a second that refresh alone is 1.4% of one core, above NFR-2's 1% for the
|
||||
whole Agent. So NVAPI is read every tick and **the sensor library every fifth** (0.28%), and on the ticks between a
|
||||
sensor has no reading — its last value is not repeated. The same refresh is what the L2 telemetry layer does once
|
||||
a second in every session: that cost is not this feature's, and is `20_OPEN_QUESTIONS` §M16.
|
||||
|
||||
### From the reader to the ledger (built 2026-11-11; fed since the switch)
|
||||
|
||||
- **The poller attaches, it does not read.** `TelemetryPoller` takes an optional `IAdvancedHardware`, holds it from
|
||||
`Start` to `Dispose`, and at each poll takes `Latest` — a read of one reference. A snapshot it has not taken yet
|
||||
rides on that poll's `TelemetrySample.Advanced`; one it has already taken is not attached again, because a
|
||||
reading is of one tick. Null — the option off — composes nothing, and a sample is what it always was.
|
||||
- **The `.partial`** carries those readings in a chunk of their own after the sensor chunk (type 9) and the
|
||||
session's context in another (type 10), so a recovered session keeps both; with the option off neither is
|
||||
written. An unknown chunk type is now skipped rather than the end of the file (D106). `06_DATA_MODEL` §The
|
||||
`.partial` file.
|
||||
- **The finalizer** (`AdvancedSessionBuilder`, both tiers) turns the samples' readings into one series each,
|
||||
aligned to `t_ms` with NaN for a tick with none, and builds the session's row: facts, sources, statistics,
|
||||
directory. Schema 0023 and the rule for NaN are `06_DATA_MODEL` §Blob encoding and §Migrations.
|
||||
|
||||
### The switch (built 2026-11-11, Advanced PR-5)
|
||||
|
||||
`telemetry.advanced` (`SettingsRegistry.TelemetryAdvanced`, Boolean, default `0`, read by the Agent) becomes
|
||||
`RecorderOptions.AdvancedMetrics` through `SettingsRecorderPolicy`, at each session's start like the other recording
|
||||
settings; exactly `1` is on. From there:
|
||||
|
||||
- **The Agent has one reader** — `AgentServices` registers `AdvancedHardwareHub` as `IAdvancedHardware`, a tick a
|
||||
second and a linger of ten — and nothing starts it but a holder. `SessionRecorder` holds it for a session's length
|
||||
**only when the option is on**, and `AgentRecording` gives the session's `TelemetryPoller` the reader on the same
|
||||
condition. Off: not held, not asked, no chunk 9 or 10, no row (`SessionRecorderTests.WithAdvancedMetricsOff…`).
|
||||
- **A session's facts are read once, off the capture loop.** Fifteen seconds after the game's process is known — by
|
||||
then it has a window — or at the session's end if that comes first, `IAdvancedHardware.ReadSessionFacts` runs on a
|
||||
pool thread: asking the driver for a profile takes some hundred milliseconds. The finalize waits at most five
|
||||
seconds for a read still in flight and stores the session without its facts rather than hold it. A read that
|
||||
throws costs the facts, never the session.
|
||||
- **Which display is the game's** comes from Windows, not from the game: `WindowGeometryProbe.MonitorDeviceOf` — the
|
||||
monitor the process's largest visible window is on, as its GDI device name — which the reader hands to
|
||||
`FlNvSessionDisplay`. No window, or a display another adapter drives: the session's display facts are absent.
|
||||
- **The context reaches the crash file as it changes** (chunk 10), from `IAdvancedHardware.Latest` — a read of one
|
||||
reference on the capture loop's task — so a recovered session keeps its machine facts, its sources and its
|
||||
directory of series.
|
||||
- **A session recorded with the option on always stores a row**, if only one that says every source is `Unknown`:
|
||||
no row means "the option was off when this was recorded", which the page (PR-7) shows as such.
|
||||
|
||||
What elevation adds changed with this: an Agent running as administrator with PawnIO reads the processor, memory
|
||||
and motherboard groups in a session with the option on. The texts that state what the admin mode adds say so —
|
||||
Disclaimer 2.15 §5 and §5A (the owner's answer of 2026-11-11), the admin mode's disclosure (`agent-admin-dialog/2`),
|
||||
Settings, the first run, the guide and `LIMITATIONS.md` — and Privacy Policy 2.15 names what is read and stored.
|
||||
|
||||
### What belongs to what
|
||||
|
||||
| Scope | What it is | Stored | Shown |
|
||||
|---|---|---|---|
|
||||
| `MachineFact` | true of the PC whatever is running: the card's firmware and architecture, the driver's package, what a display can do | `machine_profiles`, once per distinct set; a session points to its row | This PC |
|
||||
| `SessionFact` | true of one session: the game's display state, the settings the driver's profile for that game sets | `session_advanced.facts_json` | Session |
|
||||
| `Series`, during a session | a sensor of the PC sampled while the game ran | `sensor_blobs` (`adv.*`), statistics in `session_advanced.stats_json` | Session |
|
||||
| `Series`, with no session | the same sensor, read because the page is open | nowhere | This PC |
|
||||
|
||||
A third tab, **Sources**, lists every row of the inventory with its state on this PC — read, or N/A with the reason:
|
||||
not an NVIDIA card, the Agent is not administrator, PawnIO is not installed, the option was off when the session was
|
||||
recorded, the hook is not built, the route is refused, a vendor's licence. A PC without an NVIDIA card shows N/A for
|
||||
every `nvapi.` row; nothing is estimated in its place (FR-4.9).
|
||||
|
||||
### The trains
|
||||
|
||||
| Train | Release | What | Its gate |
|
||||
|---|---|---|---|
|
||||
| A | 0.1.0-beta.39 | read by the Agent only — NVAPI and LibreHardwareMonitor — storage, the page. **Nothing changes in code loaded into a game** | this section |
|
||||
| B | 0.1.0-beta.40 | inside the game: more fields of the Streamline and FidelityFX calls already hooked, and new hooks on functions `sl.interposer.dll` **exports** (`17_HOOK_ENGINE` §Hook inventory's ⏳ rows); shared-memory layout 5 | a plan of its own; overhead measured |
|
||||
| C | 0.1.0-beta.41 | Reflex latency per frame | a spike, then the owner's go or no |
|
||||
| D | 0.1.0-beta.42 | the Streamline feature state behind `slGetFeatureFunction` — DLSS frame generation's, DLSS's, Reflex's | a spike, then the owner's go or no |
|
||||
|
||||
Rules 4 and 5, the hook inventory, the measured overhead and the anti-cheat guard bind B, C and D exactly as they bind
|
||||
every hook. `sl::Constants` is read without its camera position, axes and matrices: where the camera is, is where the
|
||||
player is (rule 4). NGX stays closed by its licence (`17_HOOK_ENGINE` §NGX).
|
||||
|
||||
**Train D re-examines a refusal; it does not lift it.** `handoff/history/p0-queue-1-6.md` refused, on five grounds,
|
||||
hooking `slGetFeatureFunction` and patching the function it returns. The route to try is a different one:
|
||||
`slGetFeatureFunction` is itself an export (`vendor-exports.json`), so its hook is an ordinary inventory row, and
|
||||
what it hands back could be a wrapper for a fixed list of names instead of a patch at an address learned at run time
|
||||
— which would answer grounds 1 to 4, and turn ground 5 into "measured only when injected at launch". Two things it
|
||||
raises are the owner's: replacing the pointer the game receives is a **write**, which rule 4 forbids as written; and
|
||||
a wrapper must outlive the Overlay's own unhook. If the spike cannot answer all of it, the route stays refused and
|
||||
the page says so.
|
||||
|
||||
### Left out, by name
|
||||
|
||||
Present in the vendored `nvapi.h`, readable from the Agent, and not in the inventory — each is either not a
|
||||
measurement of how a game runs or exists on professional cards only: ECC status and errors, NVLINK, illumination
|
||||
(the card's lighting zones), licensable features, virtualization and GSP information, Quadro status, VR-ready data,
|
||||
the IRQ and bus slot numbers, logical GPUs and SLI state, HDCP support, scan-out configuration, the colour and
|
||||
info-frame controls. `NvAPI_DISP_GetTiming` calculates a timing from an input and reads nothing.
|
||||
`NV_GET_ADAPTIVE_SYNC_DATA`'s last-flip count and timestamp mean nothing sampled once a second.
|
||||
`NvAPI_GPU_ClientRegisterForUtilizationSampleUpdates` registers a callback, which is not a read.
|
||||
|
||||
### The inventory
|
||||
|
||||
One row per entry of `AdvancedMetricCatalog`, in its order; `AdvancedMetricCatalogTests` fails when this table and
|
||||
the catalog differ in either direction. **Reach** is where a value can be read from, or why it is not read: `Agent`
|
||||
(the Agent's own process), `AgentElevated` (the same, as administrator with PawnIO), `HookedCall` (an argument of a
|
||||
call the Overlay already hooks — Train B), `NewHook` (a hook that is not built — Train B), `Spike` (Trains C and D),
|
||||
`Refused`, `Deferred`, `Identifier` (D104), `PlayerState` (rule 4), `Licence`, `NotInHeaders`. Only the first two are
|
||||
read by a build of Train A.
|
||||
|
||||
**NVAPI, the graphics card: facts**
|
||||
|
||||
| Id | What it is | Scope | Source | Reach | Unit |
|
||||
|---|---|---|---|---|---|
|
||||
| `nvapi.gpu.type` | Integrated or discrete graphics | MachineFact | Nvapi | Agent | Text |
|
||||
| `nvapi.gpu.system_type` | Laptop or desktop, as the driver sees the PC | MachineFact | Nvapi | Agent | Text |
|
||||
| `nvapi.gpu.external` | The card is an external one | MachineFact | Nvapi | Agent | Flag |
|
||||
| `nvapi.gpu.bus_type` | The bus the card sits on | MachineFact | Nvapi | Agent | Text |
|
||||
| `nvapi.gpu.pci_ids` | PCI device, subsystem and revision ids - the model, not the unit | MachineFact | Nvapi | Agent | Text |
|
||||
| `nvapi.gpu.vbios_version` | Video BIOS version | MachineFact | Nvapi | Agent | Text |
|
||||
| `nvapi.gpu.architecture` | Chip architecture, implementation and revision | MachineFact | Nvapi | Agent | Text |
|
||||
| `nvapi.gpu.core_count` | Graphics cores | MachineFact | Nvapi | Agent | Count |
|
||||
| `nvapi.gpu.rt_cores` | Ray-tracing cores | MachineFact | Nvapi | Agent | Count |
|
||||
| `nvapi.gpu.tensor_cores` | Tensor cores | MachineFact | Nvapi | Agent | Count |
|
||||
| `nvapi.gpu.ram_bus_width` | Width of the card's memory bus | MachineFact | Nvapi | Agent | Bits |
|
||||
| `nvapi.gpu.clock_base_core` | Base core clock | MachineFact | Nvapi | Agent | Megahertz |
|
||||
| `nvapi.gpu.clock_base_memory` | Base memory clock | MachineFact | Nvapi | Agent | Megahertz |
|
||||
| `nvapi.gpu.clock_boost_core` | Boost core clock | MachineFact | Nvapi | Agent | Megahertz |
|
||||
| `nvapi.gpu.clock_boost_memory` | Boost memory clock | MachineFact | Nvapi | Agent | Megahertz |
|
||||
| `nvapi.gpu.temp_default_max` | The core sensor's default maximum temperature | MachineFact | Nvapi | Agent | Celsius |
|
||||
|
||||
**NVAPI, the card's memory**
|
||||
|
||||
| Id | What it is | Scope | Source | Reach | Unit |
|
||||
|---|---|---|---|---|---|
|
||||
| `nvapi.vram.dedicated` | Dedicated video memory on the card | MachineFact | Nvapi | Agent | Mebibytes |
|
||||
| `nvapi.vram.dedicated_available` | Dedicated video memory available for surfaces | MachineFact | Nvapi | Agent | Mebibytes |
|
||||
| `nvapi.vram.system` | System memory the driver reserved at load | MachineFact | Nvapi | Agent | Mebibytes |
|
||||
| `nvapi.vram.shared` | Shared system memory the driver may commit | MachineFact | Nvapi | Agent | Mebibytes |
|
||||
| `nvapi.vram.framebuffer_physical` | Physical frame buffer size | MachineFact | Nvapi | Agent | Mebibytes |
|
||||
| `nvapi.vram.framebuffer_virtual` | Virtual frame buffer size | MachineFact | Nvapi | Agent | Mebibytes |
|
||||
| `nvapi.vram.available` | Dedicated video memory available now, all programs | Series | Nvapi | Agent | Mebibytes |
|
||||
| `nvapi.vram.in_use` | Dedicated video memory in use now, all programs: available for surfaces less available now | Series | Nvapi | Agent | Mebibytes |
|
||||
| `nvapi.vram.evictions_size` | Memory released by evictions since the driver loaded | Series | Nvapi | Agent | Mebibytes |
|
||||
| `nvapi.vram.eviction_count` | Evictions from dedicated video memory since the driver loaded | Series | Nvapi | Agent | Count |
|
||||
| `nvapi.vram.promotions_size` | Memory moved in by promotions since the driver loaded | Series | Nvapi | Agent | Mebibytes |
|
||||
| `nvapi.vram.promotion_count` | Promotions into dedicated video memory since the driver loaded | Series | Nvapi | Agent | Count |
|
||||
|
||||
**NVAPI, the card over time**
|
||||
|
||||
| Id | What it is | Scope | Source | Reach | Unit |
|
||||
|---|---|---|---|---|---|
|
||||
| `nvapi.load.framebuffer` | Frame-buffer (memory controller) utilisation | Series | Nvapi | Agent | Percent |
|
||||
| `nvapi.load.video` | Video-engine utilisation | Series | Nvapi | Agent | Percent |
|
||||
| `nvapi.load.bus` | Bus-interface utilisation | Series | Nvapi | Agent | Percent |
|
||||
| `nvapi.clock.video` | Video clock | Series | Nvapi | Agent | Megahertz |
|
||||
| `nvapi.pstate` | The card's current performance state (P-state id) | Series | Nvapi | Agent | Count |
|
||||
| `nvapi.temp.board` | Board ambient temperature, where the card has the sensor | Series | Nvapi | Agent | Celsius |
|
||||
| `nvapi.temp.power_supply` | The card's power-supply temperature, where it has the sensor | Series | Nvapi | Agent | Celsius |
|
||||
| `nvapi.limit.ac_battery` | Held back by a switch to battery on the tick: 100 or 0 | Series | Nvapi | Agent | Percent |
|
||||
| `nvapi.limit.api` | Held back at a program's request on the tick: 100 or 0 | Series | Nvapi | Agent | Percent |
|
||||
| `nvapi.limit.insufficient_power` | Held back by a missing power connector on the tick: 100 or 0 | Series | Nvapi | Agent | Percent |
|
||||
| `nvapi.encoder.sessions` | Active hardware-encoder sessions, all programs | Series | Nvapi | Agent | Count |
|
||||
| `nvapi.encoder.fps` | Average encoding rate of the active sessions | Series | Nvapi | Agent | FramesPerSecond |
|
||||
| `nvapi.encoder.latency` | Average encoding latency | Series | Nvapi | Agent | Microseconds |
|
||||
|
||||
**NVAPI, the driver**
|
||||
|
||||
| Id | What it is | Scope | Source | Reach | Unit |
|
||||
|---|---|---|---|---|---|
|
||||
| `nvapi.driver.package` | Game Ready, Studio or an RTX enterprise branch | MachineFact | Nvapi | Agent | Text |
|
||||
| `nvapi.driver.dch` | The driver is a DCH package | MachineFact | Nvapi | Agent | Flag |
|
||||
| `nvapi.driver.base_branch` | The driver's base branch | MachineFact | Nvapi | Agent | Text |
|
||||
| `nvapi.driver.interface_version` | NVAPI's own interface version | MachineFact | Nvapi | Agent | Text |
|
||||
| `nvapi.driver.chipset` | Chipset vendor and name, as the driver reports them | MachineFact | Nvapi | Agent | Text |
|
||||
| `nvapi.driver.global_profile` | Every setting of the driver's global profile, read-only | MachineFact | Nvapi | Agent | Table |
|
||||
| `nvapi.session.driver_profile` | The settings the driver's profile for this game sets itself, read-only | SessionFact | Nvapi | Agent | Table |
|
||||
|
||||
**NVAPI, displays**
|
||||
|
||||
| Id | What it is | Scope | Source | Reach | Unit |
|
||||
|---|---|---|---|---|---|
|
||||
| `nvapi.display.hdr_formats` | HDR formats a display accepts: HDR10, HDR10+, HDR10+ Gaming, Dolby Vision, EDR | MachineFact, one per device | Nvapi | Agent | Text |
|
||||
| `nvapi.display.luminance_max` | A display's maximum luminance for HDR content | MachineFact, one per device | Nvapi | Agent | Nits |
|
||||
| `nvapi.display.luminance_min` | Its minimum luminance | MachineFact, one per device | Nvapi | Agent | Nits |
|
||||
| `nvapi.display.luminance_max_frame_average` | Its maximum frame-average light level | MachineFact, one per device | Nvapi | Agent | Nits |
|
||||
| `nvapi.display.vrr_support` | Variable refresh: supported, G-SYNC module or adaptive sync, ULMB, usable at the current mode | MachineFact, one per device | Nvapi | Agent | Text |
|
||||
| `nvapi.display.adaptive_sync_off` | Adaptive sync is switched off on the display | MachineFact, one per device | Nvapi | Agent | Flag |
|
||||
| `nvapi.display.max_frame_interval` | The longest frame interval adaptive sync is set to hold | MachineFact, one per device | Nvapi | Agent | Microseconds |
|
||||
| `nvapi.session.vrr_enabled` | Variable refresh was active on the game's display | SessionFact | Nvapi | Agent | Flag |
|
||||
| `nvapi.session.vrr_requested` | Variable refresh was requested for it | SessionFact | Nvapi | Agent | Flag |
|
||||
| `nvapi.session.vrr_possible` | Variable refresh was possible on it | SessionFact | Nvapi | Agent | Flag |
|
||||
| `nvapi.session.vrr_display_mode` | The display itself was in variable-refresh mode | SessionFact | Nvapi | Agent | Flag |
|
||||
| `nvapi.session.source_colorspace` | The colour space the game presented in, as the driver reports it for the process | SessionFact | Nvapi | Agent | Text |
|
||||
|
||||
**LibreHardwareMonitor, the graphics card (every vendor, unelevated)**
|
||||
|
||||
| Id | What it is | Scope | Source | Reach | Unit |
|
||||
|---|---|---|---|---|---|
|
||||
| `lhm.gpu.temperature` | Every temperature sensor of the card | Series, one per device | Lhm | Agent | Celsius |
|
||||
| `lhm.gpu.load` | Every load of the card: its engines, its bus, its memory controller | Series, one per device | Lhm | Agent | Percent |
|
||||
| `lhm.gpu.memory` | The card's memory counters: total, free, used, Direct3D dedicated and shared | Series, one per device | Lhm | Agent | Mebibytes |
|
||||
| `lhm.gpu.clock` | Every clock of the card | Series, one per device | Lhm | Agent | Megahertz |
|
||||
| `lhm.gpu.power` | Every power reading of the card | Series, one per device | Lhm | Agent | Watts |
|
||||
| `lhm.gpu.fan` | Every fan of the card | Series, one per device | Lhm | Agent | Rpm |
|
||||
| `lhm.gpu.fan_control` | Each fan's duty | Series, one per device | Lhm | Agent | Percent |
|
||||
| `lhm.gpu.voltage` | Every voltage of the card | Series, one per device | Lhm | Agent | Volts |
|
||||
| `lhm.gpu.current` | Every current of the card | Series, one per device | Lhm | Agent | Amperes |
|
||||
| `lhm.gpu.throughput` | PCI Express traffic to and from the card | Series, one per device | Lhm | Agent | BytesPerSecond |
|
||||
|
||||
**LibreHardwareMonitor through PawnIO (the Agent as administrator, D103)**
|
||||
|
||||
| Id | What it is | Scope | Source | Reach | Unit |
|
||||
|---|---|---|---|---|---|
|
||||
| `lhm.cpu.temperature` | Processor temperatures: the package and each core | Series, one per device | Lhm | AgentElevated | Celsius |
|
||||
| `lhm.cpu.load` | Processor load: the total and each core | Series, one per device | Lhm | AgentElevated | Percent |
|
||||
| `lhm.cpu.clock` | Each core's clock, and the bus clock | Series, one per device | Lhm | AgentElevated | Megahertz |
|
||||
| `lhm.cpu.power` | Processor power: the package, the cores | Series, one per device | Lhm | AgentElevated | Watts |
|
||||
| `lhm.cpu.voltage` | Processor voltages | Series, one per device | Lhm | AgentElevated | Volts |
|
||||
| `lhm.board.model` | The motherboard's maker and model | MachineFact | Lhm | AgentElevated | Text |
|
||||
| `lhm.board.sensor_chip` | The board's sensor chip | MachineFact | Lhm | AgentElevated | Text |
|
||||
| `lhm.board.temperature` | The board's temperature sensors | Series, one per device | Lhm | AgentElevated | Celsius |
|
||||
| `lhm.board.fan` | Each fan header's speed | Series, one per device | Lhm | AgentElevated | Rpm |
|
||||
| `lhm.board.fan_control` | Each fan header's duty | Series, one per device | Lhm | AgentElevated | Percent |
|
||||
| `lhm.board.voltage` | The board's voltage rails | Series, one per device | Lhm | AgentElevated | Volts |
|
||||
| `lhm.memory.modules` | The memory modules: size, speed, maker's part name - never a serial number | MachineFact | Lhm | AgentElevated | Table |
|
||||
| `lhm.memory.load` | Memory in use: physical and virtual | Series, one per device | Lhm | AgentElevated | Percent |
|
||||
| `lhm.memory.temperature` | Each memory module's temperature, where it has a sensor | Series, one per device | Lhm | AgentElevated | Celsius |
|
||||
|
||||
**What the Agent could reach and does not**
|
||||
|
||||
| Id | What it is | Scope | Source | Reach | Unit |
|
||||
|---|---|---|---|---|---|
|
||||
| `lhm.psu` | Power-supply sensors: reading them makes the library search every USB device | MachineFact | Lhm | Refused | Table |
|
||||
| `lhm.controller` | Fan-controller sensors: the same search of USB devices | MachineFact | Lhm | Refused | Table |
|
||||
| `lhm.battery` | Battery sensors | MachineFact | Lhm | Deferred | Table |
|
||||
| `lhm.storage.models` | The drives' model names: the library cannot list drives without touching removable ones | MachineFact | Lhm | Deferred | Table |
|
||||
| `lhm.storage.temperature` | Each drive's temperature: the same, so the storage group is not opened | Series, one per device | Lhm | Deferred | Celsius |
|
||||
| `nvapi.gpu.board_serial` | The card's board serial number | MachineFact | Nvapi | Identifier | Text |
|
||||
| `nvapi.gpu.uuid` | The card's unique id | MachineFact | Nvapi | Identifier | Text |
|
||||
| `nvapi.display.edid` | A display's EDID block, which carries its serial number | MachineFact, one per device | Nvapi | Identifier | Text |
|
||||
| `nvapi.encoder.session_processes` | Which programs are encoding | Series | Nvapi | Identifier | Table |
|
||||
| `nvapi.gpu.power` | Card power through NVAPI (LibreHardwareMonitor reads it) | Series | Nvapi | NotInHeaders | Watts |
|
||||
| `nvapi.gpu.fan_duty` | Fan duty through NVAPI (LibreHardwareMonitor reads it) | Series | Nvapi | NotInHeaders | Percent |
|
||||
| `nvapi.gpu.voltage` | Card voltage through NVAPI (LibreHardwareMonitor reads it) | Series | Nvapi | NotInHeaders | Volts |
|
||||
| `nvapi.gpu.ram_type` | The card's memory type | MachineFact | Nvapi | NotInHeaders | Text |
|
||||
|
||||
**Inside the game: calls the Overlay already hooks**
|
||||
|
||||
| Id | What it is | Scope | Source | Reach | Unit |
|
||||
|---|---|---|---|---|---|
|
||||
| `sl.dlss.output_size` | The output size the game gave DLSS | SessionFact | Streamline | HookedCall | Text |
|
||||
| `sl.dlss.presets` | The DLSS model preset per quality mode | SessionFact | Streamline | HookedCall | Text |
|
||||
| `sl.dlss.hdr_input` | The game told DLSS its colour buffers are HDR | SessionFact | Streamline | HookedCall | Flag |
|
||||
| `sl.dlss.auto_exposure` | DLSS auto-exposure | SessionFact | Streamline | HookedCall | Flag |
|
||||
| `sl.dlss.alpha_upscaling` | DLSS upscales the alpha channel | SessionFact | Streamline | HookedCall | Flag |
|
||||
| `sl.dlss.exposure` | Pre-exposure and exposure scale given to DLSS | SessionFact | Streamline | HookedCall | Text |
|
||||
| `ffx.upscale.sharpening` | FSR sharpening: on or off, and its strength | SessionFact | FidelityFx | HookedCall | Text |
|
||||
| `ffx.upscale.jitter` | The jitter offsets the game gave FSR | SessionFact | FidelityFx | HookedCall | Text |
|
||||
| `ffx.upscale.exposure` | Pre-exposure given to FSR | SessionFact | FidelityFx | HookedCall | Text |
|
||||
| `ffx.upscale.depth` | Near and far planes and field of view given to FSR | SessionFact | FidelityFx | HookedCall | Text |
|
||||
| `ffx.upscale.flags` | The flags of the game's FSR dispatch | SessionFact | FidelityFx | HookedCall | Text |
|
||||
| `ffx.upscale.frame_time_delta` | The frame time the game reported to FSR | Series | FidelityFx | HookedCall | Milliseconds |
|
||||
| `ffx.memory_usage` | FSR's own video memory, when the game asks it | Series | FidelityFx | HookedCall | Mebibytes |
|
||||
|
||||
**Inside the game: hooks that are not built**
|
||||
|
||||
| Id | What it is | Scope | Source | Reach | Unit |
|
||||
|---|---|---|---|---|---|
|
||||
| `sl.constants.jitter` | The jitter offsets the game gave Streamline | SessionFact | Streamline | NewHook | Text |
|
||||
| `sl.constants.motion_vectors` | Motion-vector scale, and whether they are 3D, dilated, jittered | SessionFact | Streamline | NewHook | Text |
|
||||
| `sl.constants.depth` | Near and far planes, and whether depth is inverted | SessionFact | Streamline | NewHook | Text |
|
||||
| `sl.constants.projection` | Field of view, aspect ratio, orthographic or not | SessionFact | Streamline | NewHook | Text |
|
||||
| `sl.constants.resets` | How often the game reset the upscaler's history | SessionFact | Streamline | NewHook | Count |
|
||||
| `sl.feature.versions` | Each Streamline feature's version and its NGX model version | SessionFact | Streamline | NewHook | Table |
|
||||
| `sl.feature.requirements` | What each Streamline feature requires: operating system, driver, buffers | SessionFact | Streamline | NewHook | Table |
|
||||
| `sl.init.preferences` | The preferences the game started Streamline with | SessionFact | Streamline | NewHook | Text |
|
||||
| `ffx.framegen.config` | The game's FSR frame-generation configuration | SessionFact | FidelityFx | NewHook | Text |
|
||||
| `sl.constants.camera` | Camera position, axes and matrices | SessionFact | Streamline | PlayerState | Text |
|
||||
|
||||
**Inside the game: routes a spike decides**
|
||||
|
||||
| Id | What it is | Scope | Source | Reach | Unit |
|
||||
|---|---|---|---|---|---|
|
||||
| `nvapi.reflex.mode` | Reflex: low-latency mode, boost, the frame-rate limit | SessionFact | Nvapi | Spike | Text |
|
||||
| `nvapi.reflex.sleep_status` | What the driver's low-latency state is | SessionFact | Nvapi | Spike | Text |
|
||||
| `nvapi.reflex.frame_report` | Latency per frame: simulation, render submit, present, driver, OS queue, GPU render | Series, one per device | Nvapi | Spike | Microseconds |
|
||||
| `sl.dlss.optimal_settings` | The render size and sharpness DLSS recommends | SessionFact | Streamline | Spike | Text |
|
||||
| `sl.dlss.vram_estimate` | DLSS's own estimate of its video memory | Series | Streamline | Spike | Mebibytes |
|
||||
| `sl.dlssg.options` | DLSS frame generation: mode, frames to generate | SessionFact | Streamline | Spike | Text |
|
||||
| `sl.dlssg.state` | DLSS frame generation: status, the most frames it can generate | SessionFact | Streamline | Spike | Text |
|
||||
| `sl.dlssg.frames_presented` | Frames DLSS frame generation presented, by its own count | Series | Streamline | Spike | Count |
|
||||
| `sl.dlssg.vram_estimate` | DLSS frame generation's estimate of its video memory | Series | Streamline | Spike | Mebibytes |
|
||||
| `sl.dlssd.options` | Ray reconstruction's options | SessionFact | Streamline | Spike | Text |
|
||||
| `sl.nis.options` | NVIDIA Image Scaling's options | SessionFact | Streamline | Spike | Text |
|
||||
| `sl.deepdvc.options` | RTX Dynamic Vibrance's options | SessionFact | Streamline | Spike | Text |
|
||||
| `sl.reflex.state` | Reflex through Streamline: availability and its frame reports | SessionFact | Streamline | Spike | Table |
|
||||
| `sl.pcl.markers` | PC-latency markers the game sets | Series | Streamline | Spike | Count |
|
||||
|
||||
**Closed by a licence**
|
||||
|
||||
| Id | What it is | Scope | Source | Reach | Unit |
|
||||
|---|---|---|---|---|---|
|
||||
| `ngx.parameters` | NGX parameters: the quality value, the DLSS hints | SessionFact | Ngx | Licence | Table |
|
||||
| `xess.options` | XeSS's options | SessionFact | Xess | Licence | Table |
|
||||
| `sl.nvperf` | Streamline's performance counters (NSight Perf SDK licence) | Series | Streamline | Licence | Table |
|
||||
@@ -1027,7 +1027,7 @@ injected or layered**.
|
||||
If `OpenProcess` with the needed rights fails (protected process, higher integrity), do **not** escalate creatively. Report "cannot attach" and offer Tier-2. Never attempt to acquire privileges beyond running the Agent elevated at the user's explicit request.
|
||||
|
||||
> **The explicit request exists since beta.10 (owner decision D34, 2026-09-27): the admin mode.** An option off by default,
|
||||
> turned on through a versioned disclosure (`Safety_AdminMode_*`, `agent-admin-dialog/1`) that states what it adds, what it
|
||||
> turned on through a versioned disclosure (`Safety_AdminMode_*`, `agent-admin-dialog/2` *(`/1` until 2026-11-11, when Advanced metrics widened what the option adds — D101)*) that states what it adds, what it
|
||||
> does not change, how Windows asks and the risk of a per-user install; then **Windows asks at every start of the Agent**
|
||||
> (`01_ARCHITECTURE` ADR-9). What it does NOT do, each held by code rather than by this paragraph:
|
||||
>
|
||||
|
||||
@@ -1860,6 +1860,11 @@ Moved verbatim, in this order.
|
||||
| M9 ✅ | **Closed 2026-08-02 by a decision.** The old file/module detection does not exist in this repository and the owner confirmed there is no copy elsewhere, so **"build a minimal static-hint detector as the measurement baseline" is now P0 item 3** (`15_ROADMAP`). It needs no guard and no injection. Until it exists, ADR-7's headline claim stays out of the README rather than being asserted unmeasured |
|
||||
| M10 ❓ | **§CPU — is the CPU temperature this build reads the right sensor, and does it read at all on the owner's machine?** `LhmCpuTemperatureReader` (2026-09-21) opens a CPU-only LibreHardwareMonitor `Computer` when the Agent is elevated AND `PawnIo.IsInstalled`, takes the package sensor (`CPU Package` / `Core (Tctl/Tdie)`) and falls back to the hottest core. It was written against LHM's sensor names and a fake `ILhmComputer`; **no elevated run with PawnIO has been taken.** | **The measurement is one session:** Agent elevated, PawnIO installed, a five-minute capture with HWiNFO or Ryzen Master open beside it. Pre-committed: `max_cpu_temp` within 3 °C of the reference's package peak → keep; a core sensor picked where a package sensor exists, or a reading tens of degrees off (a distance-to-TjMax sensor mistaken for a temperature) → fix `Pick` and re-run; nothing read at all → `cpu_temp` stays N/A and `legal/ACCURACY.md` says processor temperature is not measured. CPU **load** and memory are not in question: `TheRealCountersAnswerOnThisMachine` reads them on every gate run. |
|
||||
| M11 🅓 | **The game's VRAM budget and `budget_exceeded_pct` (FR-4.5's second half), 2026-10-03.** D43 reads the game's usage from outside (the `GPU Process Memory` counters); the budget the OS grants the process is what DXGI's `QueryVideoMemoryInfo` returns to the *calling* process (§M7), so only an in-process call — the Overlay's background thread, which today only checks for a stop — or `D3DKMTQueryStatistics`' `PROCESS_SEGMENT_GROUP` query (documented "Reserved for system use") could read it. **Deferred by decision:** neither is built; `vram_budget_exceeded_pct` stays NULL and the budget N/A, and the in-process route would change what the Disclaimer says the Overlay's thread does. Reopening it needs that decision, not a measurement. | — |
|
||||
| M12 ❓ | **Advanced metrics — which NVAPI rows answer on real hardware (D101, 2026-11-11).** `18_GPU_VENDOR_APIS` §The inventory lists sixty `nvapi.` rows whose reach is `Agent`. They are declared in the vendored headers; **none has been called on a GPU**, and CI has no driver, so it never takes that branch. Unknown per row: whether the RTX 5080 on the current driver answers or returns `NVAPI_NOT_SUPPORTED` (the memory-temperature target already does not exist on that card). | **The measurement is the bridge's probe on the owner's PC**, then the page itself (the release's owner-only item). Pre-committed: a call that does not answer → that row is N/A with NVAPI's own status as the reason, and nothing is put in its place; a call that hangs or faults twice → the row is off for the session (§Runtime policy); a value that contradicts the vendor's own tool → the row is withheld until it is explained. **Half answered the same day, by the bridge's own test on the dev box** (ctest `fl_nvapi_bridge`, AVAILABLE branch; RTX 5080): every fact answers (`present = 0xFFFFF`), eight of ten live groups answer (`0x33F` — no board and no power-supply temperature sensor on this card: N/A, by the first pre-committed outcome), the display answers its four groups, the global profile lists 24 settings; figures in `18_GPU_VENDOR_APIS` §L3. **Still open**: the same values on the page beside the vendor's own tool, and the session rows (`nvapi.session.*`), which need a game. **And one thing seen once and not explained**: in one test run of about a dozen that day, `FlNvReadLive` came back with no field at all although `FlNvReadFacts`, a moment earlier in the same process, had answered everything; nine further runs did not show it. A handle the driver invalidated is the usual cause of that shape, and nothing here re-enumerates after `FlNvInit`. Pre-committed for the reader that owns the thread: two readings in a row with no field → release and initialise the bridge again, once, and say so in the log; if that does not bring the fields back the layer is off for the session, as any layer that fails twice is. |
|
||||
| M13 ❓ | **Advanced metrics — LibreHardwareMonitor's CPU, memory, motherboard and storage groups, elevated, with PawnIO (D103, 2026-11-11).** Never opened by any build: §M10's elevated run has not been taken either, and this is a larger surface — a sensor chip on the LPC bus, the embedded controller, SPD over SMBus, SMART. Unknown: whether each group opens on the owner's board, what a refresh costs, whether opening the storage group touches removable drives (this PC once had a failing USB drive), and whether any group enables a privilege (`PrivilegeFootprintTests`). | **One elevated run with the probe verb, before the option exists.** Pre-committed: the storage group cannot be opened without touching removable drives → `lhm.storage.*` stays N/A in beta.39 and its reach reads `Deferred`; a node that throws twice → skipped for the session; the Agent above 1% of one core or 150 MB with the option on (NFR-2) → the slow groups are read less often or dropped before the release; a privilege enabled by a group → that group is not opened, and the owner is asked. **Two of the four answered 2026-11-11, before the option exists.** (1) **Storage: not opened, by the first outcome.** LibreHardwareMonitor 0.9.6's `StorageGroup` lists every drive through DiskInfoToolkit's `ReloadStorages` with no filter by bus and follows drives plugged in later — it cannot be opened without touching removable drives. `lhm.storage.*` reads `Deferred`, and `LhmGroups` has no member for it. (2) **Cost, unelevated, measured with `probe-advanced`** on the dev box: one refresh of the graphics-card group alone is 14 ms of processor time (62 ms elapsed) — 1.4% of one core at one a second, above NFR-2 — and one NVAPI read 0.4 ms. By the third outcome the sensor library is read every fifth tick (0.28%). **Still open, and the owner's**: the same probe as administrator with PawnIO — whether the processor, memory and motherboard groups open on this board, what they cost, and `PrivilegeFootprintTests`' new case on a token that holds the privileges (CI's does; the dev box's unelevated run passes by construction). |
|
||||
| M16 ❓ | **The L2 telemetry layer's cost — the first number, and it is above NFR-2 (found 2026-11-11, measuring something else).** `LhmTelemetrySource` refreshes LibreHardwareMonitor's graphics-card group once a second in every recorded session. `probe-advanced` measured that refresh, through the same library and the same group, at **14 ms of processor time** on the dev box (RTX 5080, 41 mapped sensors, about twenty of them the Direct3D engine nodes the library enumerates per card) — 1.4% of one core, where NFR-2 allows the whole Agent 1% during capture and `14_TESTING` §Hook overhead's Agent figure has never been measured. This is a measurement of the call, not yet of a session: L2's own poller was not instrumented. | **Measure L2 in a session** (the Agent's processor time over a ten-minute capture, telemetry at 1000 ms and at 2000 ms). Pre-committed: at or under 1% → this row closes with the number; above → the owner chooses between a slower default for `telemetry.interval_ms`, reading the sensors the layer keeps from NVAPI on NVIDIA cards (L3 already has most, at 0.4 ms), or amending NFR-2 to what is measured. Not decided here, and nothing about L2 changes in the Advanced-metrics train. |
|
||||
| M14 ❓ | **Reflex latency per frame — is there a route within rules 4 and 5? (Train C, 2026-11-11.)** `17_HOOK_ENGINE` §Memory / latency names hooks on `NvAPI_D3D_SetSleepMode` / `SetLatencyMarker` and a call to `NvAPI_D3D_GetLatency`. NVAPI resolves all three through `nvapi_QueryInterface` by id — they are not exports, so a hook on them is a patch at an address learned at run time, the class refused on 2026-08-09. The route to try first needs no hook: the Overlay's own background thread **calls** `GetLatency` with the device of the swap chain it already hooks, once a second (the call returns the last 64 frames' reports). Unknown: whether calling into the driver from that thread is safe on every device kind, what it costs, what it returns when the game never enabled Reflex, and what it means for the Disclaimer's sentence about that thread. | **A spike on `hook-harness` and a stub first, then one real title.** Pre-committed: no route without a patch at a run-time address or a loader-lock call on the game's thread → Reflex stays N/A and the page says why; overhead above NFR-1 → the same. The owner says go or no on the spike's result. |
|
||||
| M15 ❓ | **The Streamline state behind `slGetFeatureFunction` — re-examined, not reopened (Train D, 2026-11-11).** The owner asked for the refusal in `handoff/history/p0-queue-1-6.md` to be looked at again. `18_GPU_VENDOR_APIS` §The trains states the route to try (hook the export, hand back a wrapper for a fixed list of names) and what it raises: the wrapper is a write to what the game receives, which rule 4 forbids as written; a wrapper must outlive the Overlay's unhook; a game that fetched its functions before the hook existed is never seen. | **A written design against each of the five grounds, then a spike.** Pre-committed: any ground unanswered → the route stays refused, and `sl.dlssg.*`, `sl.reflex.*` and the rest of that block read N/A with "refused" as the reason. Proceeding needs the owner's amendment of rule 4, asked with the rule quoted. |
|
||||
| M10 ✅ | ~~PDH `\GPU Engine(*)\Utilization Percentage` summed across engines does not reproduce the Task Manager figure the doc invokes. Decide what we actually report and label it accordingly~~ **Decided 2026-09-09 (PR-E1): L1 does not read the engine counters at all.** `LoadPct` is L2's vendor-reported `GPU Core` load (measured ✓ on NVIDIA, §M5 row R1) and is labelled *GPU load (vendor)* wherever it is shown; on a machine without L2 the field is N/A, never a sum that is not the number the user expects. What L1 does read from PDH is one counter, `\GPU Adapter Memory(luid_…_phys_0)\Dedicated Usage`, bound by LUID — the figure Task Manager labels "Dedicated GPU memory", measured 1301 MB at an idle desktop on the RTX 5080. Reopening this needs a measurement of `max(engine)` against Task Manager's own number, not a decision |
|
||||
|
||||
#### §M5 — the decision table, pre-committed 2026-09-03 BEFORE the first run
|
||||
|
||||
+108
-81
@@ -76,6 +76,7 @@ owner-only items stay below; the history of every train, the passed owner-only i
|
||||
| `§beta.34` | [`handoff/history/0.1.0-beta.34.md`](handoff/history/0.1.0-beta.34.md) |
|
||||
| `§beta.35` | [`handoff/history/0.1.0-beta.35.md`](handoff/history/0.1.0-beta.35.md) |
|
||||
| `§beta.36` | [`handoff/history/0.1.0-beta.36.md`](handoff/history/0.1.0-beta.36.md) |
|
||||
| `§beta.37` | [`handoff/history/0.1.0-beta.37.md`](handoff/history/0.1.0-beta.37.md) |
|
||||
| `§Owner-only`, an open item | [§Owner-only](#owner-only--no-pr-can-close-these) below |
|
||||
| `§Owner-only`, a passed item (3, 12, 14–19) | [`handoff/owner-only-passed.md`](handoff/owner-only-passed.md) |
|
||||
| `§Traps`, `§Two corrections carried forward` | [`handoff/traps.md`](handoff/traps.md) |
|
||||
@@ -83,100 +84,106 @@ owner-only items stay below; the history of every train, the passed owner-only i
|
||||
|
||||
---
|
||||
|
||||
## **START HERE** — 2026-11-11, 0.1.0-beta.37: the main line on .NET 11, what an alpha is now, and why no C# 15 yet
|
||||
## **START HERE** — 2026-11-11, 0.1.0-beta.38: Qodana Ultimate in two reports — and the next work is the owner's "Thông số nâng cao"
|
||||
|
||||
*Status is `docs/changelog/0.1.0-beta.37.md`; this is what no other file carries.* The owner, with two screenshots — a
|
||||
Qodana Ultimate licence in the JetBrains console, and the Qodana Cloud project's setup page: "Bạn có thể bắt đầu với phiên
|
||||
cải tiến cho .net 11 và set up cho qodana cho tất cả ngôn ngữ (gói ultimate) nhé." The session D92 had left for after
|
||||
.NET 11's release (2026-11-10), and Qodana for every language on the Ultimate licence. One plan, approved whole, in
|
||||
three parts: **beta.37** (#376 the move, #379 what an alpha is, #380 .NET 11's API and the C# 15 finding, and this
|
||||
release) → **alpha.4** → **Qodana Ultimate in two reports**. This section is the first part; the other two follow it on
|
||||
`main` the same way.
|
||||
*Status is `docs/changelog/0.1.0-beta.38.md`; this is what no other file carries.* This release closes the plan of
|
||||
2026-11-11 — **beta.37** → **alpha.4** → **Qodana Ultimate in two reports**. The plan was one session's, and its START
|
||||
HERE was moved whole: all three parts, the decisions D94–D100, the choices and the traps are
|
||||
[`handoff/history/0.1.0-beta.37.md`](handoff/history/0.1.0-beta.37.md) — the two Qodana sections are its last two.
|
||||
#384 moved the managed job to Qodana for .NET and settled what it reports; #385 added the C++ as a second report; this
|
||||
release ships the one change to shipped code that came of it: the App's link opener refuses anything but a web or a
|
||||
mail address.
|
||||
|
||||
**Decisions (asked while planning, do not re-ask):**
|
||||
### NEXT — the owner's request of 2026-11-11, for the session(s) after this one
|
||||
|
||||
- **D94 — the main line moves to .NET 11 now.** Asked whether the betas move or only alpha.4 — with
|
||||
`20_OPEN_QUESTIONS` §G's table quoted: two alphas on the released runtime and an owner's run of a hooked title first —
|
||||
the owner chose "Chuyển main sang .NET 11 ngay". Condition (a) of that table was **set aside, not met**;
|
||||
`12_BUILD` §The main line's .NET says what stood in for it, and owner-only item 34 is the run it asked for.
|
||||
- **D95 — Windows 10 22H2 is not blocked, and is stated as untested and unsupported** ("Vẫn chạy, ghi rõ không được hỗ
|
||||
trợ"). NFR-8 is amended; a processor needs SSE4.2 and POPCNT.
|
||||
- **D96 — C# 15 in the same release** ("Áp dụng cả C# 15 ngay trong beta.37"). The plan narrowed it in writing, and was
|
||||
approved with that: a construct only where the build, CodeQL and Qodana all read it.
|
||||
- **D97 — all three legal texts reworded** ("Sửa cả ba văn bản"): EULA 1.7, Disclaimer 2.14, Alpha notice 1.1. Their
|
||||
text was in the plan and approved with it.
|
||||
- **D98 — alpha.4, then the alpha line rests** until a newer .NET has a preview ("alpha.4 rồi nghỉ tới .NET 12
|
||||
Preview").
|
||||
- **The order**: beta.37 → alpha.4 first, Qodana after; and Qodana in **two reports from the start** (the third part's
|
||||
decision, D99).
|
||||
Sent while this session was still running, and recorded here as it was written:
|
||||
|
||||
**Choices made here:**
|
||||
> "Xong phiên này, bạn cập nhật (những) phiên tiếp theo với các phiên bản về Setting "Thông số nâng cao" hoặc tương tự
|
||||
> và hiển thị tại 1 navigation riêng, khai thác số liệu, dữ liệu, biểu đồ mức tối đa, toản bộ mà các header `.h` của
|
||||
> Streamline và NVAPI hoặc pawnIO có thể sử dụng và hiển thị nhé."
|
||||
|
||||
- **No C# 15 construct is used, although the owner asked for them.** The rule decided it, not a preference:
|
||||
ReSharper's engine, which Qodana runs, reads none of the four (`13_CI_CD` §C# 15 and the analyses, `spike-notes`
|
||||
§29). Unions would not have been the form in any case — the SDK's own CA1815 asks every union to hand-write its
|
||||
equality, and the shapes that wanted one are closed record hierarchies. What the release takes is API.
|
||||
- **.NET 11's `IHost.RunAsync` is accepted, not wrapped**: a failed background service now ends the Agent through its
|
||||
crash report. A catch there would hide a fault, and could not reproduce .NET 10's exit exactly either.
|
||||
- **A resting alpha says so in the build, not only in its notes**: the anti-cheat list reaches a user only inside a
|
||||
release, so an alpha nobody updates carries an ageing one. `FlAlphaLineRests` is stamped on both lines; the `alpha`
|
||||
branch sets it to false when it next tries a .NET.
|
||||
- **"A prerelease .NET" is said only by a build that runs on one**, read from the runtime's own description — the next
|
||||
preview alpha says it again with no change to the code.
|
||||
- **`release.yml` names the .NET 10 runtime `vpk` needs**, rather than relying on the hosted image carrying one.
|
||||
- **The Community Qodana job was kept alive across the move** by installing the SDK into its container — an interim;
|
||||
the Ultimate linter replaces the job in the third part.
|
||||
- **The 2026-10-31 forms stay where they read as well** (`json.AsSpan().TrimStart().StartsWith('[')` avoids a string):
|
||||
.NET 11's `char` overloads replaced a span only where the span was there for .NET 10's sake.
|
||||
That is: once this session is done, the following session or sessions — and their versions — are about a setting
|
||||
called *"Thông số nâng cao"* (advanced metrics) or similar, shown in **a navigation item of its own**, that exploits
|
||||
to the maximum the numbers, the data and the charts that the `.h` headers of **Streamline** and **NVAPI**, or
|
||||
**PawnIO**, make available.
|
||||
|
||||
**Measured on the way** (`spike-notes` §28 and §29): the gate on SDK 11.0.100 — two analyzer sites beyond RC3's
|
||||
twenty-one, both in tests written after the last alpha; `IHost.RunAsync` rethrowing, observed for the first time; the
|
||||
first delta across two runtime majors (372 of 443 files patched, 72.6 MB on the rehearsal); `main`'s first full CodeQL
|
||||
C# analysis on `net11.0` (1,221 of 1,221 files, the same 23 unresolved `Windows.Win32` types as on .NET 10); the
|
||||
SonarScanner 12.0.0 on the 11.0 runtime; InspectCode 2026.2.3.1 and 2026.3.0 against each C# 15 construct.
|
||||
**Nothing of it was designed or begun here.** It is a new task, and it starts the way every train does — a plan, with
|
||||
the owner's decisions asked while planning. What follows is this session's reading, not the owner's words:
|
||||
|
||||
**Traps met on the way:**
|
||||
- **An inventory comes first, from the headers in the tree**: `src/native/third_party/streamline`, `nvapi`,
|
||||
`fidelityfx`; and what LibreHardwareMonitorLib reads through PawnIO (CPU and board sensors — optional, elevated
|
||||
only). For each item: what it is, and **where it can be read from** — the Agent's own process (NVAPI through
|
||||
`FrameLedger.NvapiBridge`, LibreHardwareMonitor) or only inside the game, through a hook (Streamline).
|
||||
- **Anything read inside a game is a hook**, and the rules that govern hooks are not this feature's to bend: rules 4
|
||||
and 5, `17_HOOK_ENGINE` §Hook inventory, the overhead stated, the open S-series of `20_OPEN_QUESTIONS`; the
|
||||
anti-cheat guard and rule 2 untouched. Rule 6 governs any frame rate it shows beside frame generation, rule 7 any
|
||||
Yes/No it shows, and rule 8 says it calls nothing on the network.
|
||||
- **Questions that are the owner's**: on or off by default; what is stored in the ledger (a schema change, the size
|
||||
of a session) and what is shown live only; what a PC without an NVIDIA card shows (N/A, never a guess); whether
|
||||
the page asks for the elevation PawnIO needs; how many releases, and in what order.
|
||||
- **What a new page owes**: strings in `en`, `vi`, `ja`; `ACCESSIBILITY.md` §For contributors for the page and each
|
||||
chart; `LIMITATIONS.md` and the guide; `08_UI`.
|
||||
|
||||
- **A pull request's CodeQL C# run is an overlay analysis**: it extracts the changed files on top of `main`'s cached
|
||||
database, and its "scanned N out of N" is `main`'s baseline. #376 wrote "CodeQL reads `net11.0` whole" from one and
|
||||
was corrected, dated, two pull requests later with `main`'s own run. For anything the extractor has not met, dispatch
|
||||
`codeql.yml` on the branch (it takes `workflow_dispatch` since #380).
|
||||
- **`ShmDrainIntegrationTests.TheGuardInjectsTheOverlayAndTheReaderDrainsRealFrames` failed once on the dev box** —
|
||||
"our own harness must not start matching the blocklist mid-run": the guard's re-scan refused the harness in one gate
|
||||
run of five. The class passed three times in a row straight after and no guard code had changed; not looked into.
|
||||
- **A wiki page names no version** (`wiki-check`): "since 0.1.0-alpha.4" in `wiki/Releasing.md` was red. The guide's
|
||||
pages may.
|
||||
- **The runner queue**: with three workflows per pull request and a probe's pull request open beside the train,
|
||||
`check` waited about 25 minutes for a runner. Cancel a probe's runs once it has told what it can.
|
||||
- **A Bash heredoc halves the backslashes** of an inline Python regex — write the script with the Write tool.
|
||||
- **`x.Should().NotBeNull(); x!.Member`**: ReSharper reads the `!` as redundant (Qodana's one finding on #376) and the
|
||||
compiler wants it. Keep the value the assertion needs, not the object.
|
||||
- **CA2025** on a lambda that captures a `using` variable in a test: await inside a `try`, assert after.
|
||||
- **A local gate reseeds `%LOCALAPPDATA%\FrameLedger\rules`** while the owner's installed copy runs beside it: the
|
||||
files were hashed before and after every gate (identical each time — the repository's rules were the installed ones).
|
||||
#### Planned 2026-11-11, and approved by the owner — four trains, the first begun
|
||||
|
||||
**Owner-only:** item 34 — beta.37 on real hardware, a hooked session on .NET 11.0.0, and Windows 10 if a PC with it is
|
||||
at hand.
|
||||
The plan was made the same day, the owner's decisions asked while planning. **The design, the decisions D101–D108 and
|
||||
the inventory are [`18_GPU_VENDOR_APIS.md`](18_GPU_VENDOR_APIS.md) §Advanced metrics**; what follows is only what that
|
||||
section does not carry — the order, and what was asked.
|
||||
|
||||
### 0.1.0-alpha.4 — the fourth alpha, the same day, and the last for now (D98)
|
||||
- **The owner's four answers.** (1) Inside the game: **everything, in stages — and the refusal of 2026-08-09 is
|
||||
re-examined**, not taken as final. (2) **Stored in full with the session.** (3) **Off by default, and off means
|
||||
nothing more is read or stored**; the navigation item is hidden. (4) PawnIO: **the page says what is missing and
|
||||
links to the admin mode's setting** (D34); it never asks for the rights itself.
|
||||
- **Four trains, one release each, in this order**: **A** (0.1.0-beta.39) what the Agent can read — NVAPI,
|
||||
LibreHardwareMonitor — with storage and the page, **and nothing changed in code loaded into a game**; **B**
|
||||
(beta.40) inside the game, on calls already hooked and on functions Streamline exports, shared-memory layout 5;
|
||||
**C** (beta.41) Reflex latency, after a spike; **D** (beta.42) the Streamline state behind `slGetFeatureFunction`,
|
||||
after a spike. **Why this order**: A needs no hook, so it ships the page, the storage and the option first and
|
||||
every later train only fills rows; B is hooks of a kind already built; C and D are routes nobody has proven safe,
|
||||
and each ends in the owner's go or no.
|
||||
- **The approval covers train A whole** — its eight pull requests through the release. **B, C and D each begin with a
|
||||
plan of their own**, their decisions asked then. For D the owner will be asked one thing nothing else has needed:
|
||||
handing the game a wrapper in place of the function it asked for is a write, and rule 4 as written forbids it.
|
||||
- **Train A's pull requests**: (1) decisions, inventory, the catalog; (2) the NVAPI bridge's ABI 3 and the read-only
|
||||
gate; (3) LibreHardwareMonitor's groups and the shared reader, not yet composed; (4) the `.partial` chunks and
|
||||
schema 0023, produced by nobody yet; (5) the option goes live, with Privacy 2.15; (6) the pipe request and the
|
||||
App's feed; (7) the page, the navigation item, Ctrl+6; (8) the release. A setting and its guide text, a navigation
|
||||
item and its guide text, a schema script and its writer each land in ONE pull request — the guide tests, the
|
||||
viewer-mode test and the registry test are red otherwise.
|
||||
- **What the owner will be asked to run** (the release's owner-only item): the NVAPI rows on the RTX 5080 — CI has no
|
||||
driver and never takes that branch; one run as administrator with PawnIO, which is also the first there has ever
|
||||
been (`20_OPEN_QUESTIONS` §M10); the Agent's processor time and memory with the option on and off (NFR-2).
|
||||
- **A trap already paid for**: LibreHardwareMonitor's storage group may touch every drive when it opens, and this
|
||||
PC once had a failing USB drive. If the group cannot be opened without touching removable drives, storage stays
|
||||
N/A in beta.39 — decided before the first run, not after it. **It cannot (read in the library's source,
|
||||
2026-11-11), so it is not opened**: a drive's temperature reads N/A in beta.39, and the reason is on the page.
|
||||
- **Measure before composing.** `FrameLedger.CaptureHost probe-advanced` ran the reader on this PC before any Agent
|
||||
code used it, and found the sensor library's refresh at 14 ms of processor time — so the reader reads it every
|
||||
fifth tick. The same number says the telemetry layer every session already uses costs more than NFR-2 allows
|
||||
(`20_OPEN_QUESTIONS` §M16): **not this train's to fix, and the owner's to decide** — ask it when this train is out.
|
||||
|
||||
`alpha` takes main at this pull request — `v0.1.0-beta.37` and these notes, no other change — by a merge commit. **This
|
||||
sync is not like the three before it**: main now holds what the switch held (`global.json`, the TFM, the three
|
||||
packages, `legal/licenses/nuget/`, the *Transitive* row), so every switch file conflicts, and each is resolved by
|
||||
taking main's — the branch's RC3 lines go, `RELEASE_LINE` stays `alpha`, and `git diff --name-only origin/main` on the
|
||||
merged tree must print that one name. Its gate must pass on `alpha` before the pull request is merged by hand (the
|
||||
branch has no auto-merge); the release runs from the signed tag `v0.1.0-alpha.4` on `alpha`, with its delta from
|
||||
alpha.3. Its notes are `docs/changelog/0.1.0-alpha.4.md`: the warning, and that it is the last alpha for now.
|
||||
### Left open by this session
|
||||
|
||||
- **After it the line rests** (`12_BUILD` §The alpha line): no sync follows a beta and no alpha is cut until a newer
|
||||
.NET has a preview. `FlAlphaLineRests` in `Directory.Build.props` says so to the build; the next trial sets it to
|
||||
`false` on `alpha` with the rest of the switch.
|
||||
- **What a resting alpha costs its user** is in its notes, the guide and its banner: no update, the anti-cheat list
|
||||
included; and once ten betas have followed it, a copy of alpha.3 or older no longer finds alpha.4 (Velopack reads
|
||||
the newest ten releases).
|
||||
|
||||
**Owner-only:** item 35 — the fourth alpha on real hardware, and the beta installed over it.
|
||||
- **`LogNoteW`** (`src/native/FrameLedger.Overlay/src/dllmain.cpp`): a function nothing calls, found by the native
|
||||
report and **not removed** — D100 changes code loaded into a game for a defect only, and dead code is not one. The
|
||||
owner says whether it goes (owner-only item 36 (d)); `.editorconfig` has a section, naming it, that goes with it.
|
||||
- ~~**This release's own facts** — the tag's run, the digests, the delta — are not in any file yet: the release is cut
|
||||
after this text. Record them in the next pull request, as beta.37's and alpha.4's were in #384.~~ **Recorded
|
||||
2026-11-11, in the first pull request of the Advanced-metrics train: 0.1.0-beta.38 was released
|
||||
2026-11-11T02:56:51Z** from the signed tag on `b7d6550`, by run 42947853293 — one run for the one tag push, where
|
||||
alpha.4's push had started two. Eight assets; the seven digests of `SHA256SUMS.txt` equal the ones GitHub computed;
|
||||
the shipped natives carry `FL_BUILD_ID v0.1.0-beta.38`. The delta from beta.37 is 699,201 bytes beside a full
|
||||
package of 110,325,438 — "Delta processed 0452 files. 0022 patched, 0430 unchanged". The wiki was published by run
|
||||
42949461191. The rehearsal on the release branch (run 42944533749) had made a delta of 727,036 bytes with the same
|
||||
file counts.
|
||||
- **The Qodana licence** is read from the job's log (*Qodana license plan: Ultimate*, and the day the subscription is
|
||||
active until). When it lapses both jobs are red and advisory; `qodana.yaml`'s first comment is the way back.
|
||||
- **C# 15's constructs** wait for a ReSharper engine that reads them (`20_OPEN_QUESTIONS` §G, the row added with
|
||||
beta.37): the linter is now Qodana for .NET, whose engine is the same one — re-run the canary (`spike-notes` §29)
|
||||
when the action's pin moves.
|
||||
- **The alpha line rests** (D98). No sync and no alpha follow this release.
|
||||
|
||||
**Owner-only:** item 36 — beta.38 on real hardware, the links, the two Qodana Cloud projects, and `LogNoteW`.
|
||||
|
||||
## Owner-only — no PR can close these
|
||||
|
||||
@@ -450,6 +457,15 @@ alpha.3. Its notes are `docs/changelog/0.1.0-alpha.4.md`: the warning, and that
|
||||
experimental-build warning — and Help ▸ About reads *Alpha build — runs on .NET 11.0.0*, with no "prerelease".
|
||||
(d) **Then install beta.37 over it**: the installer asks to replace it; the beta opens the ledger, shows no Alpha
|
||||
notice, and its update channel is no longer locked.
|
||||
36. **beta.38, and the two Qodana reports** (D99, D100). (a) **The update from beta.37**: Help ▸ Check for updates
|
||||
offers beta.38 — a small download — and *Restart to update* installs it; no terms window. (b) **Links still open**:
|
||||
the documentation from the Help menu, a document's page on GitHub from its window, a link inside the user guide
|
||||
and inside the update notes, and the source link in Help ▸ About each open in the browser, as before. (c) **Qodana Cloud**: the projects `frameledger` and
|
||||
`frameledger-cpp` each show a report from `main` with no problem. A job's log says *Qodana license plan: Ultimate*
|
||||
and the day the subscription is active until; when it lapses both jobs go red — advisory, never a blocked merge —
|
||||
and `qodana.yaml` says the way back. (d) **`LogNoteW`**: the Overlay has one function nothing calls
|
||||
(`src/native/FrameLedger.Overlay/src/dllmain.cpp`). Say whether it is removed — a pull request of its own, eleven
|
||||
lines — or kept; either way the `.editorconfig` section that names it is then removed or reworded.
|
||||
**Answered 2026-08-05, do not re-ask:** remove `gameguard` and keep `guard` (approved
|
||||
over a red `Rules` gate, with the reasoning recorded in the merge commit); vendor NVAPI
|
||||
headers **and** `amd64/nvapi64.lib`; Windows 11 is the **measurement scope** only —
|
||||
@@ -562,6 +578,17 @@ Where each owner decision is recorded — the file and its section, and a label
|
||||
| D96 | [`13_CI_CD.md`](13_CI_CD.md) §C# 15 and the analyses | C# 15 on the main line from beta.37, a construct only where the build, CodeQL and Qodana read it — none of the four yet (Qodana's engine reads none, 2026-11-11), so beta.37 takes .NET 11's API and no syntax; no preview feature |
|
||||
| D97 | [`../legal/ALPHA_NOTICE.md`](../legal/ALPHA_NOTICE.md) | an alpha is "a beta's source built to try a newer version of .NET, at times a prerelease one": EULA 1.7, Disclaimer 2.14 (with a paragraph on Windows and the processor), Alpha notice 1.1, approved with the plan; the App says "a prerelease .NET" only where the runtime is one |
|
||||
| D98 | [`12_BUILD.md`](12_BUILD.md) §The alpha line | alpha.4 is beta.37's source on .NET 11.0.0, and then the alpha line rests until a newer .NET has a preview; a resting alpha tells its user to install the beta |
|
||||
| D99 | [`13_CI_CD.md`](13_CI_CD.md) §Qodana | Qodana for .NET on the Ultimate licence, in two reports from the start: the managed code to the Qodana Cloud project `frameledger`, the C++ to `frameledger-cpp` |
|
||||
| D100 | [`13_CI_CD.md`](13_CI_CD.md) §Qodana | an inspection is switched off where the engine that raised it reads — ReSharper's in `.editorconfig`, the rest in `qodana.yaml` (amends D93); hints are off as a severity; in code loaded into a game only defects are fixed |
|
||||
| D101 | [`18_GPU_VENDOR_APIS.md`](18_GPU_VENDOR_APIS.md) §Advanced metrics | "Thông số nâng cao" — Advanced metrics: the option `telemetry.advanced`, off by default, and off means nothing more is read or stored and the navigation item is hidden; everything reachable inside a game follows in stages, four trains A–D |
|
||||
| D102 | [`18_GPU_VENDOR_APIS.md`](18_GPU_VENDOR_APIS.md) §Advanced metrics | stored in full with the session, in tables of their own (`machine_profiles`, `session_advanced`, schema 0023) and not in columns of `sessions`; series under `adv.` names with NaN, not −1, for a tick with no reading |
|
||||
| D103 | [`18_GPU_VENDOR_APIS.md`](18_GPU_VENDOR_APIS.md) §Advanced metrics | LibreHardwareMonitor's CPU, memory, motherboard and storage groups only when the Agent already runs as administrator with PawnIO — the page links to that setting and never asks; power-supply and fan-controller groups refused, battery deferred |
|
||||
| D104 | [`18_GPU_VENDOR_APIS.md`](18_GPU_VENDOR_APIS.md) §Advanced metrics | identifiers are never read: the card's serial number and unique id, a display's EDID, the list of programs that are encoding |
|
||||
| D105 | [`18_GPU_VENDOR_APIS.md`](18_GPU_VENDOR_APIS.md) §Advanced metrics | the navigation item is the pane's last; Ctrl+1–5 keep their pages and Ctrl+6 opens it only while the option is on |
|
||||
| D106 | [`18_GPU_VENDOR_APIS.md`](18_GPU_VENDOR_APIS.md) §Advanced metrics | a `.partial` chunk of an unknown type with a right checksum is skipped, where it ended the read |
|
||||
| D107 | [`18_GPU_VENDOR_APIS.md`](18_GPU_VENDOR_APIS.md) §Advanced metrics | with no game running the Agent reads sensors only while the page is open |
|
||||
| D108 | [`18_GPU_VENDOR_APIS.md`](18_GPU_VENDOR_APIS.md) §Advanced metrics | "never call a setter" is a build gate: every `NvAPI_*` call of the bridge is held to a committed list |
|
||||
| D109 | [`../legal/DISCLAIMER.md`](../legal/DISCLAIMER.md) §5, §5A | asked on 2026-11-11 with both sentences quoted: the Disclaimer goes to 2.15 with the Privacy Policy — PawnIO and the admin mode are no longer "for the CPU temperature" alone; with Advanced metrics on they also read the processor's, the memory's and the motherboard's sensors. The admin mode's disclosure follows (`agent-admin-dialog/2`) |
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
<!-- Moved from CHANGELOG.md's [Unreleased] when 0.1.0-beta.38 was cut, 2026-11-11 (D66). CHANGELOG.md lists every release. -->
|
||||
|
||||
## [0.1.0-beta.38] - 2026-11-11
|
||||
|
||||
**The thirty-eighth pre-release: the App opens web and mail links only.** One small hardening, and nothing else you
|
||||
see, record or measure changes. The one place in the App that hands a link to Windows now refuses any address that is
|
||||
not `http`, `https` or `mailto`, where it trusted each caller to have checked — Windows runs whatever it is handed, and
|
||||
a `file:` address is a program. Every link the App shows already was one of those three, so no link you could click
|
||||
before stops working. The rest of this release is for developers: Qodana — JetBrains' code analysis — now reads the C#
|
||||
with its Rider-based linter and, as a second report, the C++. The same unsigned installer: verify its hash against
|
||||
`SHA256SUMS.txt`, then *More info → Run anyway*.
|
||||
|
||||
**Updating from `0.1.0-beta.37`:** Help ▸ Check for updates, then *Restart to update* with no game running. The legal
|
||||
texts keep their versions, so nothing is shown for you to accept; the ledger stays at schema 22 and the detection rules
|
||||
at `2026.11.2`. Nothing about capture or measurement changes: the code FrameLedger loads into a game is
|
||||
0.1.0-beta.37's, line for line.
|
||||
|
||||
**No alpha follows this release**: the alpha line rests (`guide/11-alpha-builds.md`).
|
||||
|
||||
### Changed
|
||||
|
||||
- **Every place that starts a process was read, and the App now opens web and mail links only.** JetBrains' rule for
|
||||
"a process started with something that is not a literal" reported 35 places — 11 in the product, 24 in tests. Each
|
||||
was read: what it starts, and where the path and the arguments come from (the table in `docs/13_CI_CD.md` §Qodana).
|
||||
None takes a value from outside the PC or from a file FrameLedger did not write, except the path and arguments of
|
||||
the game the user added. One was hardened: `ShellUrlOpener` — what opens a link in the browser or the mail client —
|
||||
now refuses any address that is not `http`, `https` or `mailto` itself, where it trusted each caller to have
|
||||
checked; the shell runs whatever it is handed, and a `file:` address is a program. Every caller already passed one
|
||||
of the project's own pages or a link held to those schemes, so no link you could click before stops working. The
|
||||
rule stays on: the files its results were read in are listed in `qodana.yaml`, so a new file that starts a
|
||||
process is reported — by path on the plugin's one inspection, since a rule's own id is honoured nowhere (three
|
||||
runs measured it). And a test of the repository's own, `ProcessStartSitesTests`, in the gate, fails on a new file
|
||||
that starts a process, or registers a scheduled task, until it has been read and listed.
|
||||
- **Qodana for .NET, on the Ultimate licence, reads the managed code** (developers only; owner decisions D99 and D100).
|
||||
The owner took an Ultimate licence for the Qodana Cloud organisation and asked for Qodana over every language. The
|
||||
job — `managed`, *Qodana (managed)* in a pull request's checks — now runs Qodana for .NET (Rider's engine) in native
|
||||
mode on a Windows runner, after a `dotnet build`, where the Community linter ran in a Linux container. Besides the
|
||||
C#, the XAML and the `.resx` it reads the Markdown and XML around the solution, and JetBrains' security rules read
|
||||
the C#. Its first run reported 3,953 problems, 3,607 of them **hints** — the level an editor offers without
|
||||
underlining anything, which the Community linter never reported; hints are off as a severity. Of the 347 left: a vi
|
||||
or ja string equal to the English one (271) is off in `.editorconfig` for `.resx` files — names, units and format
|
||||
strings are not translated; two Markdown inspections (table padding, and anchors computed otherwise than GitHub
|
||||
does) and the application manifest's XML are off in `qodana.yaml`; six results in `PrimaryDisplay.cs` are the
|
||||
linter's own fault (an internal assertion, in its log) and are excluded for that file; one test expression was
|
||||
simplified. The gate stays zero problems and the job stays advisory. An inspection is now switched off **where the
|
||||
engine that raised it reads** — one of ReSharper's in `.editorconfig`, what has no key there in `qodana.yaml` — which
|
||||
amends D93's "never in `qodana.yaml`" (`docs/13_CI_CD.md` §Qodana). The C++ goes to a second report, the next pull
|
||||
request's.
|
||||
- **Qodana reads the C++ too, as a second report** (developers only; owner decision D99). The job `native` has CMake
|
||||
write a Visual Studio solution for `src/native` (the preset `x64-vs-analysis`; nothing ships from it) and runs
|
||||
Qodana for .NET over it — ReSharper's C++ inspections and the clang-tidy checks they bundle — with settings of its
|
||||
own (`qodana-native.yaml`), reporting to a Qodana Cloud project of its own. Its first run reported 4,695 problems,
|
||||
4,040 of them hints; of the 655 left, 494 are distinct (a file compiled into three targets is reported three
|
||||
times). Nearly all of them are not faults, and `.editorconfig` now says why in fifty-four lines, each with its
|
||||
reason: clang's opinion of code that only MSVC builds (`__try`, a function pointer got by name, struct padding);
|
||||
the engine misreading `std::atomic_ref`, zero-initialised API structures and tests of `constexpr` functions;
|
||||
proposals to restate working code in a newer idiom; and what a probe or a test does on purpose. Eleven things
|
||||
were fixed, none changing what a shipped binary does: `std::size` for four hand-written array lengths, two
|
||||
multiplications done in a narrower type than their result, two unused member functions, an unused type alias, two
|
||||
unused includes. **In code loaded into a game nothing was changed**: the report found no defect there, and what it
|
||||
did say about those files is listed in `docs/13_CI_CD.md` §Qodana — among it one function in the Overlay that
|
||||
nothing calls (`LogNoteW`), which is recorded for the owner and not removed (D100). The gate is zero problems and the job is advisory, like the other.
|
||||
|
||||
### Fixed
|
||||
|
||||
- **A test that failed on a busy machine** (developers only). `ShmDrainIntegrationTests`' drain under supervision
|
||||
ended after one guard evaluation whenever the first scan was slow enough for fifty presents to be waiting, and
|
||||
then failed its own "supervised more than once"; the loop now supervises at least twice whatever the first
|
||||
drain holds.
|
||||
@@ -0,0 +1,205 @@
|
||||
# HANDOFF history — 0.1.0-beta.37
|
||||
|
||||
*Moved verbatim from `docs/HANDOFF.md` when 0.1.0-beta.38 was cut, 2026-11-11 (owner decision D66); `docs/HANDOFF.md` §How this file is split lists every part. Nothing below was edited, so its "below" and "above" mean HANDOFF.md as it stood then.*
|
||||
|
||||
## **START HERE** — 2026-11-11, 0.1.0-beta.37: the main line on .NET 11, what an alpha is now, and why no C# 15 yet
|
||||
|
||||
*Status is `docs/changelog/0.1.0-beta.37.md`; this is what no other file carries.* The owner, with two screenshots — a
|
||||
Qodana Ultimate licence in the JetBrains console, and the Qodana Cloud project's setup page: "Bạn có thể bắt đầu với phiên
|
||||
cải tiến cho .net 11 và set up cho qodana cho tất cả ngôn ngữ (gói ultimate) nhé." The session D92 had left for after
|
||||
.NET 11's release (2026-11-10), and Qodana for every language on the Ultimate licence. One plan, approved whole, in
|
||||
three parts: **beta.37** (#376 the move, #379 what an alpha is, #380 .NET 11's API and the C# 15 finding, and this
|
||||
release) → **alpha.4** → **Qodana Ultimate in two reports**. This section is the first part; the other two follow it on
|
||||
`main` the same way.
|
||||
|
||||
**Decisions (asked while planning, do not re-ask):**
|
||||
|
||||
- **D94 — the main line moves to .NET 11 now.** Asked whether the betas move or only alpha.4 — with
|
||||
`20_OPEN_QUESTIONS` §G's table quoted: two alphas on the released runtime and an owner's run of a hooked title first —
|
||||
the owner chose "Chuyển main sang .NET 11 ngay". Condition (a) of that table was **set aside, not met**;
|
||||
`12_BUILD` §The main line's .NET says what stood in for it, and owner-only item 34 is the run it asked for.
|
||||
- **D95 — Windows 10 22H2 is not blocked, and is stated as untested and unsupported** ("Vẫn chạy, ghi rõ không được hỗ
|
||||
trợ"). NFR-8 is amended; a processor needs SSE4.2 and POPCNT.
|
||||
- **D96 — C# 15 in the same release** ("Áp dụng cả C# 15 ngay trong beta.37"). The plan narrowed it in writing, and was
|
||||
approved with that: a construct only where the build, CodeQL and Qodana all read it.
|
||||
- **D97 — all three legal texts reworded** ("Sửa cả ba văn bản"): EULA 1.7, Disclaimer 2.14, Alpha notice 1.1. Their
|
||||
text was in the plan and approved with it.
|
||||
- **D98 — alpha.4, then the alpha line rests** until a newer .NET has a preview ("alpha.4 rồi nghỉ tới .NET 12
|
||||
Preview").
|
||||
- **The order**: beta.37 → alpha.4 first, Qodana after; and Qodana in **two reports from the start** (the third part's
|
||||
decision, D99).
|
||||
|
||||
**Choices made here:**
|
||||
|
||||
- **No C# 15 construct is used, although the owner asked for them.** The rule decided it, not a preference:
|
||||
ReSharper's engine, which Qodana runs, reads none of the four (`13_CI_CD` §C# 15 and the analyses, `spike-notes`
|
||||
§29). Unions would not have been the form in any case — the SDK's own CA1815 asks every union to hand-write its
|
||||
equality, and the shapes that wanted one are closed record hierarchies. What the release takes is API.
|
||||
- **.NET 11's `IHost.RunAsync` is accepted, not wrapped**: a failed background service now ends the Agent through its
|
||||
crash report. A catch there would hide a fault, and could not reproduce .NET 10's exit exactly either.
|
||||
- **A resting alpha says so in the build, not only in its notes**: the anti-cheat list reaches a user only inside a
|
||||
release, so an alpha nobody updates carries an ageing one. `FlAlphaLineRests` is stamped on both lines; the `alpha`
|
||||
branch sets it to false when it next tries a .NET.
|
||||
- **"A prerelease .NET" is said only by a build that runs on one**, read from the runtime's own description — the next
|
||||
preview alpha says it again with no change to the code.
|
||||
- **`release.yml` names the .NET 10 runtime `vpk` needs**, rather than relying on the hosted image carrying one.
|
||||
- **The Community Qodana job was kept alive across the move** by installing the SDK into its container — an interim;
|
||||
the Ultimate linter replaces the job in the third part.
|
||||
- **The 2026-10-31 forms stay where they read as well** (`json.AsSpan().TrimStart().StartsWith('[')` avoids a string):
|
||||
.NET 11's `char` overloads replaced a span only where the span was there for .NET 10's sake.
|
||||
|
||||
**Measured on the way** (`spike-notes` §28 and §29): the gate on SDK 11.0.100 — two analyzer sites beyond RC3's
|
||||
twenty-one, both in tests written after the last alpha; `IHost.RunAsync` rethrowing, observed for the first time; the
|
||||
first delta across two runtime majors (372 of 443 files patched, 72.6 MB on the rehearsal); `main`'s first full CodeQL
|
||||
C# analysis on `net11.0` (1,221 of 1,221 files, the same 23 unresolved `Windows.Win32` types as on .NET 10); the
|
||||
SonarScanner 12.0.0 on the 11.0 runtime; InspectCode 2026.2.3.1 and 2026.3.0 against each C# 15 construct.
|
||||
|
||||
**Traps met on the way:**
|
||||
|
||||
- **A pull request's CodeQL C# run is an overlay analysis**: it extracts the changed files on top of `main`'s cached
|
||||
database, and its "scanned N out of N" is `main`'s baseline. #376 wrote "CodeQL reads `net11.0` whole" from one and
|
||||
was corrected, dated, two pull requests later with `main`'s own run. For anything the extractor has not met, dispatch
|
||||
`codeql.yml` on the branch (it takes `workflow_dispatch` since #380).
|
||||
- **`ShmDrainIntegrationTests.TheGuardInjectsTheOverlayAndTheReaderDrainsRealFrames` failed once on the dev box** —
|
||||
"our own harness must not start matching the blocklist mid-run": the guard's re-scan refused the harness in one gate
|
||||
run of five. The class passed three times in a row straight after and no guard code had changed; not looked into.
|
||||
- **A wiki page names no version** (`wiki-check`): "since 0.1.0-alpha.4" in `wiki/Releasing.md` was red. The guide's
|
||||
pages may.
|
||||
- **The runner queue**: with three workflows per pull request and a probe's pull request open beside the train,
|
||||
`check` waited about 25 minutes for a runner. Cancel a probe's runs once it has told what it can.
|
||||
- **A Bash heredoc halves the backslashes** of an inline Python regex — write the script with the Write tool.
|
||||
- **`x.Should().NotBeNull(); x!.Member`**: ReSharper reads the `!` as redundant (Qodana's one finding on #376) and the
|
||||
compiler wants it. Keep the value the assertion needs, not the object.
|
||||
- **CA2025** on a lambda that captures a `using` variable in a test: await inside a `try`, assert after.
|
||||
- **A local gate reseeds `%LOCALAPPDATA%\FrameLedger\rules`** while the owner's installed copy runs beside it: the
|
||||
files were hashed before and after every gate (identical each time — the repository's rules were the installed ones).
|
||||
|
||||
**The release (the tag, 2026-11-11).** Rehearsed first (`release.yml` dispatched on the release branch, run
|
||||
42926539241), then the signed tag `v0.1.0-beta.37` on `1a7fbf3`: run 42930394186, published 2026-11-11T00:36:54Z.
|
||||
Eight assets, the seven listed in `SHA256SUMS.txt` equal to the digests GitHub computed; `FL_BUILD_ID v0.1.0-beta.37`
|
||||
in the shipped natives. The delta across two major runtimes exists — the stop condition the plan had named: "Delta
|
||||
processed 0443 files. 0373 patched, 0070 unchanged, 0009 new, 0017 removed", 72,681,960 bytes beside a full package of
|
||||
110,325,368. The wiki was published by its own run (42932792575).
|
||||
|
||||
**Owner-only:** item 34 — beta.37 on real hardware, a hooked session on .NET 11.0.0, and Windows 10 if a PC with it is
|
||||
at hand.
|
||||
|
||||
### 0.1.0-alpha.4 — the fourth alpha, the same day, and the last for now (D98)
|
||||
|
||||
`alpha` takes main at this pull request — `v0.1.0-beta.37` and these notes, no other change — by a merge commit. **This
|
||||
sync is not like the three before it**: main now holds what the switch held (`global.json`, the TFM, the three
|
||||
packages, `legal/licenses/nuget/`, the *Transitive* row), so every switch file conflicts, and each is resolved by
|
||||
taking main's — the branch's RC3 lines go, `RELEASE_LINE` stays `alpha`, and `git diff --name-only origin/main` on the
|
||||
merged tree must print that one name. Its gate must pass on `alpha` before the pull request is merged by hand (the
|
||||
branch has no auto-merge); the release runs from the signed tag `v0.1.0-alpha.4` on `alpha`, with its delta from
|
||||
alpha.3. Its notes are `docs/changelog/0.1.0-alpha.4.md`: the warning, and that it is the last alpha for now.
|
||||
|
||||
- **After it the line rests** (`12_BUILD` §The alpha line): no sync follows a beta and no alpha is cut until a newer
|
||||
.NET has a preview. `FlAlphaLineRests` in `Directory.Build.props` says so to the build; the next trial sets it to
|
||||
`false` on `alpha` with the rest of the switch.
|
||||
- **What a resting alpha costs its user** is in its notes, the guide and its banner: no update, the anti-cheat list
|
||||
included; and once ten betas have followed it, a copy of alpha.3 or older no longer finds alpha.4 (Velopack reads
|
||||
the newest ten releases).
|
||||
|
||||
**The sync and the release (2026-11-11).** #382 put the notes on main (`428b723`); #383 merged main into `alpha` by
|
||||
hand (`134115b`): twenty-seven conflicts, every one resolved to main's side, and `git diff --name-only origin/main
|
||||
origin/alpha` prints `RELEASE_LINE` alone. Rehearsed on `alpha` (run 42933603983: channel `alpha`, a delta from
|
||||
alpha.3), then the signed tag `v0.1.0-alpha.4`: run 42935876535, published 2026-11-11T01:16:22Z as *FrameLedger
|
||||
0.1.0-alpha.4 (experimental alpha)*, a pre-release. Eight assets, seven of seven digests equal; "Delta processed 0448
|
||||
files. 0369 patched, 0079 unchanged, 0004 new, 0005 removed", 18,207,557 bytes; `FrameLedger.App-alpha-Setup.exe`,
|
||||
`releases.alpha.json`; the wiki run skipped, as it does for an alpha.
|
||||
|
||||
- **One tag push started two release runs** (42935876535 and 42935878584, both `push`, created in the same second;
|
||||
the tag was pushed once). `release.yml`'s concurrency group made the second wait for the first, and it then began
|
||||
the whole build again. It was cancelled once the first had published: it could only have ended red, at
|
||||
`gh release create` on a release that existed. If a tag ever shows two runs, let the first finish, verify the
|
||||
release, then cancel the other.
|
||||
|
||||
**Owner-only:** item 35 — the fourth alpha on real hardware, and the beta installed over it.
|
||||
|
||||
|
||||
### Qodana for .NET on the Ultimate licence — the managed report (D99, D100)
|
||||
|
||||
*Status is `docs/13_CI_CD.md` §Qodana and `CHANGELOG.md`; this is what no other file carries.* The third part of the
|
||||
plan, in two pull requests: this one moves the existing job to Qodana for .NET (Rider's engine, native on a Windows
|
||||
runner) and settles what it reports over the managed code; the next adds the C++ as a second report.
|
||||
|
||||
**Decisions:**
|
||||
|
||||
- **D99 — two reports from the start** ("Hai báo cáo ngay từ đầu"). The owner made a second Qodana Cloud project,
|
||||
`frameledger-cpp`, and the secret `QODANA_TOKEN_NATIVE`; the managed report goes to `frameledger` with
|
||||
`QODANA_TOKEN`. Both secrets are the owner's; no token was ever read or handled here.
|
||||
- **D100 — where an inspection is switched off** (the plan's design, approved with it; it amends D93's "never in
|
||||
`qodana.yaml`"): in the place the engine that raised it reads — one of ReSharper's in `.editorconfig`; what has no
|
||||
key there in `qodana.yaml`. Hints are off as a severity. In code loaded into a game only defects are fixed.
|
||||
|
||||
**Choices made here:**
|
||||
|
||||
- **JetBrains' security rules stay on, scoped by path — which took four runs to find.** Every result was read first
|
||||
(the table in `13_CI_CD` §Qodana), and one place hardened (`ShellUrlOpener` refuses anything but `http`, `https`
|
||||
and `mailto`). Then the files read had to be told to the linter, and a rule's own id is honoured nowhere:
|
||||
`ignore`, an `exclude` path and `enabled: false` each left all 36 results standing. The report's own
|
||||
`log/effective.profile.xml` and `qodana_inspections_summary.csv` gave the answer — one inspection,
|
||||
`OpenGrepInspection`, produces every rule's results, and it does take a path. Between the third run and the
|
||||
fourth the rules were written as off, with a test in their place; the test stayed (`ProcessStartSitesTests`, in
|
||||
the gate, and wider than the rule), the rules came back on.
|
||||
- **`PrimaryDisplay.cs` was not changed to please the linter.** Its six results come from an internal assertion in
|
||||
this linter's build (in the job's `backend.log`), not from the file; the first guess — that the engine misreads an
|
||||
`unsafe` tuple — was wrong, and a rewrite made on it was reverted. Two inspections are excluded for that one file,
|
||||
to be removed when a linter build reads it.
|
||||
- **What the Ultimate licence offers and this job does not use**: quick-fixes (the job cannot push, on purpose), code
|
||||
coverage in Qodana, FlexInspect. If the licence lapses the job is red and advisory; the way back is in `qodana.yaml`.
|
||||
|
||||
**Traps:**
|
||||
|
||||
- **A security rule's id is not an inspection.** The OpenGrep plugin's rules all report through
|
||||
`OpenGrepInspection`; only that name works in `qodana.yaml`, and only by path. Read
|
||||
`log/qodana_inspections_summary.csv` in the report artifact to see which inspection produced a result before
|
||||
spending a run on a guess.
|
||||
- **A report artifact is a zip inside the download, with backslash paths**: `unzip` extracts it and exits non-zero
|
||||
on the warnings, so do not chain on its exit code.
|
||||
- **A linter result can be the linter's fault**: read the job's log directory (the report artifact carries it) for an
|
||||
`AssertionException` before changing the code it points at.
|
||||
- **A Qodana run of the managed job takes fifteen to seventeen minutes**, most of it the scan; a pull request's own run
|
||||
reads the whole solution (`pr-mode: false`), so there is no quick partial run to iterate on.
|
||||
|
||||
**Then:** the native report, in the pull request after it — the next section.
|
||||
|
||||
|
||||
### Qodana — the native report: the C++ through a solution CMake writes (D99, D100)
|
||||
|
||||
*Status is `docs/13_CI_CD.md` §Qodana and `CHANGELOG.md`; this is what no other file carries.* The second pull request
|
||||
of the third part: the job `native`, `qodana-native.yaml`, the preset `x64-vs-analysis`, fifty-four `.editorconfig`
|
||||
lines for the C++ and eleven small fixes outside code loaded into a game.
|
||||
|
||||
**Choices made here:**
|
||||
|
||||
- **One linter for both reports.** Qodana for .NET is the only linter of JetBrains' that reads this C++ (MSVC-only;
|
||||
`qodana-cpp` and `qodana-clang` are Linux images), and it wants a Visual Studio solution — so CMake writes one. The
|
||||
generated solution is never built from, beyond the one header a build generates.
|
||||
- **No `.clang-tidy` file.** The plan had expected one. Every clang-tidy check and clang diagnostic the engine runs
|
||||
has an `.editorconfig` key of ReSharper's, so D100's "where the engine reads" is one file for all of the C++, and
|
||||
the repository gains no clang-tidy configuration that a developer's editor would start obeying.
|
||||
- **Most of what it reported is not a fault, and the settings say why, line by line**: clang's opinion of code only
|
||||
MSVC builds; the engine misreading `atomic_ref`, zero-initialised API structures and constexpr tests; proposals of
|
||||
a newer idiom. Eleven things were fixed. **In code loaded into a game nothing was changed**: no defect was found
|
||||
there.
|
||||
- **`LogNoteW` (`FrameLedger.Overlay/src/dllmain.cpp`) is dead code, and it is still there — the owner's call.**
|
||||
Nothing calls it. D100 changes code loaded into a game for a defect only, and an unused function is not one, so
|
||||
it was not removed on a linter's word; `.editorconfig` leaves that one file unread for an unused function, in a
|
||||
section that says to remove it with the function. Removing it is eleven lines with no caller: a pull request of
|
||||
its own, whose overhead statement is that the function was never reached.
|
||||
- **"Possibly unused `#include`" is off, not obeyed.** Ten of the twelve reported outside the game are a file
|
||||
including what it uses (`<cstring>` for `std::memset`) although `<windows.h>` already brought it; removing them
|
||||
would have made the files depend on an accident.
|
||||
|
||||
**Traps:**
|
||||
|
||||
- **InspectCode cannot load the native solution on the owner's PC** (Visual Studio 18 Insiders' MSBuild crashes it,
|
||||
2026.2.3.1 and 2026.3.0 alike), so C++ results are read from CI: dispatch `qodana.yml` on the branch, download
|
||||
`qodana-report-native`, unzip the inner `qodana-report.zip`.
|
||||
- **A file compiled into three targets is reported three times**: count distinct results (rule, file, line), not rows.
|
||||
- **A shortened line is a clang-format change two lines away**: the gate's clang-format step failed on an alignment
|
||||
that the edit above it had made possible. Run clang-format on every native file touched before the gate.
|
||||
- **Do not switch branches while a gate runs** — a probe branch was made during a local native build, which changed
|
||||
and restored two sources under it. Nothing came of it; the next gate was run on a still tree.
|
||||
@@ -63,6 +63,20 @@ are kept because they record what each version changed and why (owner decision D
|
||||
>
|
||||
> Version 2.5 (2026-09-27, 0.1.0-beta.10) adds how a tracked game's window is shown — read from Windows — and the engine build name read from an Unreal Engine game's executable. It is also the first version to say two things the software already did: it reads the **content** of a library game's executable (markers in its first 8 MB and its import table, since the detection of engines and features; and, when a session starts, the graphics-library markers in the whole file), and it reads the processor load and the memory in use (since 0.1.0-beta.3). Nothing here leaves your device, as before.
|
||||
|
||||
### What version 2.15 of the Privacy Policy and of the Disclaimer changed (0.1.0-beta.39)
|
||||
|
||||
**Advanced metrics** (owner decisions D101–D108; the Privacy Policy's content approved with the plan, the Disclaimer's
|
||||
two sentences by the owner's answer of 2026-11-11). Privacy Policy §1 gains one item — what a session stores **only
|
||||
while the option is on**: more sensor series of the graphics card, and of the processor, the memory and the motherboard
|
||||
when the Agent runs as administrator with PawnIO; a description of the hardware; what each display can do and what the
|
||||
game's display did; the graphics driver's settings, global and for the game — and what is never read: a serial
|
||||
number, a display's EDID, a list of other programs. §3A says an export and a bug report do not carry it. §4 names the
|
||||
same as things the software can observe, only while the option is on. The Disclaimer's §5 and §5A said PawnIO and the
|
||||
admin mode were for the CPU temperature alone; both now name the processor's, the memory's and the motherboard's
|
||||
sensors with the option on. The accuracy block gains an item that says none of these readings has been checked
|
||||
against another tool. §2 is unchanged: nothing is sent, as before. (Versions 2.12 to 2.14 of the Privacy Policy and
|
||||
2.12 to 2.14 of the Disclaimer are recorded in the changelog of the release that carried each.)
|
||||
|
||||
### What version 2.11 of the Privacy Policy changed (0.1.0-beta.23)
|
||||
|
||||
A game's page shows its artwork (beta.23 PR-3, owner decisions D60/D61; the wording approved with the plan). §1 adds the
|
||||
|
||||
@@ -22,6 +22,7 @@ The link under them, *Read what the hook does and does not do*, opens the safety
|
||||
| **Minimum session length (s)** | A shorter session is not kept. 5 to 600 seconds. *Agent.* | 30 |
|
||||
| **Sensor interval (ms)** | How often the PC's sensors are read during a session. 500 to 2000 ms. *Agent.* | 1000 |
|
||||
| **Raw series kept per game** | How many of each game's newest sessions keep their per-frame data; older ones keep their statistics. 0 keeps everything. *Agent.* | 20 |
|
||||
| **Advanced metrics** | Reads more from the graphics driver and the hardware sensors during a session — the graphics card's memory and load in detail, each fan and voltage, what your display can do, the driver's settings for the game — and stores it with the session. Off: nothing more is read or stored. It applies from the next session; a session recorded while it was off is not filled in later. *Agent.* | Off |
|
||||
|
||||
## Data
|
||||
|
||||
@@ -34,7 +35,7 @@ The link under them, *Read what the hook does and does not do*, opens the safety
|
||||
|
||||
| Setting | What it does | Default |
|
||||
|---|---|---|
|
||||
| **Run the agent as administrator** | Lets FrameLedger measure games that run as administrator, and read CPU temperature with PawnIO installed. Windows asks every time the agent starts, at logon too. A warning explains the risk first; read [Limitations](../LIMITATIONS.md#running-the-agent-as-administrator). The agent restarts to apply it, or at its next start if a game is being recorded. | Off |
|
||||
| **Run the agent as administrator** | Lets FrameLedger measure games that run as administrator, and — with PawnIO installed — read CPU temperature and, when *Advanced metrics* is on, the processor's, the memory's and the motherboard's sensors. Windows asks every time the agent starts, at logon too. A warning explains the risk first; read [Limitations](../LIMITATIONS.md#running-the-agent-as-administrator). The agent restarts to apply it, or at its next start if a game is being recorded. | Off |
|
||||
| **Start the agent at logon** | **Register**, **Repair** or **Remove** a task that starts the agent when you log on, for your user only and without administrator rights. Without it, FrameLedger starts the agent when you open it. | Not installed |
|
||||
|
||||
## Appearance
|
||||
|
||||
+9
-2
@@ -11,8 +11,8 @@
|
||||
that changes what FrameLedger.Overlay or the capture host does; date the change.
|
||||
HTML comments are not part of the block.
|
||||
-->
|
||||
> ⚠ **What FrameLedger actually measures today — 2026-11-06.** The software is a beta; its latest
|
||||
> **beta is `0.1.0-beta.37`** (2026-11-11), an unsigned installer built from that tag with its
|
||||
> ⚠ **What FrameLedger actually measures today — 2026-11-11.** The software is a beta; its latest
|
||||
> **beta is `0.1.0-beta.38`** (2026-11-11), an unsigned installer built from that tag with its
|
||||
> checksums published beside it (alphas — experimental builds that try a newer .NET — are published apart). The source holds the desktop app
|
||||
> (library, store import, charts, settings) and the background Agent, which records a session when a
|
||||
> game in the library runs (unless you switched its recording off), injects only into games you enabled
|
||||
@@ -101,6 +101,13 @@
|
||||
> Windows once a second and charted. Processor temperature is read only when the Agent runs as
|
||||
> administrator — an option, off by default, for which Windows asks at every start of the Agent — with
|
||||
> PawnIO installed, and that reading has not yet been checked on real hardware; everywhere else it is `N/A`.
|
||||
> - **Advanced metrics (since beta.39; off unless you switch it on in Settings):** with it on, a session also stores
|
||||
> what the graphics driver and the sensor library report about the hardware — the graphics card's memory, load,
|
||||
> clocks, fans, voltages and power in detail, what a display can do, the driver's settings for the game — as they
|
||||
> report it: NVIDIA's figures once a second, the sensor library's every five seconds. None of these readings has
|
||||
> been checked against another tool. The processor's, the memory's and the motherboard's need the Agent as
|
||||
> administrator with PawnIO and have never been read on real hardware; a drive's temperature is not read. No
|
||||
> screen of the App shows them yet.
|
||||
> - **Safety:** every pre-injection check runs before injection, including the signed-by-a-known-vendor
|
||||
> half of the suspicious-module rule. During every capture the Agent re-runs the checks every 30 s and
|
||||
> stops capturing on a refusal: a Direct3D or OpenGL game's hooks are removed, and the Vulkan layer
|
||||
|
||||
+13
-5
@@ -1,6 +1,6 @@
|
||||
# FrameLedger — Disclaimer
|
||||
|
||||
**Version:** 2.14 · **Effective:** {{RELEASE_DATE}}
|
||||
**Version:** 2.15 · **Effective:** {{RELEASE_DATE}}
|
||||
|
||||
## 0. This is pre-release software
|
||||
|
||||
@@ -120,8 +120,8 @@ Software running inside another process can, in principle, destabilize it. Frame
|
||||
Frame timing is derived from high-resolution timestamps taken at the moment the game presents each frame; upscaling, frame-generation and ray-tracing state are read from the parameters the game passes to those APIs. This is substantially more accurate than inferring settings from files on disk, but **no measurement is guaranteed to be exact**:
|
||||
|
||||
<!-- accuracy-block:begin -->
|
||||
> ⚠ **What FrameLedger actually measures today — 2026-11-06.** The software is a beta; its latest
|
||||
> **beta is `0.1.0-beta.37`** (2026-11-11), an unsigned installer built from that tag with its
|
||||
> ⚠ **What FrameLedger actually measures today — 2026-11-11.** The software is a beta; its latest
|
||||
> **beta is `0.1.0-beta.38`** (2026-11-11), an unsigned installer built from that tag with its
|
||||
> checksums published beside it (alphas — experimental builds that try a newer .NET — are published apart). The source holds the desktop app
|
||||
> (library, store import, charts, settings) and the background Agent, which records a session when a
|
||||
> game in the library runs (unless you switched its recording off), injects only into games you enabled
|
||||
@@ -210,6 +210,13 @@ Frame timing is derived from high-resolution timestamps taken at the moment the
|
||||
> Windows once a second and charted. Processor temperature is read only when the Agent runs as
|
||||
> administrator — an option, off by default, for which Windows asks at every start of the Agent — with
|
||||
> PawnIO installed, and that reading has not yet been checked on real hardware; everywhere else it is `N/A`.
|
||||
> - **Advanced metrics (since beta.39; off unless you switch it on in Settings):** with it on, a session also stores
|
||||
> what the graphics driver and the sensor library report about the hardware — the graphics card's memory, load,
|
||||
> clocks, fans, voltages and power in detail, what a display can do, the driver's settings for the game — as they
|
||||
> report it: NVIDIA's figures once a second, the sensor library's every five seconds. None of these readings has
|
||||
> been checked against another tool. The processor's, the memory's and the motherboard's need the Agent as
|
||||
> administrator with PawnIO and have never been read on real hardware; a drive's temperature is not read. No
|
||||
> screen of the App shows them yet.
|
||||
> - **Safety:** every pre-injection check runs before injection, including the signed-by-a-known-vendor
|
||||
> half of the suspicious-module rule. During every capture the Agent re-runs the checks every 30 s and
|
||||
> stops capturing on a refusal: a Direct3D or OpenGL game's hooks are removed, and the Vulkan layer
|
||||
@@ -251,14 +258,15 @@ be the difference between a game that runs and one that does not. Turn hooking o
|
||||
|
||||
## 5. Hardware and drivers
|
||||
|
||||
FrameLedger reads GPU telemetry through vendor libraries that ship with your graphics driver. It **only reads** — it never changes clocks, fan curves, power limits, or any other hardware setting. Optional CPU-temperature support relies on the separate third-party **PawnIO** driver, which you install at your own discretion under its own license; some anti-cheat systems object to third-party kernel drivers regardless of what they are used for.
|
||||
FrameLedger reads GPU telemetry through vendor libraries that ship with your graphics driver. It **only reads** — it never changes clocks, fan curves, power limits, or any other hardware setting. Optional CPU-temperature support — and, with Advanced metrics on, reading the processor's, the memory's and the motherboard's sensors — relies on the separate third-party **PawnIO** driver, which you install at your own discretion under its own license; some anti-cheat systems object to third-party kernel drivers regardless of what they are used for.
|
||||
|
||||
## 5A. Running the capture agent as administrator — optional, and your decision
|
||||
|
||||
Since 0.1.0-beta.10 a Settings option, off unless you turn it on, starts FrameLedger's capture agent as administrator.
|
||||
**Windows asks you every time the agent starts** — also when you sign in — and the prompt names an unknown publisher,
|
||||
because FrameLedger is not code-signed. It lets FrameLedger open and measure a game that itself runs as administrator,
|
||||
and read the CPU temperature where PawnIO is installed. It changes nothing in the anti-cheat guard (§2, §2A), opens no
|
||||
and read the CPU temperature — and, with Advanced metrics on, the processor's, the memory's and the motherboard's
|
||||
sensors — where PawnIO is installed. It changes nothing in the anti-cheat guard (§2, §2A), opens no
|
||||
process that Windows or an anti-cheat driver protects, and never starts a game as administrator: games you start from
|
||||
FrameLedger run with your standard rights.
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# FrameLedger — Privacy Policy
|
||||
|
||||
**Version:** 2.14 · **Effective:** {{RELEASE_DATE}}
|
||||
**Version:** 2.15 · **Effective:** {{RELEASE_DATE}}
|
||||
|
||||
**Short version: everything stays on your PC. FrameLedger has no accounts, no telemetry, no analytics, and never uploads your data anywhere.**
|
||||
|
||||
@@ -11,6 +11,7 @@ Stored in `%LOCALAPPDATA%\FrameLedger` on your device:
|
||||
- Your game library entries (names, executable paths, metadata you or the app filled in, and whether each one is recorded).
|
||||
- Images you choose for a game (Edit…), copied into the `covers` folder; choosing the store's image again, or removing the game together with its sessions, deletes the copy. Artwork a store's app keeps on your PC, or a game ships in its own folder, is shown from where it is and not copied.
|
||||
- Performance sessions: frame timing series, computed statistics, hardware sensor series (temperatures, load, power, memory usage, and the graphics card's clock speeds, fan speed, memory temperature and whether its power limit or heat held it back), the game's own memory use (its dedicated and shared video memory, private working set, working set and commit, once a second), session duration, crash flags, the graphics driver's settings the game ran under (NVIDIA only), how the game's window was shown (full-screen, borderless or windowed, for how long, its size and the monitor's), tags and notes you write.
|
||||
- **Only while Settings ▸ Advanced metrics is on** (it is off unless you switch it on), with each session: more hardware sensor series — the graphics card's memory use in detail, its load by part, its clocks, voltages, currents, power, each fan and its video encoder's use; and, when the capture agent runs as administrator with PawnIO installed, the processor's temperatures, load, clocks, power and voltages by core, the memory in use and its modules' temperatures, and the motherboard's temperatures, fans and voltages — and a description of the hardware: the graphics card's firmware version, architecture, bus and memory sizes, the graphics driver's package and the chipset it names, the motherboard's and the memory modules' model names, what each connected display can do (the HDR formats it accepts, its brightness range, variable refresh), whether variable refresh was in use on the display the game ran on and the colour space the game presented in, and the graphics driver's settings — its global ones and the ones it holds for the game (NVIDIA only). No serial number, no display identification data (EDID) and no list of other programs is read or stored. Switching the option off stops the reading; what earlier sessions stored stays with them until you delete those sessions.
|
||||
- A hardware snapshot per session (CPU/GPU model, driver version, RAM size, OS build, display mode) used for the "what changed between sessions" feature.
|
||||
- App settings, logs (rotated daily — the app keeps 7 days, the capture agent 14 — including the logs written by the component loaded into games), and, after a crash of the app itself, crash dump files.
|
||||
- Which games you enabled code injection for, and when you consented.
|
||||
@@ -38,11 +39,11 @@ The "Report a bug" feature builds a zip file **on your device**, shows you exact
|
||||
|
||||
## 3A. Sharing an export or a bug report
|
||||
|
||||
An exported session (CSV or JSON) and a bug report can contain your games' names and **the paths to their files** — which include your **Windows user name** when a game is installed under your user folder — your hardware model, graphics driver and Windows build, the times you played, and your tags and notes. A bug report removes user directory paths from its logs; an export is written as it is. Look at a file before you share it. Once you share it, it is outside FrameLedger: whoever receives it, and the site you post it to, can read it under their own terms.
|
||||
An exported session (CSV or JSON) and a bug report can contain your games' names and **the paths to their files** — which include your **Windows user name** when a game is installed under your user folder — your hardware model, graphics driver and Windows build, the times you played, and your tags and notes. What a session stores only while Advanced metrics is on (§1) is in neither: an export and a bug report carry what they carried before. A bug report removes user directory paths from its logs; an export is written as it is. Look at a file before you share it. Once you share it, it is outside FrameLedger: whoever receives it, and the site you post it to, can read it under their own terms.
|
||||
|
||||
## 4. What the app can technically observe
|
||||
|
||||
To do its job, FrameLedger observes: which of *your tracked* executables — the entries in your library whose recording is on — are running, and their process trees; whether a game you enabled hooking for runs in an app container, and which of Windows' code-protection settings it runs under (for example, accepting only Microsoft-signed code), read from Windows before any injection; the parameters your games pass to the graphics APIs it intercepts (presentation, upscaling, ray tracing, pipeline creation); the memory use of a tracked game's process — its dedicated and shared video memory, from Windows' GPU performance counters, and its working sets and commit, from Windows' process-memory information, for which a game it does not inject into is opened with the least access Windows offers and closed again (never its memory's content); loaded module names of a game being captured, the version information of its upscaling, frame-generation and neural-rendering libraries, and whether each was loaded from the game's folder or from the graphics driver's own copy (for detection and for the anti-cheat safety check); the names of the files in each library game's install folder, the version information of its executable and of the upscaling and neural-rendering libraries it ships, the content of its executable file (the markers of the engine and of the graphics libraries it carries, the libraries it imports, and the engine build name an Unreal Engine game carries), the version marks an engine keeps in its own files (Unity's player library and the header of its data file, the header of a Godot data pack, an RPG Maker game's title, core script and Game.ini, the library Game.ini names, and the version file of a Ren'Py game's engine), and the store files that name it (Steam's and GOG's, on your disk) and, for a game the Xbox app or the Microsoft Store installed, the package files in its install folder that describe it (`MicrosoftGame.config` and `appxmanifest.xml`) — to detect its engine, its engine version and its features and to check it for anti-cheat before any injection is possible; the lists of installed games that the Steam, GOG GALAXY, Epic Games and itch apps keep on your disk, and where GOG GALAXY is installed, the folders the Xbox app installs games into on each drive (named by the `.GamingRoot` file at the drive's root) with each game's package files, and Windows' answer to whether that game's package is installed for you — read when you import your library and when you press Play, to find the store that installed a game and hand the game to that store's app — Steam's and GOG GALAXY's also when you open a game's page, to find the artwork their apps keep for it; the cover and banner images that the Steam and GOG GALAXY apps keep on your disk for a game in your library and the logo and splash-screen images a game from the Xbox app ships in its own folder — read to show them on its page, never copied or sent anywhere; the size, position and state of a tracked game's window and the monitor it is on, read from Windows and not from the game, and — for a game FrameLedger injects into — whether the game asked for exclusive full-screen; the NVIDIA driver's settings for your tracked executables (read only: the DLSS and frame-generation overrides the NVIDIA App set); hardware sensor values from your graphics driver's own libraries; how busy the processor is and how much memory is in use, from Windows' own counters; the crash reports Windows keeps in its Application log about a tracked game's executable while it ran (to tell a crash from an ordinary exit — the reports are read, never sent anywhere); and the names of the programs a tracked game starts, so that a game's own crash reporter is recognised.
|
||||
To do its job, FrameLedger observes: which of *your tracked* executables — the entries in your library whose recording is on — are running, and their process trees; whether a game you enabled hooking for runs in an app container, and which of Windows' code-protection settings it runs under (for example, accepting only Microsoft-signed code), read from Windows before any injection; the parameters your games pass to the graphics APIs it intercepts (presentation, upscaling, ray tracing, pipeline creation); the memory use of a tracked game's process — its dedicated and shared video memory, from Windows' GPU performance counters, and its working sets and commit, from Windows' process-memory information, for which a game it does not inject into is opened with the least access Windows offers and closed again (never its memory's content); loaded module names of a game being captured, the version information of its upscaling, frame-generation and neural-rendering libraries, and whether each was loaded from the game's folder or from the graphics driver's own copy (for detection and for the anti-cheat safety check); the names of the files in each library game's install folder, the version information of its executable and of the upscaling and neural-rendering libraries it ships, the content of its executable file (the markers of the engine and of the graphics libraries it carries, the libraries it imports, and the engine build name an Unreal Engine game carries), the version marks an engine keeps in its own files (Unity's player library and the header of its data file, the header of a Godot data pack, an RPG Maker game's title, core script and Game.ini, the library Game.ini names, and the version file of a Ren'Py game's engine), and the store files that name it (Steam's and GOG's, on your disk) and, for a game the Xbox app or the Microsoft Store installed, the package files in its install folder that describe it (`MicrosoftGame.config` and `appxmanifest.xml`) — to detect its engine, its engine version and its features and to check it for anti-cheat before any injection is possible; the lists of installed games that the Steam, GOG GALAXY, Epic Games and itch apps keep on your disk, and where GOG GALAXY is installed, the folders the Xbox app installs games into on each drive (named by the `.GamingRoot` file at the drive's root) with each game's package files, and Windows' answer to whether that game's package is installed for you — read when you import your library and when you press Play, to find the store that installed a game and hand the game to that store's app — Steam's and GOG GALAXY's also when you open a game's page, to find the artwork their apps keep for it; the cover and banner images that the Steam and GOG GALAXY apps keep on your disk for a game in your library and the logo and splash-screen images a game from the Xbox app ships in its own folder — read to show them on its page, never copied or sent anywhere; the size, position and state of a tracked game's window and the monitor it is on, read from Windows and not from the game, and — for a game FrameLedger injects into — whether the game asked for exclusive full-screen; the NVIDIA driver's settings for your tracked executables (read only: the DLSS and frame-generation overrides the NVIDIA App set); hardware sensor values from your graphics driver's own libraries; and — only while Advanced metrics is on — that driver's description of the graphics card and of each connected display, what it reports about the display a tracked game's window is on, its settings for a tracked game and its global ones (read only), and, when the capture agent runs as administrator with PawnIO installed, the sensors and model names of the processor, the memory and the motherboard (never a drive's); how busy the processor is and how much memory is in use, from Windows' own counters; the crash reports Windows keeps in its Application log about a tracked game's executable while it ran (to tell a crash from an ordinary exit — the reports are read, never sent anywhere); and the names of the programs a tracked game starts, so that a game's own crash reporter is recognised.
|
||||
|
||||
It does **not** read game memory outside those API parameters, and does not read game saves, chat, input content, network traffic, or anything unrelated to performance measurement. It records only for programs you added to your library and did not switch recording off for — a program whose recording is off is not watched at all — and injects only into games you individually enabled.
|
||||
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
# Qodana's settings for the `native` job of .github/workflows/qodana.yml (owner decision D99, 2026-11-11;
|
||||
# docs/13_CI_CD.md §Qodana).
|
||||
#
|
||||
# The C++ of src/native, read by Qodana for .NET (qodana-dotnet: Rider's engine, whose C++ is ReSharper C++) in native
|
||||
# mode on a Windows runner. That linter is the only one that can: the native layer is MSVC-only, and JetBrains' two
|
||||
# C/C++ linters (qodana-cpp, qodana-clang) are Linux images. It reads C++ through a Visual Studio solution, and
|
||||
# src/native is a CMake tree, so the job generates one first - the `x64-vs-analysis` preset - and builds from it only
|
||||
# the one header a build generates (the blocklist floor). Nothing else is compiled.
|
||||
#
|
||||
# A report of its own, in a Qodana Cloud project of its own (`frameledger-cpp`, the QODANA_TOKEN_NATIVE secret): the
|
||||
# managed report (qodana.yaml) leaves src/native out, so every file is in exactly one of the two.
|
||||
version: "1.0"
|
||||
linter: qodana-dotnet
|
||||
withinDocker: false
|
||||
|
||||
profile:
|
||||
base:
|
||||
name: qodana.recommended
|
||||
groups:
|
||||
- groupId: Hints
|
||||
groups:
|
||||
- "severity:TYPO"
|
||||
inspections:
|
||||
- group: Hints
|
||||
enabled: false
|
||||
|
||||
dotnet:
|
||||
solution: build/native/x64-vs-analysis/FrameLedgerNative.slnx
|
||||
# The flags the shipped binaries are built with (the x64-release preset's build type).
|
||||
configuration: RelWithDebInfo
|
||||
platform: x64
|
||||
|
||||
# What is not FrameLedger's code: what CMake generates and fetches (MinHook, Catch2, jsmn, the floor header), the
|
||||
# vendored SDK headers, the fixtures that carry the vendors' names on purpose, a compiled shader as a byte array.
|
||||
exclude:
|
||||
- name: All
|
||||
paths:
|
||||
- build
|
||||
- src/native/third_party
|
||||
- src/native/tools/vendor-stubs
|
||||
- src/native/tools/hook-harness/dxr_raygen_dxil.h
|
||||
|
||||
failureConditions:
|
||||
severityThresholds:
|
||||
any: 0
|
||||
+99
-15
@@ -1,29 +1,113 @@
|
||||
# Qodana's settings for .github/workflows/qodana.yml (owner decision D93, 2026-11-10; docs/13_CI_CD.md §Qodana).
|
||||
# Qodana's settings for the `managed` job of .github/workflows/qodana.yml (owner decisions D93, 2026-11-10, and D99,
|
||||
# 2026-11-11; docs/13_CI_CD.md §Qodana).
|
||||
#
|
||||
# The linter is Qodana Community for .NET (ReSharper's InspectCode in a Linux container), and not Qodana for .NET
|
||||
# (Rider): that one needs an Ultimate licence, and the Qodana Cloud organisation holds a 30-day trial, so a job
|
||||
# built on it would turn red the day the trial ends. The Community linter runs under every licence.
|
||||
# The linter is Qodana for .NET (qodana-dotnet: Rider's engine), in NATIVE mode - on the job's own Windows runner, with
|
||||
# the .NET SDK global.json names, no container. It needs the Ultimate licence the Qodana Cloud organisation holds since
|
||||
# 2026-11-10; the Community linter (qodana-cdnet, InspectCode in a Linux container) ran here until then, and is the way
|
||||
# back if the subscription ever lapses - `linter: qodana-cdnet`, and the job on ubuntu-latest again.
|
||||
#
|
||||
# It analyses the C# of FrameLedger.slnx - and its XAML and .resx - and nothing native: src/native is a CMake
|
||||
# tree no solution names, and it is MSVC-only, which no Linux container compiles. CodeQL and SonarCloud read the C++.
|
||||
# It reads the solution's C#, XAML and .resx, and what Rider's own plugins read of the repository around it (Markdown,
|
||||
# XML, and JetBrains' security rules over the C#). Not the C++: that is qodana-native.yaml's report, over the Visual
|
||||
# Studio solution CMake generates, sent to a Qodana Cloud project of its own.
|
||||
#
|
||||
# The linter's image is the action's own version (the action pins the CLI, the CLI its image), so the one pin is the
|
||||
# action's commit in the workflow.
|
||||
# Everything a run needs to know is here and nothing is an action argument, so `qodana scan` on a developer's PC reads
|
||||
# the same settings. The linter's version is the action's (the action pins the CLI, the CLI its linter), so the one pin
|
||||
# is the action's commit in the workflow.
|
||||
version: "1.0"
|
||||
linter: qodana-cdnet
|
||||
linter: qodana-dotnet
|
||||
withinDocker: false
|
||||
|
||||
# INTERIM, from beta.37's move to .NET 11 (D94, 2026-11-11) until the Ultimate linter's pull request replaces this
|
||||
# file: the linter's image carries the .NET SDKs 8 to 10, and main builds on 11. The SDK global.json names is installed
|
||||
# into the container before the build, with the line JetBrains' page gives for an SDK the image lacks.
|
||||
bootstrap: curl -fsSL https://dot.net/v1/dotnet-install.sh | bash -s -- --jsonfile /data/project/global.json -i /usr/share/dotnet
|
||||
# WHERE AN INSPECTION IS SWITCHED OFF (docs/13_CI_CD.md §Qodana, CLAUDE.md §Coding conventions): one of ReSharper's -
|
||||
# C#, XAML, .resx - in .editorconfig, where Rider reads it too. Here only what has no key there: a whole severity and
|
||||
# the IntelliJ platform's own inspections (Markdown, XML) under `profile`; and, under `exclude` further down, the files
|
||||
# JetBrains' security rules were read in, and one file the linter itself fails on. Each with its reason above it.
|
||||
profile:
|
||||
base:
|
||||
name: qodana.recommended
|
||||
groups:
|
||||
# A HINT is what the editor offers without underlining anything (ReSharper's lowest level; this linter files it as
|
||||
# TYPO, Qodana as Low): "invert if", "convert to LINQ", a trailing comma, and every Roslyn analyzer message below
|
||||
# the level this build makes an error. The Community linter never reported them, and the rule D93 set is about
|
||||
# warnings and suggestions. 3,607 of this job's first 3,953 results were hints (run 42923079119).
|
||||
- groupId: Hints
|
||||
groups:
|
||||
- "severity:TYPO"
|
||||
inspections:
|
||||
- group: Hints
|
||||
enabled: false
|
||||
# Rider wants a table's columns padded to one width. The tables here are written to be diffed: a cell's text changes
|
||||
# and its row alone moves.
|
||||
- inspection: MarkdownIncorrectTableFormatting
|
||||
enabled: false
|
||||
# It computes a heading's anchor its own way; the documents are read on GitHub, whose anchors these links follow
|
||||
# (`#display-mode--both-tiers-beta10` for "Display mode — both tiers (beta.10)"), and tools/wiki-build.ps1 checks
|
||||
# the links of every page it publishes. All three it reported resolve on GitHub.
|
||||
- inspection: MarkdownUnresolvedHeaderReference
|
||||
enabled: false
|
||||
# A Windows application manifest: the linter has no schema for urn:schemas-microsoft-com:asm.v1 and reports every
|
||||
# element of the file as undeclared.
|
||||
- inspection: XmlHighlighting
|
||||
ignore:
|
||||
- "src/FrameLedger.App/app.manifest"
|
||||
|
||||
dotnet:
|
||||
solution: FrameLedger.slnx
|
||||
configuration: Release
|
||||
|
||||
# What is not FrameLedger's code, or not code at all - SonarQube.Analysis.xml's list, for its reasons - and what the
|
||||
# other report reads.
|
||||
exclude:
|
||||
- name: All
|
||||
paths:
|
||||
- src/native
|
||||
- src/FrameLedger.App/Strings.Designer.cs
|
||||
- tests/fixtures
|
||||
- legal/licenses
|
||||
- docs/vendor-exports.json
|
||||
- src/FrameLedger.Infrastructure/Persistence/Migrations
|
||||
- build
|
||||
- out
|
||||
# JETBRAINS' SECURITY RULES (the OpenGrep plugin: pattern rules, several hundred of them) stay on, and the files
|
||||
# their results were READ in are listed here - so a new file that starts a process, or builds an SQL text, is
|
||||
# reported. Two rules fired, 36 times, on 2026-11-11: "a process is started with something that is not a literal"
|
||||
# (35) - and starting processes is part of what FrameLedger is: the Agent beside the App, the game the user added,
|
||||
# Explorer on a folder, the browser on a link - and the same for an SQL text (1: a constant field, every value a
|
||||
# parameter). docs/13_CI_CD.md §Qodana has each place, what it starts and where that comes from.
|
||||
#
|
||||
# The name is the PLUGIN'S ONE INSPECTION, not a rule's: every rule's result is produced by OpenGrepInspection, and
|
||||
# a rule's own id is honoured nowhere - not by `ignore`, not by an `exclude` path, not by `enabled: false` (three
|
||||
# runs, 42932842462, 42935752891 and 42938295264: all 36 stood each time; the server is handed every rule file
|
||||
# whatever the profile says). So a file listed here is left out of ALL of the plugin's rules, which is the price.
|
||||
# ProcessStartSitesTests, in the gate, names the same files and fails on a new one.
|
||||
- name: OpenGrepInspection
|
||||
paths:
|
||||
- src/FrameLedger.App/Services/AgentLauncher.cs
|
||||
- src/FrameLedger.App/Services/AgentTool.cs
|
||||
- src/FrameLedger.App/Services/Explorer.cs
|
||||
- src/FrameLedger.App/Services/ShellStarter.cs
|
||||
- src/FrameLedger.App/Services/ShellUrlOpener.cs
|
||||
- src/FrameLedger.App/ViewModels/SettingsViewModel.cs
|
||||
- src/FrameLedger.Infrastructure/Capture/ProcessLauncher.cs
|
||||
- src/FrameLedger.Infrastructure/Diagnostics/CrashDumpWriter.cs
|
||||
- src/FrameLedger.Infrastructure/Startup/AgentElevation.cs
|
||||
- src/FrameLedger.Infrastructure/Startup/LogonTask.cs
|
||||
- src/FrameLedger.Infrastructure/Persistence/SqliteSessionRepository.cs
|
||||
# The tests start what they test - the harness, the Agent, a process to hold a handle on (24 of the 35).
|
||||
- tests
|
||||
# THE LINTER'S OWN FAULT, not the file's: resolving `PInvoke.EnumDisplaySettings(null, ...)` - the `null` to PCWSTR
|
||||
# conversion - the engine of this linter's build (QDNET-262.12299) fails an internal assertion
|
||||
# ("IsStandardImplicitConversionFromExpression(conversion.Kind)", in its log), loses the method, and reports its
|
||||
# three locals and the file's three usings as unused. The compiler builds it with warnings as errors, and
|
||||
# InspectCode 2026.2.3.1 and 2026.3.0 report nothing there. To be removed when a linter build reads the file.
|
||||
- name: UnusedVariable.Compiler
|
||||
paths:
|
||||
- src/FrameLedger.Infrastructure/Recording/PrimaryDisplay.cs
|
||||
- name: RedundantUsingDirective
|
||||
paths:
|
||||
- src/FrameLedger.Infrastructure/Recording/PrimaryDisplay.cs
|
||||
|
||||
# The gate: no problem at all. What the linter reports is settled where it is found - fixed, or its inspection
|
||||
# switched off in .editorconfig with the reason beside it (InspectCode reads its severities there, and so does
|
||||
# Rider) - so a count above zero is something new.
|
||||
# switched off with the reason beside it - so a count above zero is something new.
|
||||
failureConditions:
|
||||
severityThresholds:
|
||||
any: 0
|
||||
@@ -1,6 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using FrameLedger.Application.Advanced;
|
||||
using FrameLedger.Application.AntiCheat;
|
||||
using FrameLedger.Application.Capture;
|
||||
using FrameLedger.Application.Consent;
|
||||
@@ -43,6 +44,7 @@ internal sealed class AgentRecording
|
||||
private readonly WindowGeometryProbe _display = new();
|
||||
private readonly UserModeExceptionLapsePolicy _exceptionLapse;
|
||||
private readonly ICrashReporterSightings _reporters;
|
||||
private readonly IAdvancedHardware _advanced;
|
||||
|
||||
public AgentRecording(
|
||||
IGameConsentStore store,
|
||||
@@ -67,8 +69,10 @@ internal sealed class AgentRecording
|
||||
IUserModeExceptionSwitch exceptions,
|
||||
IOverlayToleranceChannel tolerance,
|
||||
UserModeExceptionLapsePolicy exceptionLapse,
|
||||
ICrashReporterSightings reporters)
|
||||
ICrashReporterSightings reporters,
|
||||
IAdvancedHardware advanced)
|
||||
{
|
||||
_advanced = advanced;
|
||||
_reporters = reporters;
|
||||
_profiles = profiles;
|
||||
_exceptions = exceptions;
|
||||
@@ -119,18 +123,21 @@ internal sealed class AgentRecording
|
||||
_partials,
|
||||
_finalizer,
|
||||
_crashes,
|
||||
static options => Poller(options.TelemetryInterval),
|
||||
options => Poller(options.TelemetryInterval, options.AdvancedMetrics ? _advanced : null),
|
||||
TimeProvider.System,
|
||||
new RecorderOptions { MinimumSessionLength = minimum, PartialFlushInterval = flush },
|
||||
_observer,
|
||||
_policy,
|
||||
_profiles,
|
||||
_exceptionLapse,
|
||||
_reporters);
|
||||
_reporters,
|
||||
_advanced);
|
||||
}
|
||||
|
||||
/// <summary>L1 + L2 + L3 under the composite, one poller per session; the poller owns and disposes the layers. The interval is the session's (<c>telemetry.interval_ms</c>, D16).</summary>
|
||||
public static TelemetryPoller Poller(TimeSpan interval)
|
||||
/// <param name="interval">Between two polls.</param>
|
||||
/// <param name="advanced">The Agent's shared advanced reader when the session records Advanced metrics (D101); null — the option off — composes none.</param>
|
||||
public static TelemetryPoller Poller(TimeSpan interval, IAdvancedHardware? advanced = null)
|
||||
{
|
||||
// Ownership walks up one step at a time and each local is nulled at its hand-off, so a throw
|
||||
// anywhere below disposes exactly what nobody owns yet.
|
||||
@@ -161,7 +168,7 @@ internal sealed class AgentRecording
|
||||
// The game process's own memory (beta.12, D43): read from outside it through FrameLedger.ProcessStats.dll, for
|
||||
// whichever process the capture loop tells the poller to follow. Absent DLL = N/A, never a fault.
|
||||
game = new GameMemoryReader(new NativeProcessStats());
|
||||
var poller = new TelemetryPoller(composite, new TelemetryPollerOptions { Interval = interval }, TimeProvider.System, ownsSource: true, system, game);
|
||||
var poller = new TelemetryPoller(composite, new TelemetryPollerOptions { Interval = interval }, TimeProvider.System, ownsSource: true, system, game, advanced);
|
||||
composite = null;
|
||||
system = null;
|
||||
game = null;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using FrameLedger.Agent.Hosting;
|
||||
using FrameLedger.Application.Advanced;
|
||||
using FrameLedger.Application.AntiCheat;
|
||||
using FrameLedger.Application.Capture;
|
||||
using FrameLedger.Application.Consent;
|
||||
@@ -120,6 +121,15 @@ internal static class AgentServices
|
||||
services.AddSingleton<ISeriesCodec, DeflateSeriesCodec>();
|
||||
services.AddSingleton<SessionFinalizer>();
|
||||
services.AddSingleton(static sp => new PartialRecovery(sp.GetRequiredService<IPartialSessionStore>(), sp.GetRequiredService<SessionFinalizer>()));
|
||||
// Advanced metrics (owner decisions D101 and D107): ONE reader for the whole Agent, on a thread of its own, that
|
||||
// runs only while a session recorded with the option on - or the App's page - holds it, and closes ten seconds
|
||||
// after the last lets go. Constructing it opens nothing; a PC idling with the Agent in the tray reads no sensor
|
||||
// for this. The container disposes it with the host.
|
||||
services.AddSingleton<IAdvancedHardware>(static _ => new AdvancedHardwareHub(
|
||||
static () => AdvancedHardwareReader.OverThisPc(TimeProvider.System, static line => Serilog.Log.Information("{Line}", line)),
|
||||
interval: TimeSpan.FromSeconds(1),
|
||||
linger: TimeSpan.FromSeconds(10),
|
||||
static line => Serilog.Log.Information("{Line}", line)));
|
||||
services.AddSingleton<AgentRecording>();
|
||||
}
|
||||
|
||||
|
||||
@@ -214,6 +214,19 @@
|
||||
SpinButtonPlacementMode="Inline"
|
||||
Value="{Binding ViewModel.RetentionRawSessions, Mode=TwoWay}" />
|
||||
</ui:CardControl>
|
||||
<!-- Advanced metrics (owner decision D101, 2026-11-11): off by default, and off means nothing more is read or
|
||||
stored. The Agent reads it at each session's start, so it is off in a viewer like every setting it reads. -->
|
||||
<ui:CardControl Margin="0,8,0,0" Icon="{ui:SymbolIcon DataUsage24}">
|
||||
<ui:CardControl.Header>
|
||||
<StackPanel>
|
||||
<ui:TextBlock FontTypography="BodyStrong" Text="{x:Static res:Strings.Settings_Advanced_Label}" />
|
||||
<ui:TextBlock MaxWidth="560" HorizontalAlignment="Left" Style="{StaticResource SecondaryText}" Text="{x:Static res:Strings.Settings_Advanced_Body}" TextWrapping="Wrap" />
|
||||
</StackPanel>
|
||||
</ui:CardControl.Header>
|
||||
<ui:ToggleSwitch AutomationProperties.Name="{x:Static res:Strings.Settings_Advanced_Label}"
|
||||
IsChecked="{Binding ViewModel.AdvancedMetrics, Mode=TwoWay}"
|
||||
IsEnabled="{Binding ViewModel.ActsOnThisPc}" />
|
||||
</ui:CardControl>
|
||||
<!-- beta.12: "Record games launched outside FrameLedger" stood here; nothing read it (capture.background,
|
||||
06_DATA_MODEL §Settings registry), and with no way to start a game from the App "off" could only have
|
||||
meant recording nothing. Removed until a launch path exists. -->
|
||||
|
||||
@@ -6,12 +6,30 @@ using System.Diagnostics;
|
||||
|
||||
namespace FrameLedger.App.Services;
|
||||
|
||||
/// <summary><see cref="IUrlOpener"/> through the shell (<c>UseShellExecute</c>), the same launch every other link in the App makes; a refusal is logged, never thrown.</summary>
|
||||
/// <summary>
|
||||
/// <see cref="IUrlOpener"/> through the shell (<c>UseShellExecute</c>), the same launch every other link in the App makes; a
|
||||
/// refusal is logged, never thrown. The shell runs whatever it is handed - a <c>file:</c> address is a program - so this
|
||||
/// opens web and mail links only, and says so itself rather than trusting each caller to have checked (2026-11-11: every
|
||||
/// caller passes one of the project's own pages or a link <c>MarkdownLinks</c> has already held to these schemes).
|
||||
/// </summary>
|
||||
public sealed class ShellUrlOpener : IUrlOpener
|
||||
{
|
||||
/// <summary>Whether <paramref name="url"/> is a link the shell may be handed: absolute, and <c>http</c>, <c>https</c> or <c>mailto</c>.</summary>
|
||||
public static bool IsOpenable(Uri url)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(url);
|
||||
return url.IsAbsoluteUri && url.Scheme is "https" or "http" or "mailto";
|
||||
}
|
||||
|
||||
public bool Open(Uri url)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(url);
|
||||
if (!IsOpenable(url))
|
||||
{
|
||||
Serilog.Log.Warning("ui: not opened - {Url} is neither a web nor a mail link", url);
|
||||
return false;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
using Process? _ = Process.Start(new ProcessStartInfo(url.AbsoluteUri) { UseShellExecute = true });
|
||||
|
||||
Generated
+6
@@ -942,6 +942,8 @@ public static class Strings
|
||||
nameof(Sessions_GameRamWs_Cell_Format),
|
||||
nameof(Sessions_GameRamWs_Tooltip_Format),
|
||||
nameof(Sessions_GameVram_Tooltip_Format),
|
||||
nameof(Settings_Advanced_Body),
|
||||
nameof(Settings_Advanced_Label),
|
||||
nameof(Settings_Agent_Elevated),
|
||||
nameof(Settings_Agent_Elevation_Body),
|
||||
nameof(Settings_Agent_Elevation_Label),
|
||||
@@ -3091,6 +3093,10 @@ public static class Strings
|
||||
|
||||
public static string Sessions_GameVram_Tooltip_Format => ResourceManager.GetString(nameof(Sessions_GameVram_Tooltip_Format), Culture) ?? nameof(Sessions_GameVram_Tooltip_Format);
|
||||
|
||||
public static string Settings_Advanced_Body => ResourceManager.GetString(nameof(Settings_Advanced_Body), Culture) ?? nameof(Settings_Advanced_Body);
|
||||
|
||||
public static string Settings_Advanced_Label => ResourceManager.GetString(nameof(Settings_Advanced_Label), Culture) ?? nameof(Settings_Advanced_Label);
|
||||
|
||||
public static string Settings_Agent_Elevated => ResourceManager.GetString(nameof(Settings_Agent_Elevated), Culture) ?? nameof(Settings_Agent_Elevated);
|
||||
|
||||
public static string Settings_Agent_Elevation_Body => ResourceManager.GetString(nameof(Settings_Agent_Elevation_Body), Culture) ?? nameof(Settings_Agent_Elevation_Body);
|
||||
|
||||
@@ -405,6 +405,14 @@
|
||||
<value>エージェントがルール更新に応答しませんでした。</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Settings_Advanced_Body" xml:space="preserve">
|
||||
<value>セッション中にグラフィックス ドライバーとハードウェア センサーからさらに多くを読み取り、セッションと一緒に保存します - グラフィックス カードのメモリと負荷の詳細、各ファンと電圧、ディスプレイの対応機能、ゲームに対するドライバーの設定など。オフ: 追加の読み取りも保存も行いません。次のセッションから適用され、オフの間に記録したセッションが後から補われることはありません。</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Settings_Advanced_Label" xml:space="preserve">
|
||||
<value>詳細メトリクス</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Settings_Appearance_Header" xml:space="preserve">
|
||||
<value>外観</value>
|
||||
<comment>review</comment>
|
||||
@@ -1982,7 +1990,7 @@
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Settings_Agent_Elevation_Body" xml:space="preserve">
|
||||
<value>昇格はどのキャプチャティアにも必須ではありません。CPU 温度 (PawnIO 経由) と、昇格して動作するゲームへのアタッチを任意で有効にするだけです。フック・実測・記録はすべて昇格なしで動作します。</value>
|
||||
<value>昇格はどのキャプチャティアにも必須ではありません。CPU 温度と、詳細メトリクスがオンの場合はプロセッサ・メモリ・マザーボードのセンサー (いずれも PawnIO 経由)、および昇格して動作するゲームへのアタッチを任意で有効にするだけです。フック・実測・記録はすべて昇格なしで動作します。</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Settings_Agent_Elevation_Label" xml:space="preserve">
|
||||
@@ -2338,7 +2346,7 @@
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="FirstRun_Agent_Body" xml:space="preserve">
|
||||
<value>FrameLedger は小さなキャプチャエージェントを標準ユーザーとして (昇格せずに) 起動します。昇格は任意で、どのキャプチャティアにも必須ではありません。CPU 温度 (PawnIO 経由) と、昇格して動作するゲームへのアタッチを有効にするだけです。以下はエージェントがこのマシンについて報告した内容です。</value>
|
||||
<value>FrameLedger は小さなキャプチャエージェントを標準ユーザーとして (昇格せずに) 起動します。昇格は任意で、どのキャプチャティアにも必須ではありません。CPU 温度と、詳細メトリクスがオンの場合はプロセッサ・メモリ・マザーボードのセンサー (いずれも PawnIO 経由)、および昇格して動作するゲームへのアタッチを有効にするだけです。以下はエージェントがこのマシンについて報告した内容です。</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="FirstRun_Agent_Header" xml:space="preserve">
|
||||
|
||||
@@ -309,6 +309,12 @@
|
||||
<data name="Rules_Update_Failed" xml:space="preserve">
|
||||
<value>The agent did not answer the rules update.</value>
|
||||
</data>
|
||||
<data name="Settings_Advanced_Body" xml:space="preserve">
|
||||
<value>Read more from the graphics driver and the hardware sensors during a session - the graphics card's memory and load in detail, each fan and voltage, what your display can do, the driver's settings for the game - and store it with the session. Off: nothing more is read or stored. It applies from the next session, and a session recorded while it was off is not filled in later.</value>
|
||||
</data>
|
||||
<data name="Settings_Advanced_Label" xml:space="preserve">
|
||||
<value>Advanced metrics</value>
|
||||
</data>
|
||||
<data name="Settings_Appearance_Header" xml:space="preserve">
|
||||
<value>Appearance</value>
|
||||
</data>
|
||||
@@ -1492,7 +1498,7 @@
|
||||
<value>Running elevated.</value>
|
||||
</data>
|
||||
<data name="Settings_Agent_Elevation_Body" xml:space="preserve">
|
||||
<value>Elevation is not required by any capture tier. It optionally unlocks CPU temperature (through PawnIO) and attaching to games that run elevated themselves. Everything else — hooking, measuring, recording — works without it.</value>
|
||||
<value>Elevation is not required by any capture tier. It optionally unlocks CPU temperature and, with Advanced metrics on, the processor's, the memory's and the motherboard's sensors (both through PawnIO), and attaching to games that run elevated themselves. Everything else — hooking, measuring, recording — works without it.</value>
|
||||
</data>
|
||||
<data name="Settings_Agent_Elevation_Label" xml:space="preserve">
|
||||
<value>Elevation</value>
|
||||
@@ -1759,7 +1765,7 @@
|
||||
<value>Accept</value>
|
||||
</data>
|
||||
<data name="FirstRun_Agent_Body" xml:space="preserve">
|
||||
<value>FrameLedger starts a small capture agent beside itself, as a standard user — not elevated. Elevation is optional and is not required by any capture tier: it only unlocks CPU temperature (through PawnIO) and attaching to games that run elevated themselves. Below is what the agent reports about this machine.</value>
|
||||
<value>FrameLedger starts a small capture agent beside itself, as a standard user — not elevated. Elevation is optional and is not required by any capture tier: it only unlocks CPU temperature and, with Advanced metrics on, the processor's, the memory's and the motherboard's sensors (both through PawnIO), and attaching to games that run elevated themselves. Below is what the agent reports about this machine.</value>
|
||||
</data>
|
||||
<data name="FirstRun_Agent_Header" xml:space="preserve">
|
||||
<value>The capture agent</value>
|
||||
|
||||
@@ -304,6 +304,12 @@
|
||||
<data name="Rules_Update_Failed" xml:space="preserve">
|
||||
<value>Agent không phản hồi yêu cầu cập nhật quy tắc.</value>
|
||||
</data>
|
||||
<data name="Settings_Advanced_Body" xml:space="preserve">
|
||||
<value>Đọc thêm từ driver đồ hoạ và các cảm biến phần cứng trong lúc ghi phiên - bộ nhớ và tải của card đồ hoạ ở mức chi tiết, từng quạt và điện áp, khả năng của màn hình, thiết lập của driver cho game - và lưu cùng phiên. Tắt: không đọc và không lưu thêm gì. Áp dụng từ phiên kế tiếp; phiên đã ghi lúc tắt sẽ không được bổ sung về sau.</value>
|
||||
</data>
|
||||
<data name="Settings_Advanced_Label" xml:space="preserve">
|
||||
<value>Thông số nâng cao</value>
|
||||
</data>
|
||||
<data name="Settings_Appearance_Header" xml:space="preserve">
|
||||
<value>Giao diện</value>
|
||||
</data>
|
||||
@@ -1487,7 +1493,7 @@
|
||||
<value>Đang chạy với quyền quản trị.</value>
|
||||
</data>
|
||||
<data name="Settings_Agent_Elevation_Body" xml:space="preserve">
|
||||
<value>Không tier nào cần quyền quản trị. Nó chỉ tuỳ chọn mở khoá nhiệt độ CPU (qua PawnIO) và gắn vào game tự chạy với quyền quản trị. Mọi thứ khác — hook, đo, ghi — đều chạy không cần.</value>
|
||||
<value>Không tier nào cần quyền quản trị. Nó chỉ tuỳ chọn mở khoá nhiệt độ CPU và, khi bật Thông số nâng cao, cảm biến của bộ xử lý, bộ nhớ và bo mạch (đều qua PawnIO), cùng việc gắn vào game tự chạy với quyền quản trị. Mọi thứ khác — hook, đo, ghi — đều chạy không cần.</value>
|
||||
</data>
|
||||
<data name="Settings_Agent_Elevation_Label" xml:space="preserve">
|
||||
<value>Quyền quản trị</value>
|
||||
@@ -1754,7 +1760,7 @@
|
||||
<value>Chấp nhận</value>
|
||||
</data>
|
||||
<data name="FirstRun_Agent_Body" xml:space="preserve">
|
||||
<value>FrameLedger khởi động một capture agent nhỏ bên cạnh nó, với quyền người dùng thường — không nâng quyền. Nâng quyền là tuỳ chọn và không tier thu thập nào yêu cầu: nó chỉ mở khoá nhiệt độ CPU (qua PawnIO) và gắn vào game tự chạy với quyền quản trị. Bên dưới là những gì agent báo cáo về máy này.</value>
|
||||
<value>FrameLedger khởi động một capture agent nhỏ bên cạnh nó, với quyền người dùng thường — không nâng quyền. Nâng quyền là tuỳ chọn và không tier thu thập nào yêu cầu: nó chỉ mở khoá nhiệt độ CPU và, khi bật Thông số nâng cao, cảm biến của bộ xử lý, bộ nhớ và bo mạch (đều qua PawnIO), cùng việc gắn vào game tự chạy với quyền quản trị. Bên dưới là những gì agent báo cáo về máy này.</value>
|
||||
</data>
|
||||
<data name="FirstRun_Agent_Header" xml:space="preserve">
|
||||
<value>Capture agent</value>
|
||||
|
||||
@@ -80,6 +80,13 @@ public sealed partial class SettingsViewModel : ObservableObject
|
||||
[ObservableProperty]
|
||||
private bool _removeUninstalledGames;
|
||||
|
||||
/// <summary>
|
||||
/// "Advanced metrics" (owner decision D101, <c>telemetry.advanced</c>, off by default): the Agent reads more from the
|
||||
/// graphics driver and the sensors during a session and stores it; off, nothing more is read or stored.
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _advancedMetrics;
|
||||
|
||||
[ObservableProperty]
|
||||
private int _minSessionSeconds;
|
||||
|
||||
@@ -425,6 +432,8 @@ public sealed partial class SettingsViewModel : ObservableObject
|
||||
|
||||
partial void OnRemoveUninstalledGamesChanged(bool value) => Persist(SettingsRegistry.RetentionRemoveUninstalledGames, value);
|
||||
|
||||
partial void OnAdvancedMetricsChanged(bool value) => Persist(SettingsRegistry.TelemetryAdvanced, value);
|
||||
|
||||
partial void OnHideAntiCheatHookingChanged(bool value) => Persist(SettingsRegistry.UiHideAntiCheatHooking, value);
|
||||
|
||||
/// <summary>D33: the option is one settings row the Agent reads at every session start and command; the list follows it.</summary>
|
||||
@@ -580,6 +589,7 @@ public sealed partial class SettingsViewModel : ObservableObject
|
||||
TelemetryIntervalMs = await _settings.GetIntegerAsync(SettingsRegistry.TelemetryIntervalMs).ConfigureAwait(true);
|
||||
RetentionRawSessions = await _settings.GetIntegerAsync(SettingsRegistry.RetentionRawSessionsPerGame).ConfigureAwait(true);
|
||||
RemoveUninstalledGames = await _settings.GetBooleanAsync(SettingsRegistry.RetentionRemoveUninstalledGames).ConfigureAwait(true);
|
||||
AdvancedMetrics = await _settings.GetBooleanAsync(SettingsRegistry.TelemetryAdvanced).ConfigureAwait(true);
|
||||
MinimizeToTray = await _settings.GetBooleanAsync(SettingsRegistry.UiMinimizeToTray).ConfigureAwait(true);
|
||||
HideAntiCheatHooking = await _settings.GetBooleanAsync(SettingsRegistry.UiHideAntiCheatHooking).ConfigureAwait(true);
|
||||
UserModeExceptions = await _settings.GetBooleanAsync(SettingsRegistry.HookingUserModeExceptions).ConfigureAwait(true);
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
namespace FrameLedger.Application.Advanced;
|
||||
|
||||
/// <summary>An <see cref="AdvancedSessionData"/> as the <c>.partial</c> carries it, so a session that is recovered keeps its facts.</summary>
|
||||
internal sealed record AdvancedContextDocument
|
||||
{
|
||||
public List<AdvancedFactDocument> Machine { get; init; } = [];
|
||||
|
||||
public List<AdvancedFactDocument> Session { get; init; } = [];
|
||||
|
||||
public List<AdvancedSeriesInfoDocument> Series { get; init; } = [];
|
||||
|
||||
public AdvancedSources? Sources { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
namespace FrameLedger.Application.Advanced;
|
||||
|
||||
/// <summary>
|
||||
/// One fact that was read: the catalog entry it is the value of, which member of a family it is, and the value.
|
||||
/// </summary>
|
||||
/// <param name="Id">An <see cref="AdvancedMetric.Id"/> whose scope is a fact.</param>
|
||||
/// <param name="Instance">
|
||||
/// For a family — a set of facts per display — which one: <c>1</c>, <c>2</c>… in the order the source listed them.
|
||||
/// An ordinal on purpose: the source's own handle for a display changes from boot to boot and identifies nothing
|
||||
/// worth storing (D104). Null for an entry that is one value.
|
||||
/// </param>
|
||||
/// <param name="Value">The value.</param>
|
||||
public sealed record AdvancedFact(string Id, string? Instance, AdvancedValue Value);
|
||||
@@ -0,0 +1,20 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
namespace FrameLedger.Application.Advanced;
|
||||
|
||||
/// <summary>One <see cref="AdvancedFact"/> as it is stored: its id, which member of a family, and its value in whichever one shape it has.</summary>
|
||||
internal sealed record AdvancedFactDocument
|
||||
{
|
||||
public string Id { get; init; } = string.Empty;
|
||||
|
||||
public string? Instance { get; init; }
|
||||
|
||||
public double? Number { get; init; }
|
||||
|
||||
public string? Text { get; init; }
|
||||
|
||||
public List<string>? Tokens { get; init; }
|
||||
|
||||
public List<AdvancedRowDocument>? Rows { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
namespace FrameLedger.Application.Advanced;
|
||||
|
||||
/// <summary>The heading an advanced metric is shown under.</summary>
|
||||
public enum AdvancedGroup
|
||||
{
|
||||
/// <summary>Not stated. No entry of the catalog carries it.</summary>
|
||||
None = 0,
|
||||
|
||||
Gpu = 1,
|
||||
GpuMemory = 2,
|
||||
Driver = 3,
|
||||
Display = 4,
|
||||
Cpu = 5,
|
||||
Board = 6,
|
||||
Memory = 7,
|
||||
Storage = 8,
|
||||
Upscaling = 9,
|
||||
FrameGeneration = 10,
|
||||
Latency = 11,
|
||||
}
|
||||
@@ -0,0 +1,200 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using System.Text.Json;
|
||||
using FrameLedger.Application.Recording;
|
||||
|
||||
namespace FrameLedger.Application.Advanced;
|
||||
|
||||
/// <summary>
|
||||
/// The one JSON form of what "Advanced metrics" stores and carries (owner decision D102): the facts of a PC, the facts
|
||||
/// of a session, the directory of its series, and — in a <c>.partial</c> — all of it together.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// <b>Writing is strict and reading is tolerant</b>, like every JSON column here: what is written is exactly what the
|
||||
/// types hold; what is read back and does not fit — a ledger edited by hand, a value in two shapes, a word that is not
|
||||
/// a token — is left out, never thrown, and never guessed at.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// <b>Only what the catalog says is read is written</b> (<see cref="Storable"/>). The readers have no way to produce
|
||||
/// an identifier (D104); this is the same rule held once more at the door of the ledger, where a mistake would last.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static class AdvancedJson
|
||||
{
|
||||
/// <summary>
|
||||
/// The facts a ledger may hold: those whose id is a catalog entry this build reads. A fact of an entry that is an
|
||||
/// identifier, the player's state, or simply unknown is not among them.
|
||||
/// </summary>
|
||||
public static IReadOnlyList<AdvancedFact> Storable(IReadOnlyList<AdvancedFact> facts)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(facts);
|
||||
return [.. facts.Where(static f => AdvancedMetricCatalog.Find(f.Id) is { IsRead: true })];
|
||||
}
|
||||
|
||||
public static string OfFacts(IReadOnlyList<AdvancedFact> facts)
|
||||
=> JsonSerializer.Serialize(Documents(facts), AdvancedJsonContext.Default.ListAdvancedFactDocument);
|
||||
|
||||
public static IReadOnlyList<AdvancedFact> ParseFacts(string? json)
|
||||
=> Read(json, AdvancedJsonContext.Default.ListAdvancedFactDocument) is { } documents ? Facts(documents) : [];
|
||||
|
||||
public static string OfSession(IReadOnlyList<AdvancedFact> facts, AdvancedSources sources)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(sources);
|
||||
return JsonSerializer.Serialize(new AdvancedSessionDocument { Facts = Documents(facts), Sources = sources }, AdvancedJsonContext.Default.AdvancedSessionDocument);
|
||||
}
|
||||
|
||||
public static (IReadOnlyList<AdvancedFact> Facts, AdvancedSources Sources) ParseSession(string? json)
|
||||
=> Read(json, AdvancedJsonContext.Default.AdvancedSessionDocument) is { } document
|
||||
? (Facts(document.Facts), document.Sources ?? AdvancedSources.Unknown)
|
||||
: ([], AdvancedSources.Unknown);
|
||||
|
||||
public static string OfSeries(IReadOnlyList<AdvancedSeriesInfo> series, int dropped)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(series);
|
||||
ArgumentOutOfRangeException.ThrowIfNegative(dropped);
|
||||
return JsonSerializer.Serialize(new AdvancedSeriesDocument { Series = SeriesDocuments(series), Dropped = dropped }, AdvancedJsonContext.Default.AdvancedSeriesDocument);
|
||||
}
|
||||
|
||||
public static (IReadOnlyList<AdvancedSeriesInfo> Series, int Dropped) ParseSeries(string? json)
|
||||
=> Read(json, AdvancedJsonContext.Default.AdvancedSeriesDocument) is { } document
|
||||
? (Series(document.Series), Math.Max(0, document.Dropped))
|
||||
: ([], 0);
|
||||
|
||||
public static string OfStats(IReadOnlyDictionary<string, SensorSeriesStats> stats)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(stats);
|
||||
return JsonSerializer.Serialize(new Dictionary<string, SensorSeriesStats>(stats, StringComparer.Ordinal), AdvancedJsonContext.Default.DictionaryStringSensorSeriesStats);
|
||||
}
|
||||
|
||||
public static IReadOnlyDictionary<string, SensorSeriesStats> ParseStats(string? json)
|
||||
=> Read(json, AdvancedJsonContext.Default.DictionaryStringSensorSeriesStats) ?? new Dictionary<string, SensorSeriesStats>(StringComparer.Ordinal);
|
||||
|
||||
/// <summary>A session's whole advanced context, for the <c>.partial</c>.</summary>
|
||||
public static string OfContext(AdvancedSessionData data)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(data);
|
||||
return JsonSerializer.Serialize(
|
||||
new AdvancedContextDocument
|
||||
{
|
||||
Machine = Documents(data.MachineFacts),
|
||||
Session = Documents(data.SessionFacts),
|
||||
Series = SeriesDocuments(data.Series),
|
||||
Sources = data.Sources,
|
||||
},
|
||||
AdvancedJsonContext.Default.AdvancedContextDocument);
|
||||
}
|
||||
|
||||
/// <summary>The context a <c>.partial</c> carried, or null when it carried none that reads.</summary>
|
||||
public static AdvancedSessionData? ParseContext(string? json)
|
||||
=> Read(json, AdvancedJsonContext.Default.AdvancedContextDocument) is { } document
|
||||
? new AdvancedSessionData(Facts(document.Machine), Facts(document.Session), Series(document.Series), document.Sources ?? AdvancedSources.Unknown)
|
||||
: null;
|
||||
|
||||
private static T? Read<T>(string? json, System.Text.Json.Serialization.Metadata.JsonTypeInfo<T> type)
|
||||
where T : class
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(json))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
return JsonSerializer.Deserialize(json, type);
|
||||
}
|
||||
catch (JsonException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static List<AdvancedFactDocument> Documents(IReadOnlyList<AdvancedFact> facts)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(facts);
|
||||
return
|
||||
[
|
||||
.. facts.Select(static f => new AdvancedFactDocument
|
||||
{
|
||||
Id = f.Id,
|
||||
Instance = f.Instance,
|
||||
Number = f.Value.Number,
|
||||
Text = f.Value.Text,
|
||||
Tokens = f.Value.Tokens is { } tokens ? [.. tokens] : null,
|
||||
Rows = f.Value.Rows is { } rows ? [.. rows.Select(static r => new AdvancedRowDocument { Name = r.Name, Value = r.Value, Token = r.Token })] : null,
|
||||
}),
|
||||
];
|
||||
}
|
||||
|
||||
private static List<AdvancedFact> Facts(List<AdvancedFactDocument>? documents)
|
||||
{
|
||||
var facts = new List<AdvancedFact>(documents?.Count ?? 0);
|
||||
foreach (AdvancedFactDocument d in documents ?? [])
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(d?.Id) && ValueOf(d) is { } value)
|
||||
{
|
||||
facts.Add(new AdvancedFact(d.Id, string.IsNullOrWhiteSpace(d.Instance) ? null : d.Instance, value));
|
||||
}
|
||||
}
|
||||
|
||||
return facts;
|
||||
}
|
||||
|
||||
/// <summary>The value of a stored fact when it has exactly one shape and that shape is well formed; null otherwise.</summary>
|
||||
private static AdvancedValue? ValueOf(AdvancedFactDocument d)
|
||||
{
|
||||
int shapes = (d.Number is null ? 0 : 1) + (d.Text is null ? 0 : 1) + (d.Tokens is null ? 0 : 1) + (d.Rows is null ? 0 : 1);
|
||||
if (shapes != 1)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (d.Number is { } number)
|
||||
{
|
||||
return double.IsFinite(number) ? AdvancedValue.Of(number) : null;
|
||||
}
|
||||
|
||||
if (d.Text is { } text)
|
||||
{
|
||||
return string.IsNullOrWhiteSpace(text) ? null : AdvancedValue.OfText(text);
|
||||
}
|
||||
|
||||
if (d.Tokens is { } tokens)
|
||||
{
|
||||
return tokens.TrueForAll(static t => AdvancedValue.IsToken(t)) ? AdvancedValue.OfTokens(tokens) : null;
|
||||
}
|
||||
|
||||
// A row with no name or no value is not a row: the whole fact is left out rather than shown with a hole in it.
|
||||
var rows = new List<AdvancedRow>(d.Rows!.Count);
|
||||
foreach (AdvancedRowDocument? r in d.Rows)
|
||||
{
|
||||
if (r?.Name is not { } name || r.Value is not { } value)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
rows.Add(new AdvancedRow(name, value, r.Token));
|
||||
}
|
||||
|
||||
return AdvancedValue.OfRows(rows);
|
||||
}
|
||||
|
||||
private static List<AdvancedSeriesInfoDocument> SeriesDocuments(IReadOnlyList<AdvancedSeriesInfo> series)
|
||||
=> [.. series.Select(static s => new AdvancedSeriesInfoDocument { Series = s.Series, MetricId = s.MetricId, Label = s.Label })];
|
||||
|
||||
/// <summary>The directory lines that are whole and name an advanced series; any other is left out.</summary>
|
||||
private static List<AdvancedSeriesInfo> Series(List<AdvancedSeriesInfoDocument>? documents)
|
||||
{
|
||||
var series = new List<AdvancedSeriesInfo>(documents?.Count ?? 0);
|
||||
foreach (AdvancedSeriesInfoDocument? d in documents ?? [])
|
||||
{
|
||||
if (d?.Series is { } name && d.MetricId is { } metric && d.Label is { } label && name.StartsWith(AdvancedMetric.SeriesPrefix, StringComparison.Ordinal))
|
||||
{
|
||||
series.Add(new AdvancedSeriesInfo(name, metric, label));
|
||||
}
|
||||
}
|
||||
|
||||
return series;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using System.Text.Json.Serialization;
|
||||
using FrameLedger.Application.Recording;
|
||||
|
||||
namespace FrameLedger.Application.Advanced;
|
||||
|
||||
/// <summary>Source-generated JSON for what "Advanced metrics" stores (D102); no reflection. Names are camel case, nulls are left out, and a status is its name.</summary>
|
||||
[JsonSourceGenerationOptions(
|
||||
WriteIndented = false,
|
||||
PropertyNamingPolicy = JsonKnownNamingPolicy.CamelCase,
|
||||
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
|
||||
UseStringEnumConverter = true)]
|
||||
[JsonSerializable(typeof(List<AdvancedFactDocument>))]
|
||||
[JsonSerializable(typeof(AdvancedSessionDocument))]
|
||||
[JsonSerializable(typeof(AdvancedSeriesDocument))]
|
||||
[JsonSerializable(typeof(AdvancedContextDocument))]
|
||||
[JsonSerializable(typeof(Dictionary<string, SensorSeriesStats>))]
|
||||
internal sealed partial class AdvancedJsonContext : JsonSerializerContext
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
namespace FrameLedger.Application.Advanced;
|
||||
|
||||
/// <summary>
|
||||
/// One row of <see cref="AdvancedMetricCatalog"/>: a number, a fact or a family of sensors that a vendor interface
|
||||
/// makes available, with the scope it belongs to and where it can be read from.
|
||||
/// </summary>
|
||||
/// <param name="Id">Lower case, dotted, starting with the source's prefix. It is on disk once a release stores it, and then never changes.</param>
|
||||
/// <param name="Scope">The machine or one session.</param>
|
||||
/// <param name="Source">The vendor interface.</param>
|
||||
/// <param name="Reach">Where it can be read from, or why it is not read.</param>
|
||||
/// <param name="Unit">What its value is.</param>
|
||||
/// <param name="Group">The heading it is shown under.</param>
|
||||
/// <param name="Summary">
|
||||
/// What it is, in English, for <c>docs/18_GPU_VENDOR_APIS.md</c> §The inventory — the table there is held to this
|
||||
/// text by a test. The App shows the translated string under <see cref="LabelKey"/>, never this.
|
||||
/// </param>
|
||||
public sealed record AdvancedMetric(
|
||||
string Id,
|
||||
AdvancedScope Scope,
|
||||
AdvancedSource Source,
|
||||
AdvancedReach Reach,
|
||||
AdvancedUnit Unit,
|
||||
AdvancedGroup Group,
|
||||
string Summary)
|
||||
{
|
||||
/// <summary>The prefix of every advanced series in <c>sensor_blobs</c> (D102): a reader tells them from the fixed series by it.</summary>
|
||||
public const string SeriesPrefix = "adv.";
|
||||
|
||||
/// <summary>
|
||||
/// True when the entry is not one value but as many as the hardware has — a temperature per core, a fan per
|
||||
/// header, a set of facts per display. Each instance is named by <see cref="AdvancedMetricCatalog.InstanceName"/>
|
||||
/// and labelled by what the hardware calls it.
|
||||
/// </summary>
|
||||
public bool IsFamily { get; init; }
|
||||
|
||||
/// <summary>True when a build with the option on reads it: every other reach is a reason it reads N/A.</summary>
|
||||
public bool IsRead => Reach is AdvancedReach.Agent or AdvancedReach.AgentElevated;
|
||||
|
||||
/// <summary>The name of its series in <c>sensor_blobs</c> — for a family, the stem of its instances' names; null when it is not a series.</summary>
|
||||
public string? SeriesName => Scope == AdvancedScope.Series ? SeriesPrefix + Id : null;
|
||||
|
||||
/// <summary>The key of its translated label in the App's resources.</summary>
|
||||
public string LabelKey => "Adv_" + Id.Replace('.', '_');
|
||||
}
|
||||
@@ -0,0 +1,267 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using System.Collections.Frozen;
|
||||
|
||||
using static FrameLedger.Application.Advanced.AdvancedGroup;
|
||||
using static FrameLedger.Application.Advanced.AdvancedReach;
|
||||
using static FrameLedger.Application.Advanced.AdvancedSource;
|
||||
using static FrameLedger.Application.Advanced.AdvancedUnit;
|
||||
|
||||
namespace FrameLedger.Application.Advanced;
|
||||
|
||||
/// <summary>
|
||||
/// Everything "Advanced metrics" (owner decision D101) knows of: what the vendored NVAPI and Streamline headers, the
|
||||
/// FidelityFX headers and LibreHardwareMonitor make available — what is read, and what is not with the reason.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// ONE LIST FOR EVERY CONSUMER. Before it, a metric's name, unit and label were repeated in three to five places
|
||||
/// (the trend's enum, its unit switch, its label list, Compare's rows, the summary's cards). The reader that
|
||||
/// collects, the recorder that stores, the page that shows and the table in
|
||||
/// <c>docs/18_GPU_VENDOR_APIS.md</c> §The inventory all read this list, and a test holds that table to it — so an
|
||||
/// entry cannot be stored without being shown, or documented as read while it is not.
|
||||
/// <para>
|
||||
/// AN ENTRY THAT IS NOT READ IS STILL AN ENTRY. The owner asked for everything the headers give; what stays out
|
||||
/// stays out for a reason — a hook that is not built, a route nobody has proven safe, a licence, an identifier,
|
||||
/// the player's own state — and the page's Sources tab says which.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static class AdvancedMetricCatalog
|
||||
{
|
||||
/// <summary>
|
||||
/// The entries, in the order the page lists them. An id is on disk from the first release that stores it and
|
||||
/// never changes after; an entry is added at the end of its block.
|
||||
/// </summary>
|
||||
public static IReadOnlyList<AdvancedMetric> All { get; } =
|
||||
[
|
||||
// ---- NVAPI, the graphics card: facts -------------------------------------------------------------------
|
||||
Machine("nvapi.gpu.type", Nvapi, Agent, Text, Gpu, "Integrated or discrete graphics"),
|
||||
Machine("nvapi.gpu.system_type", Nvapi, Agent, Text, Gpu, "Laptop or desktop, as the driver sees the PC"),
|
||||
Machine("nvapi.gpu.external", Nvapi, Agent, Flag, Gpu, "The card is an external one"),
|
||||
Machine("nvapi.gpu.bus_type", Nvapi, Agent, Text, Gpu, "The bus the card sits on"),
|
||||
Machine("nvapi.gpu.pci_ids", Nvapi, Agent, Text, Gpu, "PCI device, subsystem and revision ids - the model, not the unit"),
|
||||
Machine("nvapi.gpu.vbios_version", Nvapi, Agent, Text, Gpu, "Video BIOS version"),
|
||||
Machine("nvapi.gpu.architecture", Nvapi, Agent, Text, Gpu, "Chip architecture, implementation and revision"),
|
||||
Machine("nvapi.gpu.core_count", Nvapi, Agent, Count, Gpu, "Graphics cores"),
|
||||
Machine("nvapi.gpu.rt_cores", Nvapi, Agent, Count, Gpu, "Ray-tracing cores"),
|
||||
Machine("nvapi.gpu.tensor_cores", Nvapi, Agent, Count, Gpu, "Tensor cores"),
|
||||
Machine("nvapi.gpu.ram_bus_width", Nvapi, Agent, Bits, Gpu, "Width of the card's memory bus"),
|
||||
Machine("nvapi.gpu.clock_base_core", Nvapi, Agent, Megahertz, Gpu, "Base core clock"),
|
||||
Machine("nvapi.gpu.clock_base_memory", Nvapi, Agent, Megahertz, Gpu, "Base memory clock"),
|
||||
Machine("nvapi.gpu.clock_boost_core", Nvapi, Agent, Megahertz, Gpu, "Boost core clock"),
|
||||
Machine("nvapi.gpu.clock_boost_memory", Nvapi, Agent, Megahertz, Gpu, "Boost memory clock"),
|
||||
Machine("nvapi.gpu.temp_default_max", Nvapi, Agent, Celsius, Gpu, "The core sensor's default maximum temperature"),
|
||||
|
||||
// ---- NVAPI, the card's memory --------------------------------------------------------------------------
|
||||
Machine("nvapi.vram.dedicated", Nvapi, Agent, Mebibytes, GpuMemory, "Dedicated video memory on the card"),
|
||||
Machine("nvapi.vram.dedicated_available", Nvapi, Agent, Mebibytes, GpuMemory, "Dedicated video memory available for surfaces"),
|
||||
Machine("nvapi.vram.system", Nvapi, Agent, Mebibytes, GpuMemory, "System memory the driver reserved at load"),
|
||||
Machine("nvapi.vram.shared", Nvapi, Agent, Mebibytes, GpuMemory, "Shared system memory the driver may commit"),
|
||||
Machine("nvapi.vram.framebuffer_physical", Nvapi, Agent, Mebibytes, GpuMemory, "Physical frame buffer size"),
|
||||
Machine("nvapi.vram.framebuffer_virtual", Nvapi, Agent, Mebibytes, GpuMemory, "Virtual frame buffer size"),
|
||||
Sampled("nvapi.vram.available", Nvapi, Agent, Mebibytes, GpuMemory, "Dedicated video memory available now, all programs"),
|
||||
Sampled("nvapi.vram.in_use", Nvapi, Agent, Mebibytes, GpuMemory, "Dedicated video memory in use now, all programs: available for surfaces less available now"),
|
||||
Sampled("nvapi.vram.evictions_size", Nvapi, Agent, Mebibytes, GpuMemory, "Memory released by evictions since the driver loaded"),
|
||||
Sampled("nvapi.vram.eviction_count", Nvapi, Agent, Count, GpuMemory, "Evictions from dedicated video memory since the driver loaded"),
|
||||
Sampled("nvapi.vram.promotions_size", Nvapi, Agent, Mebibytes, GpuMemory, "Memory moved in by promotions since the driver loaded"),
|
||||
Sampled("nvapi.vram.promotion_count", Nvapi, Agent, Count, GpuMemory, "Promotions into dedicated video memory since the driver loaded"),
|
||||
|
||||
// ---- NVAPI, the card over time -------------------------------------------------------------------------
|
||||
Sampled("nvapi.load.framebuffer", Nvapi, Agent, Percent, Gpu, "Frame-buffer (memory controller) utilisation"),
|
||||
Sampled("nvapi.load.video", Nvapi, Agent, Percent, Gpu, "Video-engine utilisation"),
|
||||
Sampled("nvapi.load.bus", Nvapi, Agent, Percent, Gpu, "Bus-interface utilisation"),
|
||||
Sampled("nvapi.clock.video", Nvapi, Agent, Megahertz, Gpu, "Video clock"),
|
||||
Sampled("nvapi.pstate", Nvapi, Agent, Count, Gpu, "The card's current performance state (P-state id)"),
|
||||
Sampled("nvapi.temp.board", Nvapi, Agent, Celsius, Gpu, "Board ambient temperature, where the card has the sensor"),
|
||||
Sampled("nvapi.temp.power_supply", Nvapi, Agent, Celsius, Gpu, "The card's power-supply temperature, where it has the sensor"),
|
||||
Sampled("nvapi.limit.ac_battery", Nvapi, Agent, Percent, Gpu, "Held back by a switch to battery on the tick: 100 or 0"),
|
||||
Sampled("nvapi.limit.api", Nvapi, Agent, Percent, Gpu, "Held back at a program's request on the tick: 100 or 0"),
|
||||
Sampled("nvapi.limit.insufficient_power", Nvapi, Agent, Percent, Gpu, "Held back by a missing power connector on the tick: 100 or 0"),
|
||||
Sampled("nvapi.encoder.sessions", Nvapi, Agent, Count, Gpu, "Active hardware-encoder sessions, all programs"),
|
||||
Sampled("nvapi.encoder.fps", Nvapi, Agent, FramesPerSecond, Gpu, "Average encoding rate of the active sessions"),
|
||||
Sampled("nvapi.encoder.latency", Nvapi, Agent, Microseconds, Gpu, "Average encoding latency"),
|
||||
|
||||
// ---- NVAPI, the driver ---------------------------------------------------------------------------------
|
||||
Machine("nvapi.driver.package", Nvapi, Agent, Text, Driver, "Game Ready, Studio or an RTX enterprise branch"),
|
||||
Machine("nvapi.driver.dch", Nvapi, Agent, Flag, Driver, "The driver is a DCH package"),
|
||||
Machine("nvapi.driver.base_branch", Nvapi, Agent, Text, Driver, "The driver's base branch"),
|
||||
Machine("nvapi.driver.interface_version", Nvapi, Agent, Text, Driver, "NVAPI's own interface version"),
|
||||
Machine("nvapi.driver.chipset", Nvapi, Agent, Text, Driver, "Chipset vendor and name, as the driver reports them"),
|
||||
Machine("nvapi.driver.global_profile", Nvapi, Agent, Table, Driver, "Every setting of the driver's global profile, read-only"),
|
||||
Session("nvapi.session.driver_profile", Nvapi, Agent, Table, Driver, "The settings the driver's profile for this game sets itself, read-only"),
|
||||
|
||||
// ---- NVAPI, displays -----------------------------------------------------------------------------------
|
||||
MachineFamily("nvapi.display.hdr_formats", Nvapi, Agent, Text, Display, "HDR formats a display accepts: HDR10, HDR10+, HDR10+ Gaming, Dolby Vision, EDR"),
|
||||
MachineFamily("nvapi.display.luminance_max", Nvapi, Agent, Nits, Display, "A display's maximum luminance for HDR content"),
|
||||
MachineFamily("nvapi.display.luminance_min", Nvapi, Agent, Nits, Display, "Its minimum luminance"),
|
||||
MachineFamily("nvapi.display.luminance_max_frame_average", Nvapi, Agent, Nits, Display, "Its maximum frame-average light level"),
|
||||
MachineFamily("nvapi.display.vrr_support", Nvapi, Agent, Text, Display, "Variable refresh: supported, G-SYNC module or adaptive sync, ULMB, usable at the current mode"),
|
||||
MachineFamily("nvapi.display.adaptive_sync_off", Nvapi, Agent, Flag, Display, "Adaptive sync is switched off on the display"),
|
||||
MachineFamily("nvapi.display.max_frame_interval", Nvapi, Agent, Microseconds, Display, "The longest frame interval adaptive sync is set to hold"),
|
||||
Session("nvapi.session.vrr_enabled", Nvapi, Agent, Flag, Display, "Variable refresh was active on the game's display"),
|
||||
Session("nvapi.session.vrr_requested", Nvapi, Agent, Flag, Display, "Variable refresh was requested for it"),
|
||||
Session("nvapi.session.vrr_possible", Nvapi, Agent, Flag, Display, "Variable refresh was possible on it"),
|
||||
Session("nvapi.session.vrr_display_mode", Nvapi, Agent, Flag, Display, "The display itself was in variable-refresh mode"),
|
||||
Session("nvapi.session.source_colorspace", Nvapi, Agent, Text, Display, "The colour space the game presented in, as the driver reports it for the process"),
|
||||
|
||||
// ---- LibreHardwareMonitor, the graphics card (every vendor, unelevated) ---------------------------------
|
||||
SampledFamily("lhm.gpu.temperature", Lhm, Agent, Celsius, Gpu, "Every temperature sensor of the card"),
|
||||
SampledFamily("lhm.gpu.load", Lhm, Agent, Percent, Gpu, "Every load of the card: its engines, its bus, its memory controller"),
|
||||
SampledFamily("lhm.gpu.memory", Lhm, Agent, Mebibytes, GpuMemory, "The card's memory counters: total, free, used, Direct3D dedicated and shared"),
|
||||
SampledFamily("lhm.gpu.clock", Lhm, Agent, Megahertz, Gpu, "Every clock of the card"),
|
||||
SampledFamily("lhm.gpu.power", Lhm, Agent, Watts, Gpu, "Every power reading of the card"),
|
||||
SampledFamily("lhm.gpu.fan", Lhm, Agent, Rpm, Gpu, "Every fan of the card"),
|
||||
SampledFamily("lhm.gpu.fan_control", Lhm, Agent, Percent, Gpu, "Each fan's duty"),
|
||||
SampledFamily("lhm.gpu.voltage", Lhm, Agent, Volts, Gpu, "Every voltage of the card"),
|
||||
SampledFamily("lhm.gpu.current", Lhm, Agent, Amperes, Gpu, "Every current of the card"),
|
||||
SampledFamily("lhm.gpu.throughput", Lhm, Agent, BytesPerSecond, Gpu, "PCI Express traffic to and from the card"),
|
||||
|
||||
// ---- LibreHardwareMonitor through PawnIO (the Agent as administrator, D103) -----------------------------
|
||||
SampledFamily("lhm.cpu.temperature", Lhm, AgentElevated, Celsius, Cpu, "Processor temperatures: the package and each core"),
|
||||
SampledFamily("lhm.cpu.load", Lhm, AgentElevated, Percent, Cpu, "Processor load: the total and each core"),
|
||||
SampledFamily("lhm.cpu.clock", Lhm, AgentElevated, Megahertz, Cpu, "Each core's clock, and the bus clock"),
|
||||
SampledFamily("lhm.cpu.power", Lhm, AgentElevated, Watts, Cpu, "Processor power: the package, the cores"),
|
||||
SampledFamily("lhm.cpu.voltage", Lhm, AgentElevated, Volts, Cpu, "Processor voltages"),
|
||||
Machine("lhm.board.model", Lhm, AgentElevated, Text, Board, "The motherboard's maker and model"),
|
||||
Machine("lhm.board.sensor_chip", Lhm, AgentElevated, Text, Board, "The board's sensor chip"),
|
||||
SampledFamily("lhm.board.temperature", Lhm, AgentElevated, Celsius, Board, "The board's temperature sensors"),
|
||||
SampledFamily("lhm.board.fan", Lhm, AgentElevated, Rpm, Board, "Each fan header's speed"),
|
||||
SampledFamily("lhm.board.fan_control", Lhm, AgentElevated, Percent, Board, "Each fan header's duty"),
|
||||
SampledFamily("lhm.board.voltage", Lhm, AgentElevated, Volts, Board, "The board's voltage rails"),
|
||||
Machine("lhm.memory.modules", Lhm, AgentElevated, Table, Memory, "The memory modules: size, speed, maker's part name - never a serial number"),
|
||||
SampledFamily("lhm.memory.load", Lhm, AgentElevated, Percent, Memory, "Memory in use: physical and virtual"),
|
||||
SampledFamily("lhm.memory.temperature", Lhm, AgentElevated, Celsius, Memory, "Each memory module's temperature, where it has a sensor"),
|
||||
|
||||
// ---- What the Agent could reach and does not ------------------------------------------------------------
|
||||
Machine("lhm.psu", Lhm, Refused, Table, Board, "Power-supply sensors: reading them makes the library search every USB device"),
|
||||
Machine("lhm.controller", Lhm, Refused, Table, Board, "Fan-controller sensors: the same search of USB devices"),
|
||||
Machine("lhm.battery", Lhm, Deferred, Table, Board, "Battery sensors"),
|
||||
Machine("lhm.storage.models", Lhm, Deferred, Table, Storage, "The drives' model names: the library cannot list drives without touching removable ones"),
|
||||
SampledFamily("lhm.storage.temperature", Lhm, Deferred, Celsius, Storage, "Each drive's temperature: the same, so the storage group is not opened"),
|
||||
Machine("nvapi.gpu.board_serial", Nvapi, Identifier, Text, Gpu, "The card's board serial number"),
|
||||
Machine("nvapi.gpu.uuid", Nvapi, Identifier, Text, Gpu, "The card's unique id"),
|
||||
MachineFamily("nvapi.display.edid", Nvapi, Identifier, Text, Display, "A display's EDID block, which carries its serial number"),
|
||||
Sampled("nvapi.encoder.session_processes", Nvapi, Identifier, Table, Gpu, "Which programs are encoding"),
|
||||
Sampled("nvapi.gpu.power", Nvapi, NotInHeaders, Watts, Gpu, "Card power through NVAPI (LibreHardwareMonitor reads it)"),
|
||||
Sampled("nvapi.gpu.fan_duty", Nvapi, NotInHeaders, Percent, Gpu, "Fan duty through NVAPI (LibreHardwareMonitor reads it)"),
|
||||
Sampled("nvapi.gpu.voltage", Nvapi, NotInHeaders, Volts, Gpu, "Card voltage through NVAPI (LibreHardwareMonitor reads it)"),
|
||||
Machine("nvapi.gpu.ram_type", Nvapi, NotInHeaders, Text, GpuMemory, "The card's memory type"),
|
||||
|
||||
// ---- Inside the game: calls the Overlay already hooks ---------------------------------------------------
|
||||
Session("sl.dlss.output_size", Streamline, HookedCall, Text, Upscaling, "The output size the game gave DLSS"),
|
||||
Session("sl.dlss.presets", Streamline, HookedCall, Text, Upscaling, "The DLSS model preset per quality mode"),
|
||||
Session("sl.dlss.hdr_input", Streamline, HookedCall, Flag, Upscaling, "The game told DLSS its colour buffers are HDR"),
|
||||
Session("sl.dlss.auto_exposure", Streamline, HookedCall, Flag, Upscaling, "DLSS auto-exposure"),
|
||||
Session("sl.dlss.alpha_upscaling", Streamline, HookedCall, Flag, Upscaling, "DLSS upscales the alpha channel"),
|
||||
Session("sl.dlss.exposure", Streamline, HookedCall, Text, Upscaling, "Pre-exposure and exposure scale given to DLSS"),
|
||||
Session("ffx.upscale.sharpening", FidelityFx, HookedCall, Text, Upscaling, "FSR sharpening: on or off, and its strength"),
|
||||
Session("ffx.upscale.jitter", FidelityFx, HookedCall, Text, Upscaling, "The jitter offsets the game gave FSR"),
|
||||
Session("ffx.upscale.exposure", FidelityFx, HookedCall, Text, Upscaling, "Pre-exposure given to FSR"),
|
||||
Session("ffx.upscale.depth", FidelityFx, HookedCall, Text, Upscaling, "Near and far planes and field of view given to FSR"),
|
||||
Session("ffx.upscale.flags", FidelityFx, HookedCall, Text, Upscaling, "The flags of the game's FSR dispatch"),
|
||||
Sampled("ffx.upscale.frame_time_delta", FidelityFx, HookedCall, Milliseconds, Upscaling, "The frame time the game reported to FSR"),
|
||||
Sampled("ffx.memory_usage", FidelityFx, HookedCall, Mebibytes, Upscaling, "FSR's own video memory, when the game asks it"),
|
||||
|
||||
// ---- Inside the game: hooks that are not built ----------------------------------------------------------
|
||||
Session("sl.constants.jitter", Streamline, NewHook, Text, Upscaling, "The jitter offsets the game gave Streamline"),
|
||||
Session("sl.constants.motion_vectors", Streamline, NewHook, Text, Upscaling, "Motion-vector scale, and whether they are 3D, dilated, jittered"),
|
||||
Session("sl.constants.depth", Streamline, NewHook, Text, Upscaling, "Near and far planes, and whether depth is inverted"),
|
||||
Session("sl.constants.projection", Streamline, NewHook, Text, Upscaling, "Field of view, aspect ratio, orthographic or not"),
|
||||
Session("sl.constants.resets", Streamline, NewHook, Count, Upscaling, "How often the game reset the upscaler's history"),
|
||||
Session("sl.feature.versions", Streamline, NewHook, Table, Upscaling, "Each Streamline feature's version and its NGX model version"),
|
||||
Session("sl.feature.requirements", Streamline, NewHook, Table, Upscaling, "What each Streamline feature requires: operating system, driver, buffers"),
|
||||
Session("sl.init.preferences", Streamline, NewHook, Text, Upscaling, "The preferences the game started Streamline with"),
|
||||
Session("ffx.framegen.config", FidelityFx, NewHook, Text, FrameGeneration, "The game's FSR frame-generation configuration"),
|
||||
Session("sl.constants.camera", Streamline, PlayerState, Text, Upscaling, "Camera position, axes and matrices"),
|
||||
|
||||
// ---- Inside the game: routes a spike decides ------------------------------------------------------------
|
||||
Session("nvapi.reflex.mode", Nvapi, Spike, Text, Latency, "Reflex: low-latency mode, boost, the frame-rate limit"),
|
||||
Session("nvapi.reflex.sleep_status", Nvapi, Spike, Text, Latency, "What the driver's low-latency state is"),
|
||||
SampledFamily("nvapi.reflex.frame_report", Nvapi, Spike, Microseconds, Latency, "Latency per frame: simulation, render submit, present, driver, OS queue, GPU render"),
|
||||
Session("sl.dlss.optimal_settings", Streamline, Spike, Text, Upscaling, "The render size and sharpness DLSS recommends"),
|
||||
Sampled("sl.dlss.vram_estimate", Streamline, Spike, Mebibytes, Upscaling, "DLSS's own estimate of its video memory"),
|
||||
Session("sl.dlssg.options", Streamline, Spike, Text, FrameGeneration, "DLSS frame generation: mode, frames to generate"),
|
||||
Session("sl.dlssg.state", Streamline, Spike, Text, FrameGeneration, "DLSS frame generation: status, the most frames it can generate"),
|
||||
Sampled("sl.dlssg.frames_presented", Streamline, Spike, Count, FrameGeneration, "Frames DLSS frame generation presented, by its own count"),
|
||||
Sampled("sl.dlssg.vram_estimate", Streamline, Spike, Mebibytes, FrameGeneration, "DLSS frame generation's estimate of its video memory"),
|
||||
Session("sl.dlssd.options", Streamline, Spike, Text, Upscaling, "Ray reconstruction's options"),
|
||||
Session("sl.nis.options", Streamline, Spike, Text, Upscaling, "NVIDIA Image Scaling's options"),
|
||||
Session("sl.deepdvc.options", Streamline, Spike, Text, Upscaling, "RTX Dynamic Vibrance's options"),
|
||||
Session("sl.reflex.state", Streamline, Spike, Table, Latency, "Reflex through Streamline: availability and its frame reports"),
|
||||
Sampled("sl.pcl.markers", Streamline, Spike, Count, Latency, "PC-latency markers the game sets"),
|
||||
|
||||
// ---- Closed by a licence --------------------------------------------------------------------------------
|
||||
Session("ngx.parameters", Ngx, Licence, Table, Upscaling, "NGX parameters: the quality value, the DLSS hints"),
|
||||
Session("xess.options", Xess, Licence, Table, Upscaling, "XeSS's options"),
|
||||
Sampled("sl.nvperf", Streamline, Licence, Table, Gpu, "Streamline's performance counters (NSight Perf SDK licence)"),
|
||||
];
|
||||
|
||||
private static readonly FrozenDictionary<string, AdvancedMetric> _byId = All.ToFrozenDictionary(static m => m.Id, StringComparer.Ordinal);
|
||||
|
||||
/// <summary>The entry with this id, or null.</summary>
|
||||
public static AdvancedMetric? Find(string id)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(id);
|
||||
return _byId.GetValueOrDefault(id);
|
||||
}
|
||||
|
||||
/// <summary>The longest key <see cref="InstanceName"/> accepts.</summary>
|
||||
public const int MaxInstanceKeyLength = 48;
|
||||
|
||||
/// <summary>
|
||||
/// The series name of one member of a family: the family's <see cref="AdvancedMetric.SeriesName"/>, a dot, and a
|
||||
/// key made of lower-case letters, digits and underscores that names the sensor on this PC.
|
||||
/// </summary>
|
||||
/// <exception cref="ArgumentException">The entry is not a family of series, or the key is not such a key.</exception>
|
||||
public static string InstanceName(AdvancedMetric family, string key)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(family);
|
||||
ArgumentNullException.ThrowIfNull(key);
|
||||
if (!family.IsFamily || family.SeriesName is not string stem)
|
||||
{
|
||||
throw new ArgumentException($"{family.Id} is not a family of series", nameof(family));
|
||||
}
|
||||
|
||||
if (!IsInstanceKey(key))
|
||||
{
|
||||
throw new ArgumentException($"'{key}' is not an instance key: 1 to {MaxInstanceKeyLength} of a-z, 0-9 and _", nameof(key));
|
||||
}
|
||||
|
||||
return stem + "." + key;
|
||||
}
|
||||
|
||||
/// <summary>True for 1 to <see cref="MaxInstanceKeyLength"/> characters of <c>a-z</c>, <c>0-9</c> and <c>_</c>.</summary>
|
||||
public static bool IsInstanceKey(string key)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(key);
|
||||
if (key.Length is 0 or > MaxInstanceKeyLength)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach (char c in key)
|
||||
{
|
||||
if (c is not ((>= 'a' and <= 'z') or (>= '0' and <= '9') or '_'))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static AdvancedMetric Machine(string id, AdvancedSource source, AdvancedReach reach, AdvancedUnit unit, AdvancedGroup group, string summary)
|
||||
=> new(id, AdvancedScope.MachineFact, source, reach, unit, group, summary);
|
||||
|
||||
private static AdvancedMetric MachineFamily(string id, AdvancedSource source, AdvancedReach reach, AdvancedUnit unit, AdvancedGroup group, string summary)
|
||||
=> new(id, AdvancedScope.MachineFact, source, reach, unit, group, summary) { IsFamily = true };
|
||||
|
||||
private static AdvancedMetric Session(string id, AdvancedSource source, AdvancedReach reach, AdvancedUnit unit, AdvancedGroup group, string summary)
|
||||
=> new(id, AdvancedScope.SessionFact, source, reach, unit, group, summary);
|
||||
|
||||
private static AdvancedMetric Sampled(string id, AdvancedSource source, AdvancedReach reach, AdvancedUnit unit, AdvancedGroup group, string summary)
|
||||
=> new(id, AdvancedScope.Series, source, reach, unit, group, summary);
|
||||
|
||||
private static AdvancedMetric SampledFamily(string id, AdvancedSource source, AdvancedReach reach, AdvancedUnit unit, AdvancedGroup group, string summary)
|
||||
=> new(id, AdvancedScope.Series, source, reach, unit, group, summary) { IsFamily = true };
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
namespace FrameLedger.Application.Advanced;
|
||||
|
||||
/// <summary>
|
||||
/// Where an advanced metric can be read from — or why it is not read. The catalog names what is NOT read beside what
|
||||
/// is, so the page can say so with the reason instead of leaving a gap (<c>docs/18_GPU_VENDOR_APIS.md</c> §Advanced
|
||||
/// metrics; rule 7's "N/A, never a guess" applied to a whole source).
|
||||
/// </summary>
|
||||
public enum AdvancedReach
|
||||
{
|
||||
/// <summary>Not stated. No entry of the catalog carries it.</summary>
|
||||
None = 0,
|
||||
|
||||
/// <summary>The Agent reads it in its own process, unelevated.</summary>
|
||||
Agent = 1,
|
||||
|
||||
/// <summary>The Agent reads it only when it already runs as administrator and PawnIO is installed (D103).</summary>
|
||||
AgentElevated = 2,
|
||||
|
||||
/// <summary>An argument of a call the Overlay already hooks; not read yet.</summary>
|
||||
HookedCall = 3,
|
||||
|
||||
/// <summary>Needs a hook on a function its module exports; the hook is not built.</summary>
|
||||
NewHook = 4,
|
||||
|
||||
/// <summary>A route nobody has proven safe: a spike decides, and the owner says go or no.</summary>
|
||||
Spike = 5,
|
||||
|
||||
/// <summary>A source the project decided not to open (D103).</summary>
|
||||
Refused = 6,
|
||||
|
||||
/// <summary>A source left for later, with no decision against it.</summary>
|
||||
Deferred = 7,
|
||||
|
||||
/// <summary>It identifies a device, a person or another program. Never read (D104).</summary>
|
||||
Identifier = 8,
|
||||
|
||||
/// <summary>It is the game's own state — where the player is, where the camera looks. Never read (CLAUDE.md rule 4).</summary>
|
||||
PlayerState = 9,
|
||||
|
||||
/// <summary>The vendor's licence forbids vendoring and re-declaring what reading it needs.</summary>
|
||||
Licence = 10,
|
||||
|
||||
/// <summary>The vendor's public headers do not declare it.</summary>
|
||||
NotInHeaders = 11,
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
namespace FrameLedger.Application.Advanced;
|
||||
|
||||
/// <summary>
|
||||
/// One value of one advanced series at one tick. A series with no value on the tick has no reading — it is never a
|
||||
/// zero, and in storage it is NaN (D102).
|
||||
/// </summary>
|
||||
/// <param name="Series">The series' name: <see cref="AdvancedMetric.SeriesName"/>, or an instance's name for a family.</param>
|
||||
/// <param name="Value">The value, in the entry's unit. It may be negative: a voltage rail is.</param>
|
||||
public readonly record struct AdvancedReading(string Series, double Value);
|
||||
@@ -0,0 +1,12 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
namespace FrameLedger.Application.Advanced;
|
||||
|
||||
/// <summary>
|
||||
/// One row of a table-valued fact (<see cref="AdvancedUnit.Table"/>) — a driver setting, a memory module.
|
||||
/// </summary>
|
||||
/// <param name="Name">What the row is, in the vendor's own words; shown as it is.</param>
|
||||
/// <param name="Value">Its value, in the vendor's own notation; shown as it is.</param>
|
||||
/// <param name="Token">A word the App translates, saying something about the row — who set the value, say; or null.</param>
|
||||
public sealed record AdvancedRow(string Name, string Value, string? Token = null);
|
||||
@@ -0,0 +1,18 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
namespace FrameLedger.Application.Advanced;
|
||||
|
||||
/// <summary>
|
||||
/// An <see cref="AdvancedRow"/> as it is stored. Every member is nullable because a stored document is read
|
||||
/// tolerantly: a ledger edited by hand can hold a row with no name, and the reader leaves that fact out rather than
|
||||
/// trusting an annotation the text never promised to keep.
|
||||
/// </summary>
|
||||
internal sealed record AdvancedRowDocument
|
||||
{
|
||||
public string? Name { get; init; }
|
||||
|
||||
public string? Value { get; init; }
|
||||
|
||||
public string? Token { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
namespace FrameLedger.Application.Advanced;
|
||||
|
||||
/// <summary>
|
||||
/// What an advanced metric belongs to (owner decision D101, <c>docs/18_GPU_VENDOR_APIS.md</c> §Advanced metrics): the
|
||||
/// machine, or one game session. It decides where the value is stored and on which tab it is shown.
|
||||
/// </summary>
|
||||
public enum AdvancedScope
|
||||
{
|
||||
/// <summary>Not stated. No entry of the catalog carries it.</summary>
|
||||
None = 0,
|
||||
|
||||
/// <summary>A fact about the PC that no session changes: stored once in <c>machine_profiles</c>, which a session points to.</summary>
|
||||
MachineFact = 1,
|
||||
|
||||
/// <summary>A fact about one session — the game's display, the game's driver profile: <c>session_advanced.facts_json</c>.</summary>
|
||||
SessionFact = 2,
|
||||
|
||||
/// <summary>
|
||||
/// A value sampled over time. During a session it is stored with that session (<c>sensor_blobs</c>, under
|
||||
/// <see cref="AdvancedMetric.SeriesName"/>); with no session it is shown while the page is open and stored nowhere.
|
||||
/// </summary>
|
||||
Series = 3,
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
namespace FrameLedger.Application.Advanced;
|
||||
|
||||
/// <summary>
|
||||
/// <c>session_advanced.series_json</c>: what each stored series that is a member of a family is, and how many series
|
||||
/// were left out because the session had more than the most one session stores.
|
||||
/// </summary>
|
||||
internal sealed record AdvancedSeriesDocument
|
||||
{
|
||||
public List<AdvancedSeriesInfoDocument> Series { get; init; } = [];
|
||||
|
||||
public int Dropped { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
namespace FrameLedger.Application.Advanced;
|
||||
|
||||
/// <summary>
|
||||
/// One line of a session's series directory: a series that is one member of a family, the catalog entry it is a
|
||||
/// member of, and what the hardware calls the sensor.
|
||||
/// </summary>
|
||||
/// <param name="Series">The series' name in <c>sensor_blobs</c> (<see cref="AdvancedMetricCatalog.InstanceName"/>).</param>
|
||||
/// <param name="MetricId">The family's <see cref="AdvancedMetric.Id"/>.</param>
|
||||
/// <param name="Label">
|
||||
/// The hardware's own words — <c>Intel Core i7-14700K - CPU Core #3</c> — shown as they are. A family's members
|
||||
/// differ from PC to PC, so their names cannot be translated strings; the family's name, which is, stands above them.
|
||||
/// </param>
|
||||
public sealed record AdvancedSeriesInfo(string Series, string MetricId, string Label);
|
||||
@@ -0,0 +1,14 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
namespace FrameLedger.Application.Advanced;
|
||||
|
||||
/// <summary>An <see cref="AdvancedSeriesInfo"/> as it is stored — nullable throughout, for the same reason as <see cref="AdvancedRowDocument"/>.</summary>
|
||||
internal sealed record AdvancedSeriesInfoDocument
|
||||
{
|
||||
public string? Series { get; init; }
|
||||
|
||||
public string? MetricId { get; init; }
|
||||
|
||||
public string? Label { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
namespace FrameLedger.Application.Advanced;
|
||||
|
||||
/// <summary>
|
||||
/// What one session knows of advanced metrics beside its series (owner decision D102): the PC's facts as they were
|
||||
/// when it ran, its own facts, what each series is, and which sources answered.
|
||||
/// </summary>
|
||||
/// <param name="MachineFacts">The facts of the PC — stored once per distinct set, in <c>machine_profiles</c>.</param>
|
||||
/// <param name="SessionFacts">The facts of this session — <c>session_advanced.facts_json</c>.</param>
|
||||
/// <param name="Series">What each series that is a member of a family is, with the hardware's own label.</param>
|
||||
/// <param name="Sources">Which sources answered while it ran, and why the others did not.</param>
|
||||
public sealed record AdvancedSessionData(
|
||||
IReadOnlyList<AdvancedFact> MachineFacts,
|
||||
IReadOnlyList<AdvancedFact> SessionFacts,
|
||||
IReadOnlyList<AdvancedSeriesInfo> Series,
|
||||
AdvancedSources Sources);
|
||||
@@ -0,0 +1,12 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
namespace FrameLedger.Application.Advanced;
|
||||
|
||||
/// <summary><c>session_advanced.facts_json</c>: one session's facts and the state of each source while it ran.</summary>
|
||||
internal sealed record AdvancedSessionDocument
|
||||
{
|
||||
public List<AdvancedFactDocument> Facts { get; init; } = [];
|
||||
|
||||
public AdvancedSources? Sources { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
namespace FrameLedger.Application.Advanced;
|
||||
|
||||
/// <summary>
|
||||
/// What one session's facts are asked about: the game's process, its executable, and the monitor it presents on.
|
||||
/// </summary>
|
||||
/// <param name="ProcessId">The game's process id — for the colour space the driver reports for that process.</param>
|
||||
/// <param name="ExecutablePath">The game's executable, fully qualified — for the driver profile that names it; null when not known.</param>
|
||||
/// <param name="GdiDeviceName">The GDI device name of the monitor the game's window is on (<c>\\.\DISPLAY1</c>); null when not known.</param>
|
||||
public sealed record AdvancedSessionTarget(uint ProcessId, string? ExecutablePath, string? GdiDeviceName);
|
||||
@@ -0,0 +1,25 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
namespace FrameLedger.Application.Advanced;
|
||||
|
||||
/// <summary>
|
||||
/// Everything the advanced reader knows at one tick: the readings of that tick, the PC's facts, the directory of the
|
||||
/// series that are members of a family, and the state of each source. Immutable — the reader publishes a new one and
|
||||
/// a consumer keeps whichever it took, so nobody waits on the reader's thread.
|
||||
/// </summary>
|
||||
/// <param name="TakenAt">When the tick was read.</param>
|
||||
/// <param name="Readings">
|
||||
/// One value per series that was READ on this tick. A series that was not is not here — and not every source is read
|
||||
/// on every tick: a slow one is read every few. Its last value is not repeated on the ticks between, so whoever
|
||||
/// shows "the value now" keeps the last one it saw, and whoever stores a series stores a tick with no reading.
|
||||
/// </param>
|
||||
/// <param name="MachineFacts">The facts of the PC, read when the reader opened.</param>
|
||||
/// <param name="Series">Every member of a family this reader has read, with the hardware's own labels — on every tick, read or not.</param>
|
||||
/// <param name="Sources">Which sources answer, and why the others do not.</param>
|
||||
public sealed record AdvancedSnapshot(
|
||||
DateTimeOffset TakenAt,
|
||||
IReadOnlyList<AdvancedReading> Readings,
|
||||
IReadOnlyList<AdvancedFact> MachineFacts,
|
||||
IReadOnlyList<AdvancedSeriesInfo> Series,
|
||||
AdvancedSources Sources);
|
||||
@@ -0,0 +1,29 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
namespace FrameLedger.Application.Advanced;
|
||||
|
||||
/// <summary>The vendor interface an advanced metric comes from. An entry's id starts with the source's prefix.</summary>
|
||||
public enum AdvancedSource
|
||||
{
|
||||
/// <summary>Not stated. No entry of the catalog carries it.</summary>
|
||||
None = 0,
|
||||
|
||||
/// <summary>NVAPI (MIT, NVIDIA only) — <c>nvapi.</c></summary>
|
||||
Nvapi = 1,
|
||||
|
||||
/// <summary>LibreHardwareMonitorLib (MPL-2.0, every vendor; its CPU, board, memory and storage groups through PawnIO) — <c>lhm.</c></summary>
|
||||
Lhm = 2,
|
||||
|
||||
/// <summary>NVIDIA Streamline (MIT headers), read inside the game only — <c>sl.</c></summary>
|
||||
Streamline = 3,
|
||||
|
||||
/// <summary>AMD FidelityFX (MIT headers), read inside the game only — <c>ffx.</c></summary>
|
||||
FidelityFx = 4,
|
||||
|
||||
/// <summary>NVIDIA NGX, whose SDK licence forbids vendoring and re-declaring — <c>ngx.</c></summary>
|
||||
Ngx = 5,
|
||||
|
||||
/// <summary>Intel XeSS, whose SDK licence forbids the same — <c>xess.</c></summary>
|
||||
Xess = 6,
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
namespace FrameLedger.Application.Advanced;
|
||||
|
||||
/// <summary>
|
||||
/// Whether one source of advanced metrics is being read on this PC, or why not — what the page's Sources tab says
|
||||
/// beside every entry of that source that reads N/A.
|
||||
/// </summary>
|
||||
public enum AdvancedSourceStatus
|
||||
{
|
||||
/// <summary>Nobody asked the source yet. The zero a forgetful writer publishes; it reads as "not known", never as "read".</summary>
|
||||
Unknown = 0,
|
||||
|
||||
/// <summary>The source answers.</summary>
|
||||
Reading = 1,
|
||||
|
||||
/// <summary>The source is not on this PC: no NVIDIA driver, or it lists no graphics card.</summary>
|
||||
NotPresent = 2,
|
||||
|
||||
/// <summary>The Agent does not run as administrator (D103).</summary>
|
||||
NotElevated = 3,
|
||||
|
||||
/// <summary>The Agent runs as administrator and PawnIO is not installed (D103).</summary>
|
||||
PawnIoMissing = 4,
|
||||
|
||||
/// <summary>The source failed twice and is off until the reader is opened again (<c>18_GPU_VENDOR_APIS</c> §Runtime policy).</summary>
|
||||
Faulted = 5,
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
namespace FrameLedger.Application.Advanced;
|
||||
|
||||
/// <summary>
|
||||
/// The state of each source the Agent reads advanced metrics from, at one moment.
|
||||
/// </summary>
|
||||
/// <param name="Nvapi">NVAPI: every <c>nvapi.</c> entry whose reach is the Agent.</param>
|
||||
/// <param name="NvapiCode">The status NVAPI's initialisation answered when <paramref name="Nvapi"/> is not <see cref="AdvancedSourceStatus.Reading"/>; null otherwise.</param>
|
||||
/// <param name="Sensors">LibreHardwareMonitor's graphics-card group, which needs no rights: the <c>lhm.gpu.</c> entries.</param>
|
||||
/// <param name="ElevatedSensors">Its processor, memory and motherboard groups, which need the Agent as administrator and PawnIO (D103).</param>
|
||||
public sealed record AdvancedSources(
|
||||
AdvancedSourceStatus Nvapi,
|
||||
int? NvapiCode,
|
||||
AdvancedSourceStatus Sensors,
|
||||
AdvancedSourceStatus ElevatedSensors)
|
||||
{
|
||||
/// <summary>Nothing asked yet.</summary>
|
||||
public static AdvancedSources Unknown { get; } = new(AdvancedSourceStatus.Unknown, NvapiCode: null, AdvancedSourceStatus.Unknown, AdvancedSourceStatus.Unknown);
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
namespace FrameLedger.Application.Advanced;
|
||||
|
||||
/// <summary>What an advanced metric's value is, so one formatter can print it.</summary>
|
||||
public enum AdvancedUnit
|
||||
{
|
||||
/// <summary>Not stated. No entry of the catalog carries it.</summary>
|
||||
None = 0,
|
||||
|
||||
/// <summary>Words — a name, a version, a list of flags.</summary>
|
||||
Text = 1,
|
||||
|
||||
/// <summary>Several rows, each a name and a value — a driver profile, the memory modules.</summary>
|
||||
Table = 2,
|
||||
|
||||
/// <summary>Yes or no.</summary>
|
||||
Flag = 3,
|
||||
|
||||
/// <summary>A whole number with no unit.</summary>
|
||||
Count = 4,
|
||||
|
||||
Celsius = 5,
|
||||
Percent = 6,
|
||||
Megahertz = 7,
|
||||
Mebibytes = 8,
|
||||
Watts = 9,
|
||||
Volts = 10,
|
||||
Amperes = 11,
|
||||
Rpm = 12,
|
||||
Microseconds = 13,
|
||||
Milliseconds = 14,
|
||||
Nits = 15,
|
||||
FramesPerSecond = 16,
|
||||
BytesPerSecond = 17,
|
||||
Bits = 18,
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
namespace FrameLedger.Application.Advanced;
|
||||
|
||||
/// <summary>
|
||||
/// The value of one advanced fact, in exactly one of four shapes. There is no shape for "unknown": a fact that was
|
||||
/// not read is absent, and the page shows N/A with the reason (rule 7's "never a fabricated value", for every unit).
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// WORDS THE VENDOR WROTE AND WORDS WE WROTE ARE KEPT APART. <see cref="Text"/> is the vendor's — a firmware version,
|
||||
/// a chipset's name — and is shown as it is. <see cref="Tokens"/> are ours — <c>discrete</c>, <c>hdr10</c> — fixed
|
||||
/// lower-case words the App translates, because every string a user reads comes from the resources and a stored
|
||||
/// ledger must read the same in the three languages.
|
||||
/// </remarks>
|
||||
public sealed record AdvancedValue
|
||||
{
|
||||
private AdvancedValue()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>A number in the entry's unit; a flag is 1 or 0.</summary>
|
||||
public double? Number { get; private init; }
|
||||
|
||||
/// <summary>The vendor's own words.</summary>
|
||||
public string? Text { get; private init; }
|
||||
|
||||
/// <summary>Our own fixed words, in the order they are shown. May be empty: the source answered, and named nothing.</summary>
|
||||
public IReadOnlyList<string>? Tokens { get; private init; }
|
||||
|
||||
/// <summary>The rows of a table.</summary>
|
||||
public IReadOnlyList<AdvancedRow>? Rows { get; private init; }
|
||||
|
||||
public static AdvancedValue Of(double number)
|
||||
{
|
||||
if (!double.IsFinite(number))
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(number), number, "a fact's number is finite: one that was not read is absent, not NaN");
|
||||
}
|
||||
|
||||
return new AdvancedValue { Number = number };
|
||||
}
|
||||
|
||||
public static AdvancedValue Of(bool flag) => new() { Number = flag ? 1 : 0 };
|
||||
|
||||
public static AdvancedValue OfText(string text)
|
||||
{
|
||||
ArgumentException.ThrowIfNullOrWhiteSpace(text);
|
||||
return new AdvancedValue { Text = text };
|
||||
}
|
||||
|
||||
public static AdvancedValue OfTokens(params IReadOnlyList<string> tokens)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(tokens);
|
||||
foreach (string token in tokens)
|
||||
{
|
||||
if (!IsToken(token))
|
||||
{
|
||||
throw new ArgumentException($"'{token}' is not a token: lower-case letters, digits and underscores", nameof(tokens));
|
||||
}
|
||||
}
|
||||
|
||||
return new AdvancedValue { Tokens = [.. tokens] };
|
||||
}
|
||||
|
||||
public static AdvancedValue OfRows(IReadOnlyList<AdvancedRow> rows)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(rows);
|
||||
return new AdvancedValue { Rows = [.. rows] };
|
||||
}
|
||||
|
||||
/// <summary>True for a word made of <c>a-z</c>, <c>0-9</c> and <c>_</c> that starts with a letter.</summary>
|
||||
public static bool IsToken(string? token)
|
||||
{
|
||||
if (string.IsNullOrEmpty(token) || token[0] is not (>= 'a' and <= 'z'))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach (char c in token)
|
||||
{
|
||||
if (c is not ((>= 'a' and <= 'z') or (>= '0' and <= '9') or '_'))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
namespace FrameLedger.Application.Advanced;
|
||||
|
||||
/// <summary>
|
||||
/// The one reader of advanced metrics in the Agent (owner decisions D101 and D107): shared by every session and by
|
||||
/// the page, running only while somebody holds it, and never read on a caller's thread.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// <b>Why one, and why shared.</b> The Agent records several sessions at once, each with a telemetry poller of its
|
||||
/// own; a reader per session, plus one for the page, would open the motherboard's sensor chip as many times over.
|
||||
/// One reader on a thread of its own serves them all, and a slow or stuck sensor holds up that thread and nothing
|
||||
/// else — not a session's 1 Hz samples, and not the pipe.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// <b>Nothing is read while nobody holds it</b> (D107): the first <see cref="Acquire"/> opens the sources, and some
|
||||
/// seconds after the last holder lets go they are closed again. A PC idling with FrameLedger in the tray reads
|
||||
/// no sensor for this (NFR-2).
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public interface IAdvancedHardware
|
||||
{
|
||||
/// <summary>
|
||||
/// Keeps the reader running until the returned handle is disposed. Returns at once; the first snapshot follows
|
||||
/// when the sources have opened.
|
||||
/// </summary>
|
||||
IDisposable Acquire();
|
||||
|
||||
/// <summary>The last tick, without waiting; null while the reader is not running or has not read yet.</summary>
|
||||
AdvancedSnapshot? Latest { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The facts of one session, read now, on the caller's thread — it can take some hundred milliseconds, so a
|
||||
/// session asks beside its launch and never on a sampling loop. Empty while the reader is not running.
|
||||
/// </summary>
|
||||
IReadOnlyList<AdvancedFact> ReadSessionFacts(AdvancedSessionTarget target);
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
namespace FrameLedger.Application.Persistence;
|
||||
|
||||
/// <summary>
|
||||
/// What a session stores of advanced metrics beside its series (owner decision D102, schema 0023): one row of
|
||||
/// <c>session_advanced</c>, and the row of <c>machine_profiles</c> it points to.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// A session recorded with the option off has none — that absence is how the page knows to say "the option was off
|
||||
/// when this was recorded" rather than "nothing answered". Every member is JSON in <c>Application.Advanced.AdvancedJson</c>'s form.
|
||||
/// </remarks>
|
||||
public sealed record AdvancedSessionRow
|
||||
{
|
||||
/// <summary>The PC's facts, or null when no source had any. Stored once per distinct <see cref="MachineHash"/>.</summary>
|
||||
public string? MachineFactsJson { get; init; }
|
||||
|
||||
/// <summary>SHA-256 of <see cref="MachineFactsJson"/>, lower-case hexadecimal; null with it.</summary>
|
||||
public string? MachineHash { get; init; }
|
||||
|
||||
/// <summary>The session's own facts and the state of each source while it ran.</summary>
|
||||
public required string FactsJson { get; init; }
|
||||
|
||||
/// <summary>Count, mean, median, minimum and maximum of each stored series; null when the session stored none.</summary>
|
||||
public string? StatsJson { get; init; }
|
||||
|
||||
/// <summary>What each stored series that is a member of a family is, and how many series were left out.</summary>
|
||||
public required string SeriesJson { get; init; }
|
||||
}
|
||||
@@ -13,4 +13,10 @@ public sealed record FinalizedSession
|
||||
public FrameBlobs? Frames { get; init; }
|
||||
|
||||
public IReadOnlyList<SensorBlob> Sensors { get; init; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// The session's row of <c>session_advanced</c> (owner decision D102, schema 0023), or null when it was recorded
|
||||
/// with Advanced metrics off. Its series are among <see cref="Sensors"/>, under names that start with <c>adv.</c>.
|
||||
/// </summary>
|
||||
public AdvancedSessionRow? Advanced { get; init; }
|
||||
}
|
||||
@@ -15,6 +15,13 @@ public interface ISeriesCodec
|
||||
|
||||
byte[] EncodeFloat32(ReadOnlySpan<float> values);
|
||||
|
||||
/// <summary>
|
||||
/// A float series in which <b>NaN means "no reading on this tick"</b> — the advanced series only (owner decision
|
||||
/// D102), whose values may be negative, so −1 cannot mark a gap. Every other value must be finite. It is read back
|
||||
/// with the same decoder as <see cref="EncodeFloat32"/>, which still refuses NaN: a frame time has no gaps.
|
||||
/// </summary>
|
||||
byte[] EncodeSparseFloat32(ReadOnlySpan<float> values);
|
||||
|
||||
byte[] EncodeUInt16(ReadOnlySpan<ushort> values);
|
||||
|
||||
byte[] EncodeUInt32(ReadOnlySpan<uint> values);
|
||||
|
||||
@@ -74,6 +74,23 @@ public interface ISessionRepository
|
||||
/// <summary>The session's segments in frame order (the ribbon, <c>08_UI</c> §Session summary).</summary>
|
||||
ValueTask<IReadOnlyList<SegmentRow>> FindSegmentsAsync(long sessionId, CancellationToken ct = default);
|
||||
|
||||
/// <summary>The session's sensor series, still encoded (the sensor strip decodes what it draws).</summary>
|
||||
/// <summary>
|
||||
/// The session's sensor series, still encoded (the sensor strip decodes what it draws). <b>The fixed series only</b>:
|
||||
/// an advanced series (a name that starts with <c>adv.</c>, schema 0023) is not among them — it stores NaN for a
|
||||
/// tick with no reading and may be negative, where every reader of these drops a negative value as "no reading",
|
||||
/// and a session can hold a hundred of them that a summary never draws.
|
||||
/// </summary>
|
||||
ValueTask<IReadOnlyList<SensorBlob>> FindSensorsAsync(long sessionId, CancellationToken ct = default);
|
||||
|
||||
/// <summary>
|
||||
/// The session's advanced series (owner decision D102), still encoded, with <c>t_ms</c> — the clock every one of
|
||||
/// them is aligned to — first. For a session that stored no advanced series that is <c>t_ms</c> alone, or nothing.
|
||||
/// </summary>
|
||||
ValueTask<IReadOnlyList<SensorBlob>> FindAdvancedSensorsAsync(long sessionId, CancellationToken ct = default);
|
||||
|
||||
/// <summary>
|
||||
/// The session's row of <c>session_advanced</c> with the machine profile it points to, or null: it was recorded
|
||||
/// with Advanced metrics off (or before they existed).
|
||||
/// </summary>
|
||||
ValueTask<AdvancedSessionRow?> FindAdvancedAsync(long sessionId, CancellationToken ct = default);
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using FrameLedger.Application.Advanced;
|
||||
using FrameLedger.Application.Persistence;
|
||||
using FrameLedger.Application.Telemetry;
|
||||
using FrameLedger.Domain.Metrics;
|
||||
|
||||
namespace FrameLedger.Application.Recording;
|
||||
|
||||
/// <summary>
|
||||
/// What a session stores of advanced metrics (owner decision D102): one series per advanced reading its samples
|
||||
/// carried, aligned to the session's <c>t_ms</c>, and the row that holds its facts, its statistics and its directory.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// <b>A tick with no reading is NaN, not −1.</b> The fixed series store −1 for a missing tick and their readers drop
|
||||
/// every negative value; an advanced series may be negative — a −12 V rail — and most of its ticks have no reading at
|
||||
/// all, since the sensor library is read every fifth. The <c>adv.</c> prefix is how a reader tells which rule applies.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// <b>Nothing in, nothing out.</b> A session whose samples carry no advanced reading and that was given no context —
|
||||
/// the option was off — stores no series and no row, and is byte for byte what it was before this existed.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static class AdvancedSessionBuilder
|
||||
{
|
||||
/// <summary>
|
||||
/// The most advanced series one session stores. A PC with a card, a processor of thirty-two threads and a board
|
||||
/// full of headers has about a hundred and fifty; what is beyond this is counted in the directory, not stored.
|
||||
/// </summary>
|
||||
public const int MaxSeries = 256;
|
||||
|
||||
public static (IReadOnlyList<SensorBlob> Blobs, AdvancedSessionRow? Row) Build(IReadOnlyList<TelemetrySample> sensors, AdvancedSessionData? data, ISeriesCodec codec)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(sensors);
|
||||
ArgumentNullException.ThrowIfNull(codec);
|
||||
(List<string> names, Dictionary<string, int> indexOf, int dropped) = SeriesOf(sensors);
|
||||
if (names.Count == 0 && data is null)
|
||||
{
|
||||
return ([], null);
|
||||
}
|
||||
|
||||
float[][] columns = Columns(sensors, names.Count, indexOf);
|
||||
var blobs = new List<SensorBlob>(names.Count);
|
||||
var stats = new Dictionary<string, SensorSeriesStats>(StringComparer.Ordinal);
|
||||
for (int s = 0; s < names.Count; s++)
|
||||
{
|
||||
blobs.Add(new SensorBlob { Series = names[s], Hz = 1, Codec = codec.Tag, Data = codec.EncodeSparseFloat32(columns[s]) });
|
||||
SeriesAggregates aggregates = SeriesAggregates.Of(columns[s].Select(static v => float.IsNaN(v) ? (double?)null : v));
|
||||
if (aggregates.Count > 0)
|
||||
{
|
||||
stats[names[s]] = SensorSeriesStats.From(aggregates);
|
||||
}
|
||||
}
|
||||
|
||||
IReadOnlyList<AdvancedFact> machine = AdvancedJson.Storable(data?.MachineFacts ?? []);
|
||||
string? machineJson = machine.Count == 0 ? null : AdvancedJson.OfFacts(machine);
|
||||
AdvancedSeriesInfo[] directory = [.. (data?.Series ?? []).Where(i => indexOf.ContainsKey(i.Series))];
|
||||
return (blobs, new AdvancedSessionRow
|
||||
{
|
||||
MachineFactsJson = machineJson,
|
||||
MachineHash = machineJson is null ? null : Convert.ToHexStringLower(SHA256.HashData(Encoding.UTF8.GetBytes(machineJson))),
|
||||
FactsJson = AdvancedJson.OfSession(AdvancedJson.Storable(data?.SessionFacts ?? []), data?.Sources ?? AdvancedSources.Unknown),
|
||||
StatsJson = stats.Count == 0 ? null : AdvancedJson.OfStats(stats),
|
||||
SeriesJson = AdvancedJson.OfSeries(directory, dropped),
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>The series the samples carry, in the order they first appear, up to <see cref="MaxSeries"/>; and how many more there were.</summary>
|
||||
private static (List<string> Names, Dictionary<string, int> IndexOf, int Dropped) SeriesOf(IReadOnlyList<TelemetrySample> sensors)
|
||||
{
|
||||
var names = new List<string>();
|
||||
var indexOf = new Dictionary<string, int>(StringComparer.Ordinal);
|
||||
var beyond = new HashSet<string>(StringComparer.Ordinal);
|
||||
foreach (TelemetrySample sample in sensors)
|
||||
{
|
||||
foreach (AdvancedReading reading in sample.Advanced ?? [])
|
||||
{
|
||||
// Only what carries the prefix is an advanced series: a name without it could be taken for a fixed one.
|
||||
if (reading.Series is null || !reading.Series.StartsWith(AdvancedMetric.SeriesPrefix, StringComparison.Ordinal) || indexOf.ContainsKey(reading.Series))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (names.Count < MaxSeries)
|
||||
{
|
||||
indexOf[reading.Series] = names.Count;
|
||||
names.Add(reading.Series);
|
||||
}
|
||||
else
|
||||
{
|
||||
beyond.Add(reading.Series);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (names, indexOf, beyond.Count);
|
||||
}
|
||||
|
||||
private static float[][] Columns(IReadOnlyList<TelemetrySample> sensors, int series, Dictionary<string, int> indexOf)
|
||||
{
|
||||
float[][] columns = new float[series][];
|
||||
for (int s = 0; s < series; s++)
|
||||
{
|
||||
columns[s] = new float[sensors.Count];
|
||||
Array.Fill(columns[s], float.NaN);
|
||||
}
|
||||
|
||||
for (int i = 0; i < sensors.Count; i++)
|
||||
{
|
||||
foreach (AdvancedReading reading in sensors[i].Advanced ?? [])
|
||||
{
|
||||
if (reading.Series is not null && indexOf.TryGetValue(reading.Series, out int s) && double.IsFinite(reading.Value))
|
||||
{
|
||||
columns[s][i] = (float)reading.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return columns;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using FrameLedger.Application.Advanced;
|
||||
using FrameLedger.Application.Persistence;
|
||||
using FrameLedger.Application.Telemetry;
|
||||
|
||||
@@ -17,6 +18,12 @@ public sealed record FinalizeInput
|
||||
|
||||
public IReadOnlyList<TelemetrySample> Sensors { get; init; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// The session's advanced context (owner decision D101): the PC's facts, its own, its series' directory and the
|
||||
/// state of each source. Null when it was recorded with Advanced metrics off — it then stores nothing of them.
|
||||
/// </summary>
|
||||
public AdvancedSessionData? Advanced { get; init; }
|
||||
|
||||
/// <summary><c>06_DATA_MODEL</c> §Retention: raw blobs for the last N sessions per game.</summary>
|
||||
public int RetentionKeep { get; init; } = SessionFinalizer.DefaultRetentionKeep;
|
||||
|
||||
|
||||
@@ -24,4 +24,10 @@ public interface IPartialSessionWriter : IDisposable
|
||||
void AppendTouches(ReadOnlySpan<long> touchQpc);
|
||||
|
||||
void AppendNote(DateTimeOffset at, string text);
|
||||
|
||||
/// <summary>
|
||||
/// The session's advanced context as JSON (owner decision D101); a later one replaces an earlier one. Never
|
||||
/// called for a session recorded with Advanced metrics off.
|
||||
/// </summary>
|
||||
void AppendAdvancedContext(string json);
|
||||
}
|
||||
@@ -157,7 +157,9 @@ public sealed class PartialRecovery
|
||||
TotalDropped = partial.LastTick?.TotalDropped ?? 0,
|
||||
};
|
||||
|
||||
return new FinalizeInput { Skeleton = skeleton, Hooked = aggregation, Sensors = partial.Sensors };
|
||||
// A session recorded with Advanced metrics on carries its context in the file (D101); one recorded with them
|
||||
// off carries none, and stores none.
|
||||
return new FinalizeInput { Skeleton = skeleton, Hooked = aggregation, Sensors = partial.Sensors, Advanced = Advanced.AdvancedJson.ParseContext(partial.AdvancedContextJson) };
|
||||
}
|
||||
|
||||
/// <summary>The <c>build=…</c> word of the recorder's <c>attached</c> note, or null.</summary>
|
||||
|
||||
@@ -30,4 +30,10 @@ public sealed record PartialSession
|
||||
|
||||
/// <summary>True when the file ended inside a chunk, or a chunk failed its check: the tail was lost.</summary>
|
||||
public required bool Truncated { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// The session's advanced context as the file last carried it (<c>AdvancedJson.ParseContext</c> reads it), or null:
|
||||
/// it was recorded with Advanced metrics off, or by a build before they existed.
|
||||
/// </summary>
|
||||
public string? AdvancedContextJson { get; init; }
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using FrameLedger.Application.Advanced;
|
||||
using FrameLedger.Application.Capture;
|
||||
using FrameLedger.Application.Telemetry;
|
||||
using FrameLedger.Shared;
|
||||
@@ -26,6 +27,8 @@ public sealed class PartialSessionWriter : IDisposable
|
||||
private readonly TimeSpan _interval;
|
||||
private readonly List<TelemetrySample> _sensors = [];
|
||||
|
||||
private string? _advancedContext;
|
||||
private string? _advancedContextWritten;
|
||||
private int _recordsWritten;
|
||||
private int _gapsWritten;
|
||||
private int _sensorsWritten;
|
||||
@@ -53,6 +56,21 @@ public sealed class PartialSessionWriter : IDisposable
|
||||
_sensors.AddRange(samples);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The session's advanced context (owner decision D101), kept for the finalizer and written to the file with the
|
||||
/// next flush — and again only when it has changed, so a context that stays the same is in the file once. Never
|
||||
/// called for a session recorded with Advanced metrics off.
|
||||
/// </summary>
|
||||
public void SetAdvancedContext(AdvancedSessionData data)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(data);
|
||||
Advanced = data;
|
||||
_advancedContext = AdvancedJson.OfContext(data);
|
||||
}
|
||||
|
||||
/// <summary>The context last given to <see cref="SetAdvancedContext"/>, or null.</summary>
|
||||
public AdvancedSessionData? Advanced { get; private set; }
|
||||
|
||||
/// <summary>A state transition: written at once, never batched, because it is the breadcrumb.</summary>
|
||||
public void Note(string text)
|
||||
{
|
||||
@@ -95,6 +113,12 @@ public sealed class PartialSessionWriter : IDisposable
|
||||
_sensorsWritten = _sensors.Count;
|
||||
}
|
||||
|
||||
if (_advancedContext is not null && !string.Equals(_advancedContext, _advancedContextWritten, StringComparison.Ordinal))
|
||||
{
|
||||
_file.AppendAdvancedContext(_advancedContext);
|
||||
_advancedContextWritten = _advancedContext;
|
||||
}
|
||||
|
||||
if (progress.TouchQpc.Count > _touchesWritten)
|
||||
{
|
||||
_file.AppendTouches([.. progress.TouchQpc.Skip(_touchesWritten)]);
|
||||
|
||||
@@ -17,4 +17,11 @@ public sealed record RecorderOptions
|
||||
|
||||
/// <summary>FR-3.5: the sensor poll interval (<c>telemetry.interval_ms</c>, 500–2000).</summary>
|
||||
public TimeSpan TelemetryInterval { get; init; } = TimeSpan.FromSeconds(1);
|
||||
|
||||
/// <summary>
|
||||
/// <c>telemetry.advanced</c> (owner decision D101): whether this session holds the shared advanced reader, carries
|
||||
/// its readings and stores them. False — the default, and every recorder with no such reader — reads and stores
|
||||
/// nothing more than a session always did.
|
||||
/// </summary>
|
||||
public bool AdvancedMetrics { get; init; }
|
||||
}
|
||||
@@ -56,6 +56,10 @@ public sealed class SessionFinalizer
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
SessionRow row = input.Skeleton;
|
||||
|
||||
// Advanced metrics (D102), both tiers: they are read by the Agent, not by a hook, so a session that was not
|
||||
// hooked has them all the same. Nothing when the option was off - no series, no row.
|
||||
(IReadOnlyList<SensorBlob> advancedBlobs, AdvancedSessionRow? advanced) = AdvancedSessionBuilder.Build(input.Sensors, input.Advanced, _codec);
|
||||
if (input.Hooked is null)
|
||||
{
|
||||
// A Tier-2 row has no frames and every sensor the machine provided (2026-09-22): the same averages a
|
||||
@@ -63,7 +67,8 @@ public sealed class SessionFinalizer
|
||||
return new FinalizedSession
|
||||
{
|
||||
Row = SessionAggregator.WithSensorAggregates(row with { Tier = CaptureTier.NotHooked }, input.Sensors),
|
||||
Sensors = EncodeSensors(input.Sensors, row.QpcEpoch, row.QpcFrequency),
|
||||
Sensors = [.. EncodeSensors(input.Sensors, row.QpcEpoch, row.QpcFrequency), .. advancedBlobs],
|
||||
Advanced = advanced,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -77,7 +82,8 @@ public sealed class SessionFinalizer
|
||||
{
|
||||
FirstPresentMs = FirstPresentMs(r.Dominant, row.QpcEpoch, row.QpcFrequency),
|
||||
},
|
||||
Sensors = EncodeSensors(input.Sensors, row.QpcEpoch, row.QpcFrequency),
|
||||
Sensors = [.. EncodeSensors(input.Sensors, row.QpcEpoch, row.QpcFrequency), .. advancedBlobs],
|
||||
Advanced = advanced,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using System.Globalization;
|
||||
using FrameLedger.Application.Advanced;
|
||||
using FrameLedger.Application.Capture;
|
||||
using FrameLedger.Application.Persistence;
|
||||
using FrameLedger.Application.Telemetry;
|
||||
@@ -49,13 +50,17 @@ public sealed class SessionRecorder : ISessionRecorder
|
||||
private readonly IDriverProfileSource? _profiles;
|
||||
private readonly UserModeExceptionLapsePolicy? _exceptionLapse;
|
||||
private readonly ICrashReporterSightings? _reporters;
|
||||
private readonly IAdvancedHardware? _advanced;
|
||||
|
||||
public SessionRecorder(ICaptureSessionFactory sessions, IGameRepository games, IHardwareSnapshotRepository snapshots,
|
||||
IHardwareSnapshotSource hardware, IPartialSessionStore partials, SessionFinalizer finalizer, ICrashEventSource crashes,
|
||||
Func<RecorderOptions, ITelemetryPoller?> pollers, TimeProvider clock, RecorderOptions? options = null, ISessionObserver? observer = null,
|
||||
IRecorderPolicy? policy = null, IDriverProfileSource? profiles = null, UserModeExceptionLapsePolicy? exceptionLapse = null,
|
||||
ICrashReporterSightings? reporters = null)
|
||||
ICrashReporterSightings? reporters = null, IAdvancedHardware? advanced = null)
|
||||
{
|
||||
// Advanced metrics (owner decision D101): the Agent's one shared reader, held by a session only when the option
|
||||
// is on (RecorderOptions.AdvancedMetrics); null in every recorder that has none (the tests, the unshipped host).
|
||||
_advanced = advanced;
|
||||
// beta.14: the engine crash reporters the watcher saw the game start; null where nothing watches (the tests, the console).
|
||||
_reporters = reporters;
|
||||
// D33: ends a game's user-mode exception when a session under it ends badly; null in every recorder that has no
|
||||
@@ -116,6 +121,11 @@ public sealed class SessionRecorder : ISessionRecorder
|
||||
long qpcEpoch, long snapshotId, RecorderOptions options, CancellationToken ct)
|
||||
{
|
||||
ITelemetryPoller? poller = _pollers(options);
|
||||
|
||||
// Held for the whole session - the poller holds it too, and lets go before the finalize reads the last snapshot.
|
||||
// With the option off nothing is held, and the shared reader is not started for this session (D101).
|
||||
IAdvancedHardware? advanced = options.AdvancedMetrics ? _advanced : null;
|
||||
using IDisposable? advancedHold = advanced?.Acquire();
|
||||
// The driver profile, read BESIDE the session rather than before it (beta.8): a DRS load takes tens of milliseconds
|
||||
// and a launch must not wait on it. The profile the driver applies is fixed when the process starts, so a read that
|
||||
// starts here and is awaited at the end describes the run.
|
||||
@@ -138,10 +148,11 @@ public sealed class SessionRecorder : ISessionRecorder
|
||||
};
|
||||
|
||||
using var writer = new PartialSessionWriter(_partials.Create(header), _clock, options.PartialFlushInterval);
|
||||
var run = new Run(writer, poller, _clock, _observer, guid);
|
||||
var run = new Run(writer, poller, _clock, _observer, guid, advanced, request.NormalisedExePath);
|
||||
writer.Note("started " + request.Mode);
|
||||
CaptureOutcome outcome = await RunLoopAsync(request, run, ct).ConfigureAwait(false);
|
||||
DateTimeOffset endedAt = _clock.GetUtcNow();
|
||||
await run.CompleteAdvancedAsync().ConfigureAwait(false);
|
||||
run.FinalFlush();
|
||||
writer.Note("ended " + outcome.Reason);
|
||||
|
||||
@@ -207,6 +218,7 @@ public sealed class SessionRecorder : ISessionRecorder
|
||||
Skeleton = skeleton,
|
||||
Hooked = hooked ? Hooked(outcome, header.QpcFrequency) : null,
|
||||
Sensors = writer.Sensors,
|
||||
Advanced = writer.Advanced,
|
||||
RetentionKeep = options.RetentionKeep,
|
||||
MinimumSessionLength = options.MinimumSessionLength,
|
||||
ExePath = request.NormalisedExePath,
|
||||
@@ -335,12 +347,29 @@ public sealed class SessionRecorder : ISessionRecorder
|
||||
/// The recorder's ears on the loop: the flush and the telemetry drain, on the loop's task — and, after
|
||||
/// each of those, the outside observer's turn with the same tick.
|
||||
/// </summary>
|
||||
private sealed class Run(PartialSessionWriter writer, ITelemetryPoller? poller, TimeProvider clock, ISessionObserver? observer, Guid guid) : ICaptureObserver
|
||||
private sealed class Run(PartialSessionWriter writer, ITelemetryPoller? poller, TimeProvider clock, ISessionObserver? observer, Guid guid,
|
||||
IAdvancedHardware? advanced, string exePath) : ICaptureObserver
|
||||
{
|
||||
/// <summary>
|
||||
/// How long after the game's process is known its session facts are asked for (owner decision D101): by then
|
||||
/// it has a window, so the monitor it presents on can be found. A session shorter than the minimum is discarded
|
||||
/// anyway; one that ends before this asks at its end.
|
||||
/// </summary>
|
||||
private static readonly TimeSpan _sessionFactsAfter = TimeSpan.FromSeconds(15);
|
||||
|
||||
/// <summary>The longest the finalize waits for a session-facts read still in flight.</summary>
|
||||
private static readonly TimeSpan _sessionFactsWait = TimeSpan.FromSeconds(5);
|
||||
|
||||
private readonly List<TelemetrySample> _drained = [];
|
||||
private CaptureProgress? _last;
|
||||
private ulong _adapter;
|
||||
|
||||
private uint? _gamePid;
|
||||
private long _gameSince;
|
||||
private Task? _sessionFactsRead;
|
||||
private volatile IReadOnlyList<AdvancedFact>? _sessionFacts;
|
||||
private (IReadOnlyList<AdvancedFact>? Machine, IReadOnlyList<AdvancedSeriesInfo>? Series, AdvancedSources? Sources, IReadOnlyList<AdvancedFact>? Session) _context;
|
||||
|
||||
public DateTimeOffset? AttachedAt { get; private set; }
|
||||
|
||||
public void Attached(int pid, FlShmHandshake handshake)
|
||||
@@ -357,6 +386,12 @@ public sealed class SessionRecorder : ISessionRecorder
|
||||
public void Measuring(GameProcess target)
|
||||
{
|
||||
poller?.Follow(target);
|
||||
if (advanced is not null && PidOf(target) is uint game && game != _gamePid)
|
||||
{
|
||||
_gamePid = game;
|
||||
_gameSince = clock.GetTimestamp();
|
||||
}
|
||||
|
||||
writer.Note(target.IsNone
|
||||
? "memory: none"
|
||||
: target.Pid is int pid
|
||||
@@ -369,10 +404,93 @@ public sealed class SessionRecorder : ISessionRecorder
|
||||
_last = progress;
|
||||
FollowAdapter(progress.AdapterLuid);
|
||||
DrainTelemetry();
|
||||
UpdateAdvancedContext(atEnd: false);
|
||||
writer.OnTick(progress);
|
||||
observer?.Tick(guid, progress, _drained);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Before the last flush (owner decision D101): the session's facts are asked for if they were not yet, a read in
|
||||
/// flight is given a few seconds, and the context is set once more — so a session recorded with the option on
|
||||
/// always stores a row, if only to say that nothing answered. Does nothing with the option off.
|
||||
/// </summary>
|
||||
public async Task CompleteAdvancedAsync()
|
||||
{
|
||||
if (advanced is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UpdateAdvancedContext(atEnd: true);
|
||||
if (_sessionFactsRead is { IsCompleted: false } pending)
|
||||
{
|
||||
try
|
||||
{
|
||||
await pending.WaitAsync(_sessionFactsWait, clock).ConfigureAwait(false);
|
||||
}
|
||||
catch (TimeoutException)
|
||||
{
|
||||
// The driver did not answer in time: the session is stored without its facts rather than held up.
|
||||
}
|
||||
}
|
||||
|
||||
UpdateAdvancedContext(atEnd: true);
|
||||
if (writer.Advanced is null)
|
||||
{
|
||||
writer.SetAdvancedContext(new AdvancedSessionData([], [], [], AdvancedSources.Unknown));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Keeps the writer's advanced context current — from the shared reader's latest snapshot, which is a read of
|
||||
/// one reference, and from the session's facts once they were read. The facts are read OFF this task: asking
|
||||
/// the driver for a profile takes some hundred milliseconds, and this is the capture loop's.
|
||||
/// </summary>
|
||||
private void UpdateAdvancedContext(bool atEnd)
|
||||
{
|
||||
if (advanced is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_sessionFactsRead is null && _gamePid is uint pid && (atEnd || clock.GetElapsedTime(_gameSince) >= _sessionFactsAfter))
|
||||
{
|
||||
var target = new AdvancedSessionTarget(pid, exePath, GdiDeviceName: null);
|
||||
_sessionFactsRead = Task.Run(() => _sessionFacts = ReadSessionFacts(advanced, target));
|
||||
}
|
||||
|
||||
AdvancedSnapshot? snapshot = advanced.Latest;
|
||||
IReadOnlyList<AdvancedFact>? session = _sessionFacts;
|
||||
(IReadOnlyList<AdvancedFact>?, IReadOnlyList<AdvancedSeriesInfo>?, AdvancedSources?, IReadOnlyList<AdvancedFact>?) now = (snapshot?.MachineFacts, snapshot?.Series, snapshot?.Sources, session);
|
||||
if ((snapshot is null && session is null)
|
||||
|| (ReferenceEquals(now.Item1, _context.Machine) && ReferenceEquals(now.Item2, _context.Series) && Equals(now.Item3, _context.Sources) && ReferenceEquals(now.Item4, _context.Session)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_context = now;
|
||||
writer.SetAdvancedContext(new AdvancedSessionData(snapshot?.MachineFacts ?? [], session ?? [], snapshot?.Series ?? [], snapshot?.Sources ?? AdvancedSources.Unknown));
|
||||
}
|
||||
|
||||
private static IReadOnlyList<AdvancedFact> ReadSessionFacts(IAdvancedHardware advanced, AdvancedSessionTarget target)
|
||||
{
|
||||
try
|
||||
{
|
||||
return advanced.ReadSessionFacts(target);
|
||||
}
|
||||
catch (Exception e) when (e is not OperationCanceledException)
|
||||
{
|
||||
// The reader guards its sources; a throw here is a defect in it, and it costs the session its facts, not itself.
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
private static uint? PidOf(GameProcess target)
|
||||
{
|
||||
int? pid = target.IsNone ? null : target.Pid ?? (target.Processes.Count > 0 ? target.Processes[0].Pid : null);
|
||||
return pid is > 0 ? (uint)pid.Value : null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The adapter the game presents on (beta.13): the Overlay publishes its LUID at the first present, the telemetry thread
|
||||
/// is told once, and the <c>.partial</c> says whether its layers could follow — until then, and where they could not,
|
||||
|
||||
@@ -24,6 +24,7 @@ public sealed class SettingsRecorderPolicy : IRecorderPolicy
|
||||
int minimumSeconds = await _settings.GetIntegerAsync(SettingsRegistry.CaptureMinSessionSeconds, ct).ConfigureAwait(false);
|
||||
int keep = await _settings.GetIntegerAsync(SettingsRegistry.RetentionRawSessionsPerGame, ct).ConfigureAwait(false);
|
||||
int intervalMs = await _settings.GetIntegerAsync(SettingsRegistry.TelemetryIntervalMs, ct).ConfigureAwait(false);
|
||||
bool advanced = await _settings.GetBooleanAsync(SettingsRegistry.TelemetryAdvanced, ct).ConfigureAwait(false);
|
||||
|
||||
TimeSpan minimum = baseline.MinimumSessionLength < SessionFinalizer.MinimumSessionLength
|
||||
? baseline.MinimumSessionLength
|
||||
@@ -33,6 +34,7 @@ public sealed class SettingsRecorderPolicy : IRecorderPolicy
|
||||
MinimumSessionLength = minimum,
|
||||
RetentionKeep = keep == 0 ? int.MaxValue : keep,
|
||||
TelemetryInterval = TimeSpan.FromMilliseconds(intervalMs),
|
||||
AdvancedMetrics = advanced,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -190,6 +190,22 @@ public static class SettingsRegistry
|
||||
AgentReads = true,
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// "Advanced metrics" (owner decision D101, 2026-11-11): whether the Agent reads, and a session stores, what the
|
||||
/// vendor interfaces make available beyond the fixed sensors — NVAPI's facts and figures, every sensor
|
||||
/// LibreHardwareMonitor has for the card and, as administrator with PawnIO, for the processor, memory and
|
||||
/// motherboard (<c>18_GPU_VENDOR_APIS</c> §Advanced metrics). <b>Off by default, and off means nothing more is
|
||||
/// read or stored</b>; a session recorded while it was off is never filled in afterwards. Read at each session's
|
||||
/// start like every key the Agent reads. Exactly "1" is on.
|
||||
/// </summary>
|
||||
public static readonly SettingDefinition TelemetryAdvanced = new()
|
||||
{
|
||||
Key = "telemetry.advanced",
|
||||
Kind = SettingKind.Boolean,
|
||||
Default = "0",
|
||||
AgentReads = true,
|
||||
};
|
||||
|
||||
/// <summary>FR-3.5: telemetry at 1 Hz, configurable 0.5–2 s. Milliseconds.</summary>
|
||||
public static readonly SettingDefinition TelemetryIntervalMs = new()
|
||||
{
|
||||
@@ -268,7 +284,7 @@ public static class SettingsRegistry
|
||||
public static IReadOnlyList<SettingDefinition> All { get; } =
|
||||
[
|
||||
UiLanguage, UiTheme, UiStartWithWindows, UiMinimizeToTray, UiHideAntiCheatHooking, UiFpsDecimals, UiHideScrollBars, UiLibraryView, UiPlayMode,
|
||||
UiGameArt, UiGameArtTint, CaptureBackground, HookingKillSwitch, HookingUserModeExceptions, CaptureRunElevated, CaptureMinSessionSeconds, TelemetryIntervalMs, RetentionRawSessionsPerGame,
|
||||
UiGameArt, UiGameArtTint, CaptureBackground, HookingKillSwitch, HookingUserModeExceptions, CaptureRunElevated, CaptureMinSessionSeconds, TelemetryIntervalMs, TelemetryAdvanced, RetentionRawSessionsPerGame,
|
||||
RetentionRemoveUninstalledGames, UpdateChannel, UpdateAutoCheck, PrivacyOnlineMetadata, LogDebug,
|
||||
];
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using System.Runtime.InteropServices;
|
||||
using FrameLedger.Application.Advanced;
|
||||
|
||||
namespace FrameLedger.Application.Telemetry;
|
||||
|
||||
@@ -26,5 +27,10 @@ namespace FrameLedger.Application.Telemetry;
|
||||
/// <param name="Sample">The GPU layers' composed sample; a placeholder with <see cref="TelemetryLayer.None"/> and no field on a tick only the system source answered.</param>
|
||||
/// <param name="System">The machine beside the GPU on the same tick (2026-09-21): CPU busy %, memory in use, CPU temperature where readable. Empty when no system source is composed, which is every sample recorded before that date.</param>
|
||||
/// <param name="Game">The game process's own memory on the same tick (beta.12, D43): read from outside the game. Empty when no game source is composed or nothing was followed yet — every sample recorded before beta.12.</param>
|
||||
/// <param name="Advanced">
|
||||
/// The advanced readings of the same tick (owner decision D101): the one snapshot of the shared advanced reader that
|
||||
/// was new at this poll, or null — the option is off, or that reader published nothing since the last poll. Null on
|
||||
/// every sample recorded before it existed. Never a repeat of an earlier tick's readings: a reading is of one tick.
|
||||
/// </param>
|
||||
[StructLayout(LayoutKind.Auto)]
|
||||
public readonly record struct TelemetrySample(long QpcTicks, GpuSample Sample, SystemReading System = default, ProcessReading Game = default);
|
||||
public readonly record struct TelemetrySample(long QpcTicks, GpuSample Sample, SystemReading System = default, ProcessReading Game = default, IReadOnlyList<AdvancedReading>? Advanced = null);
|
||||
@@ -71,7 +71,7 @@ internal sealed record CommandLine
|
||||
|
||||
if (verb == Verb.None)
|
||||
{
|
||||
return new CommandLine { Error = "usage: consent list | consent grant --exe <path> | consent revoke --exe <path> | capture --exe <path> [--seconds <n>] | launch --exe <path> [--args \"<string>\"] [--seconds <n>] | recover | probe-lhm [--seconds <n>]" };
|
||||
return new CommandLine { Error = "usage: consent list | consent grant --exe <path> | consent revoke --exe <path> | capture --exe <path> [--seconds <n>] | launch --exe <path> [--args \"<string>\"] [--seconds <n>] | recover | probe-lhm [--seconds <n>] | probe-advanced [--seconds <n>]" };
|
||||
}
|
||||
|
||||
string? exe = null;
|
||||
@@ -116,9 +116,9 @@ internal sealed record CommandLine
|
||||
}
|
||||
}
|
||||
|
||||
// probe-lhm touches no game: it opens a sensor library in THIS process and nothing
|
||||
// else, so there is no executable to name and no consent record to look up.
|
||||
if (verb is not (Verb.ConsentList or Verb.ProbeLhm or Verb.Recover) && string.IsNullOrWhiteSpace(exe))
|
||||
// probe-lhm and probe-advanced touch no game: each opens sensor libraries in THIS process
|
||||
// and nothing else, so there is no executable to name and no consent record to look up.
|
||||
if (verb is not (Verb.ConsentList or Verb.ProbeLhm or Verb.ProbeAdvanced or Verb.Recover) && string.IsNullOrWhiteSpace(exe))
|
||||
{
|
||||
return new CommandLine { Error = "--exe <path> is required" };
|
||||
}
|
||||
@@ -135,6 +135,7 @@ internal sealed record CommandLine
|
||||
["launch", ..] => Verb.Launch,
|
||||
["recover", ..] => Verb.Recover,
|
||||
["probe-lhm", ..] => Verb.ProbeLhm,
|
||||
["probe-advanced", ..] => Verb.ProbeAdvanced,
|
||||
_ => Verb.None,
|
||||
};
|
||||
}
|
||||
@@ -94,6 +94,7 @@ internal static class Program
|
||||
Verb.Launch => await LaunchAsync(db, store, cmd.ExePath!, cmd.Arguments, cmd.Seconds).ConfigureAwait(false),
|
||||
Verb.Recover => await RecoverAsync(db).ConfigureAwait(false),
|
||||
Verb.ProbeLhm => LhmProbe.Run(cmd.Seconds == 0 ? LhmProbe.DefaultSeconds : cmd.Seconds),
|
||||
Verb.ProbeAdvanced => AdvancedProbe.Run(cmd.Seconds == 0 ? AdvancedProbe.DefaultSeconds : cmd.Seconds),
|
||||
_ => _exitUsage,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,168 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using FrameLedger.Application.Advanced;
|
||||
using FrameLedger.Infrastructure.Telemetry;
|
||||
|
||||
namespace FrameLedger.CaptureHost.Telemetry;
|
||||
|
||||
/// <summary>
|
||||
/// The instrument of <c>20_OPEN_QUESTIONS</c> §M12 and §M13: what does "Advanced metrics" read on THIS PC, and what
|
||||
/// does reading it cost? It runs the reader the Agent will run — <see cref="AdvancedHardwareReader"/> over the real
|
||||
/// NVAPI bridge and LibreHardwareMonitor — for a few ticks, and prints everything it got.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// <b>It opens exactly what the Agent would, on this process's own rights.</b> Unelevated: NVAPI and the graphics
|
||||
/// card's sensors. As administrator with PawnIO installed: the processor, the memory and the motherboard as well —
|
||||
/// that run is the first there has ever been (§M13, and §M10 with it), which is why its cost is printed: the time
|
||||
/// the open took, each tick's, the processor time this process used and its working set (NFR-2).
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// <b>No game, no injection, no consent record</b> — like <c>probe-lhm</c>, it touches this process and nothing else.
|
||||
/// The storage group is not opened by it or by anything (D103).
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
internal static class AdvancedProbe
|
||||
{
|
||||
public const int DefaultSeconds = 5;
|
||||
|
||||
public static int Run(int seconds)
|
||||
{
|
||||
bool elevated = LhmEnvironment.IsElevated;
|
||||
bool? pawnIo = LhmEnvironment.IsPawnIoInstalled;
|
||||
HostConsole.Line($"probe-advanced: {seconds} tick(s) of the reader Advanced metrics uses");
|
||||
HostConsole.Line($" process elevated: {elevated} PawnIO installed: {pawnIo?.ToString() ?? "unknown"} sensor groups to open: {LhmAdvancedReader.GroupsFor(elevated, pawnIo)}");
|
||||
|
||||
using var self = Process.GetCurrentProcess();
|
||||
TimeSpan cpuBefore = self.TotalProcessorTime;
|
||||
using AdvancedHardwareReader reader = AdvancedHardwareReader.OverThisPc(TimeProvider.System, static note => HostConsole.Line(" NOTE " + note));
|
||||
|
||||
long started = Stopwatch.GetTimestamp();
|
||||
reader.Open();
|
||||
HostConsole.Line(string.Create(CultureInfo.InvariantCulture, $" open: {Stopwatch.GetElapsedTime(started).TotalMilliseconds:F0} ms"));
|
||||
|
||||
// Elapsed time and processor time are told apart on purpose: a tick spends most of its time waiting for the
|
||||
// driver, and NFR-2 is about the processor. The first tick carries the libraries' start-up and is listed, not
|
||||
// averaged.
|
||||
AdvancedSnapshot? last = null;
|
||||
var tickMs = new List<double>(seconds);
|
||||
var cpuMs = new List<double>(seconds);
|
||||
for (int tick = 1; tick <= seconds; tick++)
|
||||
{
|
||||
self.Refresh();
|
||||
TimeSpan cpuAt = self.TotalProcessorTime;
|
||||
long at = Stopwatch.GetTimestamp();
|
||||
last = reader.Tick();
|
||||
tickMs.Add(Stopwatch.GetElapsedTime(at).TotalMilliseconds);
|
||||
self.Refresh();
|
||||
cpuMs.Add((self.TotalProcessorTime - cpuAt).TotalMilliseconds);
|
||||
HostConsole.Line(string.Create(CultureInfo.InvariantCulture, $" tick {tick}: {last.Readings.Count} reading(s) in {tickMs[^1]:F1} ms elapsed, {cpuMs[^1]:F1} ms of processor time"));
|
||||
if (tick < seconds)
|
||||
{
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
}
|
||||
|
||||
if (last is null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
Describe(last);
|
||||
self.Refresh();
|
||||
double[] steady = cpuMs.Count > 1 ? [.. cpuMs.Skip(1)] : [.. cpuMs];
|
||||
HostConsole.Line(string.Create(CultureInfo.InvariantCulture,
|
||||
$" cost: a tick takes {tickMs.Min():F1} to {tickMs.Max():F1} ms elapsed (mean {tickMs.Average():F1}); after the first, {steady.Average():F1} ms of processor time each (max {steady.Max():F1}) = {steady.Average() / 10.0:F2}% of one core at one tick a second"));
|
||||
HostConsole.Line(string.Create(CultureInfo.InvariantCulture,
|
||||
$" cost: this process used {(self.TotalProcessorTime - cpuBefore).TotalMilliseconds:F0} ms of processor time in all, start-up included; working set {self.WorkingSet64 / (1024.0 * 1024.0):F0} MiB. NFR-2 allows the whole Agent 1% of one core and 150 MiB"));
|
||||
CostBySource(self, elevated, pawnIo);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Which source the processor time goes to: each read on its own, many times back to back, because the clock a
|
||||
/// process's processor time is counted with ticks every 15.6 ms and one read is shorter than that.
|
||||
/// </summary>
|
||||
private static void CostBySource(Process self, bool elevated, bool? pawnIo)
|
||||
{
|
||||
const int Reads = 40;
|
||||
using (NvapiAdvancedReader nvapi = NvapiAdvancedReader.OverTheNativeBridge())
|
||||
{
|
||||
if (nvapi.Start())
|
||||
{
|
||||
Measure(self, "NVAPI, one live read", Reads, nvapi, static reader => _ = reader.ReadLive());
|
||||
}
|
||||
}
|
||||
|
||||
using var sensors = new LhmAdvancedReader(new LhmComputerAdapter(LhmAdvancedReader.GroupsFor(elevated, pawnIo)));
|
||||
if (sensors.Open())
|
||||
{
|
||||
Measure(self, "the sensor library, one refresh and read", Reads, sensors, static reader =>
|
||||
{
|
||||
reader.Refresh();
|
||||
_ = reader.Read();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private static void Measure<T>(Process self, string what, int reads, T source, Action<T> read)
|
||||
{
|
||||
read(source);
|
||||
self.Refresh();
|
||||
TimeSpan cpu = self.TotalProcessorTime;
|
||||
long at = Stopwatch.GetTimestamp();
|
||||
for (int i = 0; i < reads; i++)
|
||||
{
|
||||
read(source);
|
||||
}
|
||||
|
||||
double elapsed = Stopwatch.GetElapsedTime(at).TotalMilliseconds / reads;
|
||||
self.Refresh();
|
||||
double processor = (self.TotalProcessorTime - cpu).TotalMilliseconds / reads;
|
||||
HostConsole.Line(string.Create(CultureInfo.InvariantCulture, $" cost by source: {what}: {elapsed:F1} ms elapsed, {processor:F1} ms of processor time (mean of {reads})"));
|
||||
}
|
||||
|
||||
private static void Describe(AdvancedSnapshot snapshot)
|
||||
{
|
||||
AdvancedSources s = snapshot.Sources;
|
||||
HostConsole.Line($" sources: NVAPI {s.Nvapi}{(s.NvapiCode is { } code ? $" ({code})" : string.Empty)}; card sensors {s.Sensors}; processor, memory and board sensors {s.ElevatedSensors}");
|
||||
|
||||
HostConsole.Line($" facts of the PC: {snapshot.MachineFacts.Count}");
|
||||
foreach (AdvancedFact fact in snapshot.MachineFacts)
|
||||
{
|
||||
HostConsole.Line($" {fact.Id}{(fact.Instance is null ? string.Empty : "#" + fact.Instance)} = {Describe(fact.Value)}");
|
||||
}
|
||||
|
||||
var labels = snapshot.Series.ToDictionary(static i => i.Series, static i => i.Label, StringComparer.Ordinal);
|
||||
HostConsole.Line($" readings of the last tick: {snapshot.Readings.Count}");
|
||||
foreach (AdvancedReading reading in snapshot.Readings)
|
||||
{
|
||||
string label = labels.TryGetValue(reading.Series, out string? text) ? $" [{text}]" : string.Empty;
|
||||
HostConsole.Line(string.Create(CultureInfo.InvariantCulture, $" {reading.Series} = {reading.Value:0.###}{label}"));
|
||||
}
|
||||
}
|
||||
|
||||
private static string Describe(AdvancedValue value)
|
||||
{
|
||||
if (value.Number is { } number)
|
||||
{
|
||||
return number.ToString("0.####", CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
if (value.Text is { } text)
|
||||
{
|
||||
return "\"" + text + "\"";
|
||||
}
|
||||
|
||||
if (value.Tokens is { } tokens)
|
||||
{
|
||||
return "[" + string.Join(", ", tokens) + "]";
|
||||
}
|
||||
|
||||
// A table is counted, not listed: a driver profile is the user's settings, and a console scrolls into a paste.
|
||||
return value.Rows is { } rows ? $"{rows.Count} row(s)" : "?";
|
||||
}
|
||||
}
|
||||
@@ -31,4 +31,11 @@ internal enum Verb
|
||||
/// Injects nothing, needs no consent record, and takes no <c>--exe</c>.
|
||||
/// </summary>
|
||||
ProbeLhm,
|
||||
|
||||
/// <summary>
|
||||
/// The instrument of §M12 and §M13 (owner decision D101): run the reader "Advanced metrics" uses for a few ticks
|
||||
/// on this process's own rights and print what it read and what reading it cost. Injects nothing, needs no
|
||||
/// consent record, and takes no <c>--exe</c>.
|
||||
/// </summary>
|
||||
ProbeAdvanced,
|
||||
}
|
||||
@@ -12,6 +12,8 @@ public sealed class DeflateSeriesCodec : ISeriesCodec
|
||||
|
||||
public byte[] EncodeFloat32(ReadOnlySpan<float> values) => SeriesCodec.EncodeFloat32(values.ToArray());
|
||||
|
||||
public byte[] EncodeSparseFloat32(ReadOnlySpan<float> values) => SeriesCodec.EncodeSparseFloat32(values.ToArray());
|
||||
|
||||
public byte[] EncodeUInt16(ReadOnlySpan<ushort> values) => SeriesCodec.EncodeUInt16(values.ToArray());
|
||||
|
||||
public byte[] EncodeUInt32(ReadOnlySpan<uint> values) => SeriesCodec.EncodeUInt32(values.ToArray());
|
||||
|
||||
@@ -38,6 +38,30 @@ public static class SeriesCodec
|
||||
return Deflate(raw);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A float series in which NaN means "no reading on this tick" (owner decision D102: the advanced series, whose
|
||||
/// values may be negative). The rule above is not relaxed by this — it is a second encoder, for a series that has
|
||||
/// gaps by nature, and <see cref="EncodeFloat32"/> still throws on a NaN. An infinity is refused here as there:
|
||||
/// no sensor reads one.
|
||||
/// </summary>
|
||||
public static byte[] EncodeSparseFloat32(IReadOnlyList<float> values)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(values);
|
||||
|
||||
byte[] raw = new byte[values.Count * sizeof(float)];
|
||||
for (int i = 0; i < values.Count; i++)
|
||||
{
|
||||
if (float.IsInfinity(values[i]))
|
||||
{
|
||||
throw new ArgumentException($"infinity at index {i}: a sparse series carries finite values and NaN for a gap (06_DATA_MODEL §Blob encoding)", nameof(values));
|
||||
}
|
||||
|
||||
BinaryPrimitives.WriteSingleLittleEndian(raw.AsSpan(i * sizeof(float)), values[i]);
|
||||
}
|
||||
|
||||
return Deflate(raw);
|
||||
}
|
||||
|
||||
public static float[] DecodeFloat32(byte[] blob)
|
||||
{
|
||||
byte[] raw = Inflate(blob, sizeof(float));
|
||||
|
||||
@@ -127,6 +127,37 @@ public sealed class WindowGeometryProbe : IDisplayProbe
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The GDI device name of the monitor the game's main window is on (<c>\\.\DISPLAY1</c>), or null when the game has
|
||||
/// no window yet. Advanced metrics (owner decision D101) asks the driver about that display; the name is the
|
||||
/// monitor's place in Windows' list — not an identity of the monitor, and never stored.
|
||||
/// </summary>
|
||||
public static unsafe string? MonitorDeviceOf(IReadOnlyCollection<int> pids)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(pids);
|
||||
if (pids.Count == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
HWND window = Largest(pids);
|
||||
if (window.IsNull)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
string device = info.szDevice.ToString();
|
||||
return device.Length == 0 ? null : device;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
-- 0023 (2026-11-11, owner decisions D101 and D102): what "Advanced metrics" stores.
|
||||
--
|
||||
-- Two tables of their own and no column on `sessions`: every read of a sessions row, the JSON export and the bug bundle
|
||||
-- carry the whole row, and a driver profile does not belong in a bug bundle. The first CREATE TABLE since 0001.
|
||||
--
|
||||
-- machine_profiles - the facts of the PC (the card's firmware and architecture, the driver's package, what a display
|
||||
-- can do, the driver's global profile), ONE ROW PER DISTINCT SET: `hash` is the SHA-256 of
|
||||
-- `facts_json`. Beside hardware_snapshots, not in it: that table's hash feeds the trend's
|
||||
-- hardware-change markers, and a set of facts that exists only while an option is on would raise a
|
||||
-- marker each time the option is switched.
|
||||
-- session_advanced - one row per session recorded with the option ON: its own facts and the state of each source
|
||||
-- (facts_json), the statistics of its advanced series (stats_json), what each series that is one of
|
||||
-- a family is (series_json), and the machine profile that was true when it ran. A session recorded
|
||||
-- with the option off has NO row - that absence is how the App says "the option was off when this
|
||||
-- was recorded" rather than "nothing answered". The series themselves are rows of sensor_blobs
|
||||
-- under names that start with `adv.`, with NaN for a tick that has no reading.
|
||||
--
|
||||
-- No identifier is in either (D104): no serial number, no unique id, no EDID, no other program's process id.
|
||||
-- Written by the Agent only (06_DATA_MODEL section Writer ownership). A session deleted takes its row with it; a
|
||||
-- machine profile no session points to any more is left, as a hardware snapshot is.
|
||||
|
||||
CREATE TABLE machine_profiles (
|
||||
id INTEGER PRIMARY KEY,
|
||||
hash TEXT NOT NULL UNIQUE, -- sha256 of facts_json, lower-case hex
|
||||
facts_json TEXT NOT NULL, -- Application.Advanced.AdvancedJson: a list of facts
|
||||
captured_at INTEGER NOT NULL -- unix ms: the start of the first session that had this set
|
||||
);
|
||||
|
||||
CREATE TABLE session_advanced (
|
||||
session_id INTEGER PRIMARY KEY REFERENCES sessions(id) ON DELETE CASCADE,
|
||||
machine_profile_id INTEGER REFERENCES machine_profiles(id), -- NULL: no source had a fact of the PC
|
||||
facts_json TEXT NOT NULL, -- the session's facts and each source's state
|
||||
stats_json TEXT, -- per advanced series: n, mean, median, min, max; NULL: it stored none
|
||||
series_json TEXT NOT NULL -- the directory of its family members, and how many series were left out
|
||||
);
|
||||
|
||||
CREATE INDEX ix_session_advanced_profile ON session_advanced(machine_profile_id);
|
||||
@@ -51,7 +51,28 @@ public sealed class SqliteSessionRepository : ISessionRepository
|
||||
"SELECT swapchain_id, start_frame, end_frame, render_w, render_h, output_w, output_h, upscaler, upscaler_quality, fg_mode, "
|
||||
+ "native_fps, displayed_fps, p1_low_fps FROM session_segments WHERE session_id = @sessionId ORDER BY start_frame, swapchain_id";
|
||||
|
||||
private const string _selectSensors = "SELECT series, hz, codec, data FROM sensor_blobs WHERE session_id = @sessionId ORDER BY series";
|
||||
// The fixed series; an advanced one (schema 0023) is a row of the same table under a name that starts with 'adv.'.
|
||||
// In LIKE the dot is a literal and the only wildcard is the trailing %, so 'adv.%' is exactly that prefix.
|
||||
private const string _selectSensors =
|
||||
"SELECT series, hz, codec, data FROM sensor_blobs WHERE session_id = @sessionId AND series NOT LIKE 'adv.%' ORDER BY series";
|
||||
|
||||
private const string _selectAdvancedSensors =
|
||||
"SELECT series, hz, codec, data FROM sensor_blobs WHERE session_id = @sessionId AND (series = 't_ms' OR series LIKE 'adv.%') "
|
||||
+ "ORDER BY CASE WHEN series = 't_ms' THEN 0 ELSE 1 END, series";
|
||||
|
||||
// One row per distinct set of facts: a second session with the same set finds the first one's row.
|
||||
private const string _insertMachineProfile =
|
||||
"INSERT INTO machine_profiles (hash, facts_json, captured_at) VALUES (@hash, @facts, @at) ON CONFLICT(hash) DO NOTHING";
|
||||
|
||||
private const string _selectMachineProfile = "SELECT id FROM machine_profiles WHERE hash = @hash";
|
||||
|
||||
private const string _insertAdvanced =
|
||||
"INSERT INTO session_advanced (session_id, machine_profile_id, facts_json, stats_json, series_json) "
|
||||
+ "VALUES (@id, @profileId, @facts, @stats, @series)";
|
||||
|
||||
private const string _selectAdvanced =
|
||||
"SELECT a.facts_json, a.stats_json, a.series_json, m.hash, m.facts_json FROM session_advanced a "
|
||||
+ "LEFT JOIN machine_profiles m ON m.id = a.machine_profile_id WHERE a.session_id = @sessionId";
|
||||
|
||||
// One pass over the aggregate columns; SUM(capture_tier = 1) is SQLite's boolean-as-integer idiom.
|
||||
private const string _summarise =
|
||||
@@ -111,6 +132,11 @@ public sealed class SqliteSessionRepository : ISessionRepository
|
||||
}
|
||||
|
||||
await InsertSensorsAsync(c, tx, id, session.Sensors, token).ConfigureAwait(false);
|
||||
if (session.Advanced is AdvancedSessionRow advanced)
|
||||
{
|
||||
await InsertAdvancedAsync(c, tx, id, advanced, session.Row.StartedAt, token).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
return id;
|
||||
}, ct);
|
||||
}
|
||||
@@ -186,6 +212,23 @@ public sealed class SqliteSessionRepository : ISessionRepository
|
||||
c, new CommandDefinition(_selectSensors, new { sessionId }, cancellationToken: token),
|
||||
static r => new SensorBlob { Series = r.GetString(0), Hz = r.GetDouble(1), Codec = r.GetString(2), Data = (byte[])r.GetValue(3) }), ct);
|
||||
|
||||
public ValueTask<IReadOnlyList<SensorBlob>> FindAdvancedSensorsAsync(long sessionId, CancellationToken ct = default) =>
|
||||
_db.ReadAsync((c, token) => SqliteReaders.ReadAllAsync(
|
||||
c, new CommandDefinition(_selectAdvancedSensors, new { sessionId }, cancellationToken: token),
|
||||
static r => new SensorBlob { Series = r.GetString(0), Hz = r.GetDouble(1), Codec = r.GetString(2), Data = (byte[])r.GetValue(3) }), ct);
|
||||
|
||||
public ValueTask<AdvancedSessionRow?> FindAdvancedAsync(long sessionId, CancellationToken ct = default) =>
|
||||
_db.ReadAsync((c, token) => SqliteReaders.ReadOneAsync(
|
||||
c, new CommandDefinition(_selectAdvanced, new { sessionId }, cancellationToken: token),
|
||||
static r => new AdvancedSessionRow
|
||||
{
|
||||
FactsJson = r.GetString(0),
|
||||
StatsJson = r.IsDBNull(1) ? null : r.GetString(1),
|
||||
SeriesJson = r.GetString(2),
|
||||
MachineHash = r.IsDBNull(3) ? null : r.GetString(3),
|
||||
MachineFactsJson = r.IsDBNull(4) ? null : r.GetString(4),
|
||||
}), ct);
|
||||
|
||||
public ValueTask<IReadOnlyList<SessionRow>> ListRecentAsync(int count, CancellationToken ct = default)
|
||||
{
|
||||
ArgumentOutOfRangeException.ThrowIfNegativeOrZero(count);
|
||||
@@ -330,6 +373,23 @@ public sealed class SqliteSessionRepository : ISessionRepository
|
||||
|
||||
private static object Optional(ReadOnlyMemory<byte>? blob) => blob is { } b ? b.ToArray() : DBNull.Value;
|
||||
|
||||
/// <summary>
|
||||
/// The session's row of <c>session_advanced</c>, and the machine profile it points to — found by its hash when a
|
||||
/// session before it had the same facts, inserted when none had. Inside the session's own transaction.
|
||||
/// </summary>
|
||||
private static async Task InsertAdvancedAsync(SqliteConnection c, SqliteTransaction tx, long id, AdvancedSessionRow advanced, DateTimeOffset startedAt, CancellationToken ct)
|
||||
{
|
||||
long? profileId = null;
|
||||
if (advanced is { MachineHash: { } hash, MachineFactsJson: { } facts })
|
||||
{
|
||||
await c.ExecuteAsync(new CommandDefinition(_insertMachineProfile, new { hash, facts, at = startedAt.ToUnixTimeMilliseconds() }, tx, cancellationToken: ct)).ConfigureAwait(false);
|
||||
profileId = await c.ExecuteScalarAsync<long>(new CommandDefinition(_selectMachineProfile, new { hash }, tx, cancellationToken: ct)).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
await c.ExecuteAsync(new CommandDefinition(
|
||||
_insertAdvanced, new { id, profileId, facts = advanced.FactsJson, stats = advanced.StatsJson, series = advanced.SeriesJson }, tx, cancellationToken: ct)).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private static async Task InsertSensorsAsync(SqliteConnection c, SqliteTransaction tx, long id, IReadOnlyList<SensorBlob> sensors, CancellationToken ct)
|
||||
{
|
||||
foreach (SensorBlob sensor in sensors)
|
||||
|
||||
@@ -0,0 +1,205 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using System.Buffers.Binary;
|
||||
using System.Text;
|
||||
using FrameLedger.Application.Advanced;
|
||||
using FrameLedger.Application.Telemetry;
|
||||
|
||||
namespace FrameLedger.Infrastructure.Recording;
|
||||
|
||||
/// <summary>
|
||||
/// The advanced readings of a batch of telemetry samples as bytes, for the <c>.partial</c> (chunk type
|
||||
/// <c>SensorsAdvanced</c>, owner decision D101): the names the batch uses, once, then per sample its QPC and its
|
||||
/// readings as (name index, value).
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// <b>Beside the wide sensor chunk, not instead of it.</b> The samples of a batch are written as they always were
|
||||
/// (<see cref="SensorSampleCodec"/>), byte for byte; this chunk follows it and carries only what is new, keyed by the
|
||||
/// QPC each sample already has. A session recorded with the option off never writes one.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// <b>Each chunk stands alone</b>: its names are in it. A reader needs nothing from an earlier chunk to read it, so a
|
||||
/// file cut anywhere still reads up to its last whole chunk — the property the whole format is built on.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Layout, little-endian: <c>u16 names</c>, then per name <c>u16 bytes</c> and its UTF-8; <c>u32 samples</c>, then per
|
||||
/// sample <c>i64 qpc</c>, <c>u16 readings</c> and per reading <c>u16 name</c>, <c>f64 value</c>.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
internal static class AdvancedSampleCodec
|
||||
{
|
||||
/// <summary>A name longer than this is not a series name this project writes; a chunk claiming one is refused.</summary>
|
||||
private const int _maxNameBytes = 256;
|
||||
|
||||
private const int _readingBytes = 2 + 8;
|
||||
private const int _sampleHeaderBytes = 8 + 2;
|
||||
|
||||
/// <summary>The chunk for the samples of <paramref name="samples"/> that carry advanced readings, or null when none does.</summary>
|
||||
public static byte[]? Write(ReadOnlySpan<TelemetrySample> samples)
|
||||
{
|
||||
var names = new List<string>();
|
||||
var indexOf = new Dictionary<string, ushort>(StringComparer.Ordinal);
|
||||
int carrying = 0;
|
||||
int bytes = 2 + 4;
|
||||
foreach (ref readonly TelemetrySample sample in samples)
|
||||
{
|
||||
if (sample.Advanced is not { Count: > 0 } readings)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
carrying++;
|
||||
bytes += _sampleHeaderBytes;
|
||||
foreach (AdvancedReading reading in readings)
|
||||
{
|
||||
if (!Writable(reading.Series) || (!indexOf.ContainsKey(reading.Series) && names.Count >= ushort.MaxValue))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (indexOf.TryAdd(reading.Series, (ushort)names.Count))
|
||||
{
|
||||
names.Add(reading.Series);
|
||||
bytes += 2 + Encoding.UTF8.GetByteCount(reading.Series);
|
||||
}
|
||||
|
||||
bytes += _readingBytes;
|
||||
}
|
||||
}
|
||||
|
||||
return carrying == 0 ? null : Fill(new byte[bytes], samples, names, indexOf, carrying);
|
||||
}
|
||||
|
||||
/// <summary>The readings of each sample in a chunk, by the sample's QPC; false when the chunk is not well formed.</summary>
|
||||
public static bool TryRead(ReadOnlySpan<byte> payload, List<(long Qpc, IReadOnlyList<AdvancedReading> Readings)> into)
|
||||
{
|
||||
int at = 0;
|
||||
if (!TryReadNames(payload, ref at, out string[] names) || payload.Length - at < 4)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uint samples = BinaryPrimitives.ReadUInt32LittleEndian(payload[at..]);
|
||||
at += 4;
|
||||
var read = new List<(long, IReadOnlyList<AdvancedReading>)>();
|
||||
for (uint s = 0; s < samples; s++)
|
||||
{
|
||||
if (payload.Length - at < _sampleHeaderBytes)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
long qpc = BinaryPrimitives.ReadInt64LittleEndian(payload[at..]);
|
||||
int count = BinaryPrimitives.ReadUInt16LittleEndian(payload[(at + 8)..]);
|
||||
at += _sampleHeaderBytes;
|
||||
if (payload.Length - at < count * _readingBytes)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var readings = new AdvancedReading[count];
|
||||
for (int r = 0; r < count; r++)
|
||||
{
|
||||
int index = BinaryPrimitives.ReadUInt16LittleEndian(payload[at..]);
|
||||
if (index >= names.Length)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
readings[r] = new AdvancedReading(names[index], BinaryPrimitives.ReadDoubleLittleEndian(payload[(at + 2)..]));
|
||||
at += _readingBytes;
|
||||
}
|
||||
|
||||
read.Add((qpc, readings));
|
||||
}
|
||||
|
||||
if (at != payload.Length)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
into.AddRange(read);
|
||||
return true;
|
||||
}
|
||||
|
||||
private static bool Writable(string? series) => series is not null && Encoding.UTF8.GetByteCount(series) is > 0 and <= _maxNameBytes;
|
||||
|
||||
private static byte[] Fill(byte[] payload, ReadOnlySpan<TelemetrySample> samples, List<string> names, Dictionary<string, ushort> indexOf, int carrying)
|
||||
{
|
||||
int at = 0;
|
||||
BinaryPrimitives.WriteUInt16LittleEndian(payload.AsSpan(at), (ushort)names.Count);
|
||||
at += 2;
|
||||
foreach (string name in names)
|
||||
{
|
||||
int length = Encoding.UTF8.GetBytes(name, payload.AsSpan(at + 2));
|
||||
BinaryPrimitives.WriteUInt16LittleEndian(payload.AsSpan(at), (ushort)length);
|
||||
at += 2 + length;
|
||||
}
|
||||
|
||||
BinaryPrimitives.WriteUInt32LittleEndian(payload.AsSpan(at), (uint)carrying);
|
||||
at += 4;
|
||||
foreach (ref readonly TelemetrySample sample in samples)
|
||||
{
|
||||
if (sample.Advanced is not { Count: > 0 } readings)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
BinaryPrimitives.WriteInt64LittleEndian(payload.AsSpan(at), sample.QpcTicks);
|
||||
int countAt = at + 8;
|
||||
at += _sampleHeaderBytes;
|
||||
ushort count = 0;
|
||||
foreach (AdvancedReading reading in readings)
|
||||
{
|
||||
if (reading.Series is null || !indexOf.TryGetValue(reading.Series, out ushort index))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
BinaryPrimitives.WriteUInt16LittleEndian(payload.AsSpan(at), index);
|
||||
BinaryPrimitives.WriteDoubleLittleEndian(payload.AsSpan(at + 2), reading.Value);
|
||||
at += _readingBytes;
|
||||
count++;
|
||||
}
|
||||
|
||||
BinaryPrimitives.WriteUInt16LittleEndian(payload.AsSpan(countAt), count);
|
||||
}
|
||||
|
||||
return at == payload.Length ? payload : payload[..at];
|
||||
}
|
||||
|
||||
private static bool TryReadNames(ReadOnlySpan<byte> payload, ref int at, out string[] names)
|
||||
{
|
||||
names = [];
|
||||
if (payload.Length - at < 2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int count = BinaryPrimitives.ReadUInt16LittleEndian(payload[at..]);
|
||||
at += 2;
|
||||
string[] read = new string[count];
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
if (payload.Length - at < 2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int length = BinaryPrimitives.ReadUInt16LittleEndian(payload[at..]);
|
||||
at += 2;
|
||||
if (length is 0 or > _maxNameBytes || payload.Length - at < length)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
read[i] = Encoding.UTF8.GetString(payload.Slice(at, length));
|
||||
at += length;
|
||||
}
|
||||
|
||||
names = read;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -35,4 +35,18 @@ internal enum PartialChunkType
|
||||
/// read, so a beta.11 <c>.partial</c> recovers (without game memory, which it never had).
|
||||
/// </summary>
|
||||
SensorsWide = 8,
|
||||
|
||||
/// <summary>
|
||||
/// The advanced readings of the samples of the <see cref="SensorsWide"/> chunk before it (owner decision D101):
|
||||
/// <c>AdvancedSampleCodec</c> — the names used, then per sample its QPC and its (name, value) pairs. Written only
|
||||
/// when a sample of the batch carries any, so a session recorded with the option off has none.
|
||||
/// </summary>
|
||||
SensorsAdvanced = 9,
|
||||
|
||||
/// <summary>
|
||||
/// UTF-8 JSON of the session's advanced context — the PC's facts, its own, its series' directory, each source's
|
||||
/// state (<c>Application.Advanced.AdvancedJson.OfContext</c>) — so a session that is recovered keeps them. The
|
||||
/// last one wins.
|
||||
/// </summary>
|
||||
AdvancedContext = 10,
|
||||
}
|
||||
@@ -5,6 +5,7 @@ using System.Buffers.Binary;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using FrameLedger.Application.Advanced;
|
||||
using FrameLedger.Application.Recording;
|
||||
using FrameLedger.Application.Telemetry;
|
||||
using FrameLedger.Shared;
|
||||
@@ -145,6 +146,7 @@ public static class PartialSessionFile
|
||||
private readonly List<long> _touches = [];
|
||||
private readonly List<PartialNote> _notes = [];
|
||||
private PartialTick? _tick;
|
||||
private string? _advancedContext;
|
||||
|
||||
public bool Apply(PartialChunkType type, ReadOnlySpan<byte> payload)
|
||||
{
|
||||
@@ -162,7 +164,15 @@ public static class PartialSessionFile
|
||||
PartialChunkType.Tick => Tick(payload),
|
||||
PartialChunkType.Note => Note(payload),
|
||||
PartialChunkType.Touches => Int64s(payload, _touches),
|
||||
_ => false,
|
||||
PartialChunkType.SensorsAdvanced => AdvancedSensors(payload),
|
||||
PartialChunkType.AdvancedContext => AdvancedContext(payload),
|
||||
|
||||
// A type this build does not know, in a chunk whose length and checksum are right (TryReadChunk has
|
||||
// verified both): a newer build wrote it, and it is passed over (owner decision D106, 2026-11-11).
|
||||
// Until then it ended the read, so a build one release older lost everything after the first new
|
||||
// chunk - where a chunk it does know and cannot read still ends it, because that is a torn or a
|
||||
// wrong file, not a newer one.
|
||||
_ => true,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -172,6 +182,7 @@ public static class PartialSessionFile
|
||||
Records = _records,
|
||||
GapBefore = _gaps,
|
||||
Sensors = _sensors,
|
||||
AdvancedContextJson = _advancedContext,
|
||||
TouchQpc = _touches,
|
||||
Notes = _notes,
|
||||
LastTick = _tick,
|
||||
@@ -263,6 +274,40 @@ public static class PartialSessionFile
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The advanced readings of samples already read: each is attached to the sample with its QPC — the last one
|
||||
/// that has none yet, since the chunk follows the sensor chunk of the same flush. A reading whose sample is not
|
||||
/// there is left out; it has no tick to belong to.
|
||||
/// </summary>
|
||||
private bool AdvancedSensors(ReadOnlySpan<byte> payload)
|
||||
{
|
||||
var read = new List<(long Qpc, IReadOnlyList<AdvancedReading> Readings)>();
|
||||
if (!AdvancedSampleCodec.TryRead(payload, read))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ((long qpc, IReadOnlyList<AdvancedReading> readings) in read)
|
||||
{
|
||||
for (int i = _sensors.Count - 1; i >= 0; i--)
|
||||
{
|
||||
if (_sensors[i].QpcTicks == qpc && _sensors[i].Advanced is null)
|
||||
{
|
||||
_sensors[i] = _sensors[i] with { Advanced = readings };
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool AdvancedContext(ReadOnlySpan<byte> payload)
|
||||
{
|
||||
_advancedContext = Encoding.UTF8.GetString(payload);
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool Tick(ReadOnlySpan<byte> payload)
|
||||
{
|
||||
int stateBytes = Marshal.SizeOf<FlWriterState>();
|
||||
@@ -353,6 +398,19 @@ public static class PartialSessionFile
|
||||
}
|
||||
|
||||
Append(PartialChunkType.SensorsWide, payload);
|
||||
|
||||
// The advanced readings of the same samples, in a chunk of their own after it - and only when there are
|
||||
// any, so with the option off the file is byte for byte what it was (D101).
|
||||
if (AdvancedSampleCodec.Write(samples) is byte[] advanced)
|
||||
{
|
||||
Append(PartialChunkType.SensorsAdvanced, advanced);
|
||||
}
|
||||
}
|
||||
|
||||
public void AppendAdvancedContext(string json)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(json);
|
||||
Append(PartialChunkType.AdvancedContext, Encoding.UTF8.GetBytes(json));
|
||||
}
|
||||
|
||||
public void AppendTick(PartialTick tick)
|
||||
|
||||
@@ -0,0 +1,256 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using System.Diagnostics;
|
||||
using FrameLedger.Application.Advanced;
|
||||
|
||||
namespace FrameLedger.Infrastructure.Telemetry;
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="IAdvancedHardware"/>: one <see cref="IAdvancedHardwareReader"/> on a thread of its own, running while
|
||||
/// somebody holds it and for a short while after (owner decision D107).
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// <b>The thread exists only while it is needed.</b> The first <see cref="Acquire"/> starts it; it opens the sources,
|
||||
/// reads a tick every interval and publishes it by swapping one reference; when the last holder has let go for longer
|
||||
/// than the linger it closes the sources and ends. The linger is there so that a session ending while the page is
|
||||
/// being opened, or two sessions one after the other, do not close and reopen a sensor chip.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// <b>Nobody waits on it.</b> <see cref="Latest"/> is a read of that reference. A sensor that hangs holds this thread
|
||||
/// and nothing else: the holders go on seeing the last snapshot, whose <see cref="AdvancedSnapshot.TakenAt"/> says how
|
||||
/// old it is.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// <b>A tick that throws twice ends the run</b> — the reader's own guards make that a defect in the reader rather than
|
||||
/// a sensor's fault, and a loop that throws every second is worse than no readings.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public sealed class AdvancedHardwareHub : IAdvancedHardware, IDisposable
|
||||
{
|
||||
/// <summary>Ticks that may throw before the run ends.</summary>
|
||||
public const int MaxTickFaults = 2;
|
||||
|
||||
private readonly Lock _gate = new();
|
||||
private readonly Func<IAdvancedHardwareReader> _readerFactory;
|
||||
private readonly TimeSpan _interval;
|
||||
private readonly TimeSpan _linger;
|
||||
private readonly Action<string> _note;
|
||||
private readonly ManualResetEventSlim _wake = new(initialState: false);
|
||||
|
||||
private Thread? _thread;
|
||||
private IAdvancedHardwareReader? _reader;
|
||||
private volatile AdvancedSnapshot? _latest;
|
||||
private int _holders;
|
||||
private long _idleSince;
|
||||
private bool _disposed;
|
||||
|
||||
/// <summary>A hub that reads nothing until it is held.</summary>
|
||||
/// <param name="readerFactory">Makes the reader a run uses; called on the hub's thread, once per run.</param>
|
||||
/// <param name="interval">Between two ticks.</param>
|
||||
/// <param name="linger">How long the run goes on after the last holder let go.</param>
|
||||
/// <param name="note">Told, in one line, when a run ends because its ticks threw — the Agent's log.</param>
|
||||
public AdvancedHardwareHub(Func<IAdvancedHardwareReader> readerFactory, TimeSpan interval, TimeSpan linger, Action<string>? note = null)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(readerFactory);
|
||||
ArgumentOutOfRangeException.ThrowIfLessThanOrEqual(interval, TimeSpan.Zero);
|
||||
ArgumentOutOfRangeException.ThrowIfLessThan(linger, TimeSpan.Zero);
|
||||
_readerFactory = readerFactory;
|
||||
_interval = interval;
|
||||
_linger = linger;
|
||||
_note = note ?? (static _ => { });
|
||||
}
|
||||
|
||||
public AdvancedSnapshot? Latest => _latest;
|
||||
|
||||
/// <summary>How many hold the reader now.</summary>
|
||||
public int Holders
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (_gate)
|
||||
{
|
||||
return _holders;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Whether a run is in progress.</summary>
|
||||
public bool IsRunning
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (_gate)
|
||||
{
|
||||
return _thread is not null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public IDisposable Acquire()
|
||||
{
|
||||
lock (_gate)
|
||||
{
|
||||
ObjectDisposedException.ThrowIf(_disposed, this);
|
||||
_holders++;
|
||||
if (_thread is null)
|
||||
{
|
||||
_thread = new Thread(Run) { IsBackground = true, Name = "fl-advanced" };
|
||||
_thread.Start();
|
||||
}
|
||||
}
|
||||
|
||||
return new Hold(this);
|
||||
}
|
||||
|
||||
public IReadOnlyList<AdvancedFact> ReadSessionFacts(AdvancedSessionTarget target)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(target);
|
||||
IAdvancedHardwareReader? reader;
|
||||
lock (_gate)
|
||||
{
|
||||
reader = _reader;
|
||||
}
|
||||
|
||||
// Outside the lock: the read can take some hundred milliseconds, and a run that ends meanwhile disposes the
|
||||
// reader, whose own guard then answers with nothing.
|
||||
return reader?.ReadSessionFacts(target) ?? [];
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Thread? thread;
|
||||
lock (_gate)
|
||||
{
|
||||
if (_disposed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_disposed = true;
|
||||
thread = _thread;
|
||||
}
|
||||
|
||||
_wake.Set();
|
||||
if (thread is not null && thread != Thread.CurrentThread)
|
||||
{
|
||||
thread.Join(TimeSpan.FromSeconds(5));
|
||||
}
|
||||
|
||||
_wake.Dispose();
|
||||
}
|
||||
|
||||
private void Release()
|
||||
{
|
||||
lock (_gate)
|
||||
{
|
||||
if (_holders > 0 && --_holders == 0)
|
||||
{
|
||||
_idleSince = Stopwatch.GetTimestamp();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Run()
|
||||
{
|
||||
IAdvancedHardwareReader? reader = null;
|
||||
try
|
||||
{
|
||||
reader = _readerFactory();
|
||||
reader.Open();
|
||||
lock (_gate)
|
||||
{
|
||||
_reader = reader;
|
||||
}
|
||||
|
||||
int faults = 0;
|
||||
while (!Finished())
|
||||
{
|
||||
try
|
||||
{
|
||||
_latest = reader.Tick();
|
||||
faults = 0;
|
||||
}
|
||||
catch (Exception e) when (e is not OperationCanceledException)
|
||||
{
|
||||
if (++faults >= MaxTickFaults)
|
||||
{
|
||||
_note($"advanced: the reader's tick threw {MaxTickFaults} times running and the run ends ({e.GetType().Name}: {e.Message})");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Wait();
|
||||
}
|
||||
}
|
||||
catch (Exception e) when (e is not OperationCanceledException)
|
||||
{
|
||||
_note($"advanced: the reader did not start ({e.GetType().Name}: {e.Message})");
|
||||
}
|
||||
finally
|
||||
{
|
||||
lock (_gate)
|
||||
{
|
||||
if (ReferenceEquals(_thread, Thread.CurrentThread))
|
||||
{
|
||||
_thread = null;
|
||||
_reader = null;
|
||||
_latest = null;
|
||||
}
|
||||
}
|
||||
|
||||
reader?.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// True when the run is over: the hub is disposed, or nobody has held it for the linger. Decided under the lock,
|
||||
/// and the thread's slot is cleared in the same step, so an <see cref="Acquire"/> that arrives a moment later
|
||||
/// starts a run of its own rather than joining one that is closing.
|
||||
/// </summary>
|
||||
private bool Finished()
|
||||
{
|
||||
lock (_gate)
|
||||
{
|
||||
if (!_disposed && (_holders > 0 || Stopwatch.GetElapsedTime(_idleSince) < _linger))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ReferenceEquals(_thread, Thread.CurrentThread))
|
||||
{
|
||||
_thread = null;
|
||||
_reader = null;
|
||||
_latest = null;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private void Wait()
|
||||
{
|
||||
try
|
||||
{
|
||||
_wake.Wait(_interval);
|
||||
}
|
||||
catch (ObjectDisposedException)
|
||||
{
|
||||
// Dispose gave up waiting for this thread and released the event: the next Finished() ends the run.
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class Hold(AdvancedHardwareHub hub) : IDisposable
|
||||
{
|
||||
private int _released;
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (Interlocked.Exchange(ref _released, 1) == 0)
|
||||
{
|
||||
hub.Release();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,333 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using FrameLedger.Application.Advanced;
|
||||
|
||||
namespace FrameLedger.Infrastructure.Telemetry;
|
||||
|
||||
/// <summary>
|
||||
/// One tick of "Advanced metrics" (owner decision D101): NVAPI's readings and LibreHardwareMonitor's, the PC's facts
|
||||
/// and the state of each source, as one <see cref="AdvancedSnapshot"/>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// <b>A source that is not there is a state, never an exception.</b> No NVIDIA driver, an Agent that is not
|
||||
/// administrator, PawnIO not installed: <see cref="AdvancedSources"/> says which, and the entries of that source read
|
||||
/// N/A with that reason. Nothing is estimated in their place (FR-4.9).
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// <b>A source that fails twice is off</b> until the reader is opened again (<c>18_GPU_VENDOR_APIS</c> §Runtime
|
||||
/// policy). One case is given a single second chance first, by the outcome written down before it was built
|
||||
/// (<c>20_OPEN_QUESTIONS</c> §M12): NVAPI answering with no field at all, two ticks running, after it had answered —
|
||||
/// the shape a handle the driver invalidated has. The bridge is then released and initialised again, once.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// <b>NVAPI every tick, the sensor library every fifth.</b> Measured on the dev box before anything composed this
|
||||
/// (2026-11-11, <c>probe-advanced</c>, RTX 5080, unelevated): one NVAPI live read costs 0.4 ms of processor time; one
|
||||
/// refresh of LibreHardwareMonitor's graphics-card group costs 14 ms — 62 ms elapsed — which at one a second is 1.4%
|
||||
/// of one core, above what NFR-2 allows the whole Agent. So the sensors are refreshed on every
|
||||
/// <see cref="SensorsEveryTicks"/>th tick, 0.28%, by the outcome written down before the measurement
|
||||
/// (<c>20_OPEN_QUESTIONS</c> §M13). On the ticks between, a sensor has NO reading: its last value is not repeated,
|
||||
/// because a value that was not read on a tick is not that tick's value. The series directory stays, so a reader of
|
||||
/// the snapshot always knows what each series is.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// <b>The PC's facts are read when the reader opens</b> and not again: they are facts. A display plugged in while the
|
||||
/// page stays open is seen the next time the reader opens — some seconds after the page is left and entered again.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public sealed class AdvancedHardwareReader : IAdvancedHardwareReader
|
||||
{
|
||||
/// <summary>Faults, or empty ticks in a row, after which a source is given up.</summary>
|
||||
public const int MaxFaults = 2;
|
||||
|
||||
/// <summary>The sensor library is refreshed on the first tick and every this-many-th after it.</summary>
|
||||
public const int SensorsEveryTicks = 5;
|
||||
|
||||
private readonly Lock _gate = new();
|
||||
private readonly Func<NvapiAdvancedReader> _nvapiFactory;
|
||||
private readonly Func<LhmGroups, LhmAdvancedReader> _lhmFactory;
|
||||
private readonly bool _elevated;
|
||||
private readonly bool? _pawnIoInstalled;
|
||||
private readonly TimeProvider _time;
|
||||
private readonly Action<string> _note;
|
||||
private readonly Func<uint, string?>? _monitorOf;
|
||||
|
||||
private NvapiAdvancedReader? _nvapi;
|
||||
private LhmAdvancedReader? _lhm;
|
||||
private IReadOnlyList<AdvancedFact> _facts = [];
|
||||
private IReadOnlyList<AdvancedSeriesInfo> _series = [];
|
||||
private long _tick;
|
||||
private AdvancedSources _sources = AdvancedSources.Unknown;
|
||||
private int _nvapiFaults;
|
||||
private int _nvapiEmptyTicks;
|
||||
private bool _nvapiEverRead;
|
||||
private bool _nvapiReinitialised;
|
||||
private bool _opened;
|
||||
private bool _disposed;
|
||||
|
||||
/// <summary>A reader over the two sources it is given the makers of. Nothing is opened until <see cref="Open"/>.</summary>
|
||||
/// <param name="nvapi">Makes NVAPI's reader; called at <see cref="Open"/> and once more if the bridge is initialised again.</param>
|
||||
/// <param name="lhm">Makes LibreHardwareMonitor's reader over the groups it is given.</param>
|
||||
/// <param name="elevated">Whether the Agent runs as administrator.</param>
|
||||
/// <param name="pawnIoInstalled">Whether PawnIO is installed; null when that could not be told, which is not a yes.</param>
|
||||
/// <param name="time">The clock a snapshot is stamped with.</param>
|
||||
/// <param name="note">Told, in one line, when a source is given up or initialised again — the Agent's log.</param>
|
||||
/// <param name="monitorOf">Finds the GDI device name of the monitor a process's window is on, for a session that did not name one; null finds none.</param>
|
||||
public AdvancedHardwareReader(
|
||||
Func<NvapiAdvancedReader> nvapi,
|
||||
Func<LhmGroups, LhmAdvancedReader> lhm,
|
||||
bool elevated,
|
||||
bool? pawnIoInstalled,
|
||||
TimeProvider time,
|
||||
Action<string>? note = null,
|
||||
Func<uint, string?>? monitorOf = null)
|
||||
{
|
||||
_monitorOf = monitorOf;
|
||||
ArgumentNullException.ThrowIfNull(nvapi);
|
||||
ArgumentNullException.ThrowIfNull(lhm);
|
||||
ArgumentNullException.ThrowIfNull(time);
|
||||
_nvapiFactory = nvapi;
|
||||
_lhmFactory = lhm;
|
||||
_elevated = elevated;
|
||||
_pawnIoInstalled = pawnIoInstalled;
|
||||
_time = time;
|
||||
_note = note ?? (static _ => { });
|
||||
}
|
||||
|
||||
/// <summary>The real sources, on this process's own rights.</summary>
|
||||
public static AdvancedHardwareReader OverThisPc(TimeProvider time, Action<string>? note = null)
|
||||
=> new(
|
||||
NvapiAdvancedReader.OverTheNativeBridge,
|
||||
static groups => new LhmAdvancedReader(new LhmComputerAdapter(groups)),
|
||||
LhmEnvironment.IsElevated,
|
||||
LhmEnvironment.IsPawnIoInstalled,
|
||||
time,
|
||||
note,
|
||||
static pid => Display.WindowGeometryProbe.MonitorDeviceOf([(int)pid]));
|
||||
|
||||
public void Open()
|
||||
{
|
||||
lock (_gate)
|
||||
{
|
||||
ObjectDisposedException.ThrowIf(_disposed, this);
|
||||
if (_opened)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_opened = true;
|
||||
(AdvancedSourceStatus nvapi, int? code) = OpenNvapi();
|
||||
LhmGroups groups = LhmAdvancedReader.GroupsFor(_elevated, _pawnIoInstalled);
|
||||
(AdvancedSourceStatus sensors, AdvancedSourceStatus elevatedSensors) = OpenLhm(groups);
|
||||
_sources = new AdvancedSources(nvapi, code, sensors, elevatedSensors);
|
||||
_facts = ReadMachineFacts();
|
||||
}
|
||||
}
|
||||
|
||||
public AdvancedSnapshot Tick()
|
||||
{
|
||||
lock (_gate)
|
||||
{
|
||||
var readings = new List<AdvancedReading>();
|
||||
if (_opened && !_disposed)
|
||||
{
|
||||
readings.AddRange(TickNvapi());
|
||||
if (_tick++ % SensorsEveryTicks == 0)
|
||||
{
|
||||
(IReadOnlyList<AdvancedReading> sensorReadings, _series) = TickLhm();
|
||||
readings.AddRange(sensorReadings);
|
||||
}
|
||||
}
|
||||
|
||||
return new AdvancedSnapshot(_time.GetUtcNow(), readings, _facts, _series, _sources);
|
||||
}
|
||||
}
|
||||
|
||||
public IReadOnlyList<AdvancedFact> ReadSessionFacts(AdvancedSessionTarget target)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(target);
|
||||
lock (_gate)
|
||||
{
|
||||
if (_disposed || _nvapi is null || _sources.Nvapi != AdvancedSourceStatus.Reading)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// A session that names no monitor is asked about the one its window is on now - found from outside
|
||||
// the game, by a user32 question about a top-level window (WindowGeometryProbe).
|
||||
string? device = target.GdiDeviceName ?? _monitorOf?.Invoke(target.ProcessId);
|
||||
return _nvapi.ReadSessionFacts(device, target.ProcessId, target.ExecutablePath);
|
||||
}
|
||||
catch (Exception e) when (e is not OperationCanceledException)
|
||||
{
|
||||
NvapiFault($"session facts: {e.GetType().Name}: {e.Message}");
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
lock (_gate)
|
||||
{
|
||||
if (_disposed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_disposed = true;
|
||||
_nvapi?.Dispose();
|
||||
_nvapi = null;
|
||||
_lhm?.Dispose();
|
||||
_lhm = null;
|
||||
}
|
||||
}
|
||||
|
||||
private (AdvancedSourceStatus Status, int? Code) OpenNvapi()
|
||||
{
|
||||
try
|
||||
{
|
||||
_nvapi = _nvapiFactory();
|
||||
return _nvapi.Start() ? (AdvancedSourceStatus.Reading, null) : (AdvancedSourceStatus.NotPresent, _nvapi.InitStatus);
|
||||
}
|
||||
catch (Exception e) when (e is not OperationCanceledException)
|
||||
{
|
||||
_note($"advanced: NVAPI did not open ({e.GetType().Name}: {e.Message})");
|
||||
return (AdvancedSourceStatus.Faulted, null);
|
||||
}
|
||||
}
|
||||
|
||||
private (AdvancedSourceStatus Sensors, AdvancedSourceStatus Elevated) OpenLhm(LhmGroups groups)
|
||||
{
|
||||
AdvancedSourceStatus whyNotElevated = !_elevated ? AdvancedSourceStatus.NotElevated : AdvancedSourceStatus.PawnIoMissing;
|
||||
bool wantsElevated = groups.HasFlag(LhmGroups.Cpu);
|
||||
try
|
||||
{
|
||||
_lhm = _lhmFactory(groups);
|
||||
if (_lhm.Open())
|
||||
{
|
||||
return (AdvancedSourceStatus.Reading, wantsElevated ? AdvancedSourceStatus.Reading : whyNotElevated);
|
||||
}
|
||||
|
||||
_note($"advanced: the sensor library did not open ({_lhm.LastFault})");
|
||||
}
|
||||
catch (Exception e) when (e is not OperationCanceledException)
|
||||
{
|
||||
_note($"advanced: the sensor library did not open ({e.GetType().Name}: {e.Message})");
|
||||
}
|
||||
|
||||
return (AdvancedSourceStatus.Faulted, wantsElevated ? AdvancedSourceStatus.Faulted : whyNotElevated);
|
||||
}
|
||||
|
||||
private List<AdvancedFact> ReadMachineFacts()
|
||||
{
|
||||
var facts = new List<AdvancedFact>();
|
||||
if (_nvapi is not null && _sources.Nvapi == AdvancedSourceStatus.Reading)
|
||||
{
|
||||
try
|
||||
{
|
||||
facts.AddRange(_nvapi.ReadMachineFacts());
|
||||
}
|
||||
catch (Exception e) when (e is not OperationCanceledException)
|
||||
{
|
||||
NvapiFault($"facts: {e.GetType().Name}: {e.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
if (_lhm is not null && _sources.Sensors == AdvancedSourceStatus.Reading)
|
||||
{
|
||||
facts.AddRange(_lhm.ReadFacts());
|
||||
}
|
||||
|
||||
return facts;
|
||||
}
|
||||
|
||||
private IReadOnlyList<AdvancedReading> TickNvapi()
|
||||
{
|
||||
if (_nvapi is null || _sources.Nvapi != AdvancedSourceStatus.Reading)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
IReadOnlyList<AdvancedReading> readings;
|
||||
try
|
||||
{
|
||||
readings = _nvapi.ReadLive();
|
||||
}
|
||||
catch (Exception e) when (e is not OperationCanceledException)
|
||||
{
|
||||
NvapiFault($"live: {e.GetType().Name}: {e.Message}");
|
||||
return [];
|
||||
}
|
||||
|
||||
if (readings.Count > 0)
|
||||
{
|
||||
_nvapiEverRead = true;
|
||||
_nvapiEmptyTicks = 0;
|
||||
return readings;
|
||||
}
|
||||
|
||||
// A card that never answers a live field is a card without those sensors, not a fault. One that answered and
|
||||
// then answers nothing, two ticks running, is the shape of a handle the driver invalidated (M12).
|
||||
if (_nvapiEverRead && ++_nvapiEmptyTicks >= MaxFaults)
|
||||
{
|
||||
_nvapiEmptyTicks = 0;
|
||||
if (_nvapiReinitialised)
|
||||
{
|
||||
GiveUpNvapi("it answered with no field again after being initialised again");
|
||||
}
|
||||
else
|
||||
{
|
||||
ReinitialiseNvapi();
|
||||
}
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
private void ReinitialiseNvapi()
|
||||
{
|
||||
_nvapiReinitialised = true;
|
||||
_note("advanced: NVAPI answered with no field twice running; releasing it and initialising it again, once");
|
||||
_nvapi?.Dispose();
|
||||
_nvapi = null;
|
||||
(AdvancedSourceStatus status, int? code) = OpenNvapi();
|
||||
_sources = _sources with { Nvapi = status, NvapiCode = code };
|
||||
}
|
||||
|
||||
private void NvapiFault(string what)
|
||||
{
|
||||
if (++_nvapiFaults >= MaxFaults)
|
||||
{
|
||||
GiveUpNvapi(what);
|
||||
}
|
||||
}
|
||||
|
||||
private void GiveUpNvapi(string why)
|
||||
{
|
||||
_note($"advanced: NVAPI is off until the reader is opened again ({why})");
|
||||
_sources = _sources with { Nvapi = AdvancedSourceStatus.Faulted, NvapiCode = null };
|
||||
_nvapi?.Dispose();
|
||||
_nvapi = null;
|
||||
}
|
||||
|
||||
private (IReadOnlyList<AdvancedReading> Readings, IReadOnlyList<AdvancedSeriesInfo> Series) TickLhm()
|
||||
{
|
||||
if (_lhm is null || _sources.Sensors != AdvancedSourceStatus.Reading)
|
||||
{
|
||||
return ([], []);
|
||||
}
|
||||
|
||||
int skippedBefore = _lhm.SkippedDevices;
|
||||
_lhm.Refresh();
|
||||
if (_lhm.SkippedDevices > skippedBefore)
|
||||
{
|
||||
_note($"advanced: a device is left alone after {LhmAdvancedReader.MaxFaults} faults ({_lhm.LastFault})");
|
||||
}
|
||||
|
||||
return _lhm.Read();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using FrameLedger.Application.Advanced;
|
||||
|
||||
namespace FrameLedger.Infrastructure.Telemetry;
|
||||
|
||||
/// <summary>
|
||||
/// What <see cref="AdvancedHardwareHub"/> runs on its thread: open the sources, read one tick, close. A seam so the
|
||||
/// hub's holding and letting go is tested without a sensor in the room; <see cref="AdvancedHardwareReader"/> is the real one.
|
||||
/// </summary>
|
||||
public interface IAdvancedHardwareReader : IDisposable
|
||||
{
|
||||
/// <summary>Opens the sources. Never throws for a source that is not there: its state says so.</summary>
|
||||
void Open();
|
||||
|
||||
/// <summary>Reads one tick of every source that is open.</summary>
|
||||
AdvancedSnapshot Tick();
|
||||
|
||||
/// <summary>The facts of one session, read now. Safe to call from another thread than <see cref="Tick"/>'s.</summary>
|
||||
IReadOnlyList<AdvancedFact> ReadSessionFacts(AdvancedSessionTarget target);
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
namespace FrameLedger.Infrastructure.Telemetry;
|
||||
|
||||
/// <summary>
|
||||
/// The bridge's ABI 3 reads (owner decision D101) as <see cref="NvapiAdvancedReader"/> sees them, so it is tested on a
|
||||
/// machine with no NVIDIA driver. A port of its own beside <see cref="INvapiBridge"/>: the telemetry layer and the NGX
|
||||
/// probe neither need these reads nor change because they exist. <see cref="NativeNvapiBridge"/> is the real one.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Every method answers a status: 0 with the struct filled, <c>FL_NV_NOT_INITIALISED</c>, <c>FL_NV_NO_GPU</c>, or
|
||||
/// <see cref="NativeNvapiBridge.Unavailable"/> when the DLL beside the Agent predates ABI 3. Every call is a read
|
||||
/// (<c>18_GPU_VENDOR_APIS</c> §Runtime policy; the gate <c>tools/nvapi-readonly-check.ps1</c>, D108).
|
||||
/// </remarks>
|
||||
public interface INvapiAdvancedBridge
|
||||
{
|
||||
/// <summary><c>FlNvReadFacts</c>: what is true of the first graphics card whatever is running.</summary>
|
||||
int ReadFacts(out NvapiFacts facts);
|
||||
|
||||
/// <summary><c>FlNvReadLive</c>: what it says now.</summary>
|
||||
int ReadLive(out NvapiLive live);
|
||||
|
||||
/// <summary><c>FlNvReadDisplays</c>: the displays connected to it and what each can do.</summary>
|
||||
int ReadDisplays(out NvapiDisplays displays);
|
||||
|
||||
/// <summary><c>FlNvSessionDisplay</c>: the display <paramref name="gdiDeviceName"/> names, and the colour space of <paramref name="pid"/> on it.</summary>
|
||||
int SessionDisplay(string gdiDeviceName, uint pid, out NvapiSessionDisplay display);
|
||||
|
||||
/// <summary>
|
||||
/// <c>FlNvProfileSettings</c>: every setting of the current global profile (<paramref name="exePath"/> null), or
|
||||
/// of the profile that names an executable — with <paramref name="ownOnly"/>, only what that profile sets itself.
|
||||
/// </summary>
|
||||
int ProfileSettings(string? exePath, bool ownOnly, out NvapiProfileList list, out IReadOnlyList<NvapiProfileEntry> entries);
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using System.Text;
|
||||
using FrameLedger.Application.Advanced;
|
||||
using LibreHardwareMonitor.Hardware;
|
||||
|
||||
namespace FrameLedger.Infrastructure.Telemetry;
|
||||
|
||||
/// <summary>
|
||||
/// Which catalog family a LibreHardwareMonitor sensor is a member of, and what its series is called
|
||||
/// (owner decision D101): the device at the top of the sensor's tree and the sensor's type decide the family, the
|
||||
/// library's identifier names the member.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <b>A sensor with no family is not read.</b> The table below is the whole of what is taken — a network adapter's
|
||||
/// throughput, a drive's anything, a type the catalog has no entry for stay where they are. That is the difference
|
||||
/// between "every sensor of the card" and "every sensor the library can find".
|
||||
/// </remarks>
|
||||
public static class LhmAdvancedMap
|
||||
{
|
||||
/// <summary>The family's id for a sensor of <paramref name="type"/> under a device of <paramref name="root"/>, or null.</summary>
|
||||
public static string? FamilyOf(HardwareType root, SensorType type) => root switch
|
||||
{
|
||||
HardwareType.GpuNvidia or HardwareType.GpuAmd or HardwareType.GpuIntel => type switch
|
||||
{
|
||||
SensorType.Temperature => "lhm.gpu.temperature",
|
||||
SensorType.Load => "lhm.gpu.load",
|
||||
SensorType.SmallData => "lhm.gpu.memory",
|
||||
SensorType.Clock => "lhm.gpu.clock",
|
||||
SensorType.Power => "lhm.gpu.power",
|
||||
SensorType.Fan => "lhm.gpu.fan",
|
||||
SensorType.Control => "lhm.gpu.fan_control",
|
||||
SensorType.Voltage => "lhm.gpu.voltage",
|
||||
SensorType.Current => "lhm.gpu.current",
|
||||
SensorType.Throughput => "lhm.gpu.throughput",
|
||||
_ => null,
|
||||
},
|
||||
HardwareType.Cpu => type switch
|
||||
{
|
||||
SensorType.Temperature => "lhm.cpu.temperature",
|
||||
SensorType.Load => "lhm.cpu.load",
|
||||
SensorType.Clock => "lhm.cpu.clock",
|
||||
SensorType.Power => "lhm.cpu.power",
|
||||
SensorType.Voltage => "lhm.cpu.voltage",
|
||||
_ => null,
|
||||
},
|
||||
HardwareType.Motherboard => type switch
|
||||
{
|
||||
SensorType.Temperature => "lhm.board.temperature",
|
||||
SensorType.Fan => "lhm.board.fan",
|
||||
SensorType.Control => "lhm.board.fan_control",
|
||||
SensorType.Voltage => "lhm.board.voltage",
|
||||
_ => null,
|
||||
},
|
||||
HardwareType.Memory => type switch
|
||||
{
|
||||
SensorType.Load => "lhm.memory.load",
|
||||
SensorType.Temperature => "lhm.memory.temperature",
|
||||
_ => null,
|
||||
},
|
||||
_ => null,
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// The instance key of a sensor: the library's identifier (<c>/lpc/nct6798d/0/voltage/3</c>) without the segment
|
||||
/// that repeats the sensor's type, in lower case, with every other character an underscore
|
||||
/// (<c>lpc_nct6798d_0_3</c>). Null when nothing usable is left.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The identifier is the library's own stable name for a sensor on a PC — a path of device kind, index and sensor
|
||||
/// index. It holds no serial number: the library builds it from positions, not from what a device reports.
|
||||
/// </remarks>
|
||||
public static string? KeyOf(string? identifier, SensorType type)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(identifier))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
string typeSegment = type.ToString();
|
||||
var key = new StringBuilder(identifier.Length);
|
||||
foreach (string segment in identifier.Split('/', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries))
|
||||
{
|
||||
if (string.Equals(segment, typeSegment, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (key.Length > 0)
|
||||
{
|
||||
key.Append('_');
|
||||
}
|
||||
|
||||
foreach (char c in segment)
|
||||
{
|
||||
char lower = char.ToLowerInvariant(c);
|
||||
key.Append(lower is (>= 'a' and <= 'z') or (>= '0' and <= '9') ? lower : '_');
|
||||
}
|
||||
}
|
||||
|
||||
// The tail carries the indices that tell two sensors apart, so a key too long keeps its end.
|
||||
string text = key.Length > AdvancedMetricCatalog.MaxInstanceKeyLength
|
||||
? key.ToString(key.Length - AdvancedMetricCatalog.MaxInstanceKeyLength, AdvancedMetricCatalog.MaxInstanceKeyLength)
|
||||
: key.ToString();
|
||||
text = text.Trim('_');
|
||||
return AdvancedMetricCatalog.IsInstanceKey(text) ? text : null;
|
||||
}
|
||||
|
||||
/// <summary>What the hardware calls a sensor, for the page: the device's name, then the sensor's.</summary>
|
||||
public static string LabelOf(ISensor sensor)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(sensor);
|
||||
string device = sensor.Hardware?.Name?.Trim() ?? string.Empty;
|
||||
string name = sensor.Name?.Trim() ?? string.Empty;
|
||||
return (device.Length, name.Length) switch
|
||||
{
|
||||
(0, 0) => sensor.Identifier?.ToString() ?? string.Empty,
|
||||
(0, _) => name,
|
||||
(_, 0) => device,
|
||||
_ => $"{device} - {name}",
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,234 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using FrameLedger.Application.Advanced;
|
||||
using LibreHardwareMonitor.Hardware;
|
||||
|
||||
namespace FrameLedger.Infrastructure.Telemetry;
|
||||
|
||||
/// <summary>
|
||||
/// LibreHardwareMonitor's part of "Advanced metrics" (owner decisions D101 and D103): every sensor of the graphics
|
||||
/// card, and — where the Agent runs as administrator with PawnIO — of the processor, the memory and the motherboard,
|
||||
/// each as a member of a catalog family.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// <b>Its own <c>Computer</c>.</b> Not the telemetry layer's (L2), which is GPU-only, per session and unelevated by
|
||||
/// design, and not the one <see cref="LhmCpuTemperatureReader"/> opens: this one lives as long as the shared reader
|
||||
/// does. What may be opened is <see cref="GroupsFor"/>'s answer and nothing else.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// <b>A device that throws is skipped, not retried in a loop.</b> The library's own traversal stops at the first
|
||||
/// exception, so one faulting sensor chip would silence every device after it. Each top-level device is refreshed in
|
||||
/// a guard of its own; two faults and it is left alone until the reader is opened again — its series simply stop
|
||||
/// having readings (<c>18_GPU_VENDOR_APIS</c> §Runtime policy).
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// <b>Not every device every tick.</b> Memory modules are read over SMBus and change slowly: every fifth tick.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public sealed class LhmAdvancedReader : IDisposable
|
||||
{
|
||||
/// <summary>Faults after which a device is left alone.</summary>
|
||||
public const int MaxFaults = 2;
|
||||
|
||||
/// <summary>How many ticks pass between two refreshes of the memory group.</summary>
|
||||
public const int MemoryEveryTicks = 5;
|
||||
|
||||
private readonly ILhmComputer _computer;
|
||||
private readonly Dictionary<IHardware, int> _faults = new(ReferenceEqualityComparer.Instance);
|
||||
private IReadOnlyList<IHardware> _hardware = [];
|
||||
private long _tick;
|
||||
private bool _open;
|
||||
private bool _disposed;
|
||||
|
||||
public LhmAdvancedReader(ILhmComputer computer)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(computer);
|
||||
_computer = computer;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The groups this process may open: the graphics cards always; the processor, memory and motherboard only when
|
||||
/// it is elevated AND PawnIO is installed (D103). An unknown answer about PawnIO is not a yes.
|
||||
/// </summary>
|
||||
public static LhmGroups GroupsFor(bool elevated, bool? pawnIoInstalled)
|
||||
=> elevated && pawnIoInstalled == true
|
||||
? LhmGroups.Gpu | LhmGroups.Cpu | LhmGroups.Memory | LhmGroups.Motherboard
|
||||
: LhmGroups.Gpu;
|
||||
|
||||
/// <summary>Devices left alone after <see cref="MaxFaults"/> faults.</summary>
|
||||
public int SkippedDevices => _faults.Count(static f => f.Value >= MaxFaults);
|
||||
|
||||
/// <summary>What the last fault said, for the log; null when there was none.</summary>
|
||||
public string? LastFault { get; private set; }
|
||||
|
||||
/// <summary>Opens the groups. False when the library threw: nothing is read, and <see cref="LastFault"/> says why.</summary>
|
||||
public bool Open()
|
||||
{
|
||||
ObjectDisposedException.ThrowIf(_disposed, this);
|
||||
if (_open)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_computer.Open();
|
||||
_hardware = _computer.Hardware;
|
||||
_open = true;
|
||||
return true;
|
||||
}
|
||||
catch (Exception e) when (e is not OperationCanceledException)
|
||||
{
|
||||
LastFault = $"open: {e.GetType().Name}: {e.Message}";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Refreshes every device that is due on this tick and has not faulted out.</summary>
|
||||
public void Refresh()
|
||||
{
|
||||
if (!_open || _disposed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
long tick = _tick++;
|
||||
foreach (IHardware device in _hardware)
|
||||
{
|
||||
if (_faults.GetValueOrDefault(device) >= MaxFaults || (device.HardwareType == HardwareType.Memory && tick % MemoryEveryTicks != 0))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Update(device, depth: 0);
|
||||
}
|
||||
catch (Exception e) when (e is not OperationCanceledException)
|
||||
{
|
||||
_faults[device] = _faults.GetValueOrDefault(device) + 1;
|
||||
LastFault = $"{device.HardwareType} '{device.Name}': {e.GetType().Name}: {e.Message}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The value every mapped sensor holds after the last <see cref="Refresh"/>, with the directory entry of each: a
|
||||
/// sensor with no value, or of a device that faulted out, has no reading.
|
||||
/// </summary>
|
||||
public (IReadOnlyList<AdvancedReading> Readings, IReadOnlyList<AdvancedSeriesInfo> Series) Read()
|
||||
{
|
||||
var readings = new List<AdvancedReading>();
|
||||
var series = new List<AdvancedSeriesInfo>();
|
||||
if (!_open || _disposed)
|
||||
{
|
||||
return (readings, series);
|
||||
}
|
||||
|
||||
var seen = new HashSet<string>(StringComparer.Ordinal);
|
||||
foreach (IHardware device in _hardware)
|
||||
{
|
||||
if (_faults.GetValueOrDefault(device) >= MaxFaults)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach (ISensor sensor in SensorMap.AllSensors(device))
|
||||
{
|
||||
if (LhmAdvancedMap.FamilyOf(device.HardwareType, sensor.SensorType) is not string family
|
||||
|| AdvancedMetricCatalog.Find(family) is not { } metric
|
||||
|| LhmAdvancedMap.KeyOf(sensor.Identifier?.ToString(), sensor.SensorType) is not string key
|
||||
|| sensor.Value is not float value
|
||||
|| !float.IsFinite(value))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
string name = AdvancedMetricCatalog.InstanceName(metric, key);
|
||||
if (!seen.Add(name))
|
||||
{
|
||||
// Two sensors whose identifiers shorten to one key: the first keeps the name, the second is not read.
|
||||
continue;
|
||||
}
|
||||
|
||||
readings.Add(new AdvancedReading(name, value));
|
||||
series.Add(new AdvancedSeriesInfo(name, family, LhmAdvancedMap.LabelOf(sensor)));
|
||||
}
|
||||
}
|
||||
|
||||
return (readings, series);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The facts the opened groups carry: the motherboard's model and its sensor chip, and the memory devices by name.
|
||||
/// Empty where those groups are not open.
|
||||
/// </summary>
|
||||
public IReadOnlyList<AdvancedFact> ReadFacts()
|
||||
{
|
||||
var facts = new List<AdvancedFact>();
|
||||
if (!_open || _disposed)
|
||||
{
|
||||
return facts;
|
||||
}
|
||||
|
||||
if (_hardware.FirstOrDefault(static h => h.HardwareType == HardwareType.Motherboard) is { } board)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(board.Name))
|
||||
{
|
||||
facts.Add(new AdvancedFact("lhm.board.model", Instance: null, AdvancedValue.OfText(board.Name.Trim())));
|
||||
}
|
||||
|
||||
string[] chips = [.. board.SubHardware.Where(static s => s.HardwareType is HardwareType.SuperIO or HardwareType.EmbeddedController).Select(static s => s.Name?.Trim() ?? string.Empty).Where(static n => n.Length > 0)];
|
||||
if (chips.Length > 0)
|
||||
{
|
||||
facts.Add(new AdvancedFact("lhm.board.sensor_chip", Instance: null, AdvancedValue.OfText(string.Join(", ", chips))));
|
||||
}
|
||||
}
|
||||
|
||||
AdvancedRow[] modules = [.. _hardware.Where(static h => h.HardwareType == HardwareType.Memory && !string.IsNullOrWhiteSpace(h.Name)).Select(static h => new AdvancedRow(h.Name.Trim(), string.Empty))];
|
||||
if (modules.Length > 0)
|
||||
{
|
||||
facts.Add(new AdvancedFact("lhm.memory.modules", Instance: null, AdvancedValue.OfRows(modules)));
|
||||
}
|
||||
|
||||
return facts;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (_disposed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_disposed = true;
|
||||
if (_open)
|
||||
{
|
||||
try
|
||||
{
|
||||
_computer.Close();
|
||||
}
|
||||
catch (Exception e) when (e is not OperationCanceledException)
|
||||
{
|
||||
// Closing a library that already faulted must not take the reader's thread with it.
|
||||
LastFault = $"close: {e.GetType().Name}: {e.Message}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void Update(IHardware hardware, int depth)
|
||||
{
|
||||
hardware.Update();
|
||||
if (depth >= 4)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (IHardware sub in hardware.SubHardware)
|
||||
{
|
||||
Update(sub, depth + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,9 +12,16 @@ namespace FrameLedger.Infrastructure.Telemetry;
|
||||
/// <para>
|
||||
/// <c>IsGpuEnabled</c> is always on; <c>IsCpuEnabled</c> and <c>IsMemoryEnabled</c> only when
|
||||
/// the caller says so, and the caller may only say so when the Agent is elevated and PawnIO
|
||||
/// is present (<c>18_GPU_VENDOR_APIS</c> §L2). Nothing else is ever enabled — motherboard,
|
||||
/// is present (<c>18_GPU_VENDOR_APIS</c> §L2). ~~Nothing else is ever enabled — motherboard,
|
||||
/// storage, network, battery, PSU and controllers are outside what this product measures,
|
||||
/// and every group enabled is a driver path that can fault.
|
||||
/// and every group enabled is a driver path that can fault.~~
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// <b>Amended 2026-11-11 (owner decision D103).</b> "Advanced metrics" opens the motherboard group as well, under
|
||||
/// the same two conditions, through the <see cref="LhmGroups"/> constructor — and only what that enum has a member
|
||||
/// for can be opened at all: storage, network, battery, PSU and controllers have none, each for the reason written
|
||||
/// there. The last clause above stands: every group enabled is a driver path that can fault, which is why the
|
||||
/// reader that opens them counts faults per device and reads on a thread of its own.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Consumed <b>unmodified</b>, as an ordinary NuGet package reference. MPL-2.0 §3.3 is what
|
||||
@@ -36,6 +43,18 @@ public sealed class LhmComputerAdapter : ILhmComputer
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>The groups <paramref name="groups"/> names, and no other (D103).</summary>
|
||||
public LhmComputerAdapter(LhmGroups groups)
|
||||
{
|
||||
_computer = new Computer
|
||||
{
|
||||
IsGpuEnabled = groups.HasFlag(LhmGroups.Gpu),
|
||||
IsCpuEnabled = groups.HasFlag(LhmGroups.Cpu),
|
||||
IsMemoryEnabled = groups.HasFlag(LhmGroups.Memory),
|
||||
IsMotherboardEnabled = groups.HasFlag(LhmGroups.Motherboard),
|
||||
};
|
||||
}
|
||||
|
||||
public IReadOnlyList<IHardware> Hardware => [.. _computer.Hardware];
|
||||
|
||||
public void Open() => _computer.Open();
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
namespace FrameLedger.Infrastructure.Telemetry;
|
||||
|
||||
/// <summary>
|
||||
/// The hardware groups of LibreHardwareMonitor this project may open (owner decision D103) — and, by what is not a
|
||||
/// member, the ones it may not.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <b>Not here, on purpose:</b> the power-supply and controller groups, which make the library search every USB HID
|
||||
/// device (refused); the battery group (deferred); the network group, which is not a hardware measurement; and
|
||||
/// <b>storage</b> — the library lists every drive through DiskInfoToolkit with no filter and follows drives as they
|
||||
/// are plugged in (its <c>StorageGroup</c>, read 2026-11-11), so it cannot be opened without touching removable
|
||||
/// drives, and by the outcome written down before the first run that group stays closed (<c>20_OPEN_QUESTIONS</c> §M13).
|
||||
/// </remarks>
|
||||
[Flags]
|
||||
public enum LhmGroups
|
||||
{
|
||||
None = 0,
|
||||
|
||||
/// <summary>The graphics cards. Needs no rights (<c>20_OPEN_QUESTIONS</c> §M5).</summary>
|
||||
Gpu = 1,
|
||||
|
||||
/// <summary>The processor. Elevated, with PawnIO.</summary>
|
||||
Cpu = 2,
|
||||
|
||||
/// <summary>System memory and its modules. Elevated, with PawnIO.</summary>
|
||||
Memory = 4,
|
||||
|
||||
/// <summary>The motherboard: its sensor chip and embedded controller. Elevated, with PawnIO.</summary>
|
||||
Motherboard = 8,
|
||||
}
|
||||
@@ -24,8 +24,11 @@ namespace FrameLedger.Infrastructure.Telemetry;
|
||||
/// words the guard's §S18 heuristic scans a launcher's ancestors for.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public sealed class NativeNvapiBridge : INvapiBridge
|
||||
public sealed class NativeNvapiBridge : INvapiBridge, INvapiAdvancedBridge
|
||||
{
|
||||
/// <summary>The most settings <see cref="ProfileSettings"/> lists of one profile. The global profile of the dev box holds 24.</summary>
|
||||
public const int MaxProfileEntries = 512;
|
||||
|
||||
/// <summary>What <see cref="Init"/> answers when the DLL is not beside this assembly at all.</summary>
|
||||
public const int Unavailable = -1999;
|
||||
|
||||
@@ -113,6 +116,87 @@ public sealed class NativeNvapiBridge : INvapiBridge
|
||||
return status;
|
||||
}
|
||||
|
||||
// ---- ABI 3 (D101). A DLL beside the Agent that predates it has no such export: that is Unavailable, the answer
|
||||
// a missing DLL gives, and never an exception out of a read - the guard NativeProcessStats makes for its own. ----
|
||||
|
||||
public int ReadFacts(out NvapiFacts facts)
|
||||
{
|
||||
facts = new NvapiFacts { Size = (uint)Marshal.SizeOf<NvapiFacts>() };
|
||||
try
|
||||
{
|
||||
return FlNvReadFacts(ref facts);
|
||||
}
|
||||
catch (Exception e) when (e is EntryPointNotFoundException or DllNotFoundException)
|
||||
{
|
||||
return Unavailable;
|
||||
}
|
||||
}
|
||||
|
||||
public int ReadLive(out NvapiLive live)
|
||||
{
|
||||
live = new NvapiLive { Size = (uint)Marshal.SizeOf<NvapiLive>() };
|
||||
try
|
||||
{
|
||||
return FlNvReadLive(ref live);
|
||||
}
|
||||
catch (Exception e) when (e is EntryPointNotFoundException or DllNotFoundException)
|
||||
{
|
||||
return Unavailable;
|
||||
}
|
||||
}
|
||||
|
||||
public int ReadDisplays(out NvapiDisplays displays)
|
||||
{
|
||||
displays = new NvapiDisplays
|
||||
{
|
||||
Size = (uint)Marshal.SizeOf<NvapiDisplays>(),
|
||||
Displays = new NvapiDisplay[NvapiDisplays.MaxDisplays],
|
||||
};
|
||||
try
|
||||
{
|
||||
return FlNvReadDisplays(ref displays);
|
||||
}
|
||||
catch (Exception e) when (e is EntryPointNotFoundException or DllNotFoundException)
|
||||
{
|
||||
return Unavailable;
|
||||
}
|
||||
}
|
||||
|
||||
public int SessionDisplay(string gdiDeviceName, uint pid, out NvapiSessionDisplay display)
|
||||
{
|
||||
ArgumentException.ThrowIfNullOrWhiteSpace(gdiDeviceName);
|
||||
display = new NvapiSessionDisplay { Size = (uint)Marshal.SizeOf<NvapiSessionDisplay>() };
|
||||
try
|
||||
{
|
||||
return FlNvSessionDisplay(gdiDeviceName, pid, ref display);
|
||||
}
|
||||
catch (Exception e) when (e is EntryPointNotFoundException or DllNotFoundException)
|
||||
{
|
||||
return Unavailable;
|
||||
}
|
||||
}
|
||||
|
||||
public int ProfileSettings(string? exePath, bool ownOnly, out NvapiProfileList list, out IReadOnlyList<NvapiProfileEntry> entries)
|
||||
{
|
||||
list = new NvapiProfileList { Size = (uint)Marshal.SizeOf<NvapiProfileList>(), ProfileName = string.Empty };
|
||||
var buffer = new NvapiProfileEntry[MaxProfileEntries];
|
||||
entries = [];
|
||||
try
|
||||
{
|
||||
int status = FlNvProfileSettings(exePath, ownOnly ? 1u : 0u, buffer, (uint)buffer.Length, ref list);
|
||||
if (status == 0)
|
||||
{
|
||||
entries = buffer.AsSpan(0, (int)Math.Min(list.Count, (uint)buffer.Length)).ToArray();
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
catch (Exception e) when (e is EntryPointNotFoundException or DllNotFoundException)
|
||||
{
|
||||
return Unavailable;
|
||||
}
|
||||
}
|
||||
|
||||
public void Shutdown()
|
||||
{
|
||||
if (_live > 0)
|
||||
@@ -142,6 +226,18 @@ public sealed class NativeNvapiBridge : INvapiBridge
|
||||
|
||||
public static uint AbiVersion() => FlNvAbiVersion();
|
||||
|
||||
public static uint FactsSize() => FlNvFactsSize();
|
||||
|
||||
public static uint LiveSize() => FlNvLiveSize();
|
||||
|
||||
public static uint DisplaysSize() => FlNvDisplaysSize();
|
||||
|
||||
public static uint SessionDisplaySize() => FlNvSessionDisplaySize();
|
||||
|
||||
public static uint ProfileEntrySize() => FlNvProfileEntrySize();
|
||||
|
||||
public static uint ProfileListSize() => FlNvProfileListSize();
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (_disposed)
|
||||
@@ -199,4 +295,49 @@ public sealed class NativeNvapiBridge : INvapiBridge
|
||||
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
|
||||
[DllImport(_dll, CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern IntPtr FlNvBuildId();
|
||||
|
||||
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
|
||||
[DllImport(_dll, CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern int FlNvReadFacts(ref NvapiFacts facts);
|
||||
|
||||
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
|
||||
[DllImport(_dll, CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern int FlNvReadLive(ref NvapiLive live);
|
||||
|
||||
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
|
||||
[DllImport(_dll, CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern int FlNvReadDisplays(ref NvapiDisplays displays);
|
||||
|
||||
// A GDI device name is ASCII ("\\.\DISPLAY1"); a character that is not is refused rather than best-fitted into one that is.
|
||||
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
|
||||
[DllImport(_dll, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, BestFitMapping = false, ThrowOnUnmappableChar = true)]
|
||||
private static extern int FlNvSessionDisplay([MarshalAs(UnmanagedType.LPStr)] string gdiDeviceName, uint pid, ref NvapiSessionDisplay display);
|
||||
|
||||
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
|
||||
[DllImport(_dll, CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern int FlNvProfileSettings([MarshalAs(UnmanagedType.LPWStr)] string? exePath, uint ownOnly, [In, Out] NvapiProfileEntry[] entries, uint capacity, ref NvapiProfileList list);
|
||||
|
||||
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
|
||||
[DllImport(_dll, CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern uint FlNvFactsSize();
|
||||
|
||||
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
|
||||
[DllImport(_dll, CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern uint FlNvLiveSize();
|
||||
|
||||
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
|
||||
[DllImport(_dll, CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern uint FlNvDisplaysSize();
|
||||
|
||||
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
|
||||
[DllImport(_dll, CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern uint FlNvSessionDisplaySize();
|
||||
|
||||
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
|
||||
[DllImport(_dll, CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern uint FlNvProfileEntrySize();
|
||||
|
||||
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
|
||||
[DllImport(_dll, CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern uint FlNvProfileListSize();
|
||||
}
|
||||
@@ -0,0 +1,555 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using System.Globalization;
|
||||
using FrameLedger.Application.Advanced;
|
||||
|
||||
namespace FrameLedger.Infrastructure.Telemetry;
|
||||
|
||||
/// <summary>
|
||||
/// NVAPI's part of "Advanced metrics" (owner decision D101): the bridge's ABI 3 structs turned into the facts and
|
||||
/// readings of <see cref="AdvancedMetricCatalog"/> — every <c>nvapi.</c> entry whose reach is the Agent, and no other.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// <b>What was not read is not there.</b> A bit the driver left clear, a call it refused, a display it did not find:
|
||||
/// the fact or the reading is absent, and the page shows N/A. Nothing is put in its place — not a zero, not the last
|
||||
/// value (FR-4.9).
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// <b>Not a poller, and it counts no faults.</b> Whoever calls it decides how often, on which thread, and when a read
|
||||
/// that keeps failing is given up (<c>18_GPU_VENDOR_APIS</c> §Runtime policy) — the reader that owns the thread, not
|
||||
/// this mapping.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// <b>Identifiers never reach it</b> (D104): the bridge has no entry point for a serial number, a unique id or an
|
||||
/// EDID, and the one handle it does return — NVAPI's display id — is replaced here by the display's place in the list.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public sealed class NvapiAdvancedReader : IDisposable
|
||||
{
|
||||
private const double _mebibyte = 1024.0 * 1024.0;
|
||||
|
||||
private readonly INvapiBridge _bridge;
|
||||
private readonly INvapiAdvancedBridge _advanced;
|
||||
private bool _started;
|
||||
private bool _disposed;
|
||||
|
||||
public NvapiAdvancedReader(INvapiBridge bridge, INvapiAdvancedBridge advanced)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(bridge);
|
||||
ArgumentNullException.ThrowIfNull(advanced);
|
||||
_bridge = bridge;
|
||||
_advanced = advanced;
|
||||
}
|
||||
|
||||
/// <summary>The real bridge behind both ports. The reader owns it and disposes it.</summary>
|
||||
public static NvapiAdvancedReader OverTheNativeBridge()
|
||||
{
|
||||
var bridge = new NativeNvapiBridge();
|
||||
return new NvapiAdvancedReader(bridge, bridge);
|
||||
}
|
||||
|
||||
/// <summary>What <c>FlNvInit</c> answered, or null before <see cref="Start"/>. Not 0: every read below is empty, and this is why.</summary>
|
||||
public int? InitStatus { get; private set; }
|
||||
|
||||
/// <summary>True when the driver initialised and listed a graphics card.</summary>
|
||||
public bool IsAvailable => InitStatus == 0;
|
||||
|
||||
/// <summary>Initialises NVAPI once. A PC with no NVIDIA driver answers a status, which is a normal condition and not a fault.</summary>
|
||||
public bool Start()
|
||||
{
|
||||
ObjectDisposedException.ThrowIf(_disposed, this);
|
||||
if (!_started)
|
||||
{
|
||||
_started = true;
|
||||
InitStatus = _bridge.Init();
|
||||
}
|
||||
|
||||
return IsAvailable;
|
||||
}
|
||||
|
||||
/// <summary>The facts of the PC: the card, the driver, each connected display, the driver's global profile.</summary>
|
||||
public IReadOnlyList<AdvancedFact> ReadMachineFacts()
|
||||
{
|
||||
var facts = new List<AdvancedFact>();
|
||||
if (!IsAvailable)
|
||||
{
|
||||
return facts;
|
||||
}
|
||||
|
||||
if (_advanced.ReadFacts(out NvapiFacts card) == 0)
|
||||
{
|
||||
AddCardFacts(facts, card);
|
||||
}
|
||||
|
||||
if (_advanced.ReadDisplays(out NvapiDisplays displays) == 0)
|
||||
{
|
||||
AddDisplayFacts(facts, displays);
|
||||
}
|
||||
|
||||
if (_advanced.ProfileSettings(exePath: null, ownOnly: false, out NvapiProfileList list, out IReadOnlyList<NvapiProfileEntry> entries) == 0
|
||||
&& list.Status == NvapiDriverProfile.Global)
|
||||
{
|
||||
facts.Add(new AdvancedFact(Ids.GlobalProfile, Instance: null, AdvancedValue.OfRows(RowsOf(entries))));
|
||||
}
|
||||
|
||||
return facts;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The facts of one session: the state of the display the game presents on and the colour space of its process
|
||||
/// (when <paramref name="gdiDeviceName"/> is known), and what the driver's profile for the game sets itself (when
|
||||
/// <paramref name="exePath"/> is known).
|
||||
/// </summary>
|
||||
public IReadOnlyList<AdvancedFact> ReadSessionFacts(string? gdiDeviceName, uint pid, string? exePath)
|
||||
{
|
||||
var facts = new List<AdvancedFact>();
|
||||
if (!IsAvailable)
|
||||
{
|
||||
return facts;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(gdiDeviceName) && _advanced.SessionDisplay(gdiDeviceName, pid, out NvapiSessionDisplay display) == 0)
|
||||
{
|
||||
AddSessionDisplayFacts(facts, display);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(exePath)
|
||||
&& _advanced.ProfileSettings(exePath, ownOnly: true, out NvapiProfileList list, out IReadOnlyList<NvapiProfileEntry> entries) == 0)
|
||||
{
|
||||
if (list.Status == NvapiDriverProfile.Application)
|
||||
{
|
||||
facts.Add(new AdvancedFact(Ids.SessionProfile, Instance: null, AdvancedValue.OfRows(RowsOf(entries))));
|
||||
}
|
||||
else if (list.Status == NvapiDriverProfile.Global)
|
||||
{
|
||||
// The driver answered, and no profile names this game: said so, rather than left to read as "not asked".
|
||||
facts.Add(new AdvancedFact(Ids.SessionProfile, Instance: null, AdvancedValue.OfTokens(NvapiAdvancedTokens.NoProfileForGame)));
|
||||
}
|
||||
}
|
||||
|
||||
return facts;
|
||||
}
|
||||
|
||||
/// <summary>One reading of every series the card answers now.</summary>
|
||||
public IReadOnlyList<AdvancedReading> ReadLive()
|
||||
{
|
||||
if (!IsAvailable || _advanced.ReadLive(out NvapiLive live) != 0)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
return ReadingsOf(live);
|
||||
}
|
||||
|
||||
/// <summary>The card's own facts, one per field the driver filled.</summary>
|
||||
public static void AddCardFacts(ICollection<AdvancedFact> facts, NvapiFacts card)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(facts);
|
||||
if (card.Has(NvapiFactField.GpuType) && card.GpuType switch { 1 => NvapiAdvancedTokens.Integrated, 2 => NvapiAdvancedTokens.Discrete, _ => null } is string type)
|
||||
{
|
||||
Add(facts, Ids.GpuType, AdvancedValue.OfTokens(type));
|
||||
}
|
||||
|
||||
if (card.Has(NvapiFactField.SystemType) && card.SystemType switch { 1 => NvapiAdvancedTokens.Laptop, 2 => NvapiAdvancedTokens.Desktop, _ => null } is string system)
|
||||
{
|
||||
Add(facts, Ids.SystemType, AdvancedValue.OfTokens(system));
|
||||
}
|
||||
|
||||
if (card.Has(NvapiFactField.GpuInfo))
|
||||
{
|
||||
Add(facts, Ids.External, AdvancedValue.Of(card.External != 0));
|
||||
Add(facts, Ids.RtCores, AdvancedValue.Of(card.RtCores));
|
||||
Add(facts, Ids.TensorCores, AdvancedValue.Of(card.TensorCores));
|
||||
}
|
||||
|
||||
if (card.Has(NvapiFactField.BusType) && BusTokenOf(card.BusType) is string bus)
|
||||
{
|
||||
Add(facts, Ids.BusType, AdvancedValue.OfTokens(bus));
|
||||
}
|
||||
|
||||
if (card.Has(NvapiFactField.PciIds))
|
||||
{
|
||||
Add(facts, Ids.PciIds, AdvancedValue.OfText(string.Create(CultureInfo.InvariantCulture, $"{card.PciDeviceId:X8} / {card.PciSubSystemId:X8} / {card.PciRevisionId:X2}")));
|
||||
}
|
||||
|
||||
if (card.Has(NvapiFactField.Vbios) && !string.IsNullOrWhiteSpace(card.Vbios))
|
||||
{
|
||||
Add(facts, Ids.Vbios, AdvancedValue.OfText(card.Vbios));
|
||||
}
|
||||
|
||||
if (card.Has(NvapiFactField.Arch))
|
||||
{
|
||||
Add(facts, Ids.Architecture, AdvancedValue.OfText(string.Create(CultureInfo.InvariantCulture, $"0x{card.ArchId:X} / 0x{card.ArchImplementation:X} / 0x{card.ArchRevision:X}")));
|
||||
}
|
||||
|
||||
AddCapacityFacts(facts, card);
|
||||
AddDriverFacts(facts, card);
|
||||
}
|
||||
|
||||
private static void AddCapacityFacts(ICollection<AdvancedFact> facts, NvapiFacts card)
|
||||
{
|
||||
AddNumber(facts, Ids.CoreCount, card.Has(NvapiFactField.CoreCount), card.CoreCount);
|
||||
AddNumber(facts, Ids.RamBusWidth, card.Has(NvapiFactField.RamBusWidth), card.RamBusWidth);
|
||||
AddNumber(facts, Ids.ClockBaseCore, card.Has(NvapiFactField.ClockBaseCore), card.ClockBaseCoreMhz);
|
||||
AddNumber(facts, Ids.ClockBaseMemory, card.Has(NvapiFactField.ClockBaseMemory), card.ClockBaseMemoryMhz);
|
||||
AddNumber(facts, Ids.ClockBoostCore, card.Has(NvapiFactField.ClockBoostCore), card.ClockBoostCoreMhz);
|
||||
AddNumber(facts, Ids.ClockBoostMemory, card.Has(NvapiFactField.ClockBoostMemory), card.ClockBoostMemoryMhz);
|
||||
AddNumber(facts, Ids.TempDefaultMax, card.Has(NvapiFactField.TempDefaultMax), card.TempDefaultMaxC);
|
||||
if (card.Has(NvapiFactField.Memory))
|
||||
{
|
||||
Add(facts, Ids.VramDedicated, AdvancedValue.Of(card.VramDedicatedBytes / _mebibyte));
|
||||
Add(facts, Ids.VramDedicatedAvailable, AdvancedValue.Of(card.VramDedicatedAvailableBytes / _mebibyte));
|
||||
Add(facts, Ids.VramSystem, AdvancedValue.Of(card.VramSystemBytes / _mebibyte));
|
||||
Add(facts, Ids.VramShared, AdvancedValue.Of(card.VramSharedBytes / _mebibyte));
|
||||
}
|
||||
|
||||
AddNumber(facts, Ids.FramebufferPhysical, card.Has(NvapiFactField.FbPhysical), card.FbPhysicalKb / 1024.0);
|
||||
AddNumber(facts, Ids.FramebufferVirtual, card.Has(NvapiFactField.FbVirtual), card.FbVirtualKb / 1024.0);
|
||||
}
|
||||
|
||||
private static void AddDriverFacts(ICollection<AdvancedFact> facts, NvapiFacts card)
|
||||
{
|
||||
if (card.Has(NvapiFactField.DriverInfo))
|
||||
{
|
||||
Add(facts, Ids.DriverPackage, AdvancedValue.OfTokens(PackageTokensOf(card.DriverFlags)));
|
||||
Add(facts, Ids.DriverDch, AdvancedValue.Of((card.DriverFlags & 0x01) != 0));
|
||||
if (!string.IsNullOrWhiteSpace(card.BaseBranch))
|
||||
{
|
||||
Add(facts, Ids.DriverBaseBranch, AdvancedValue.OfText(card.BaseBranch));
|
||||
}
|
||||
}
|
||||
|
||||
if (card.Has(NvapiFactField.InterfaceVersion) && !string.IsNullOrWhiteSpace(card.InterfaceVersion))
|
||||
{
|
||||
Add(facts, Ids.InterfaceVersion, AdvancedValue.OfText(card.InterfaceVersion));
|
||||
}
|
||||
|
||||
if (card.Has(NvapiFactField.Chipset) && $"{card.ChipsetVendor} {card.ChipsetName}".Trim() is { Length: > 0 } chipset)
|
||||
{
|
||||
Add(facts, Ids.Chipset, AdvancedValue.OfText(chipset));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>What each connected display can do, each under its place in the driver's list — 1, 2, …</summary>
|
||||
public static void AddDisplayFacts(ICollection<AdvancedFact> facts, NvapiDisplays displays)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(facts);
|
||||
if (displays.Displays is not { } list)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < displays.Count && i < list.Length; i++)
|
||||
{
|
||||
NvapiDisplay d = list[i];
|
||||
string instance = (i + 1).ToString(CultureInfo.InvariantCulture);
|
||||
if ((d.Present & NvapiDisplay.HasHdr) != 0)
|
||||
{
|
||||
facts.Add(new AdvancedFact(Ids.HdrFormats, instance, AdvancedValue.OfTokens(HdrTokensOf(d.HdrFlags))));
|
||||
facts.Add(new AdvancedFact(Ids.LuminanceMax, instance, AdvancedValue.Of(d.LuminanceMax)));
|
||||
facts.Add(new AdvancedFact(Ids.LuminanceMin, instance, AdvancedValue.Of(d.LuminanceMinTenThousandths / 10000.0)));
|
||||
facts.Add(new AdvancedFact(Ids.LuminanceMaxFrameAverage, instance, AdvancedValue.Of(d.LuminanceMaxFrameAverage)));
|
||||
}
|
||||
|
||||
if ((d.Present & NvapiDisplay.HasCaps) != 0)
|
||||
{
|
||||
facts.Add(new AdvancedFact(Ids.VrrSupport, instance, AdvancedValue.OfTokens(VrrSupportTokensOf(d.CapsFlags))));
|
||||
}
|
||||
|
||||
if ((d.Present & NvapiDisplay.HasAdaptiveSync) != 0)
|
||||
{
|
||||
facts.Add(new AdvancedFact(Ids.AdaptiveSyncOff, instance, AdvancedValue.Of((d.AdaptiveSyncFlags & NvapiDisplay.AdaptiveSyncDisabled) != 0)));
|
||||
facts.Add(new AdvancedFact(Ids.MaxFrameInterval, instance, AdvancedValue.Of(d.MaxFrameIntervalUs)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>The game's display and its process's colour space; nothing when the driver did not find the display.</summary>
|
||||
public static void AddSessionDisplayFacts(ICollection<AdvancedFact> facts, NvapiSessionDisplay display)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(facts);
|
||||
if (display.NvapiStatus != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ((display.Present & NvapiSessionDisplay.HasVrr) != 0)
|
||||
{
|
||||
Add(facts, Ids.SessionVrrEnabled, AdvancedValue.Of((display.VrrFlags & NvapiDisplay.VrrEnabled) != 0));
|
||||
Add(facts, Ids.SessionVrrRequested, AdvancedValue.Of((display.VrrFlags & NvapiDisplay.VrrRequested) != 0));
|
||||
Add(facts, Ids.SessionVrrPossible, AdvancedValue.Of((display.VrrFlags & NvapiDisplay.VrrPossible) != 0));
|
||||
Add(facts, Ids.SessionVrrDisplayMode, AdvancedValue.Of((display.VrrFlags & NvapiDisplay.VrrDisplayMode) != 0));
|
||||
}
|
||||
|
||||
if ((display.Present & NvapiSessionDisplay.HasColorSpace) != 0)
|
||||
{
|
||||
// NV_COLORSPACE_TYPE has three values today. One it gains later is shown as its number, never as a guess.
|
||||
AdvancedValue space = display.ColorSpace switch
|
||||
{
|
||||
0 => AdvancedValue.OfTokens(NvapiAdvancedTokens.Srgb),
|
||||
1 => AdvancedValue.OfTokens(NvapiAdvancedTokens.ScRgbLinear),
|
||||
12 => AdvancedValue.OfTokens(NvapiAdvancedTokens.Bt2100Pq),
|
||||
_ => AdvancedValue.OfText(display.ColorSpace.ToString(CultureInfo.InvariantCulture)),
|
||||
};
|
||||
Add(facts, Ids.SessionColorSpace, space);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>A profile's settings as rows: the driver's name for each with its id, its value in hexadecimal, and who set it.</summary>
|
||||
public static IReadOnlyList<AdvancedRow> RowsOf(IReadOnlyList<NvapiProfileEntry> entries)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(entries);
|
||||
var rows = new List<AdvancedRow>(entries.Count);
|
||||
foreach (NvapiProfileEntry e in entries)
|
||||
{
|
||||
string id = string.Create(CultureInfo.InvariantCulture, $"0x{e.Id:X8}");
|
||||
string name = string.IsNullOrWhiteSpace(e.Name) ? id : $"{e.Name} ({id})";
|
||||
// A binary or string value is not copied out of the driver: its row says the setting is there, and no more.
|
||||
rows.Add(e.Type == NvapiProfileEntry.DwordType
|
||||
? new AdvancedRow(name, string.Create(CultureInfo.InvariantCulture, $"0x{e.Value:X8}"), e.Predefined != 0 ? NvapiAdvancedTokens.DriverDefault : NvapiAdvancedTokens.UserSet)
|
||||
: new AdvancedRow(name, string.Empty, NvapiAdvancedTokens.NotANumber));
|
||||
}
|
||||
|
||||
return rows;
|
||||
}
|
||||
|
||||
/// <summary>One reading per series the driver filled.</summary>
|
||||
public static IReadOnlyList<AdvancedReading> ReadingsOf(NvapiLive live)
|
||||
{
|
||||
var readings = new List<AdvancedReading>(18);
|
||||
if (live.Has(NvapiLiveField.Memory))
|
||||
{
|
||||
readings.Add(new AdvancedReading(Series.VramAvailable, live.VramAvailableBytes / _mebibyte));
|
||||
if (live.VramDedicatedAvailableBytes >= live.VramAvailableBytes)
|
||||
{
|
||||
// Arithmetic on two figures of one read, not an estimate: what surfaces can use, less what is free now.
|
||||
readings.Add(new AdvancedReading(Series.VramInUse, (live.VramDedicatedAvailableBytes - live.VramAvailableBytes) / _mebibyte));
|
||||
}
|
||||
|
||||
readings.Add(new AdvancedReading(Series.EvictionsSize, live.EvictionsBytes / _mebibyte));
|
||||
readings.Add(new AdvancedReading(Series.EvictionCount, live.EvictionCount));
|
||||
readings.Add(new AdvancedReading(Series.PromotionsSize, live.PromotionsBytes / _mebibyte));
|
||||
readings.Add(new AdvancedReading(Series.PromotionCount, live.PromotionCount));
|
||||
}
|
||||
|
||||
AddReading(readings, Series.LoadFramebuffer, live.Has(NvapiLiveField.LoadFramebuffer), live.LoadFramebufferPct);
|
||||
AddReading(readings, Series.LoadVideo, live.Has(NvapiLiveField.LoadVideo), live.LoadVideoPct);
|
||||
AddReading(readings, Series.LoadBus, live.Has(NvapiLiveField.LoadBus), live.LoadBusPct);
|
||||
AddReading(readings, Series.ClockVideo, live.Has(NvapiLiveField.ClockVideo), live.ClockVideoMhz);
|
||||
AddReading(readings, Series.Pstate, live.Has(NvapiLiveField.Pstate), live.Pstate);
|
||||
AddReading(readings, Series.TempBoard, live.Has(NvapiLiveField.TempBoard), live.TempBoardC);
|
||||
AddReading(readings, Series.TempPowerSupply, live.Has(NvapiLiveField.TempPowerSupply), live.TempPowerSupplyC);
|
||||
if (live.Has(NvapiLiveField.Throttle))
|
||||
{
|
||||
// NV_GPU_PERF_DECREASE_REASON_*: the thermal and power bits are the fixed series gpu_thermal_limit and
|
||||
// gpu_power_limit; these are the other three, in the same 100-or-0 form so a mean is a share in percent.
|
||||
readings.Add(new AdvancedReading(Series.LimitAcBattery, (live.ThrottleReasons & 0x04) != 0 ? 100 : 0));
|
||||
readings.Add(new AdvancedReading(Series.LimitApi, (live.ThrottleReasons & 0x08) != 0 ? 100 : 0));
|
||||
readings.Add(new AdvancedReading(Series.LimitInsufficientPower, (live.ThrottleReasons & 0x10) != 0 ? 100 : 0));
|
||||
}
|
||||
|
||||
if (live.Has(NvapiLiveField.Encoder))
|
||||
{
|
||||
readings.Add(new AdvancedReading(Series.EncoderSessions, live.EncoderSessions));
|
||||
readings.Add(new AdvancedReading(Series.EncoderFps, live.EncoderFps));
|
||||
readings.Add(new AdvancedReading(Series.EncoderLatency, live.EncoderLatencyUs));
|
||||
}
|
||||
|
||||
return readings;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (_disposed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_disposed = true;
|
||||
if (_started && InitStatus is 0 or NativeNvapiBridge.NoGpu)
|
||||
{
|
||||
_bridge.Shutdown();
|
||||
}
|
||||
|
||||
_bridge.Dispose();
|
||||
}
|
||||
|
||||
private static void Add(ICollection<AdvancedFact> facts, string id, AdvancedValue value) => facts.Add(new AdvancedFact(id, Instance: null, value));
|
||||
|
||||
private static void AddNumber(ICollection<AdvancedFact> facts, string id, bool present, double value)
|
||||
{
|
||||
if (present && double.IsFinite(value))
|
||||
{
|
||||
Add(facts, id, AdvancedValue.Of(value));
|
||||
}
|
||||
}
|
||||
|
||||
private static void AddReading(List<AdvancedReading> readings, string series, bool present, double value)
|
||||
{
|
||||
if (present && double.IsFinite(value))
|
||||
{
|
||||
readings.Add(new AdvancedReading(series, value));
|
||||
}
|
||||
}
|
||||
|
||||
private static string? BusTokenOf(uint busType) => busType switch
|
||||
{
|
||||
1 => NvapiAdvancedTokens.Pci,
|
||||
2 => NvapiAdvancedTokens.Agp,
|
||||
3 => NvapiAdvancedTokens.PciExpress,
|
||||
4 => NvapiAdvancedTokens.Fpci,
|
||||
5 => NvapiAdvancedTokens.Axi,
|
||||
_ => null,
|
||||
};
|
||||
|
||||
private static List<string> PackageTokensOf(uint driverFlags)
|
||||
{
|
||||
var tokens = new List<string>(2);
|
||||
if ((driverFlags & 0x04) != 0)
|
||||
{
|
||||
tokens.Add(NvapiAdvancedTokens.GameReady);
|
||||
}
|
||||
|
||||
if ((driverFlags & 0x02) != 0)
|
||||
{
|
||||
tokens.Add(NvapiAdvancedTokens.Studio);
|
||||
}
|
||||
|
||||
if ((driverFlags & 0x08) != 0)
|
||||
{
|
||||
tokens.Add(NvapiAdvancedTokens.RtxProduction);
|
||||
}
|
||||
|
||||
if ((driverFlags & 0x10) != 0)
|
||||
{
|
||||
tokens.Add(NvapiAdvancedTokens.RtxNewFeature);
|
||||
}
|
||||
|
||||
return tokens;
|
||||
}
|
||||
|
||||
private static List<string> HdrTokensOf(uint hdrFlags)
|
||||
{
|
||||
var tokens = new List<string>(5);
|
||||
if ((hdrFlags & NvapiDisplay.HdrSt2084) != 0)
|
||||
{
|
||||
tokens.Add(NvapiAdvancedTokens.Hdr10);
|
||||
}
|
||||
|
||||
if ((hdrFlags & NvapiDisplay.HdrHdr10Plus) != 0)
|
||||
{
|
||||
tokens.Add(NvapiAdvancedTokens.Hdr10Plus);
|
||||
}
|
||||
|
||||
if ((hdrFlags & NvapiDisplay.HdrHdr10PlusGaming) != 0)
|
||||
{
|
||||
tokens.Add(NvapiAdvancedTokens.Hdr10PlusGaming);
|
||||
}
|
||||
|
||||
if ((hdrFlags & NvapiDisplay.HdrDolbyVision) != 0)
|
||||
{
|
||||
tokens.Add(NvapiAdvancedTokens.DolbyVision);
|
||||
}
|
||||
|
||||
if ((hdrFlags & NvapiDisplay.HdrEdr) != 0)
|
||||
{
|
||||
tokens.Add(NvapiAdvancedTokens.Edr);
|
||||
}
|
||||
|
||||
return tokens;
|
||||
}
|
||||
|
||||
private static List<string> VrrSupportTokensOf(uint capsFlags)
|
||||
{
|
||||
var tokens = new List<string>(4);
|
||||
if ((capsFlags & NvapiDisplay.CapsVrr) == 0)
|
||||
{
|
||||
tokens.Add(NvapiAdvancedTokens.NotSupported);
|
||||
return tokens;
|
||||
}
|
||||
|
||||
tokens.Add(NvapiAdvancedTokens.VariableRefresh);
|
||||
tokens.Add((capsFlags & NvapiDisplay.CapsTrueGsync) != 0 ? NvapiAdvancedTokens.GsyncModule : NvapiAdvancedTokens.AdaptiveSync);
|
||||
if ((capsFlags & NvapiDisplay.CapsUlmb) != 0)
|
||||
{
|
||||
tokens.Add(NvapiAdvancedTokens.Ulmb);
|
||||
}
|
||||
|
||||
if ((capsFlags & NvapiDisplay.CapsVrrNow) != 0)
|
||||
{
|
||||
tokens.Add(NvapiAdvancedTokens.UsableNow);
|
||||
}
|
||||
|
||||
return tokens;
|
||||
}
|
||||
|
||||
private static class Ids
|
||||
{
|
||||
public const string GpuType = "nvapi.gpu.type";
|
||||
public const string SystemType = "nvapi.gpu.system_type";
|
||||
public const string External = "nvapi.gpu.external";
|
||||
public const string BusType = "nvapi.gpu.bus_type";
|
||||
public const string PciIds = "nvapi.gpu.pci_ids";
|
||||
public const string Vbios = "nvapi.gpu.vbios_version";
|
||||
public const string Architecture = "nvapi.gpu.architecture";
|
||||
public const string CoreCount = "nvapi.gpu.core_count";
|
||||
public const string RtCores = "nvapi.gpu.rt_cores";
|
||||
public const string TensorCores = "nvapi.gpu.tensor_cores";
|
||||
public const string RamBusWidth = "nvapi.gpu.ram_bus_width";
|
||||
public const string ClockBaseCore = "nvapi.gpu.clock_base_core";
|
||||
public const string ClockBaseMemory = "nvapi.gpu.clock_base_memory";
|
||||
public const string ClockBoostCore = "nvapi.gpu.clock_boost_core";
|
||||
public const string ClockBoostMemory = "nvapi.gpu.clock_boost_memory";
|
||||
public const string TempDefaultMax = "nvapi.gpu.temp_default_max";
|
||||
public const string VramDedicated = "nvapi.vram.dedicated";
|
||||
public const string VramDedicatedAvailable = "nvapi.vram.dedicated_available";
|
||||
public const string VramSystem = "nvapi.vram.system";
|
||||
public const string VramShared = "nvapi.vram.shared";
|
||||
public const string FramebufferPhysical = "nvapi.vram.framebuffer_physical";
|
||||
public const string FramebufferVirtual = "nvapi.vram.framebuffer_virtual";
|
||||
public const string DriverPackage = "nvapi.driver.package";
|
||||
public const string DriverDch = "nvapi.driver.dch";
|
||||
public const string DriverBaseBranch = "nvapi.driver.base_branch";
|
||||
public const string InterfaceVersion = "nvapi.driver.interface_version";
|
||||
public const string Chipset = "nvapi.driver.chipset";
|
||||
public const string GlobalProfile = "nvapi.driver.global_profile";
|
||||
public const string SessionProfile = "nvapi.session.driver_profile";
|
||||
public const string HdrFormats = "nvapi.display.hdr_formats";
|
||||
public const string LuminanceMax = "nvapi.display.luminance_max";
|
||||
public const string LuminanceMin = "nvapi.display.luminance_min";
|
||||
public const string LuminanceMaxFrameAverage = "nvapi.display.luminance_max_frame_average";
|
||||
public const string VrrSupport = "nvapi.display.vrr_support";
|
||||
public const string AdaptiveSyncOff = "nvapi.display.adaptive_sync_off";
|
||||
public const string MaxFrameInterval = "nvapi.display.max_frame_interval";
|
||||
public const string SessionVrrEnabled = "nvapi.session.vrr_enabled";
|
||||
public const string SessionVrrRequested = "nvapi.session.vrr_requested";
|
||||
public const string SessionVrrPossible = "nvapi.session.vrr_possible";
|
||||
public const string SessionVrrDisplayMode = "nvapi.session.vrr_display_mode";
|
||||
public const string SessionColorSpace = "nvapi.session.source_colorspace";
|
||||
}
|
||||
|
||||
private static class Series
|
||||
{
|
||||
public const string VramAvailable = AdvancedMetric.SeriesPrefix + "nvapi.vram.available";
|
||||
public const string VramInUse = AdvancedMetric.SeriesPrefix + "nvapi.vram.in_use";
|
||||
public const string EvictionsSize = AdvancedMetric.SeriesPrefix + "nvapi.vram.evictions_size";
|
||||
public const string EvictionCount = AdvancedMetric.SeriesPrefix + "nvapi.vram.eviction_count";
|
||||
public const string PromotionsSize = AdvancedMetric.SeriesPrefix + "nvapi.vram.promotions_size";
|
||||
public const string PromotionCount = AdvancedMetric.SeriesPrefix + "nvapi.vram.promotion_count";
|
||||
public const string LoadFramebuffer = AdvancedMetric.SeriesPrefix + "nvapi.load.framebuffer";
|
||||
public const string LoadVideo = AdvancedMetric.SeriesPrefix + "nvapi.load.video";
|
||||
public const string LoadBus = AdvancedMetric.SeriesPrefix + "nvapi.load.bus";
|
||||
public const string ClockVideo = AdvancedMetric.SeriesPrefix + "nvapi.clock.video";
|
||||
public const string Pstate = AdvancedMetric.SeriesPrefix + "nvapi.pstate";
|
||||
public const string TempBoard = AdvancedMetric.SeriesPrefix + "nvapi.temp.board";
|
||||
public const string TempPowerSupply = AdvancedMetric.SeriesPrefix + "nvapi.temp.power_supply";
|
||||
public const string LimitAcBattery = AdvancedMetric.SeriesPrefix + "nvapi.limit.ac_battery";
|
||||
public const string LimitApi = AdvancedMetric.SeriesPrefix + "nvapi.limit.api";
|
||||
public const string LimitInsufficientPower = AdvancedMetric.SeriesPrefix + "nvapi.limit.insufficient_power";
|
||||
public const string EncoderSessions = AdvancedMetric.SeriesPrefix + "nvapi.encoder.sessions";
|
||||
public const string EncoderFps = AdvancedMetric.SeriesPrefix + "nvapi.encoder.fps";
|
||||
public const string EncoderLatency = AdvancedMetric.SeriesPrefix + "nvapi.encoder.latency";
|
||||
}
|
||||
}
|
||||
Loaded 100 of 160 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user