Class JvmCpuMonitor
java.lang.Object
com.ibm.lang.management.internal.JvmCpuMonitor
- All Implemented Interfaces:
JvmCpuMonitorMXBean
,PlatformManagedObject
Runtime type for
JvmCpuMonitorMXBean
.
Implements getting CPU Usage for various JVM thread categories.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic JvmCpuMonitor
Singleton accessor method.Returns the object name of the MXBeangetThreadCategory
(long id) This function gets the current value of the thread category for the target thread.This function creates a newJvmCpuMonitorInfo
object and populates it with CPU usage statistics of the various thread categories.getThreadsCpuUsage
(JvmCpuMonitorInfo jcmInfo) This function updates the user providedJvmCpuMonitorInfo
object with CPU usage statistics of the various thread categories.int
setThreadCategory
(long id, String category) This function sets the thread category of the target thread.
-
Constructor Details
-
JvmCpuMonitor
public JvmCpuMonitor()
-
-
Method Details
-
getInstance
Singleton accessor method. Returns an instance ofJvmCpuMonitor
- Returns:
- a static instance of
JvmCpuMonitor
-
getObjectName
Returns the object name of the MXBean- Specified by:
getObjectName
in interfacePlatformManagedObject
- Returns:
- objectName representing the MXBean
-
getThreadsCpuUsage
This function updates the user providedJvmCpuMonitorInfo
object with CPU usage statistics of the various thread categories. The statistics are an aggregate across all CPUs of the operating system.- Specified by:
getThreadsCpuUsage
in interfaceJvmCpuMonitorMXBean
- Parameters:
jcmInfo
- User provided JvmCpuMonitorInfo object.- Returns:
- the updated JvmCpuMonitorInfo instance.
-
getThreadsCpuUsage
This function creates a newJvmCpuMonitorInfo
object and populates it with CPU usage statistics of the various thread categories. The statistics are an aggregate across all CPUs of the operating system.- Specified by:
getThreadsCpuUsage
in interfaceJvmCpuMonitorMXBean
- Returns:
- the new
JvmCpuMonitorInfo
instance.
-
setThreadCategory
This function sets the thread category of the target thread. Valid categories are- "Resource-Monitor"
- "Application"
- "Application-User1" through to "Application-User5"
- "Application" threads cannot be changed to any "System-JVM" category.
- Threads in the "System-JVM" category cannot be modified.
- Once a thread is designated as "Resource-Monitor", it cannot be changed.
- Specified by:
setThreadCategory
in interfaceJvmCpuMonitorMXBean
- Parameters:
id
- The target thread id for which the type needs to be set.category
- The category of the target thread.- Returns:
- -1 to indicate failure or 0 on success.
-
getThreadCategory
This function gets the current value of the thread category for the target thread.- Specified by:
getThreadCategory
in interfaceJvmCpuMonitorMXBean
- Parameters:
id
- The target thread id for which we need the thread category.- Returns:
- NULL to indicate failure, else the category string of the target thread.
-