Add Intel GPU usage monitoring support via PDH and DXGI#1295
Merged
Conversation
Contributor
Rust Backend Coverage ReportCoverage Details |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds Windows Intel GPU usage monitoring by matching DXGI adapter LUIDs to PDH “GPU Engine” counters, integrating this into both the periodic monitoring sampler and the Windows platform GPU-usage query path.
Changes:
- Add Intel GPU sampling in the monitoring service using cached DXGI LUID info + PDH per-LUID engine utilization.
- Extend the Windows PDH provider with per-LUID caching and a new
query_gpu_usage_by_luid_and_engineAPI. - Add a DirectX helper to enumerate Intel adapters with LUIDs and prefer this path in the Windows GPU usage resolver before generic PDH fallback.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src-tauri/src/services/monitoring_service.rs | Adds Intel GPU sampling path (DXGI LUID cache + PDH utilization) to the Windows monitoring loop. |
| src-tauri/src/platform/windows/gpu.rs | Prefers Intel-specific PDH-by-LUID lookup (via DXGI) before generic PDH fallback. |
| src-tauri/src/infrastructure/providers/windows/pdh_provider.rs | Introduces per-LUID engine utilization cache, parsing LUID from PDH instances, and a new per-LUID query API. |
| src-tauri/src/infrastructure/providers/windows/directx.rs | Adds GpuLuidInfo and a DXGI-based Intel LUID enumeration helper for PDH matching. |
… layer - Add `get_intel_gpu_luid_info_cached()` in directx.rs to avoid recreating DXGI factory on every call; use it from both gpu.rs and monitoring_service.rs - Replace `Factory::new().expect()` with proper `map_err`/`?` error propagation in `get_intel_gpu_luid_info` - Document `ensure_fresh_data` TTL semantics (no-op within TTL is intentional since PDH collects all counters in one call)
- Initialize cache_time to an expired value so the first query always triggers a PDH collection instead of returning a false cache miss - Parse LUID HighPart as u32 then cast to i32 so values >= 0x80000000 are handled correctly (e.g. 0xFFFFFFFF → -1) - Add tests for negative HighPart and uppercase 0X hex prefix
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.
Summary
Related Issues
Type of Change
fix/branch)feat/branch)refactor/branch)docs/branch)chore/branch)Screenshots / Videos
Test Plan
Checklist
npm run lint && npm run format/cargo tauri-lint && cargo tauri-fmt)npm test/cargo tauri-test)