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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic JvmCpuMonitorSingleton 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 newJvmCpuMonitorInfoobject and populates it with CPU usage statistics of the various thread categories.getThreadsCpuUsage(JvmCpuMonitorInfo jcmInfo) This function updates the user providedJvmCpuMonitorInfoobject with CPU usage statistics of the various thread categories.intsetThreadCategory(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:
getObjectNamein interfacePlatformManagedObject- Returns:
- objectName representing the MXBean
-
getThreadsCpuUsage
This function updates the user providedJvmCpuMonitorInfoobject with CPU usage statistics of the various thread categories. The statistics are an aggregate across all CPUs of the operating system.- Specified by:
getThreadsCpuUsagein interfaceJvmCpuMonitorMXBean- Parameters:
jcmInfo- User provided JvmCpuMonitorInfo object.- Returns:
- the updated JvmCpuMonitorInfo instance.
-
getThreadsCpuUsage
This function creates a newJvmCpuMonitorInfoobject 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:
getThreadsCpuUsagein interfaceJvmCpuMonitorMXBean- Returns:
- the new
JvmCpuMonitorInfoinstance.
-
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:
setThreadCategoryin 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:
getThreadCategoryin 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.
-