src/share/vm/services/jmm.h

Print this page




  31  * and management.
  32  *
  33  * Bump the version number when either of the following happens:
  34  *
  35  * 1. There is a change in functions in JmmInterface.
  36  *
  37  * 2. There is a change in the contract between VM and Java classes.
  38  */
  39 
  40 #include "jni.h"
  41 
  42 #ifdef __cplusplus
  43 extern "C" {
  44 #endif
  45 
  46 enum {
  47   JMM_VERSION_1   = 0x20010000,
  48   JMM_VERSION_1_0 = 0x20010000,
  49   JMM_VERSION_1_1 = 0x20010100, // JDK 6
  50   JMM_VERSION_1_2 = 0x20010200, // JDK 7
  51   JMM_VERSION     = 0x20010201

  52 };
  53 
  54 typedef struct {
  55   unsigned int isLowMemoryDetectionSupported : 1;
  56   unsigned int isCompilationTimeMonitoringSupported : 1;
  57   unsigned int isThreadContentionMonitoringSupported : 1;
  58   unsigned int isCurrentThreadCpuTimeSupported : 1;
  59   unsigned int isOtherThreadCpuTimeSupported : 1;
  60   unsigned int isBootClassPathSupported : 1;
  61   unsigned int isObjectMonitorUsageSupported : 1;
  62   unsigned int isSynchronizerUsageSupported : 1;
  63   unsigned int isThreadAllocatedMemorySupported : 1;
  64   unsigned int : 23;
  65 } jmmOptionalSupport;
  66 
  67 typedef enum {
  68   JMM_CLASS_LOADED_COUNT             = 1,    /* Total number of loaded classes */
  69   JMM_CLASS_UNLOADED_COUNT           = 2,    /* Total number of unloaded classes */
  70   JMM_THREAD_TOTAL_COUNT             = 3,    /* Total number of threads that have been started */
  71   JMM_THREAD_LIVE_COUNT              = 4,    /* Current number of live threads */


 171 } jmmExtAttributeInfo;
 172 
 173 /* Caller has to set the following fields before calling GetLastGCStat
 174  *   o usage_before_gc               - array of MemoryUsage objects
 175  *   o usage_after_gc                - array of MemoryUsage objects
 176  *   o gc_ext_attribute_values_size - size of gc_ext_atttribute_values array
 177  *   o gc_ext_attribtue_values      - array of jvalues
 178  */
 179 typedef struct {
 180   jlong        gc_index;                       /* Index of the collections */
 181   jlong        start_time;                     /* Start time of the GC */
 182   jlong        end_time;                       /* End time of the GC */
 183   jobjectArray usage_before_gc;                /* Memory usage array before GC */
 184   jobjectArray usage_after_gc;                 /* Memory usage array after GC */
 185   jint         gc_ext_attribute_values_size;   /* set by the caller of GetGCStat */
 186   jvalue*      gc_ext_attribute_values;        /* Array of jvalue for GC extension attributes */
 187   jint         num_gc_ext_attributes;          /* number of GC extension attribute values s are filled */
 188                                                /* -1 indicates gc_ext_attribute_values is not big enough */
 189 } jmmGCStat;
 190 


















 191 typedef struct jmmInterface_1_ {
 192   void*        reserved1;
 193   void*        reserved2;
 194 
 195   jint         (JNICALL *GetVersion)             (JNIEnv *env);
 196 
 197   jint         (JNICALL *GetOptionalSupport)     (JNIEnv *env,
 198                                                   jmmOptionalSupport* support_ptr);
 199 
 200   /* This is used by JDK 6 and earlier.
 201    * For JDK 7 and after, use GetInputArgumentArray.
 202    */
 203   jobject      (JNICALL *GetInputArguments)      (JNIEnv *env);
 204 
 205   jint         (JNICALL *GetThreadInfo)          (JNIEnv *env,
 206                                                   jlongArray ids,
 207                                                   jint maxDepth,
 208                                                   jobjectArray infoArray);
 209   jobjectArray (JNICALL *GetInputArgumentArray)  (JNIEnv *env);
 210 


 279                                                   jlongArray ids,
 280                                                   jlongArray timeArray,
 281                                                   jboolean user_sys_cpu_time);
 282 
 283   jint         (JNICALL *DumpHeap0)              (JNIEnv *env,
 284                                                   jstring outputfile,
 285                                                   jboolean live);
 286   jobjectArray (JNICALL *FindDeadlocks)          (JNIEnv *env,
 287                                                   jboolean object_monitors_only);
 288   void         (JNICALL *SetVMGlobal)            (JNIEnv *env,
 289                                                   jstring flag_name,
 290                                                   jvalue  new_value);
 291   void*        reserved6;
 292   jobjectArray (JNICALL *DumpThreads)            (JNIEnv *env,
 293                                                   jlongArray ids,
 294                                                   jboolean lockedMonitors,
 295                                                   jboolean lockedSynchronizers);
 296   void         (JNICALL *SetGCNotificationEnabled) (JNIEnv *env,
 297                                                     jobject mgr,
 298                                                     jboolean enabled);









 299 } JmmInterface;
 300 
 301 #ifdef __cplusplus
 302 } /* extern "C" */
 303 #endif /* __cplusplus */
 304 
 305 #endif /* !_JAVA_JMM_H_ */


  31  * and management.
  32  *
  33  * Bump the version number when either of the following happens:
  34  *
  35  * 1. There is a change in functions in JmmInterface.
  36  *
  37  * 2. There is a change in the contract between VM and Java classes.
  38  */
  39 
  40 #include "jni.h"
  41 
  42 #ifdef __cplusplus
  43 extern "C" {
  44 #endif
  45 
  46 enum {
  47   JMM_VERSION_1   = 0x20010000,
  48   JMM_VERSION_1_0 = 0x20010000,
  49   JMM_VERSION_1_1 = 0x20010100, // JDK 6
  50   JMM_VERSION_1_2 = 0x20010200, // JDK 7
  51   JMM_VERSION_1_2_1 = 0x20010201, // JDK7 GA
  52   JMM_VERSION     = 0x20010202
  53 };
  54 
  55 typedef struct {
  56   unsigned int isLowMemoryDetectionSupported : 1;
  57   unsigned int isCompilationTimeMonitoringSupported : 1;
  58   unsigned int isThreadContentionMonitoringSupported : 1;
  59   unsigned int isCurrentThreadCpuTimeSupported : 1;
  60   unsigned int isOtherThreadCpuTimeSupported : 1;
  61   unsigned int isBootClassPathSupported : 1;
  62   unsigned int isObjectMonitorUsageSupported : 1;
  63   unsigned int isSynchronizerUsageSupported : 1;
  64   unsigned int isThreadAllocatedMemorySupported : 1;
  65   unsigned int : 23;
  66 } jmmOptionalSupport;
  67 
  68 typedef enum {
  69   JMM_CLASS_LOADED_COUNT             = 1,    /* Total number of loaded classes */
  70   JMM_CLASS_UNLOADED_COUNT           = 2,    /* Total number of unloaded classes */
  71   JMM_THREAD_TOTAL_COUNT             = 3,    /* Total number of threads that have been started */
  72   JMM_THREAD_LIVE_COUNT              = 4,    /* Current number of live threads */


 172 } jmmExtAttributeInfo;
 173 
 174 /* Caller has to set the following fields before calling GetLastGCStat
 175  *   o usage_before_gc               - array of MemoryUsage objects
 176  *   o usage_after_gc                - array of MemoryUsage objects
 177  *   o gc_ext_attribute_values_size - size of gc_ext_atttribute_values array
 178  *   o gc_ext_attribtue_values      - array of jvalues
 179  */
 180 typedef struct {
 181   jlong        gc_index;                       /* Index of the collections */
 182   jlong        start_time;                     /* Start time of the GC */
 183   jlong        end_time;                       /* End time of the GC */
 184   jobjectArray usage_before_gc;                /* Memory usage array before GC */
 185   jobjectArray usage_after_gc;                 /* Memory usage array after GC */
 186   jint         gc_ext_attribute_values_size;   /* set by the caller of GetGCStat */
 187   jvalue*      gc_ext_attribute_values;        /* Array of jvalue for GC extension attributes */
 188   jint         num_gc_ext_attributes;          /* number of GC extension attribute values s are filled */
 189                                                /* -1 indicates gc_ext_attribute_values is not big enough */
 190 } jmmGCStat;
 191 
 192 typedef struct {
 193     const char *name;
 194     const char *description;
 195     const char *impact;
 196     int num_arguments;
 197     jboolean enabled;
 198 } dcmdInfo;
 199 
 200 typedef struct {
 201     const char *name;
 202     const char *description;
 203     const char *type;
 204     const char *default_string;
 205     jboolean mandatory;
 206     jboolean option;
 207     int position;
 208 } dcmdArgInfo;
 209 
 210 typedef struct jmmInterface_1_ {
 211   void*        reserved1;
 212   void*        reserved2;
 213 
 214   jint         (JNICALL *GetVersion)             (JNIEnv *env);
 215 
 216   jint         (JNICALL *GetOptionalSupport)     (JNIEnv *env,
 217                                                   jmmOptionalSupport* support_ptr);
 218 
 219   /* This is used by JDK 6 and earlier.
 220    * For JDK 7 and after, use GetInputArgumentArray.
 221    */
 222   jobject      (JNICALL *GetInputArguments)      (JNIEnv *env);
 223 
 224   jint         (JNICALL *GetThreadInfo)          (JNIEnv *env,
 225                                                   jlongArray ids,
 226                                                   jint maxDepth,
 227                                                   jobjectArray infoArray);
 228   jobjectArray (JNICALL *GetInputArgumentArray)  (JNIEnv *env);
 229 


 298                                                   jlongArray ids,
 299                                                   jlongArray timeArray,
 300                                                   jboolean user_sys_cpu_time);
 301 
 302   jint         (JNICALL *DumpHeap0)              (JNIEnv *env,
 303                                                   jstring outputfile,
 304                                                   jboolean live);
 305   jobjectArray (JNICALL *FindDeadlocks)          (JNIEnv *env,
 306                                                   jboolean object_monitors_only);
 307   void         (JNICALL *SetVMGlobal)            (JNIEnv *env,
 308                                                   jstring flag_name,
 309                                                   jvalue  new_value);
 310   void*        reserved6;
 311   jobjectArray (JNICALL *DumpThreads)            (JNIEnv *env,
 312                                                   jlongArray ids,
 313                                                   jboolean lockedMonitors,
 314                                                   jboolean lockedSynchronizers);
 315   void         (JNICALL *SetGCNotificationEnabled) (JNIEnv *env,
 316                                                     jobject mgr,
 317                                                     jboolean enabled);
 318   jobjectArray (JNICALL *GetDiagnosticCommands) (JNIEnv *env);
 319   void         (JNICALL *GetDiagnosticCommandInfo) (JNIEnv *env,
 320                                                   jobjectArray cmds,
 321                                                   dcmdInfo *infoArray);
 322   void         (JNICALL *GetDiagnosticCommandArgumentsInfo) (JNIEnv *env,
 323                                                   jstring commandName,
 324                                                   dcmdArgInfo *infoArray);
 325   jstring      (JNICALL *ExecuteDiagnosticCommand) (JNIEnv *env,
 326                                                   jstring command);
 327 } JmmInterface;
 328 
 329 #ifdef __cplusplus
 330 } /* extern "C" */
 331 #endif /* __cplusplus */
 332 
 333 #endif /* !_JAVA_JMM_H_ */