src/java.management/share/native/libmanagement/VMManagementImpl.c
author sangheki
Mon, 04 Jun 2018 21:20:16 -0700
changeset 50396 7f48bff40a9a
parent 47216 71c04702a3d5
permissions -rw-r--r--
8204094: assert(worker_i < _length) failed: Worker 15 is greater than max: 11 at ReferenceProcessorPhaseTimes Reviewed-by: kbarrett, tschatzl
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
42102
3e0a2861efe1 8151099: java.lang.management.ManagementFactory.getPlatformMXBeans() should work even if jdk.management is not present.
vtewari
parents: 36511
diff changeset
     2
 * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
#include <jni.h>
17954
885a02686acb 7150256: Add back Diagnostic Command JMX API
fparain
parents: 9698
diff changeset
    27
#include <stdlib.h>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
#include "jvm.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
#include "management.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
#include "sun_management_VMManagementImpl.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
#define MAX_VERSION_LEN   20
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
JNIEXPORT jstring JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
Java_sun_management_VMManagementImpl_getVersion0
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
  (JNIEnv *env, jclass dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
    char buf[MAX_VERSION_LEN];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
    jstring version_string = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
    unsigned int major = ((unsigned int) jmm_version & 0x0FFF0000) >> 16;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
    unsigned int minor = ((unsigned int) jmm_version & 0xFF00) >> 8;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
    // for internal use
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
    unsigned int micro = (unsigned int) jmm_version & 0xFF;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
    sprintf(buf, "%d.%d", major, minor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
    version_string = (*env)->NewStringUTF(env, buf);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
    return version_string;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
static void setStaticBooleanField
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
   (JNIEnv* env, jclass cls, const char* name, jboolean value)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
    jfieldID fid;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    fid = (*env)->GetStaticFieldID(env, cls, name, "Z");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    if (fid != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
        (*env)->SetStaticBooleanField(env, cls, fid, value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
JNIEXPORT void JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
Java_sun_management_VMManagementImpl_initOptionalSupportFields
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
  (JNIEnv *env, jclass cls)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
    jmmOptionalSupport mos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    jint ret = jmm_interface->GetOptionalSupport(env, &mos);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
    jboolean value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    value = mos.isCompilationTimeMonitoringSupported;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    setStaticBooleanField(env, cls, "compTimeMonitoringSupport", value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    value = mos.isThreadContentionMonitoringSupported;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
    setStaticBooleanField(env, cls, "threadContentionMonitoringSupport", value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    value = mos.isCurrentThreadCpuTimeSupported;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
    setStaticBooleanField(env, cls, "currentThreadCpuTimeSupport", value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
    value = mos.isOtherThreadCpuTimeSupported;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    setStaticBooleanField(env, cls, "otherThreadCpuTimeSupport", value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    if (jmm_version >= JMM_VERSION_1_1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
        value = mos.isObjectMonitorUsageSupported;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
        setStaticBooleanField(env, cls, "objectMonitorUsageSupport", value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
        value = mos.isSynchronizerUsageSupported;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
        setStaticBooleanField(env, cls, "synchronizerUsageSupport", value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
        setStaticBooleanField(env, cls, "objectMonitorUsageSupport", JNI_FALSE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
        setStaticBooleanField(env, cls, "synchronizerUsageSupport", JNI_FALSE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    }
8001
192adf3627b7 6173675: M&M: approximate memory allocation rate/amount per thread
phh
parents: 5506
diff changeset
    93
192adf3627b7 6173675: M&M: approximate memory allocation rate/amount per thread
phh
parents: 5506
diff changeset
    94
    value = mos.isThreadAllocatedMemorySupported;
192adf3627b7 6173675: M&M: approximate memory allocation rate/amount per thread
phh
parents: 5506
diff changeset
    95
    setStaticBooleanField(env, cls, "threadAllocatedMemorySupport", value);
9698
8b66cd6c5ebc 7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents: 8001
diff changeset
    96
17954
885a02686acb 7150256: Add back Diagnostic Command JMX API
fparain
parents: 9698
diff changeset
    97
    value = mos.isRemoteDiagnosticCommandsSupported;
885a02686acb 7150256: Add back Diagnostic Command JMX API
fparain
parents: 9698
diff changeset
    98
    setStaticBooleanField(env, cls, "remoteDiagnosticCommandsSupport", value);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
JNIEXPORT jobjectArray JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
Java_sun_management_VMManagementImpl_getVmArguments0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
{
35262
6ffcba13c973 8138677: IllegalAccessException Class sun.usagetracker.UsageTrackerClient$4 (module java.base) can not access a member of class java.lang.management.ManagementFactory (module java.management)
jbachorik
parents: 25859
diff changeset
   105
    return JVM_GetVmArguments(env);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
JNIEXPORT jlong JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
Java_sun_management_VMManagementImpl_getTotalClassCount
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    /* JMM_CLASS_LOADED_COUNT is the total number of classes loaded */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    jlong count = jmm_interface->GetLongAttribute(env, NULL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
                                                  JMM_CLASS_LOADED_COUNT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    return count;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
JNIEXPORT jlong JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
Java_sun_management_VMManagementImpl_getUnloadedClassCount
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
    /* JMM_CLASS_UNLOADED_COUNT is the total number of classes unloaded */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
    jlong count = jmm_interface->GetLongAttribute(env, NULL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
                                                  JMM_CLASS_UNLOADED_COUNT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
    return count;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
JNIEXPORT jboolean JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
Java_sun_management_VMManagementImpl_getVerboseGC
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
    return jmm_interface->GetBoolAttribute(env, JMM_VERBOSE_GC);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
JNIEXPORT jboolean JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
Java_sun_management_VMManagementImpl_getVerboseClass
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
    return jmm_interface->GetBoolAttribute(env, JMM_VERBOSE_CLASS);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
JNIEXPORT jlong JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
Java_sun_management_VMManagementImpl_getTotalThreadCount
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
    return jmm_interface->GetLongAttribute(env, NULL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
                                           JMM_THREAD_TOTAL_COUNT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
JNIEXPORT jint JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
Java_sun_management_VMManagementImpl_getLiveThreadCount
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
    jlong count = jmm_interface->GetLongAttribute(env, NULL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
                                                  JMM_THREAD_LIVE_COUNT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
    return (jint) count;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
JNIEXPORT jint JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
Java_sun_management_VMManagementImpl_getPeakThreadCount
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
    jlong count = jmm_interface->GetLongAttribute(env, NULL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
                                                  JMM_THREAD_PEAK_COUNT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
    return (jint) count;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
JNIEXPORT jint JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
Java_sun_management_VMManagementImpl_getDaemonThreadCount
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
    jlong count = jmm_interface->GetLongAttribute(env, NULL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
                                                  JMM_THREAD_DAEMON_COUNT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
    return (jint) count;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
JNIEXPORT jlong JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
Java_sun_management_VMManagementImpl_getTotalCompileTime
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
    return jmm_interface->GetLongAttribute(env, NULL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
                                           JMM_COMPILE_TOTAL_TIME_MS);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
JNIEXPORT jlong JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
Java_sun_management_VMManagementImpl_getStartupTime
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
    return jmm_interface->GetLongAttribute(env, NULL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
                                           JMM_JVM_INIT_DONE_TIME_MS);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
21640
6bbdcc430310 6523160: RuntimeMXBean.getUptime() returns negative values
jbachorik
parents: 17954
diff changeset
   193
JNIEXPORT jlong JNICALL
6bbdcc430310 6523160: RuntimeMXBean.getUptime() returns negative values
jbachorik
parents: 17954
diff changeset
   194
Java_sun_management_VMManagementImpl_getUptime0
6bbdcc430310 6523160: RuntimeMXBean.getUptime() returns negative values
jbachorik
parents: 17954
diff changeset
   195
  (JNIEnv *env, jobject dummy)
6bbdcc430310 6523160: RuntimeMXBean.getUptime() returns negative values
jbachorik
parents: 17954
diff changeset
   196
{
6bbdcc430310 6523160: RuntimeMXBean.getUptime() returns negative values
jbachorik
parents: 17954
diff changeset
   197
    return jmm_interface->GetLongAttribute(env, NULL, JMM_JVM_UPTIME_MS);
6bbdcc430310 6523160: RuntimeMXBean.getUptime() returns negative values
jbachorik
parents: 17954
diff changeset
   198
}
6bbdcc430310 6523160: RuntimeMXBean.getUptime() returns negative values
jbachorik
parents: 17954
diff changeset
   199
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
JNIEXPORT jboolean JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
Java_sun_management_VMManagementImpl_isThreadContentionMonitoringEnabled
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    return jmm_interface->GetBoolAttribute(env,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
                                           JMM_THREAD_CONTENTION_MONITORING);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
JNIEXPORT jboolean JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
Java_sun_management_VMManagementImpl_isThreadCpuTimeEnabled
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
    return jmm_interface->GetBoolAttribute(env, JMM_THREAD_CPU_TIME);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
8001
192adf3627b7 6173675: M&M: approximate memory allocation rate/amount per thread
phh
parents: 5506
diff changeset
   215
JNIEXPORT jboolean JNICALL
192adf3627b7 6173675: M&M: approximate memory allocation rate/amount per thread
phh
parents: 5506
diff changeset
   216
Java_sun_management_VMManagementImpl_isThreadAllocatedMemoryEnabled
192adf3627b7 6173675: M&M: approximate memory allocation rate/amount per thread
phh
parents: 5506
diff changeset
   217
  (JNIEnv *env, jobject dummy)
192adf3627b7 6173675: M&M: approximate memory allocation rate/amount per thread
phh
parents: 5506
diff changeset
   218
{
192adf3627b7 6173675: M&M: approximate memory allocation rate/amount per thread
phh
parents: 5506
diff changeset
   219
    return jmm_interface->GetBoolAttribute(env, JMM_THREAD_ALLOCATED_MEMORY);
192adf3627b7 6173675: M&M: approximate memory allocation rate/amount per thread
phh
parents: 5506
diff changeset
   220
}
192adf3627b7 6173675: M&M: approximate memory allocation rate/amount per thread
phh
parents: 5506
diff changeset
   221
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
JNIEXPORT jint JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
Java_sun_management_VMManagementImpl_getProcessId
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
    jlong pid = jmm_interface->GetLongAttribute(env, NULL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
                                                JMM_OS_PROCESS_ID);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
    return (jint) pid;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
JNIEXPORT jint JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
Java_sun_management_VMManagementImpl_getAvailableProcessors
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
    return JVM_ActiveProcessorCount();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
JNIEXPORT jlong JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
Java_sun_management_VMManagementImpl_getSafepointCount
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
    return jmm_interface->GetLongAttribute(env, NULL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
                                           JMM_SAFEPOINT_COUNT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
JNIEXPORT jlong JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
Java_sun_management_VMManagementImpl_getTotalSafepointTime
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
    return jmm_interface->GetLongAttribute(env, NULL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
                                           JMM_TOTAL_STOPPED_TIME_MS);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
JNIEXPORT jlong JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
Java_sun_management_VMManagementImpl_getSafepointSyncTime
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
    return jmm_interface->GetLongAttribute(env, NULL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
                                           JMM_TOTAL_SAFEPOINTSYNC_TIME_MS);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
JNIEXPORT jlong JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
Java_sun_management_VMManagementImpl_getTotalApplicationNonStoppedTime
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
    return jmm_interface->GetLongAttribute(env, NULL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
                                           JMM_TOTAL_APP_TIME_MS);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
JNIEXPORT jlong JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
Java_sun_management_VMManagementImpl_getLoadedClassSize
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
    return jmm_interface->GetLongAttribute(env, NULL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
                                           JMM_CLASS_LOADED_BYTES);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
JNIEXPORT jlong JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
Java_sun_management_VMManagementImpl_getUnloadedClassSize
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
    return jmm_interface->GetLongAttribute(env, NULL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
                                           JMM_CLASS_UNLOADED_BYTES);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
JNIEXPORT jlong JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
Java_sun_management_VMManagementImpl_getClassLoadingTime
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
    return jmm_interface->GetLongAttribute(env, NULL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
                                           JMM_TOTAL_CLASSLOAD_TIME_MS);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
JNIEXPORT jlong JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
Java_sun_management_VMManagementImpl_getMethodDataSize
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
    return jmm_interface->GetLongAttribute(env, NULL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
                                           JMM_METHOD_DATA_SIZE_BYTES);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
JNIEXPORT jlong JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
Java_sun_management_VMManagementImpl_getInitializedClassCount
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
    return jmm_interface->GetLongAttribute(env, NULL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
                                           JMM_CLASS_INIT_TOTAL_COUNT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
JNIEXPORT jlong JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
Java_sun_management_VMManagementImpl_getClassInitializationTime
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
    return jmm_interface->GetLongAttribute(env, NULL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
                                           JMM_CLASS_INIT_TOTAL_TIME_MS);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
JNIEXPORT jlong JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
Java_sun_management_VMManagementImpl_getClassVerificationTime
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
    return jmm_interface->GetLongAttribute(env, NULL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
                                           JMM_CLASS_VERIFY_TOTAL_TIME_MS);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
}