feat: Add AIX platform support to common package with uptime and boot time functions#1979
Conversation
aabd2f6 to
9649184
Compare
9649184 to
49f0e76
Compare
shirou
left a comment
There was a problem hiding this comment.
Overall LGTM, but could you check my comment? Thanks!
Done, addressed, and ready for your re-review. Is there anything I can do for you or help with to accelerate your review/testing of this PR set? I can help with temporary access to an AIX system if that would help. I would just need a more private contact for you. If you're on the CNCF Slack, we could chat there. |
shirou
left a comment
There was a problem hiding this comment.
LGTM! common.timeSince is the same as the one in host/host.go. I'll open another PR to have host.go use this common function. Thanks!
That is handled by one of my follow on PRs EDIT: Nevermind, I seem to have missed that one. :) |
Description
This PR adds comprehensive AIX (ppc64) platform support to the gopsutil common package.
Part 1 of splitting #1969: Prerequisites
Changes
common_aix.gomodule providing:BootTimeWithContext(): Calculates system boot timeUptimeWithContext(): Retrieves system uptime using ps commandParseUptime(): Parses ps etimes output into total minutes, handling multiple time formatshost_aix.goto delegate uptime/boot time functions to common packagecommon_aix_test.gocovering valid and invalid uptime parsing scenariosImplementation Details
The AIX implementation uses
ps -o etimes -p 1to retrieve the elapsed time for PID 1, which supports the following formats:DAYS-HOURS:MINUTES:SECONDS(e.g., "124-01:40:39")HOURS:MINUTES:SECONDS(e.g., "15:03:02")MINUTES:SECONDS(e.g., "01:02" on just-rebooted systems)This approach is more robust than parsing the
uptimecommand output and provides better accuracy for the AIX platform.