Nothing calls it yet: no Agent code composes the reader, so nothing a user sees or records changes. - Application.Advanced: the port IAdvancedHardware (Acquire, Latest, ReadSessionFacts), AdvancedSnapshot, AdvancedSources and the status of each source - Reading, NotPresent, NotElevated, PawnIoMissing, Faulted. A source that is not there is a state, never an exception and never a value in its place. - Infrastructure: AdvancedHardwareHub - one reader for the whole Agent on a thread of its own (fl-advanced), started by the first holder and closed a linger after the last lets go (D107), so a PC idling with FrameLedger in the tray reads nothing for this. AdvancedHardwareReader - one tick of NVAPI and of LibreHardwareMonitor. LhmAdvancedReader over a Computer of its own: every sensor of the graphics card, and as administrator with PawnIO the processor, memory and motherboard groups (D103). LhmGroups has a member for those four and no other. - Storage is not opened (D103's outcome, written before any run): LibreHardwareMonitor 0.9.6's StorageGroup lists every drive through DiskInfoToolkit with no filter by bus and follows drives plugged in later. lhm.storage.* is Deferred in the catalog; a drive's temperature will read N/A with that reason. - A device that throws twice is left alone and the others go on; NVAPI answering with no field twice running, after it had answered, is released and initialised again once (20_OPEN_QUESTIONS M12). - FrameLedger.CaptureHost probe-advanced (unshipped): runs that reader on the caller's own rights and prints what it read and what it cost. On the dev box (RTX 5080, unelevated): 35 facts, 58 readings a tick; one NVAPI live read 0.4 ms of processor time; one refresh of the sensor library's graphics-card group 14 ms (62 ms elapsed) - 1.4% of one core at one a second, above NFR-2. So NVAPI is read every tick and the sensor library every fifth (0.28%), with no value repeated between. - The same refresh is what the L2 telemetry layer does once a second in every session. That cost is not this train's: recorded as 20_OPEN_QUESTIONS M16, with the owner's choices. - PrivilegeFootprintTests: opening every group this project can name enables no powerful privilege (the real thing on the elevated CI runner). - docs: 18_GPU_VENDOR_APIS (the reader, D103 as found, L2's line), 20_OPEN_QUESTIONS (M13 half answered, M16 new), HANDOFF, CLAUDE.md, CHANGELOG. Hook overhead: not applicable - nothing in code loaded into a game changes. Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
42 lines
1.2 KiB
C#
42 lines
1.2 KiB
C#
// SPDX-License-Identifier: GPL-3.0-only
|
|
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
|
|
|
using FrameLedger.Infrastructure.Telemetry;
|
|
using LibreHardwareMonitor.Hardware;
|
|
|
|
namespace FrameLedger.Infrastructure.Tests.Telemetry;
|
|
|
|
/// <summary>A scripted <see cref="ILhmComputer"/>: the tree it lists, and whether opening or closing throws.</summary>
|
|
internal sealed class FakeLhmComputer(params IHardware[] hardware) : ILhmComputer
|
|
{
|
|
public bool OpenThrows { get; set; }
|
|
|
|
public bool CloseThrows { get; set; }
|
|
|
|
public int Opens { get; private set; }
|
|
|
|
public int Closes { get; private set; }
|
|
|
|
public IReadOnlyList<IHardware> Hardware { get; } = hardware;
|
|
|
|
public void Open()
|
|
{
|
|
Opens++;
|
|
if (OpenThrows)
|
|
{
|
|
throw new InvalidOperationException("the driver refused");
|
|
}
|
|
}
|
|
|
|
public void Update() => throw new NotSupportedException("the advanced reader refreshes device by device, never the whole tree");
|
|
|
|
public void Close()
|
|
{
|
|
Closes++;
|
|
if (CloseThrows)
|
|
{
|
|
throw new InvalidOperationException("already closed");
|
|
}
|
|
}
|
|
}
|