2094 if (cmdline == nullptr) {
2095 THROW_MSG_NULL(vmSymbols::java_lang_NullPointerException(),
2096 "Command line content cannot be null.");
2097 }
2098 bufferedStream output;
2099 DCmd::parse_and_execute(DCmd_Source_MBean, &output, cmdline, ' ', CHECK_NULL);
2100 oop result = java_lang_String::create_oop_from_str(output.as_string(), CHECK_NULL);
2101 return (jstring) JNIHandles::make_local(THREAD, result);
2102 JVM_END
2103
2104 JVM_ENTRY(void, jmm_SetDiagnosticFrameworkNotificationEnabled(JNIEnv *env, jboolean enabled))
2105 DCmdFactory::set_jmx_notification_enabled(enabled?true:false);
2106 JVM_END
2107
2108 jlong Management::ticks_to_ms(jlong ticks) {
2109 assert(os::elapsed_frequency() > 0, "Must be non-zero");
2110 return (jlong)(((double)ticks / (double)os::elapsed_frequency())
2111 * (double)1000.0);
2112 }
2113
2114 // Gets the amount of memory allocated on the Java heap since JVM launch.
2115 JVM_ENTRY(jlong, jmm_GetTotalThreadAllocatedMemory(JNIEnv *env))
2116 // A thread increments exited_allocated_bytes in ThreadService::remove_thread
2117 // only after it removes itself from the threads list, and once a TLH is
2118 // created, no thread it references can remove itself from the threads
2119 // list, so none can update exited_allocated_bytes. We therefore initialize
2120 // result with exited_allocated_bytes after after we create the TLH so that
2121 // the final result can only be short due to (1) threads that start after
2122 // the TLH is created, or (2) terminating threads that escape TLH creation
2123 // and don't update exited_allocated_bytes before we initialize result.
2124
2125 // We keep a high water mark to ensure monotonicity in case threads counted
2126 // on a previous call end up in state (2).
2127 static jlong high_water_result = 0;
2128
2129 JavaThreadIteratorWithHandle jtiwh;
2130 jlong result = ThreadService::exited_allocated_bytes();
2131 for (; JavaThread* thread = jtiwh.next();) {
2132 jlong size = thread->cooked_allocated_bytes();
2133 result += size;
|
2094 if (cmdline == nullptr) {
2095 THROW_MSG_NULL(vmSymbols::java_lang_NullPointerException(),
2096 "Command line content cannot be null.");
2097 }
2098 bufferedStream output;
2099 DCmd::parse_and_execute(DCmd_Source_MBean, &output, cmdline, ' ', CHECK_NULL);
2100 oop result = java_lang_String::create_oop_from_str(output.as_string(), CHECK_NULL);
2101 return (jstring) JNIHandles::make_local(THREAD, result);
2102 JVM_END
2103
2104 JVM_ENTRY(void, jmm_SetDiagnosticFrameworkNotificationEnabled(JNIEnv *env, jboolean enabled))
2105 DCmdFactory::set_jmx_notification_enabled(enabled?true:false);
2106 JVM_END
2107
2108 jlong Management::ticks_to_ms(jlong ticks) {
2109 assert(os::elapsed_frequency() > 0, "Must be non-zero");
2110 return (jlong)(((double)ticks / (double)os::elapsed_frequency())
2111 * (double)1000.0);
2112 }
2113
2114 jlong Management::ticks_to_us(jlong ticks) {
2115 assert(os::elapsed_frequency() > 0, "Must be non-zero");
2116 return (jlong)(((double)ticks / (double)os::elapsed_frequency())
2117 * (double)1000000.0);
2118 }
2119
2120 // Gets the amount of memory allocated on the Java heap since JVM launch.
2121 JVM_ENTRY(jlong, jmm_GetTotalThreadAllocatedMemory(JNIEnv *env))
2122 // A thread increments exited_allocated_bytes in ThreadService::remove_thread
2123 // only after it removes itself from the threads list, and once a TLH is
2124 // created, no thread it references can remove itself from the threads
2125 // list, so none can update exited_allocated_bytes. We therefore initialize
2126 // result with exited_allocated_bytes after after we create the TLH so that
2127 // the final result can only be short due to (1) threads that start after
2128 // the TLH is created, or (2) terminating threads that escape TLH creation
2129 // and don't update exited_allocated_bytes before we initialize result.
2130
2131 // We keep a high water mark to ensure monotonicity in case threads counted
2132 // on a previous call end up in state (2).
2133 static jlong high_water_result = 0;
2134
2135 JavaThreadIteratorWithHandle jtiwh;
2136 jlong result = ThreadService::exited_allocated_bytes();
2137 for (; JavaThread* thread = jtiwh.next();) {
2138 jlong size = thread->cooked_allocated_bytes();
2139 result += size;
|