Skip to content

Commit 64a79d8

Browse files
committed
8335625: Update Javadoc for GetCpuLoad
Reviewed-by: alanb, kevinw
1 parent c246ede commit 64a79d8

File tree

1 file changed

+41
-13
lines changed

1 file changed

+41
-13
lines changed

src/jdk.management/share/classes/com/sun/management/OperatingSystemMXBean.java

Lines changed: 41 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -130,18 +130,27 @@ public interface OperatingSystemMXBean extends
130130
public long getTotalMemorySize();
131131

132132
/**
133-
* Returns the "recent cpu usage" for the whole system. This value is a
133+
* Returns the "recent CPU usage" for the whole system. This value is a
134134
* double in the [0.0,1.0] interval. A value of 0.0 means that all CPUs
135135
* were idle during the recent period of time observed, while a value
136136
* of 1.0 means that all CPUs were actively running 100% of the time
137-
* during the recent period being observed. All values between 0.0 and
138-
* 1.0 are possible depending of the activities going on in the system.
139-
* If the system recent cpu usage is not available, the method returns a
137+
* during the recent period being observed.
138+
*
139+
* The recent period of observation is implementation-specific, and
140+
* typically relates to the duration since the last call made to this
141+
* method, or {@link #getCpuLoad()}. For the very first invocation, the
142+
* recent period of observation is undefined.
143+
*
144+
* All values between 0.0 and 1.0 are possible dependent on the activities
145+
* going on. If the recent CPU usage is not available, the method returns a
140146
* negative value.
141147
*
142148
* @deprecated Use {@link #getCpuLoad()} instead of
143149
* this historically named method.
144150
*
151+
* @apiNote Callers should be aware of the possibility of other callers
152+
* affecting the observation period and the result.
153+
*
145154
* @implSpec This implementation must return the same value
146155
* as {@link #getCpuLoad()}.
147156
*
@@ -153,32 +162,51 @@ public interface OperatingSystemMXBean extends
153162
public default double getSystemCpuLoad() { return getCpuLoad(); }
154163

155164
/**
156-
* Returns the "recent cpu usage" for the operating environment. This value
165+
* Returns the "recent CPU usage" for the operating environment. This value
157166
* is a double in the [0.0,1.0] interval. A value of 0.0 means that all CPUs
158167
* were idle during the recent period of time observed, while a value
159168
* of 1.0 means that all CPUs were actively running 100% of the time
160-
* during the recent period being observed. All values between 0.0 and
161-
* 1.0 are possible depending of the activities going on.
162-
* If the recent cpu usage is not available, the method returns a
169+
* during the recent period being observed.
170+
*
171+
* The recent period of observation is implementation-specific, and
172+
* typically relates to the duration since the last call made to this
173+
* method, or {@link #getSystemCpuLoad()}. For the very first invocation,
174+
* the recent period of observation is undefined.
175+
*
176+
* All values between 0.0 and 1.0 are possible dependent on the activities
177+
* going on. If the recent CPU usage is not available, the method returns a
163178
* negative value.
164179
*
180+
* @apiNote Callers should be aware of the possibility of other callers
181+
* affecting the observation period and the result.
182+
*
165183
* @return the "recent cpu usage" for the whole operating environment;
166184
* a negative value if not available.
167185
* @since 14
168186
*/
169187
public double getCpuLoad();
170188

171189
/**
172-
* Returns the "recent cpu usage" for the Java Virtual Machine process.
190+
* Returns the "recent CPU usage" for the Java Virtual Machine process.
173191
* This value is a double in the [0.0,1.0] interval. A value of 0.0 means
174192
* that none of the CPUs were running threads from the JVM process during
175193
* the recent period of time observed, while a value of 1.0 means that all
176194
* CPUs were actively running threads from the JVM 100% of the time
177195
* during the recent period being observed. Threads from the JVM include
178-
* the application threads as well as the JVM internal threads. All values
179-
* between 0.0 and 1.0 are possible depending of the activities going on
180-
* in the JVM process and the whole system. If the Java Virtual Machine
181-
* recent CPU usage is not available, the method returns a negative value.
196+
* the application threads as well as the JVM internal threads.
197+
*
198+
* The recent period of observation is implementation-specific, and
199+
* typically relates to the duration since the last call made to this
200+
* method. For the very first invocation, the recent period of observation
201+
* is undefined.
202+
*
203+
* All values between 0.0 and 1.0 are possible dependent on the activities
204+
* going on in the JVM process and the whole system. If the Java Virtual
205+
* Machine recent CPU usage is not available, the method returns a negative
206+
* value.
207+
*
208+
* @apiNote Callers should be aware of the possibility of other callers
209+
* affecting the observation period and the result.
182210
*
183211
* @return the "recent cpu usage" for the Java Virtual Machine process;
184212
* a negative value if not available.

0 commit comments

Comments
 (0)