jdk/src/share/native/sun/management/VMManagementImpl.c
author duke
Sat, 01 Dec 2007 00:00:00 +0000
changeset 2 90ce3da70b43
child 5506 202f599c92aa
permissions -rw-r--r--
Initial load
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
 * Copyright 2003-2006 Sun Microsystems, Inc.  All Rights Reserved.
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
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
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
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 * have any questions.
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>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
#include "jvm.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
#include "management.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
#include "sun_management_VMManagementImpl.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
#define MAX_VERSION_LEN   20
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
JNIEXPORT jstring JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
Java_sun_management_VMManagementImpl_getVersion0
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
  (JNIEnv *env, jclass dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
    char buf[MAX_VERSION_LEN];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
    jstring version_string = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
    unsigned int major = ((unsigned int) jmm_version & 0x0FFF0000) >> 16;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
    unsigned int minor = ((unsigned int) jmm_version & 0xFF00) >> 8;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
    // for internal use
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
    unsigned int micro = (unsigned int) jmm_version & 0xFF;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
    sprintf(buf, "%d.%d", major, minor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
    version_string = (*env)->NewStringUTF(env, buf);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
    return version_string;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
static void setStaticBooleanField
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
   (JNIEnv* env, jclass cls, const char* name, jboolean value)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
    jfieldID fid;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
    fid = (*env)->GetStaticFieldID(env, cls, name, "Z");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    if (fid != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
        (*env)->SetStaticBooleanField(env, cls, fid, value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
JNIEXPORT void JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
Java_sun_management_VMManagementImpl_initOptionalSupportFields
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
  (JNIEnv *env, jclass cls)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    jmmOptionalSupport mos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
    jint ret = jmm_interface->GetOptionalSupport(env, &mos);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
    jboolean value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
    value = mos.isCompilationTimeMonitoringSupported;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    setStaticBooleanField(env, cls, "compTimeMonitoringSupport", value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    value = mos.isThreadContentionMonitoringSupported;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    setStaticBooleanField(env, cls, "threadContentionMonitoringSupport", value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    value = mos.isCurrentThreadCpuTimeSupported;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    setStaticBooleanField(env, cls, "currentThreadCpuTimeSupport", value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    value = mos.isOtherThreadCpuTimeSupported;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
    setStaticBooleanField(env, cls, "otherThreadCpuTimeSupport", value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    value = mos.isBootClassPathSupported;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    setStaticBooleanField(env, cls, "bootClassPathSupport", value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    if (jmm_version >= JMM_VERSION_1_1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
        value = mos.isObjectMonitorUsageSupported;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
        setStaticBooleanField(env, cls, "objectMonitorUsageSupport", value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
        value = mos.isSynchronizerUsageSupported;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
        setStaticBooleanField(env, cls, "synchronizerUsageSupport", value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
        setStaticBooleanField(env, cls, "objectMonitorUsageSupport", JNI_FALSE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
        setStaticBooleanField(env, cls, "synchronizerUsageSupport", JNI_FALSE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
JNIEXPORT jobjectArray JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
Java_sun_management_VMManagementImpl_getVmArguments0
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
    return jmm_interface->GetInputArgumentArray(env);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
JNIEXPORT jlong JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
Java_sun_management_VMManagementImpl_getTotalClassCount
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    /* JMM_CLASS_LOADED_COUNT is the total number of classes loaded */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    jlong count = jmm_interface->GetLongAttribute(env, NULL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
                                                  JMM_CLASS_LOADED_COUNT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    return count;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
JNIEXPORT jlong JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
Java_sun_management_VMManagementImpl_getUnloadedClassCount
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    /* JMM_CLASS_UNLOADED_COUNT is the total number of classes unloaded */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
    jlong count = jmm_interface->GetLongAttribute(env, NULL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
                                                  JMM_CLASS_UNLOADED_COUNT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
    return count;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
JNIEXPORT jboolean JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
Java_sun_management_VMManagementImpl_getVerboseGC
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
    return jmm_interface->GetBoolAttribute(env, JMM_VERBOSE_GC);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
JNIEXPORT jboolean JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
Java_sun_management_VMManagementImpl_getVerboseClass
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
    return jmm_interface->GetBoolAttribute(env, JMM_VERBOSE_CLASS);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
JNIEXPORT jlong JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
Java_sun_management_VMManagementImpl_getTotalThreadCount
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
    return jmm_interface->GetLongAttribute(env, NULL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
                                           JMM_THREAD_TOTAL_COUNT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
JNIEXPORT jint JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
Java_sun_management_VMManagementImpl_getLiveThreadCount
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
    jlong count = jmm_interface->GetLongAttribute(env, NULL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
                                                  JMM_THREAD_LIVE_COUNT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
    return (jint) count;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
JNIEXPORT jint JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
Java_sun_management_VMManagementImpl_getPeakThreadCount
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
    jlong count = jmm_interface->GetLongAttribute(env, NULL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
                                                  JMM_THREAD_PEAK_COUNT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
    return (jint) count;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
JNIEXPORT jint JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
Java_sun_management_VMManagementImpl_getDaemonThreadCount
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
    jlong count = jmm_interface->GetLongAttribute(env, NULL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
                                                  JMM_THREAD_DAEMON_COUNT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
    return (jint) count;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
JNIEXPORT jlong JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
Java_sun_management_VMManagementImpl_getTotalCompileTime
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
    return jmm_interface->GetLongAttribute(env, NULL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
                                           JMM_COMPILE_TOTAL_TIME_MS);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
JNIEXPORT jlong JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
Java_sun_management_VMManagementImpl_getStartupTime
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
    return jmm_interface->GetLongAttribute(env, NULL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
                                           JMM_JVM_INIT_DONE_TIME_MS);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
JNIEXPORT jboolean JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
Java_sun_management_VMManagementImpl_isThreadContentionMonitoringEnabled
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
    return jmm_interface->GetBoolAttribute(env,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
                                           JMM_THREAD_CONTENTION_MONITORING);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
JNIEXPORT jboolean JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
Java_sun_management_VMManagementImpl_isThreadCpuTimeEnabled
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
    return jmm_interface->GetBoolAttribute(env, JMM_THREAD_CPU_TIME);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
JNIEXPORT jint JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
Java_sun_management_VMManagementImpl_getProcessId
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
    jlong pid = jmm_interface->GetLongAttribute(env, NULL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
                                                JMM_OS_PROCESS_ID);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
    return (jint) pid;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
JNIEXPORT jint JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
Java_sun_management_VMManagementImpl_getAvailableProcessors
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
    return JVM_ActiveProcessorCount();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
JNIEXPORT jlong JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
Java_sun_management_VMManagementImpl_getSafepointCount
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
    return jmm_interface->GetLongAttribute(env, NULL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
                                           JMM_SAFEPOINT_COUNT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
JNIEXPORT jlong JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
Java_sun_management_VMManagementImpl_getTotalSafepointTime
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
    return jmm_interface->GetLongAttribute(env, NULL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
                                           JMM_TOTAL_STOPPED_TIME_MS);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
JNIEXPORT jlong JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
Java_sun_management_VMManagementImpl_getSafepointSyncTime
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
    return jmm_interface->GetLongAttribute(env, NULL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
                                           JMM_TOTAL_SAFEPOINTSYNC_TIME_MS);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
JNIEXPORT jlong JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
Java_sun_management_VMManagementImpl_getTotalApplicationNonStoppedTime
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
    return jmm_interface->GetLongAttribute(env, NULL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
                                           JMM_TOTAL_APP_TIME_MS);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
JNIEXPORT jlong JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
Java_sun_management_VMManagementImpl_getLoadedClassSize
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
    return jmm_interface->GetLongAttribute(env, NULL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
                                           JMM_CLASS_LOADED_BYTES);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
JNIEXPORT jlong JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
Java_sun_management_VMManagementImpl_getUnloadedClassSize
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
    return jmm_interface->GetLongAttribute(env, NULL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
                                           JMM_CLASS_UNLOADED_BYTES);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
JNIEXPORT jlong JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
Java_sun_management_VMManagementImpl_getClassLoadingTime
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
    return jmm_interface->GetLongAttribute(env, NULL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
                                           JMM_TOTAL_CLASSLOAD_TIME_MS);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
JNIEXPORT jlong JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
Java_sun_management_VMManagementImpl_getMethodDataSize
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
    return jmm_interface->GetLongAttribute(env, NULL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
                                           JMM_METHOD_DATA_SIZE_BYTES);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
JNIEXPORT jlong JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
Java_sun_management_VMManagementImpl_getInitializedClassCount
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
    return jmm_interface->GetLongAttribute(env, NULL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
                                           JMM_CLASS_INIT_TOTAL_COUNT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
JNIEXPORT jlong JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
Java_sun_management_VMManagementImpl_getClassInitializationTime
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
    return jmm_interface->GetLongAttribute(env, NULL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
                                           JMM_CLASS_INIT_TOTAL_TIME_MS);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
JNIEXPORT jlong JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
Java_sun_management_VMManagementImpl_getClassVerificationTime
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
  (JNIEnv *env, jobject dummy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
    return jmm_interface->GetLongAttribute(env, NULL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
                                           JMM_CLASS_VERIFY_TOTAL_TIME_MS);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
}