fix: lighten Resource History sampler, speed up loads, tidy shutdown#1156
Merged
Conversation
- The always-on 10s sampler called TemperatureService.ReadAllAsync(), which on an elevated box runs a Win32_DiskDrive WMI query plus a full DiskHealthService SMART enumeration just to NAME storage sensors — data the sampler discards (it stores only CPU/GPU temps). Added a ReadAllAsync(includeStorage:false) fast path that skips the storage-name lookup and disk-temp read; the sampler now uses it, cutting ~8640 WMI/SMART enumerations/day on a tray-minimized session. Dashboard keeps the full read (default includeStorage:true) — no behavior change there. - LoadAsync parsed the ENTIRE NDJSON file (up to ~260k lines at 30-day retention) on every range change/tab open, allocating a ResourceSample per line then discarding 99%. It now reads from the newest end and stops at the cutoff, bounding work to the requested window. - Dispose disposed _fileLock without awaiting the sampler loop, so an in-flight Release() could hit a disposed semaphore at shutdown (caught+logged, but a real race). Dispose now waits (bounded 2s) for the loop to observe cancellation first, guards Release with _disposed, and PruneAsync takes a cancellation token. - Temperature chart now shows an EmptyState on sensorless machines instead of a blank chart (HasTemperatureData). Tests: Downsample boundaries (maxPoints 0/1/exactly-N, partial-GPU averaging).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Performance + robustness fixes for Resource History (#13), from the post-feature audit (Batch 3 of 6).
Fixes
TemperatureService.ReadAllAsync(), which on an elevated machine runs aWin32_DiskDriveWMI query plus a fullDiskHealthServiceSMART enumeration just to name storage sensors — data the sampler discards (it stores only CPU/GPU temps). AddedReadAllAsync(includeStorage: false)that skips that; the sampler uses it. ~8,640 needless WMI/SMART enumerations/day eliminated on a tray-minimized session. The Dashboard keeps the full read (defaulttrue) — no behavior change there.LoadAsyncparsed the whole file every time (perf, HIGH). Up to ~260k lines at 30-day retention, allocating a sample per line then discarding 99% for a "last hour" view. It now reads from the newest end and stops at the cutoff, bounding work to the requested window.Disposedisposed_fileLockwithout awaiting the sampler loop, so an in-flightRelease()could hit a disposed semaphore at shutdown (caught+logged, but a real race).Disposenow waits (bounded 2s) for the loop to cancel first, guardsReleasewith_disposed, andPruneAsynctakes a cancellation token.Tests
Downsampleboundary tests: maxPoints 0 (clamp), 1 (averages whole series), exactly-N (unchanged), partial-GPU-nulls (averages over present values only).Docs
CHANGELOG 1.51.3, version bump to 1.51.3.
Part of the post-feature audit remediation (Batch 3 of 6).