2066 return (jlong)(((double)ticks / (double)os::elapsed_frequency()) |
2066 return (jlong)(((double)ticks / (double)os::elapsed_frequency()) |
2067 * (double)1000.0); |
2067 * (double)1000.0); |
2068 } |
2068 } |
2069 #endif // INCLUDE_MANAGEMENT |
2069 #endif // INCLUDE_MANAGEMENT |
2070 |
2070 |
2071 // Gets the amount of memory allocated on the Java heap for a single thread. |
|
2072 // Returns -1 if the thread does not exist or has terminated. |
|
2073 JVM_ENTRY(jlong, jmm_GetOneThreadAllocatedMemory(JNIEnv *env, jlong thread_id)) |
|
2074 if (thread_id < 0) { |
|
2075 THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(), |
|
2076 "Invalid thread ID", -1); |
|
2077 } |
|
2078 |
|
2079 if (thread_id == 0) { |
|
2080 // current thread |
|
2081 if (THREAD->is_Java_thread()) { |
|
2082 return ((JavaThread*)THREAD)->cooked_allocated_bytes(); |
|
2083 } |
|
2084 return -1; |
|
2085 } |
|
2086 |
|
2087 ThreadsListHandle tlh; |
|
2088 JavaThread* java_thread = tlh.list()->find_JavaThread_from_java_tid(thread_id); |
|
2089 |
|
2090 if (java_thread != NULL) { |
|
2091 return java_thread->cooked_allocated_bytes(); |
|
2092 } |
|
2093 return -1; |
|
2094 JVM_END |
|
2095 |
|
2096 // Gets an array containing the amount of memory allocated on the Java |
2071 // Gets an array containing the amount of memory allocated on the Java |
2097 // heap for a set of threads (in bytes). Each element of the array is |
2072 // heap for a set of threads (in bytes). Each element of the array is |
2098 // the amount of memory allocated for the thread ID specified in the |
2073 // the amount of memory allocated for the thread ID specified in the |
2099 // corresponding entry in the given array of thread IDs; or -1 if the |
2074 // corresponding entry in the given array of thread IDs; or -1 if the |
2100 // thread does not exist or has terminated. |
2075 // thread does not exist or has terminated. |
2215 jmm_GetThreadInfo, |
2190 jmm_GetThreadInfo, |
2216 jmm_GetMemoryPools, |
2191 jmm_GetMemoryPools, |
2217 jmm_GetMemoryManagers, |
2192 jmm_GetMemoryManagers, |
2218 jmm_GetMemoryPoolUsage, |
2193 jmm_GetMemoryPoolUsage, |
2219 jmm_GetPeakMemoryPoolUsage, |
2194 jmm_GetPeakMemoryPoolUsage, |
2220 jmm_GetOneThreadAllocatedMemory, |
|
2221 jmm_GetThreadAllocatedMemory, |
2195 jmm_GetThreadAllocatedMemory, |
2222 jmm_GetMemoryUsage, |
2196 jmm_GetMemoryUsage, |
2223 jmm_GetLongAttribute, |
2197 jmm_GetLongAttribute, |
2224 jmm_GetBoolAttribute, |
2198 jmm_GetBoolAttribute, |
2225 jmm_SetBoolAttribute, |
2199 jmm_SetBoolAttribute, |