Repository navigation
Refactor FFM PDH utility and remove dead constants - #3165
Conversation
Rename PdhUtilFFM to PerfDataUtilFFM, paralleling PerfDataUtil on the JNA side. Generalize the hardcoded handle count query into a reusable queryCounter(object, instance, counter) method. Update the caller in WindowsFileSystemFFM to use constants from PerfmonConstants and HandleCountProperty instead of hardcoded strings. Remove unused delegated constants from PerfCounterQuery that were left over from the perfmon enum refactoring to oshi-common.
|
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 (3)
💤 Files with no reviewable changes (1)
📜 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). (9)
🧰 Additional context used🧠 Learnings (3)📓 Common learnings📚 Learning: 2026-03-29T20:03:00.830ZApplied to files:
📚 Learning: 2026-04-03T02:07:47.621ZApplied to files:
🔇 Additional comments (2)
📝 WalkthroughWalkthroughThis refactor consolidates Windows performance counter querying logic by replacing the specialized Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
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 #3165 +/- ##
==========================================
- Coverage 58.14% 58.11% -0.03%
==========================================
Files 324 324
Lines 17375 17382 +7
Branches 3066 3068 +2
==========================================
- Hits 10102 10101 -1
- Misses 5788 5805 +17
+ Partials 1485 1476 -9
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:
|
Summary
Rename
PdhUtilFFMtoPerfDataUtilFFM, parallelingPerfDataUtilon the JNA side. Generalize the hardcoded handle count query into a reusablequeryCounter(object, instance, counter)method. Update the caller inWindowsFileSystemFFMto use constants fromPerfmonConstantsandHandleCountPropertyinstead of hardcoded strings.Remove unused delegated constants from
PerfCounterQuerythat were left over from the perfmon enum refactoring to oshi-common.Changes
PdhUtilFFM→PerfDataUtilFFM: Renamed and generalizedgetOpenFileDescriptors()intoqueryCounter(String object, String instance, String counter)that builds the counter path from parameters and returns the value (or -1 on failure). Fixed resource safety: query handle is null-checked infinallyto handle the case wherequeryPtr.get()throws afterPdhOpenQuerysucceeds.WindowsFileSystemFFM: Updated to callPerfDataUtilFFM.queryCounter(PROCESS, TOTAL_INSTANCE, HandleCountProperty.HANDLECOUNT.getCounter())using shared constants.PerfCounterQuery: Removed 5 dead delegated constants (TOTAL_INSTANCE,TOTAL_OR_IDLE_INSTANCES,TOTAL_INSTANCES,NOT_TOTAL_INSTANCE,NOT_TOTAL_INSTANCES) that just pointed toPerfmonConstantswith no remaining callers.Summary by CodeRabbit