Skip to content

JDK-8030957 - AIX: Implement OperatingSystemMXBean.getSystemCpuLoad() and .getProcessCpuLoad() on AIX #25332

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

suchismith1993
Copy link
Contributor

@suchismith1993 suchismith1993 commented May 20, 2025

JBS Issue : JDK-8030957

These two methods should be implemented in src/aix/native/sun/management/AixOperatingSystem.c (which has to be created).

getProcessCpuLoad() can be probably implemented in the same way like on Solaris be reading /proc/self/psinfo

For getSystemCpuLoad() we'll probalby have to use 'perfstat_cpu_total()' from libperf (see http://publib.boulder.ibm.com/infocenter/pseries/v5r3/topic/com.ibm.aix.prftools/doc/prftools/prftools07.htm#wq407)

Once this issue has been resolved you should not forget to remove the two excludes from jdk/test/ProblemList.txt:

com/sun/management/OperatingSystemMXBean/GetProcessCpuLoad.java aix-all
com/sun/management/OperatingSystemMXBean/GetSystemCpuLoad.java aix-all


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Error

 ⚠️ 8030957 is used in problem lists: [test/jdk/ProblemList.txt]

Issue

  • JDK-8030957: AIX: Implement OperatingSystemMXBean.getSystemCpuLoad() and .getProcessCpuLoad() on AIX (Enhancement - P4)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/25332/head:pull/25332
$ git checkout pull/25332

Update a local copy of the PR:
$ git checkout pull/25332
$ git pull https://git.openjdk.org/jdk.git pull/25332/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 25332

View PR using the GUI difftool:
$ git pr show -t 25332

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/25332.diff

@bridgekeeper
Copy link

bridgekeeper bot commented May 20, 2025

👋 Welcome back sroy! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented May 20, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk
Copy link

openjdk bot commented May 20, 2025

@suchismith1993 The following labels will be automatically applied to this pull request:

  • jmx
  • serviceability

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.

}

ret = perfstat_cpu_total(NULL, &cpu_total, sizeof(perfstat_cpu_total_t), 1);
if (ret <= 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that we check for retval < 0 in os_perf_aix.cpp, should we align this in some way ?

@MBaesken
Copy link
Member

Are you sure the perfstat functionality is always available ?
In HS we do dynamic resolution (see e.g. os_perf_aix.cpp), but maybe that was needed long time ago and is not really needed any more? But please check this .

@suchismith1993
Copy link
Contributor Author

Are you sure the perfstat functionality is always available ? In HS we do dynamic resolution (see e.g. os_perf_aix.cpp), but maybe that was needed long time ago and is not really needed any more? But please check this .

I tried with a standalone program and did not face any issues.

@suchismith1993
Copy link
Contributor Author

@MBaesken would it be possible for you to try this patch once to see if the load values are realistic / accurate ?
Else if you can provide some use case that I can try.

@MBaesken
Copy link
Member

Are you sure the perfstat functionality is always available ? In HS we do dynamic resolution (see e.g. os_perf_aix.cpp), but maybe that was needed long time ago and is not really needed any more? But please check this .

I tried with a standalone program and did not face any issues.

I was more thinking about different AIX machines setups/OS levels/installations. Is the perfstat functionality always there 'these days' ?

@MBaesken
Copy link
Member

would it be possible for you to try this patch once to see if the load values are realistic / accurate ?

Not 100% sure how, should we compare with values provided by other tools (system tools etc.) ?

@suchismith1993
Copy link
Contributor Author

Are you sure the perfstat functionality is always available ? In HS we do dynamic resolution (see e.g. os_perf_aix.cpp), but maybe that was needed long time ago and is not really needed any more? But please check this .

I tried with a standalone program and did not face any issues.

I was more thinking about different AIX machines setups/OS levels/installations. Is the perfstat functionality always there 'these days' ?

Hi @MBaesken It seems perfstat is available since AIX 5. I see there is dynamic loading done in libperfstat.cpp. How to confirm if that is necessary ? I did not face issues in this program and also standalone C++ program on AIX 7.2

@MBaesken
Copy link
Member

MBaesken commented Jul 8, 2025

How to confirm if that is necessary ? I did not face issues in this program and also standalone C++ program on AIX 7.2

We did this not only because of (un)availability of libperfstat , but also to address different versions (with different functionality) of libperfstat at runtime.

@MBaesken
Copy link
Member

MBaesken commented Jul 8, 2025

If we only address minimum AIX 7.2 we can probably simplify this approach or even go away from the current dynamic loading approach.
See also https://bugs.openjdk.org/browse/JDK-8222719 where I did already some cleanup (but kept the AIX 7.1 vs. 7.2 ) .

@suchismith1993 suchismith1993 force-pushed the cpuprocessload branch 2 times, most recently from 2c85db9 to 0df6b81 Compare July 9, 2025 14:49
@suchismith1993 suchismith1993 force-pushed the cpuprocessload branch 2 times, most recently from 7b5b0f5 to 283fe5d Compare July 9, 2025 15:10
@MBaesken
Copy link
Member

There is still an fflush(stdout); in UnixOperatingSystem.c - guess this is not needed any more?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants