< prev index next >
src/hotspot/share/runtime/thread.cpp
Print this page
rev 50748 : Thread Dump Extension (memory allocation)
*** 91,100 ****
--- 91,101 ----
#include "runtime/sweeper.hpp"
#include "runtime/task.hpp"
#include "runtime/thread.inline.hpp"
#include "runtime/threadCritical.hpp"
#include "runtime/threadSMR.inline.hpp"
+ #include "runtime/threadStatisticalInfo.hpp"
#include "runtime/timer.hpp"
#include "runtime/timerTrace.hpp"
#include "runtime/vframe.inline.hpp"
#include "runtime/vframeArray.hpp"
#include "runtime/vframe_hp.hpp"
*** 867,883 ****
f(metadata_handles()->at(i));
}
}
}
! void Thread::print_on(outputStream* st) const {
// get_priority assumes osthread initialized
if (osthread() != NULL) {
int os_prio;
if (os::get_native_priority(this, &os_prio) == OS_OK) {
st->print("os_prio=%d ", os_prio);
}
st->print("tid=" INTPTR_FORMAT " ", p2i(this));
osthread()->print_on(st);
}
ThreadsSMRSupport::print_info_on(this, st);
st->print(" ");
--- 868,900 ----
f(metadata_handles()->at(i));
}
}
}
! void Thread::print_on(outputStream* st, bool print_extended_info) const {
// get_priority assumes osthread initialized
if (osthread() != NULL) {
int os_prio;
if (os::get_native_priority(this, &os_prio) == OS_OK) {
st->print("os_prio=%d ", os_prio);
}
+
+ st->print("cpu=%.2fms ",
+ os::thread_cpu_time(const_cast<Thread*>(this), true) / 1000000.0
+ );
+ st->print("elapsed=%.2fs ",
+ _statistical_info.getElapsedTime() / 1000.0
+ );
+ if (is_Java_thread() && (PrintExtendedThreadInfo || print_extended_info)) {
+ size_t allocated_bytes = (size_t) const_cast<Thread*>(this)->cooked_allocated_bytes();
+ st->print("allocated=" SIZE_FORMAT "%s ",
+ byte_size_in_proper_unit(allocated_bytes),
+ proper_unit_for_byte_size(allocated_bytes)
+ );
+ st->print("defined_classes=" INT64_FORMAT " ", _statistical_info.getDefineClassCount());
+ }
+
st->print("tid=" INTPTR_FORMAT " ", p2i(this));
osthread()->print_on(st);
}
ThreadsSMRSupport::print_info_on(this, st);
st->print(" ");
*** 2869,2889 ****
print_thread_state_on(tty);
}
#endif // PRODUCT
// Called by Threads::print() for VM_PrintThreads operation
! void JavaThread::print_on(outputStream *st) const {
st->print_raw("\"");
st->print_raw(get_thread_name());
st->print_raw("\" ");
oop thread_oop = threadObj();
if (thread_oop != NULL) {
st->print("#" INT64_FORMAT " ", (int64_t)java_lang_Thread::thread_id(thread_oop));
if (java_lang_Thread::is_daemon(thread_oop)) st->print("daemon ");
st->print("prio=%d ", java_lang_Thread::priority(thread_oop));
}
! Thread::print_on(st);
// print guess for valid stack memory region (assume 4K pages); helps lock debugging
st->print_cr("[" INTPTR_FORMAT "]", (intptr_t)last_Java_sp() & ~right_n_bits(12));
if (thread_oop != NULL) {
st->print_cr(" java.lang.Thread.State: %s", java_lang_Thread::thread_status_name(thread_oop));
}
--- 2886,2906 ----
print_thread_state_on(tty);
}
#endif // PRODUCT
// Called by Threads::print() for VM_PrintThreads operation
! void JavaThread::print_on(outputStream *st, bool print_extended_info) const {
st->print_raw("\"");
st->print_raw(get_thread_name());
st->print_raw("\" ");
oop thread_oop = threadObj();
if (thread_oop != NULL) {
st->print("#" INT64_FORMAT " ", (int64_t)java_lang_Thread::thread_id(thread_oop));
if (java_lang_Thread::is_daemon(thread_oop)) st->print("daemon ");
st->print("prio=%d ", java_lang_Thread::priority(thread_oop));
}
! Thread::print_on(st, print_extended_info);
// print guess for valid stack memory region (assume 4K pages); helps lock debugging
st->print_cr("[" INTPTR_FORMAT "]", (intptr_t)last_Java_sp() & ~right_n_bits(12));
if (thread_oop != NULL) {
st->print_cr(" java.lang.Thread.State: %s", java_lang_Thread::thread_status_name(thread_oop));
}
*** 4529,4539 ****
return the_owner;
}
// Threads::print_on() is called at safepoint by VM_PrintThreads operation.
void Threads::print_on(outputStream* st, bool print_stacks,
! bool internal_format, bool print_concurrent_locks) {
char buf[32];
st->print_raw_cr(os::local_time_string(buf, sizeof(buf)));
st->print_cr("Full thread dump %s (%s %s):",
Abstract_VM_Version::vm_name(),
--- 4546,4557 ----
return the_owner;
}
// Threads::print_on() is called at safepoint by VM_PrintThreads operation.
void Threads::print_on(outputStream* st, bool print_stacks,
! bool internal_format, bool print_concurrent_locks,
! bool print_extended_info) {
char buf[32];
st->print_raw_cr(os::local_time_string(buf, sizeof(buf)));
st->print_cr("Full thread dump %s (%s %s):",
Abstract_VM_Version::vm_name(),
*** 4552,4562 ****
ThreadsSMRSupport::print_info_on(st);
st->cr();
ALL_JAVA_THREADS(p) {
ResourceMark rm;
! p->print_on(st);
if (print_stacks) {
if (internal_format) {
p->trace_stack();
} else {
p->print_stack_on(st);
--- 4570,4580 ----
ThreadsSMRSupport::print_info_on(st);
st->cr();
ALL_JAVA_THREADS(p) {
ResourceMark rm;
! p->print_on(st, print_extended_info);
if (print_stacks) {
if (internal_format) {
p->trace_stack();
} else {
p->print_stack_on(st);
< prev index next >