Repository navigation
Filter WMI handle count query to _Total instance - #3166
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (2)
📜 Recent review details⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
🧰 Additional context used🧠 Learnings (4)📚 Learning: 2026-03-29T20:03:00.830ZApplied to files:
📚 Learning: 2026-04-08T00:58:10.736ZApplied to files:
📚 Learning: 2026-04-06T04:45:47.644ZApplied to files:
📚 Learning: 2026-04-12T19:22:09.716ZApplied to files:
🔇 Additional comments (2)
📝 WalkthroughWalkthroughAdded a new PERFMON constant to target the "_Total" process instance and refactored handle-count collection to query that aggregate directly (method signature changed to return a single-value map). Tests and callers were updated to use the new constant and the new return shape. Changes
Sequence Diagram(s)sequenceDiagram
rect rgba(200,220,255,0.5)
participant App as Client (WindowsFileSystem)
participant PI as ProcessInformationJNA
participant PC as PerfCounterQuery (PDH/WMI)
participant CONST as PerfmonConstants
end
App->>PI: getOpenFileDescriptors()
PI->>CONST: use WIN32_PERFPROC_PROCESS_WHERE_NAME_TOTAL
PI->>PC: queryValues(counterDefs, WIN32_PERFPROC_PROCESS_WHERE_NAME_TOTAL)
PC-->>PI: Map<HandleCountProperty, Long> (aggregate _Total)
PI-->>App: value for HANDLECOUNT (or 0L)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3166 +/- ##
==========================================
+ Coverage 58.06% 58.12% +0.06%
==========================================
Files 324 324
Lines 17382 17376 -6
Branches 3068 3066 -2
==========================================
+ Hits 10092 10100 +8
+ Misses 5804 5789 -15
- Partials 1486 1487 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Change HandleCountProperty from PdhCounterWildcardProperty to PdhCounterProperty with a _Total instance. This switches queryHandles() from PerfCounterWildcardQuery (which enumerates all process instances) to PerfCounterQuery (which queries _Total directly), with WMI fallback filtered to WHERE Name="_Total". Simplify WindowsFileSystem.getOpenFileDescriptors() to read the single value directly instead of iterating a list.
4175568 to
529f7b3
Compare
The
queryHandles()WMI fallback was querying all processes fromWin32_PerfRawData_PerfProc_Processwithout a WHERE clause, returning every process row when only the_Totalinstance is needed. This adds aWHERE Name="_Total"filter to match the PDH instance filter already defined inHandleCountProperty.Changes
PerfmonConstants: AddedWIN32_PERFPROC_PROCESS_WHERE_NAME_TOTALconstant.ProcessInformationJNA.queryHandles(): Use filtered WMI class instead of unfilteredWIN32_PERFPROC_PROCESS.PerfmonDriversTest.testQueryHandles(): Updated WMI test to use the filtered class.Summary by CodeRabbit