Skip to content

SapMachine #2392: Add load average to vitals - #2409

Open
schmelter-sap wants to merge 11 commits into
SAP:sapmachinefrom
schmelter-sap:two-sample-vitals
Open

SapMachine #2392: Add load average to vitals#2409
schmelter-sap wants to merge 11 commits into
SAP:sapmachinefrom
schmelter-sap:two-sample-vitals

Conversation

@schmelter-sap

Copy link
Copy Markdown
Member

The change adds a load average value for all operating systems.

It only uses one value as the load average which tries to be specific for the sample interval of vitals. For the long term values the load average is defined as the short term values averaged over the sample interval of the long term table.

This change adds the ability to use different values for entries in the long term table. Until now that value in the long term table is just the same as in the short term table for the given timestamp. This is OK for some types of values but, for others a value which more represents the sample interval of the long term table might be better.

We also split up the initialization of the vitals system into two phases, since we don't want to start the sampler thread until the himem report system is initialized too (otherwise there is a race condition).

And finally some traces were improved.

fixes #2392

@sapmachine-bot

Copy link
Copy Markdown
Contributor

Hello @schmelter-sap, this pull request fulfills all formal requirements.

@schmelter-sap
schmelter-sap requested review from MBaesken, RealCLanger and ansteiner and removed request for MBaesken September 11, 2026 11:28
@MBaesken

MBaesken commented Sep 11, 2026

Copy link
Copy Markdown
Member

Ohh nooo, AIX fails to compile! But I see a commit dealing with AIX so I wonder if this is already fixed??

@ansteiner

ansteiner commented Sep 11, 2026

Copy link
Copy Markdown
Member

Ohh nooo, AIX fails to compile! But I see a commit dealing with AIX so I wonder if this is already fixed??

I think there is no getloadavg() on AIX. Isn't it? Have to use perfstat_cpu_total.

@schmelter-sap

Copy link
Copy Markdown
Member Author

Ohh nooo, AIX fails to compile! But I see a commit dealing with AIX so I wonder if this is already fixed??

I think there is no getloadavg() on AIX. Isn't it? Have to use perfstat_cpu_total.

There is an implementation for os::loadavg() on aix at least. And that's what I wanted to use, but the "os" part is missing.

@sapmachine-bot

Copy link
Copy Markdown
Contributor

Hello @schmelter-sap, this pull request fulfills all formal requirements.

@MBaesken

Copy link
Copy Markdown
Member

The column is named
'Load average of system in percent'
but on some platforms
'Load average in the sample interval in percent'
is this intentional?
Is it NOT of the system in the second case ?

@MBaesken

MBaesken commented Sep 11, 2026

Copy link
Copy Markdown
Member

From the info I find, the PDH stuff (e.g. PROCESSOR_TIME) might be localized.
Seems this is the reason the OpenJDK codebase uses indices and not those 'paths', there are some potentially useful comments and code here

https://github.com/openjdk/jdk/blob/af4116009d8567aab8f23a04fc79e801b52f60d4/src/hotspot/os/windows/os_perf_windows.cpp#L71
https://github.com/openjdk/jdk/blob/af4116009d8567aab8f23a04fc79e801b52f60d4/src/jdk.management/windows/native/libmanagement_ext/OperatingSystemImpl.c#L292

(there are also english-name counter functions, maybe those help too to get around issues on non-english Windows https://learn.microsoft.com/en-us/windows/win32/api/pdh/nf-pdh-pdhaddenglishcounterw)

@schmelter-sap

Copy link
Copy Markdown
Member Author

From the info I find, the PDH stuff (e.g. PROCESSOR_TIME) might be localized.

According to the SAPJVM code this doesn't matter from Vista onward. But I can test it on my machine.

@MBaesken

MBaesken commented Sep 11, 2026

Copy link
Copy Markdown
Member

Maybe the comments in os_perf_windows about this localization stuff
https://github.com/openjdk/jdk/blob/af4116009d8567aab8f23a04fc79e801b52f60d4/src/hotspot/os/windows/os_perf_windows.cpp#L42
are a little outdated, who knows.

Fun side fact , if the docu is correct, the language neutral helper PdhAddEnglishCounterW https://learn.microsoft.com/en-us/windows/win32/api/pdh/nf-pdh-pdhaddenglishcounterw
requires Vista or higher. So we would have a helper on OS , where the helper is not needed any more !??

@schmelter-sap

Copy link
Copy Markdown
Member Author

The column is named
'Load average of system in percent' ...

Ups, that is the initial description. I later changed to do indicate it covers the sample interval of the table.

@schmelter-sap

schmelter-sap commented Sep 11, 2026

Copy link
Copy Markdown
Member Author

So we would have a helper on OS , where the helper is not needed any more

Good question. It doesn't seem to make sense. I will switch to PdhAddEnglishCounterW.

Edit:
Or not. I'll look into the counter-base access, since otherwise I would have to touch the pdh_interface code and I want to keep this change to SapMachine code only.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add load average to vitals

4 participants