jmx-dev RFR: 8335625: Update Javadoc for GetCpuLoad [v2]

Joakim Nordström jnordstrom at openjdk.org
Wed Aug 21 13:42:18 UTC 2024


> Can I get a review of this documentation update to clarify the usage of GetCpuLoad (and inherently deprecated GetSystemCpuLoad) and GetProcessCpuLoad.
> 
> Calling either of these methods in quick succession can lead to unrepresentative results due to too few data points.
> 
> This behavior is easy to reproduce on at least Linux (Windows implementation enforces a 500 ticks duration); when calling GetCpuLoad repeatedly CPU load values of either 0, 0.5, or 1 will be returned.
> 
> double cpuLoad1 = getCpuLoad();
> double cpuLoad2 = getCpuLoad();   // not enough ticks has passed to give representative values
> 
> Worth noting is that this holds true even if getSystemCpuLoad() is called. 
> 
> double cpuLoad1 = getCpuLoad();
> double cpuLoad2 = getSystemCpuLoad();   // not enough ticks has passed to give representative values, since getSystemCpuLoad effectively calls getCpuLoad.

Joakim Nordström has updated the pull request incrementally with one additional commit since the last revision:

  Made it an apiNote

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/20546/files
  - new: https://git.openjdk.org/jdk/pull/20546/files/88c10534..07b0faa6

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=20546&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=20546&range=00-01

  Stats: 11 lines in 1 file changed: 0 ins; 1 del; 10 mod
  Patch: https://git.openjdk.org/jdk/pull/20546.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/20546/head:pull/20546

PR: https://git.openjdk.org/jdk/pull/20546


More information about the jmx-dev mailing list