< prev index next >

src/hotspot/share/runtime/memprofiler.cpp

Print this page
rev 47862 : imported patch 10.07.open.rebase_20171110.dcubed
rev 47866 : robinw CR: Fix some inefficient code, update some comments, fix some indents, and add some 'const' specifiers.

*** 34,43 **** --- 34,44 ---- #include "runtime/memprofiler.hpp" #include "runtime/mutexLocker.hpp" #include "runtime/os.hpp" #include "runtime/task.hpp" #include "runtime/thread.inline.hpp" + #include "runtime/threadSMR.hpp" #include "runtime/vmThread.hpp" #ifndef PRODUCT // --------------------------------------------------------
*** 49,60 **** void task(); }; void MemProfilerTask::task() { - // Get thread lock to provide mutual exclusion, and so we can iterate safely over the thread list. - MutexLocker mu(Threads_lock); MemProfiler::do_trace(); } //---------------------------------------------------------- --- 50,59 ----
*** 107,130 **** void MemProfiler::do_trace() { // Calculate thread local sizes size_t handles_memory_usage = VMThread::vm_thread()->handle_area()->size_in_bytes(); size_t resource_memory_usage = VMThread::vm_thread()->resource_area()->size_in_bytes(); ! JavaThread *cur = Threads::first(); ! while (cur != NULL) { handles_memory_usage += cur->handle_area()->size_in_bytes(); resource_memory_usage += cur->resource_area()->size_in_bytes(); - cur = cur->next(); } // Print trace line in log fprintf(_log_fp, "%6.1f,%5d,%5d," UINTX_FORMAT_W(6) "," UINTX_FORMAT_W(6) ",", os::elapsedTime(), ! Threads::number_of_threads(), InstanceKlass::number_of_instance_classes(), Universe::heap()->used() / K, Universe::heap()->capacity() / K); fprintf(_log_fp, UINTX_FORMAT_W(6) ",", CodeCache::capacity() / K); fprintf(_log_fp, UINTX_FORMAT_W(6) "," UINTX_FORMAT_W(6) ",%6ld\n", handles_memory_usage / K, --- 106,130 ---- void MemProfiler::do_trace() { // Calculate thread local sizes size_t handles_memory_usage = VMThread::vm_thread()->handle_area()->size_in_bytes(); size_t resource_memory_usage = VMThread::vm_thread()->resource_area()->size_in_bytes(); ! { ! JavaThreadIteratorWithHandle jtiwh; ! for (; JavaThread *cur = jtiwh.next(); ) { handles_memory_usage += cur->handle_area()->size_in_bytes(); resource_memory_usage += cur->resource_area()->size_in_bytes(); } // Print trace line in log fprintf(_log_fp, "%6.1f,%5d,%5d," UINTX_FORMAT_W(6) "," UINTX_FORMAT_W(6) ",", os::elapsedTime(), ! jtiwh.length(), InstanceKlass::number_of_instance_classes(), Universe::heap()->used() / K, Universe::heap()->capacity() / K); + } fprintf(_log_fp, UINTX_FORMAT_W(6) ",", CodeCache::capacity() / K); fprintf(_log_fp, UINTX_FORMAT_W(6) "," UINTX_FORMAT_W(6) ",%6ld\n", handles_memory_usage / K,
< prev index next >