src/share/vm/services/jmm.h

Mon, 05 Nov 2012 15:30:22 -0500

author
zgu
date
Mon, 05 Nov 2012 15:30:22 -0500
changeset 4248
69ad7823b1ca
parent 3329
3b688d6ff3d0
child 5047
31a4e55f8c9d
permissions
-rw-r--r--

8001591: NMT: assertion failed: assert(rec->addr() + rec->size() <= cur->base()) failed: Can not overlap in memSnapshot.cpp
Summary: NMT should allow overlapping committed regions as long as they belong to the same reserved region
Reviewed-by: dholmes, coleenp

duke@435 1 /*
phh@2423 2 * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
trims@1907 7 * published by the Free Software Foundation. Oracle designates this
duke@435 8 * particular file as subject to the "Classpath" exception as provided
trims@1907 9 * by Oracle in the LICENSE file that accompanied this code.
duke@435 10 *
duke@435 11 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 14 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 15 * accompanied this code).
duke@435 16 *
duke@435 17 * You should have received a copy of the GNU General Public License version
duke@435 18 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 20 *
trims@1907 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 22 * or visit www.oracle.com if you need additional information or have any
trims@1907 23 * questions.
duke@435 24 */
duke@435 25
duke@435 26 #ifndef _JAVA_JMM_H_
duke@435 27 #define _JAVA_JMM_H_
duke@435 28
duke@435 29 /*
duke@435 30 * This is a private interface used by JDK for JVM monitoring
duke@435 31 * and management.
duke@435 32 *
duke@435 33 * Bump the version number when either of the following happens:
duke@435 34 *
duke@435 35 * 1. There is a change in functions in JmmInterface.
duke@435 36 *
duke@435 37 * 2. There is a change in the contract between VM and Java classes.
duke@435 38 */
duke@435 39
duke@435 40 #include "jni.h"
duke@435 41
duke@435 42 #ifdef __cplusplus
duke@435 43 extern "C" {
duke@435 44 #endif
duke@435 45
duke@435 46 enum {
duke@435 47 JMM_VERSION_1 = 0x20010000,
duke@435 48 JMM_VERSION_1_0 = 0x20010000,
duke@435 49 JMM_VERSION_1_1 = 0x20010100, // JDK 6
duke@435 50 JMM_VERSION_1_2 = 0x20010200, // JDK 7
fparain@3329 51 JMM_VERSION_1_2_1 = 0x20010201, // JDK 7 GA
fparain@3329 52 JMM_VERSION = 0x20010202
duke@435 53 };
duke@435 54
duke@435 55 typedef struct {
duke@435 56 unsigned int isLowMemoryDetectionSupported : 1;
duke@435 57 unsigned int isCompilationTimeMonitoringSupported : 1;
duke@435 58 unsigned int isThreadContentionMonitoringSupported : 1;
duke@435 59 unsigned int isCurrentThreadCpuTimeSupported : 1;
duke@435 60 unsigned int isOtherThreadCpuTimeSupported : 1;
duke@435 61 unsigned int isBootClassPathSupported : 1;
duke@435 62 unsigned int isObjectMonitorUsageSupported : 1;
duke@435 63 unsigned int isSynchronizerUsageSupported : 1;
phh@2423 64 unsigned int isThreadAllocatedMemorySupported : 1;
phh@2423 65 unsigned int : 23;
duke@435 66 } jmmOptionalSupport;
duke@435 67
duke@435 68 typedef enum {
duke@435 69 JMM_CLASS_LOADED_COUNT = 1, /* Total number of loaded classes */
duke@435 70 JMM_CLASS_UNLOADED_COUNT = 2, /* Total number of unloaded classes */
duke@435 71 JMM_THREAD_TOTAL_COUNT = 3, /* Total number of threads that have been started */
duke@435 72 JMM_THREAD_LIVE_COUNT = 4, /* Current number of live threads */
duke@435 73 JMM_THREAD_PEAK_COUNT = 5, /* Peak number of live threads */
duke@435 74 JMM_THREAD_DAEMON_COUNT = 6, /* Current number of daemon threads */
duke@435 75 JMM_JVM_INIT_DONE_TIME_MS = 7, /* Time when the JVM finished initialization */
duke@435 76 JMM_COMPILE_TOTAL_TIME_MS = 8, /* Total accumulated time spent in compilation */
duke@435 77 JMM_GC_TIME_MS = 9, /* Total accumulated time spent in collection */
duke@435 78 JMM_GC_COUNT = 10, /* Total number of collections */
duke@435 79
duke@435 80 JMM_INTERNAL_ATTRIBUTE_INDEX = 100,
duke@435 81 JMM_CLASS_LOADED_BYTES = 101, /* Number of bytes loaded instance classes */
duke@435 82 JMM_CLASS_UNLOADED_BYTES = 102, /* Number of bytes unloaded instance classes */
duke@435 83 JMM_TOTAL_CLASSLOAD_TIME_MS = 103, /* Accumulated VM class loader time (TraceClassLoadingTime) */
duke@435 84 JMM_VM_GLOBAL_COUNT = 104, /* Number of VM internal flags */
duke@435 85 JMM_SAFEPOINT_COUNT = 105, /* Total number of safepoints */
duke@435 86 JMM_TOTAL_SAFEPOINTSYNC_TIME_MS = 106, /* Accumulated time spent getting to safepoints */
duke@435 87 JMM_TOTAL_STOPPED_TIME_MS = 107, /* Accumulated time spent at safepoints */
duke@435 88 JMM_TOTAL_APP_TIME_MS = 108, /* Accumulated time spent in Java application */
duke@435 89 JMM_VM_THREAD_COUNT = 109, /* Current number of VM internal threads */
duke@435 90 JMM_CLASS_INIT_TOTAL_COUNT = 110, /* Number of classes for which initializers were run */
duke@435 91 JMM_CLASS_INIT_TOTAL_TIME_MS = 111, /* Accumulated time spent in class initializers */
duke@435 92 JMM_METHOD_DATA_SIZE_BYTES = 112, /* Size of method data in memory */
duke@435 93 JMM_CLASS_VERIFY_TOTAL_TIME_MS = 113, /* Accumulated time spent in class verifier */
duke@435 94 JMM_SHARED_CLASS_LOADED_COUNT = 114, /* Number of shared classes loaded */
duke@435 95 JMM_SHARED_CLASS_UNLOADED_COUNT = 115, /* Number of shared classes unloaded */
duke@435 96 JMM_SHARED_CLASS_LOADED_BYTES = 116, /* Number of bytes loaded shared classes */
duke@435 97 JMM_SHARED_CLASS_UNLOADED_BYTES = 117, /* Number of bytes unloaded shared classes */
duke@435 98
duke@435 99 JMM_OS_ATTRIBUTE_INDEX = 200,
duke@435 100 JMM_OS_PROCESS_ID = 201, /* Process id of the JVM */
duke@435 101 JMM_OS_MEM_TOTAL_PHYSICAL_BYTES = 202, /* Physical memory size */
duke@435 102
duke@435 103 JMM_GC_EXT_ATTRIBUTE_INFO_SIZE = 401 /* the size of the GC specific attributes for a given GC memory manager */
duke@435 104 } jmmLongAttribute;
duke@435 105
duke@435 106 typedef enum {
duke@435 107 JMM_VERBOSE_GC = 21,
duke@435 108 JMM_VERBOSE_CLASS = 22,
duke@435 109 JMM_THREAD_CONTENTION_MONITORING = 23,
phh@2423 110 JMM_THREAD_CPU_TIME = 24,
phh@2423 111 JMM_THREAD_ALLOCATED_MEMORY = 25
duke@435 112 } jmmBoolAttribute;
duke@435 113
duke@435 114
duke@435 115 enum {
duke@435 116 JMM_THREAD_STATE_FLAG_SUSPENDED = 0x00100000,
duke@435 117 JMM_THREAD_STATE_FLAG_NATIVE = 0x00400000
duke@435 118 };
duke@435 119
duke@435 120 #define JMM_THREAD_STATE_FLAG_MASK 0xFFF00000
duke@435 121
duke@435 122 typedef enum {
duke@435 123 JMM_STAT_PEAK_THREAD_COUNT = 801,
duke@435 124 JMM_STAT_THREAD_CONTENTION_COUNT = 802,
duke@435 125 JMM_STAT_THREAD_CONTENTION_TIME = 803,
duke@435 126 JMM_STAT_THREAD_CONTENTION_STAT = 804,
duke@435 127 JMM_STAT_PEAK_POOL_USAGE = 805,
duke@435 128 JMM_STAT_GC_STAT = 806
duke@435 129 } jmmStatisticType;
duke@435 130
duke@435 131 typedef enum {
duke@435 132 JMM_USAGE_THRESHOLD_HIGH = 901,
duke@435 133 JMM_USAGE_THRESHOLD_LOW = 902,
duke@435 134 JMM_COLLECTION_USAGE_THRESHOLD_HIGH = 903,
duke@435 135 JMM_COLLECTION_USAGE_THRESHOLD_LOW = 904
duke@435 136 } jmmThresholdType;
duke@435 137
duke@435 138 /* Should match what is allowed in globals.hpp */
duke@435 139 typedef enum {
duke@435 140 JMM_VMGLOBAL_TYPE_UNKNOWN = 0,
duke@435 141 JMM_VMGLOBAL_TYPE_JBOOLEAN = 1,
duke@435 142 JMM_VMGLOBAL_TYPE_JSTRING = 2,
duke@435 143 JMM_VMGLOBAL_TYPE_JLONG = 3
duke@435 144 } jmmVMGlobalType;
duke@435 145
duke@435 146 typedef enum {
duke@435 147 JMM_VMGLOBAL_ORIGIN_DEFAULT = 1, /* Default value */
duke@435 148 JMM_VMGLOBAL_ORIGIN_COMMAND_LINE = 2, /* Set at command line (or JNI invocation) */
duke@435 149 JMM_VMGLOBAL_ORIGIN_MANAGEMENT = 3, /* Set via management interface */
duke@435 150 JMM_VMGLOBAL_ORIGIN_ENVIRON_VAR = 4, /* Set via environment variables */
duke@435 151 JMM_VMGLOBAL_ORIGIN_CONFIG_FILE = 5, /* Set via config file (such as .hotspotrc) */
duke@435 152 JMM_VMGLOBAL_ORIGIN_ERGONOMIC = 6, /* Set via ergonomic */
duke@435 153 JMM_VMGLOBAL_ORIGIN_OTHER = 99 /* Set via some other mechanism */
duke@435 154 } jmmVMGlobalOrigin;
duke@435 155
duke@435 156 typedef struct {
duke@435 157 jstring name;
duke@435 158 jvalue value;
duke@435 159 jmmVMGlobalType type; /* Data type */
duke@435 160 jmmVMGlobalOrigin origin; /* Default or non-default value */
duke@435 161 unsigned int writeable : 1; /* dynamically writeable */
duke@435 162 unsigned int external : 1; /* external supported interface */
duke@435 163 unsigned int reserved : 30;
duke@435 164 void *reserved1;
duke@435 165 void *reserved2;
duke@435 166 } jmmVMGlobal;
duke@435 167
duke@435 168 typedef struct {
duke@435 169 const char* name;
duke@435 170 char type;
duke@435 171 const char* description;
duke@435 172 } jmmExtAttributeInfo;
duke@435 173
duke@435 174 /* Caller has to set the following fields before calling GetLastGCStat
duke@435 175 * o usage_before_gc - array of MemoryUsage objects
duke@435 176 * o usage_after_gc - array of MemoryUsage objects
duke@435 177 * o gc_ext_attribute_values_size - size of gc_ext_atttribute_values array
duke@435 178 * o gc_ext_attribtue_values - array of jvalues
duke@435 179 */
duke@435 180 typedef struct {
duke@435 181 jlong gc_index; /* Index of the collections */
duke@435 182 jlong start_time; /* Start time of the GC */
duke@435 183 jlong end_time; /* End time of the GC */
duke@435 184 jobjectArray usage_before_gc; /* Memory usage array before GC */
duke@435 185 jobjectArray usage_after_gc; /* Memory usage array after GC */
duke@435 186 jint gc_ext_attribute_values_size; /* set by the caller of GetGCStat */
duke@435 187 jvalue* gc_ext_attribute_values; /* Array of jvalue for GC extension attributes */
duke@435 188 jint num_gc_ext_attributes; /* number of GC extension attribute values s are filled */
duke@435 189 /* -1 indicates gc_ext_attribute_values is not big enough */
duke@435 190 } jmmGCStat;
duke@435 191
fparain@3329 192 typedef struct {
fparain@3329 193 const char* name;
fparain@3329 194 const char* description;
fparain@3329 195 const char* impact;
fparain@3329 196 int num_arguments;
fparain@3329 197 jboolean enabled;
fparain@3329 198 } dcmdInfo;
fparain@3329 199
fparain@3329 200 typedef struct {
fparain@3329 201 const char* name;
fparain@3329 202 const char* description;
fparain@3329 203 const char* type;
fparain@3329 204 const char* default_string;
fparain@3329 205 jboolean mandatory;
fparain@3329 206 jboolean option;
fparain@3329 207 int position;
fparain@3329 208 } dcmdArgInfo;
fparain@3329 209
duke@435 210 typedef struct jmmInterface_1_ {
duke@435 211 void* reserved1;
duke@435 212 void* reserved2;
duke@435 213
duke@435 214 jint (JNICALL *GetVersion) (JNIEnv *env);
duke@435 215
duke@435 216 jint (JNICALL *GetOptionalSupport) (JNIEnv *env,
duke@435 217 jmmOptionalSupport* support_ptr);
duke@435 218
duke@435 219 /* This is used by JDK 6 and earlier.
duke@435 220 * For JDK 7 and after, use GetInputArgumentArray.
duke@435 221 */
duke@435 222 jobject (JNICALL *GetInputArguments) (JNIEnv *env);
duke@435 223
duke@435 224 jint (JNICALL *GetThreadInfo) (JNIEnv *env,
duke@435 225 jlongArray ids,
duke@435 226 jint maxDepth,
duke@435 227 jobjectArray infoArray);
duke@435 228 jobjectArray (JNICALL *GetInputArgumentArray) (JNIEnv *env);
duke@435 229
duke@435 230 jobjectArray (JNICALL *GetMemoryPools) (JNIEnv* env, jobject mgr);
duke@435 231
duke@435 232 jobjectArray (JNICALL *GetMemoryManagers) (JNIEnv* env, jobject pool);
duke@435 233
duke@435 234 jobject (JNICALL *GetMemoryPoolUsage) (JNIEnv* env, jobject pool);
duke@435 235 jobject (JNICALL *GetPeakMemoryPoolUsage) (JNIEnv* env, jobject pool);
duke@435 236
phh@2423 237 void (JNICALL *GetThreadAllocatedMemory)
phh@2423 238 (JNIEnv *env,
phh@2423 239 jlongArray ids,
phh@2423 240 jlongArray sizeArray);
duke@435 241
duke@435 242 jobject (JNICALL *GetMemoryUsage) (JNIEnv* env, jboolean heap);
duke@435 243
duke@435 244 jlong (JNICALL *GetLongAttribute) (JNIEnv *env, jobject obj, jmmLongAttribute att);
duke@435 245 jboolean (JNICALL *GetBoolAttribute) (JNIEnv *env, jmmBoolAttribute att);
duke@435 246 jboolean (JNICALL *SetBoolAttribute) (JNIEnv *env, jmmBoolAttribute att, jboolean flag);
duke@435 247
duke@435 248 jint (JNICALL *GetLongAttributes) (JNIEnv *env,
duke@435 249 jobject obj,
duke@435 250 jmmLongAttribute* atts,
duke@435 251 jint count,
duke@435 252 jlong* result);
duke@435 253
duke@435 254 jobjectArray (JNICALL *FindCircularBlockedThreads) (JNIEnv *env);
phh@2423 255
phh@2423 256 // Not used in JDK 6 or JDK 7
duke@435 257 jlong (JNICALL *GetThreadCpuTime) (JNIEnv *env, jlong thread_id);
duke@435 258
duke@435 259 jobjectArray (JNICALL *GetVMGlobalNames) (JNIEnv *env);
duke@435 260 jint (JNICALL *GetVMGlobals) (JNIEnv *env,
duke@435 261 jobjectArray names,
duke@435 262 jmmVMGlobal *globals,
duke@435 263 jint count);
duke@435 264
duke@435 265 jint (JNICALL *GetInternalThreadTimes) (JNIEnv *env,
duke@435 266 jobjectArray names,
duke@435 267 jlongArray times);
duke@435 268
duke@435 269 jboolean (JNICALL *ResetStatistic) (JNIEnv *env,
duke@435 270 jvalue obj,
duke@435 271 jmmStatisticType type);
duke@435 272
duke@435 273 void (JNICALL *SetPoolSensor) (JNIEnv *env,
duke@435 274 jobject pool,
duke@435 275 jmmThresholdType type,
duke@435 276 jobject sensor);
duke@435 277
duke@435 278 jlong (JNICALL *SetPoolThreshold) (JNIEnv *env,
duke@435 279 jobject pool,
duke@435 280 jmmThresholdType type,
duke@435 281 jlong threshold);
duke@435 282 jobject (JNICALL *GetPoolCollectionUsage) (JNIEnv* env, jobject pool);
duke@435 283
duke@435 284 jint (JNICALL *GetGCExtAttributeInfo) (JNIEnv *env,
duke@435 285 jobject mgr,
duke@435 286 jmmExtAttributeInfo *ext_info,
duke@435 287 jint count);
duke@435 288 void (JNICALL *GetLastGCStat) (JNIEnv *env,
duke@435 289 jobject mgr,
duke@435 290 jmmGCStat *gc_stat);
phh@2423 291
phh@2423 292 jlong (JNICALL *GetThreadCpuTimeWithKind)
phh@2423 293 (JNIEnv *env,
phh@2423 294 jlong thread_id,
phh@2423 295 jboolean user_sys_cpu_time);
phh@2423 296 void (JNICALL *GetThreadCpuTimesWithKind)
phh@2423 297 (JNIEnv *env,
phh@2423 298 jlongArray ids,
phh@2423 299 jlongArray timeArray,
phh@2423 300 jboolean user_sys_cpu_time);
phh@2423 301
duke@435 302 jint (JNICALL *DumpHeap0) (JNIEnv *env,
duke@435 303 jstring outputfile,
duke@435 304 jboolean live);
phh@2423 305 jobjectArray (JNICALL *FindDeadlocks) (JNIEnv *env,
phh@2423 306 jboolean object_monitors_only);
duke@435 307 void (JNICALL *SetVMGlobal) (JNIEnv *env,
duke@435 308 jstring flag_name,
duke@435 309 jvalue new_value);
duke@435 310 void* reserved6;
duke@435 311 jobjectArray (JNICALL *DumpThreads) (JNIEnv *env,
duke@435 312 jlongArray ids,
duke@435 313 jboolean lockedMonitors,
duke@435 314 jboolean lockedSynchronizers);
fparain@2888 315 void (JNICALL *SetGCNotificationEnabled) (JNIEnv *env,
fparain@2888 316 jobject mgr,
fparain@2888 317 jboolean enabled);
fparain@3329 318 jobjectArray (JNICALL *GetDiagnosticCommands) (JNIEnv *env);
fparain@3329 319 void (JNICALL *GetDiagnosticCommandInfo)
fparain@3329 320 (JNIEnv *env,
fparain@3329 321 jobjectArray cmds,
fparain@3329 322 dcmdInfo *infoArray);
fparain@3329 323 void (JNICALL *GetDiagnosticCommandArgumentsInfo)
fparain@3329 324 (JNIEnv *env,
fparain@3329 325 jstring commandName,
fparain@3329 326 dcmdArgInfo *infoArray);
fparain@3329 327 jstring (JNICALL *ExecuteDiagnosticCommand)
fparain@3329 328 (JNIEnv *env,
fparain@3329 329 jstring command);
duke@435 330 } JmmInterface;
duke@435 331
duke@435 332 #ifdef __cplusplus
duke@435 333 } /* extern "C" */
duke@435 334 #endif /* __cplusplus */
duke@435 335
duke@435 336 #endif /* !_JAVA_JMM_H_ */

mercurial