Repository navigation
feat: add disk activity history on the Performance page - #30
Conversation
Sample physical-disk byte counters on the existing system worker and draw active time with the same history graph as CPU and memory. Co-authored-by: jameslincn <jameslincn@outlook.sg>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 247cd9e8ac
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let ok = unsafe { | ||
| DeviceIoControl( | ||
| handle, | ||
| IOCTL_DISK_PERFORMANCE, |
There was a problem hiding this comment.
Balance each disk-performance enable request
On every successful periodic sample, this issues IOCTL_DISK_PERFORMANCE again without ever issuing IOCTL_DISK_PERFORMANCE_OFF. Microsoft documents that the former increments a reference counter and that the latter disables counters enabled by previous calls, so the worker continually accumulates enable references and releases none when a drive disappears or the collector stops, potentially leaving system-wide disk-statistics collection enabled after exit. Track and balance successful enables, including the worker shutdown path.
AGENTS.md reference: AGENTS.md:L48-L50
Useful? React with 👍 / 👎.
Each successful IOCTL_DISK_PERFORMANCE increments the driver's reference count. Track those successes, keep one enable while the handle is open, and issue IOCTL_DISK_PERFORMANCE_OFF for the rest, including worker shutdown and a drive that disappears. Co-authored-by: jameslincn <jameslincn@outlook.sg>
Summary
Adds disk activity history on the Performance page, in the same style as the CPU and memory graphs.
IOCTL_DISK_PERFORMANCEon\\.\PhysicalDriveNand keeps those handles open. Refresh does not open processes. A failed read leaves the byte and timing baselines in place.IOCTL_DISK_PERFORMANCEincrements the driver's enable reference. The collector keeps one enable while the handle is open and issuesIOCTL_DISK_PERFORMANCE_OFFfor every other success. Dropping the drive — worker shutdown, or the drive disappearing — releases whatever remains beforeCloseHandle. A failed IOCTL does not add a reference. A disable that fails leaves that reference outstanding and is reported once.u64replace the baseline and do not publish a point. A zero query interval publishes nothing and keeps the previous baseline.u64. The graph is active time, 0–100, in the same ring buffer and grid used by the other performance graphs. The UI thread only lays out and paints.TextKeyand every locale. No new menu command.Optionsis unchanged.Tests
u64, or a sum of drive rates that overflowsu64, does not publish.Verification
This host is Linux.
cargo fmt --all -- --checkpassed.cargo clippy --all-targets --locked -- -D warningspassed forx86_64-pc-windows-msvc,i686-pc-windows-msvc, andaarch64-pc-windows-msvc.cargo build --release --locked --target x86_64-pc-windows-msvcstops becauselink.exeis not on this machine, so the disk unit tests were type-checked and not executed here. These checks are not a Windows device test.CI on this PR runs Quality (x86_64) and Architecture (i686, aarch64), including the Windows test and release builds. Hands-on disk graph behavior on a Windows device is still pending.