1 /* src/native/vm/openjdk/management.cpp - HotSpot management interface functions
3 Copyright (C) 2008 Theobroma Systems Ltd.
5 This file is part of CACAO.
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License as
9 published by the Free Software Foundation; either version 2, or (at
10 your option) any later version.
12 This program is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
29 // Include our JNI header before the JMM header, because the JMM
30 // header include jni.h and we want to override the typedefs in jni.h.
31 #include "native/jni.hpp"
33 #include INCLUDE_JMM_H
35 #include "native/vm/openjdk/management.hpp"
37 #include "toolbox/logging.h"
44 * Initialize the Management subsystem.
46 Management::Management()
48 // Initialize optional support
49 _optional_support.isLowMemoryDetectionSupported = 1;
50 _optional_support.isCompilationTimeMonitoringSupported = 1;
51 _optional_support.isThreadContentionMonitoringSupported = 1;
53 // if (os::is_thread_cpu_time_supported()) {
55 _optional_support.isCurrentThreadCpuTimeSupported = 1;
56 _optional_support.isOtherThreadCpuTimeSupported = 1;
59 _optional_support.isCurrentThreadCpuTimeSupported = 0;
60 _optional_support.isOtherThreadCpuTimeSupported = 0;
63 _optional_support.isBootClassPathSupported = 1;
64 _optional_support.isObjectMonitorUsageSupported = 1;
65 _optional_support.isSynchronizerUsageSupported = 1;
70 * Return a pointer to the optional support structure.
72 * @param Pointer to optional support structure.
74 const jmmOptionalSupport& Management::get_optional_support() const
76 return _optional_support;
80 // Interface functions are exported as C functions.
83 // Returns a version string and sets major and minor version if the
84 // input parameters are non-null.
85 jint jmm_GetVersion(JNIEnv* env)
91 // Gets the list of VM monitoring and management optional supports
92 // Returns 0 if succeeded; otherwise returns non-zero.
93 jint jmm_GetOptionalSupport(JNIEnv* env, jmmOptionalSupport* support)
95 if (support == NULL) {
99 Management& mm = VM::get_current()->get_management();
101 // memcpy the structure.
102 os::memcpy(support, &mm.get_optional_support(), sizeof(jmmOptionalSupport));
108 jobject jmm_GetInputArguments(JNIEnv* env)
110 log_println("jmm_GetInputArguments: IMPLEMENT ME!");
115 jobjectArray jmm_GetInputArgumentArray(JNIEnv* env)
117 log_println("jmm_GetInputArgumentArray: IMPLEMENT ME!");
122 jobjectArray jmm_GetMemoryPools(JNIEnv* env, jobject obj)
124 log_println("jmm_GetMemoryPools: IMPLEMENT ME!");
129 jobjectArray jmm_GetMemoryManagers(JNIEnv* env, jobject obj)
131 log_println("jmm_GetMemoryManagers: IMPLEMENT ME!");
136 jobject jmm_GetMemoryPoolUsage(JNIEnv* env, jobject obj)
138 log_println("jmm_GetMemoryPoolUsage: IMPLEMENT ME!");
143 jobject jmm_GetPeakMemoryPoolUsage(JNIEnv* env, jobject obj)
145 log_println("jmm_GetPeakMemoryPoolUsage: IMPLEMENT ME!");
150 jobject jmm_GetPoolCollectionUsage(JNIEnv* env, jobject obj)
152 log_println("jmm_GetPoolCollectionUsage: IMPLEMENT ME!");
157 void jmm_SetPoolSensor(JNIEnv* env, jobject obj, jmmThresholdType type, jobject sensorObj)
159 log_println("jmm_SetPoolSensor: IMPLEMENT ME!");
163 jlong jmm_SetPoolThreshold(JNIEnv* env, jobject obj, jmmThresholdType type, jlong threshold)
165 log_println("jmm_SetPoolThreshold: IMPLEMENT ME!");
170 jobject jmm_GetMemoryUsage(JNIEnv* env, jboolean heap)
172 log_println("jmm_GetMemoryUsage: IMPLEMENT ME!");
177 jboolean jmm_GetBoolAttribute(JNIEnv* env, jmmBoolAttribute att)
179 log_println("jmm_GetBoolAttribute: IMPLEMENT ME!");
184 jboolean jmm_SetBoolAttribute(JNIEnv* env, jmmBoolAttribute att, jboolean flag)
186 log_println("jmm_SetBoolAttribute: IMPLEMENT ME!");
191 jlong jmm_GetLongAttribute(JNIEnv* env, jobject obj, jmmLongAttribute att)
193 log_println("jmm_GetLongAttribute: IMPLEMENT ME!");
198 jint jmm_GetLongAttributes(JNIEnv* env, jobject obj, jmmLongAttribute* atts, jint count, jlong* result)
200 log_println("jmm_GetLongAttributes: IMPLEMENT ME!");
205 jint jmm_GetThreadInfo(JNIEnv* env, jlongArray ids, jint maxDepth, jobjectArray infoArray)
207 log_println("jmm_GetThreadInfo: IMPLEMENT ME!");
212 jobjectArray jmm_DumpThreads(JNIEnv* env, jlongArray thread_ids, jboolean locked_monitors, jboolean locked_synchronizers)
214 log_println("jmm_DumpThreads: IMPLEMENT ME!");
219 jobjectArray jmm_GetLoadedClasses(JNIEnv* env)
221 log_println("jmm_GetLoadedClasses: IMPLEMENT ME!");
226 jboolean jmm_ResetStatistic(JNIEnv* env, jvalue obj, jmmStatisticType type)
228 log_println("jmm_ResetStatistic: IMPLEMENT ME!");
233 jlong jmm_GetThreadCpuTime(JNIEnv* env, jlong thread_id)
235 log_println("jmm_GetThreadCpuTime: IMPLEMENT ME!");
240 jlong jmm_GetThreadCpuTimeWithKind(JNIEnv* env, jlong thread_id, jboolean user_sys_cpu_time)
242 log_println("jmm_GetThreadCpuTimeWithKind: IMPLEMENT ME!");
247 jobjectArray jmm_GetVMGlobalNames(JNIEnv* env)
249 log_println("jmm_GetVMGlobalNames: IMPLEMENT ME!");
254 jint jmm_GetVMGlobals(JNIEnv* env, jobjectArray names, jmmVMGlobal* globals, jint count)
256 log_println("jmm_GetVMGlobals: IMPLEMENT ME!");
261 void jmm_SetVMGlobal(JNIEnv* env, jstring flag_name, jvalue new_value)
263 log_println("jmm_SetVMGlobal: IMPLEMENT ME!");
267 jint jmm_GetInternalThreadTimes(JNIEnv* env, jobjectArray names, jlongArray times)
269 log_println("jmm_GetInternalThreadTimes: IMPLEMENT ME!");
274 jobjectArray jmm_FindDeadlockedThreads(JNIEnv* env, jboolean object_monitors_only)
276 log_println("jmm_FindDeadlockedThreads: IMPLEMENT ME!");
281 jobjectArray jmm_FindMonitorDeadlockedThreads(JNIEnv* env)
283 log_println("jmm_FindMonitorDeadlockedThreads: IMPLEMENT ME!");
288 jint jmm_GetGCExtAttributeInfo(JNIEnv* env, jobject mgr, jmmExtAttributeInfo* info, jint count)
290 log_println("jmm_GetGCExtAttributeInfo: IMPLEMENT ME!");
295 void jmm_GetLastGCStat(JNIEnv* env, jobject obj, jmmGCStat* gc_stat)
297 log_println("jmm_GetLastGCStat: IMPLEMENT ME!");
301 jint jmm_DumpHeap0(JNIEnv* env, jstring outputfile, jboolean live)
303 log_println("jmm_DumpHeap0: IMPLEMENT ME!");
310 const struct jmmInterface_1_ jmm_interface = {
314 jmm_GetOptionalSupport,
315 jmm_GetInputArguments,
317 jmm_GetInputArgumentArray,
319 jmm_GetMemoryManagers,
320 jmm_GetMemoryPoolUsage,
321 jmm_GetPeakMemoryPoolUsage,
324 jmm_GetLongAttribute,
325 jmm_GetBoolAttribute,
326 jmm_SetBoolAttribute,
327 jmm_GetLongAttributes,
328 jmm_FindMonitorDeadlockedThreads,
329 jmm_GetThreadCpuTime,
330 jmm_GetVMGlobalNames,
332 jmm_GetInternalThreadTimes,
335 jmm_SetPoolThreshold,
336 jmm_GetPoolCollectionUsage,
337 jmm_GetGCExtAttributeInfo,
339 jmm_GetThreadCpuTimeWithKind,
342 jmm_FindDeadlockedThreads,
350 * Return the requested management interface.
352 * @param version Requested management interface version.
354 * @return Pointer to management interface structure.
356 void* Management::get_jmm_interface(int version)
358 if (version == JMM_VERSION_1_0) {
359 return (void*) &jmm_interface;
366 * These are local overrides for various environment variables in Emacs.
367 * Please do not remove this and leave it at the end of the file, where
368 * Emacs will automagically detect them.
369 * ---------------------------------------------------------------------
372 * indent-tabs-mode: t
376 * vim:noexpandtab:sw=4:ts=4: