Repository navigation
Extract AixOperatingSystem base and shared perfstat process carrier - #3469
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (11)
🚧 Files skipped from review as they are similar to previous changes (10)
📜 Recent review details⏰ Context from checks skipped due to timeout. (12)
🧰 Additional context used🧠 Learnings (1)📚 Learning: 2026-07-06T19:25:59.225ZApplied to files:
🔇 Additional comments (1)
📝 WalkthroughWalkthroughChangesThe AIX implementation now shares a common perfstat process data carrier and abstract operating-system layer. JNA and FFM backends provide platform-specific hooks, while common process, service, timing, application, and rlimit behavior is centralized. AIX OS abstraction
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant AixOperatingSystemJNA
participant AixOperatingSystemFFM
participant AixOperatingSystem
participant PerfstatProcessJNA
participant PerfstatProcessFFM
participant AixOSProcess
AixOperatingSystemJNA->>AixOperatingSystem: provide JNA platform hooks
AixOperatingSystemFFM->>AixOperatingSystem: provide FFM platform hooks
AixOperatingSystem->>PerfstatProcessJNA: query JNA process records
AixOperatingSystem->>PerfstatProcessFFM: query FFM process records
PerfstatProcessJNA-->>AixOperatingSystem: AixPerfstatProcess[]
PerfstatProcessFFM-->>AixOperatingSystem: AixPerfstatProcess[]
AixOperatingSystem->>AixOSProcess: create and update process
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3469 +/- ##
============================================
- Coverage 75.24% 75.20% -0.04%
Complexity 76 76
============================================
Files 589 589
Lines 21528 21528
Branches 3592 3592
============================================
- Hits 16198 16190 -8
Misses 3378 3378
- Partials 1952 1960 +8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@oshi-common/src/main/java/oshi/driver/common/unix/aix/AixPerfstatProcess.java`:
- Around line 19-24: Update the field documentation for proc_real_mem_data,
proc_real_mem_text, and real_inuse in the perfstat process structure to state
that the values are reported in kilobytes, replacing the incorrect “pages”
wording; leave the fields and downstream conversion unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 25e3a325-1d59-4e49-93bd-e00df9cc737c
📒 Files selected for processing (11)
config/checkstyle-suppressions.xmloshi-common/src/main/java/oshi/driver/common/unix/aix/AixPerfstatProcess.javaoshi-common/src/main/java/oshi/software/common/os/unix/aix/AixOSProcess.javaoshi-common/src/main/java/oshi/software/common/os/unix/aix/AixOperatingSystem.javaoshi-core-ffm/src/main/java/oshi/driver/unix/aix/perfstat/PerfstatProcessFFM.javaoshi-core-ffm/src/main/java/oshi/software/os/unix/aix/AixOSProcessFFM.javaoshi-core-ffm/src/main/java/oshi/software/os/unix/aix/AixOperatingSystemFFM.javaoshi-core/src/main/java/oshi/driver/unix/aix/perfstat/PerfstatProcessJNA.javaoshi-core/src/main/java/oshi/software/os/unix/aix/AixOSProcessJNA.javaoshi-core/src/main/java/oshi/software/os/unix/aix/AixOperatingSystemJNA.javaoshi-core/src/test/java/oshi/driver/unix/aix/perfstat/PerfstatJNATest.java
📜 Review details
⏰ Context from checks skipped due to timeout. (14)
- GitHub Check: Codacy Static Code Analysis
- GitHub Check: Test JDK 26, macos-latest
- GitHub Check: Test JDK 25, macos-latest (+ JNA==FFM)
- GitHub Check: Test JDK 26, windows-latest
- GitHub Check: Test JDK 21, windows-latest
- GitHub Check: Test JDK 25, ubuntu-latest (+ JNA==FFM)
- GitHub Check: Test JDK 21, macos-latest
- GitHub Check: Test JDK 26, ubuntu-latest
- GitHub Check: Test JDK 25, windows-latest (+ JNA==FFM)
- GitHub Check: Lint (Spotless, Checkstyle, ForbiddenAPIs, Javadoc)
- GitHub Check: Test JDK 25, FreeBSD (+ JNA==FFM)
- GitHub Check: Test JDK 25, OpenBSD (+ JNA==FFM)
- GitHub Check: Test JDK 25, OpenIndiana (+ JNA==FFM)
- GitHub Check: Analyze (java)
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2026-04-12T19:22:09.716Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3149
File: oshi-common/src/main/java/oshi/hardware/common/platform/mac/MacCentralProcessor.java:159-163
Timestamp: 2026-04-12T19:22:09.716Z
Learning: When reviewing OSHI hardware platform code that uses or implements `CentralProcessor`/`PhysicalProcessor.getEfficiency()`, remember the API’s counterintuitive semantics: a *higher* efficiency-class value indicates *greater performance* (lower efficiency). P-cores/“performance cores” should therefore have higher values (e.g., 1) than E-cores/“efficiency cores” (e.g., 0), as documented in the `CentralProcessor` Javadoc. Do not flag code as incorrect solely because ARM_P_CORES or Intel P-cores are assigned higher efficiency values.
Applied to files:
oshi-common/src/main/java/oshi/driver/common/unix/aix/AixPerfstatProcess.javaoshi-common/src/main/java/oshi/software/common/os/unix/aix/AixOperatingSystem.javaoshi-common/src/main/java/oshi/software/common/os/unix/aix/AixOSProcess.java
📚 Learning: 2026-07-06T19:25:59.225Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3432
File: oshi-common/src/main/java/oshi/util/ExceptionUtil.java:26-56
Timestamp: 2026-07-06T19:25:59.225Z
Learning: In this repo’s SLF4J 1.x-compatible logging code, do not flag cases where a logger call uses SLF4J 1.6+ implicit-cause handling—e.g., `log.error("...{}", value, t)` (or similar with a single `{}` placeholder) where `t` is passed as the final/trailing argument. SLF4J will attach `t` as the log event’s cause with the full stack trace; this is equivalent to SLF4J 2.x’s fluent `atLevel(...).setCause(t).log(...)` and is intentionally used to preserve SLF4J 1.x runtime compatibility.
Applied to files:
oshi-common/src/main/java/oshi/driver/common/unix/aix/AixPerfstatProcess.javaoshi-core/src/main/java/oshi/driver/unix/aix/perfstat/PerfstatProcessJNA.javaoshi-core-ffm/src/main/java/oshi/driver/unix/aix/perfstat/PerfstatProcessFFM.javaoshi-core-ffm/src/main/java/oshi/software/os/unix/aix/AixOSProcessFFM.javaoshi-common/src/main/java/oshi/software/common/os/unix/aix/AixOperatingSystem.javaoshi-common/src/main/java/oshi/software/common/os/unix/aix/AixOSProcess.javaoshi-core/src/main/java/oshi/software/os/unix/aix/AixOSProcessJNA.javaoshi-core/src/main/java/oshi/software/os/unix/aix/AixOperatingSystemJNA.javaoshi-core-ffm/src/main/java/oshi/software/os/unix/aix/AixOperatingSystemFFM.java
📚 Learning: 2026-04-06T04:45:47.644Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3121
File: oshi-core/src/main/java/oshi/software/os/linux/LinuxOperatingSystem.java:53-53
Timestamp: 2026-04-06T04:45:47.644Z
Learning: In the oshi/oshi project, only interfaces and classes in the root packages `oshi`, `oshi.hardware`, and `oshi.software.os` are considered the public API. Code in subpackages that represent specific implementations/platforms (e.g., `oshi.software.os.linux`, `oshi.hardware.platform.linux`, and similar subpackages) is implementation detail. When reviewing, do not treat changes to classes in these platform-specific subpackages as public API breaks (for example: making `LinuxOperatingSystem` abstract, narrowing constructor visibility, or adding/removing abstract methods should not be flagged as breaking public API).
Applied to files:
oshi-core/src/main/java/oshi/software/os/unix/aix/AixOSProcessJNA.javaoshi-core/src/main/java/oshi/software/os/unix/aix/AixOperatingSystemJNA.java
🔇 Additional comments (11)
oshi-common/src/main/java/oshi/driver/common/unix/aix/AixPerfstatProcess.java (1)
1-18: LGTM!Also applies to: 25-29
config/checkstyle-suppressions.xml (1)
53-57: LGTM!oshi-core-ffm/src/main/java/oshi/driver/unix/aix/perfstat/PerfstatProcessFFM.java (1)
25-25: LGTM!Also applies to: 49-78
oshi-core/src/main/java/oshi/driver/unix/aix/perfstat/PerfstatProcessJNA.java (1)
12-12: LGTM!Also applies to: 38-64
oshi-core/src/test/java/oshi/driver/unix/aix/perfstat/PerfstatJNATest.java (1)
30-30: LGTM!Also applies to: 86-90
oshi-common/src/main/java/oshi/software/common/os/unix/aix/AixOperatingSystem.java (1)
1-251: LGTM!oshi-common/src/main/java/oshi/software/common/os/unix/aix/AixOSProcess.java (1)
20-20: LGTM!Also applies to: 40-48, 60-77, 103-113
oshi-core/src/main/java/oshi/software/os/unix/aix/AixOperatingSystemJNA.java (1)
15-67: LGTM!oshi-core-ffm/src/main/java/oshi/software/os/unix/aix/AixOperatingSystemFFM.java (1)
12-49: LGTM!Also applies to: 71-72
oshi-core-ffm/src/main/java/oshi/software/os/unix/aix/AixOSProcessFFM.java (1)
19-19: LGTM!Also applies to: 36-38, 52-61
oshi-core/src/main/java/oshi/software/os/unix/aix/AixOSProcessJNA.java (1)
18-18: LGTM!Also applies to: 35-37, 51-56
AIX was the only platform whose OperatingSystem JNA and FFM twins extended AbstractOperatingSystem directly, with no common base, so they duplicated the service/version/boot-time/installed-app logic and the perfstat-driven process and thread enumeration. Introduce a backend-neutral AixPerfstatProcess carrier (oshi-common) holding the perfstat_process fields OSHI consumes; PerfstatProcessJNA maps its JNA struct into it and PerfstatProcessFFM returns it in place of its private ProcessInfo POJO. On top of that, extract an AixOperatingSystem base holding all the shared logic plus the carrier-typed process/thread enumeration. The twins keep only hooks: the perfstat/partition-config reads, the native process/thread IDs, and the OSProcess/InternetProtocolStats/NetworkParams factories. AixOSProcess also unifies: its procCpu iteration (updateAttributes) and the getrlimit open-file-limit skeleton move into the base behind an AixPerfstatProcess[] supplier and a queryRlimitNofile hook, so the twins keep only the native getrlimit, affinity, and address-space reads. Behavior-preserving refactor; no CHANGELOG.
Part of the cross-OS consistency/dedup audit (OperatingSystem subsystem — AIX). AIX was the largest remaining single duplication hotspot: it is the only platform whose
OperatingSystemJNA and FFM twins extendAbstractOperatingSystemdirectly, with no common base, so they duplicated ~200 lines.Shared perfstat carrier
New
oshi.driver.common.unix.aix.AixPerfstatProcess(oshi-common) — a backend-neutral POJO holding theperfstat_process_tfields OSHI consumes.PerfstatProcessJNAnow maps its JNAStructurearray into this carrier, andPerfstatProcessFFMreturns it in place of its own privateProcessInfoPOJO. Both drivers therefore hand back the same type.AixOperatingSystem base
New abstract
AixOperatingSystem(oshi-common) holds all the shared logic —getServices, version/manufacturer, boot time, installed applications, and the perfstat-drivenqueryAllProcesses/getProcess/getProcessCount/getThreadCount/getCurrentThread(operating on the carrier). The JNA and FFM twins collapse from ~254/253 lines to ~72/78, providing only hooks:queryPerfstatProcesses()— the perfstat array (via the driver),queryOsBuildRaw()/is64BitKernel()— the partition-config reads,createProcess(...)— theOSProcessfactory,getProcessId/getThreadIdand theInternetProtocolStats/NetworkParamsfactories.The partition-config POJO is intentionally not promoted to a shared carrier — its other fields feed
AixCentralProcessor/AixGlobalMemory, out of scope here — so config access stays as the two small hooks above.AixOSProcess
With the carrier in place,
AixOSProcess's duplicatedprocCpuiteration (updateAttributes) and itsgetrlimit-based open-file-limit skeleton move into the base (behind anAixPerfstatProcess[]supplier and aqueryRlimitNofile(boolean)hook, matching the BsdOSProcess pattern). The twins keep only the nativegetrlimit, the affinity supplier, and thequeryArgsEnvaddress-space read.No CHANGELOG entry: behavior is identical.
Local gate: spotless, checkstyle (the carrier is added to the existing AIX perfstat-POJO suppression), forbiddenapis, javadoc, and a clean full-reactor build all pass; oshi-common and oshi-core tests pass (
PerfstatJNATestupdated for the new return type). AIX runtime, including JNA==FFM parity, is validated on the compile farm (dispatched separately, since cfarm does not run on pull requests).Summary by CodeRabbit