91 #include "runtime/sweeper.hpp" |
91 #include "runtime/sweeper.hpp" |
92 #include "runtime/task.hpp" |
92 #include "runtime/task.hpp" |
93 #include "runtime/thread.inline.hpp" |
93 #include "runtime/thread.inline.hpp" |
94 #include "runtime/threadCritical.hpp" |
94 #include "runtime/threadCritical.hpp" |
95 #include "runtime/threadSMR.inline.hpp" |
95 #include "runtime/threadSMR.inline.hpp" |
|
96 #include "runtime/threadStatisticalInfo.hpp" |
96 #include "runtime/timer.hpp" |
97 #include "runtime/timer.hpp" |
97 #include "runtime/timerTrace.hpp" |
98 #include "runtime/timerTrace.hpp" |
98 #include "runtime/vframe.inline.hpp" |
99 #include "runtime/vframe.inline.hpp" |
99 #include "runtime/vframeArray.hpp" |
100 #include "runtime/vframeArray.hpp" |
100 #include "runtime/vframe_hp.hpp" |
101 #include "runtime/vframe_hp.hpp" |
867 f(metadata_handles()->at(i)); |
868 f(metadata_handles()->at(i)); |
868 } |
869 } |
869 } |
870 } |
870 } |
871 } |
871 |
872 |
872 void Thread::print_on(outputStream* st) const { |
873 void Thread::print_on(outputStream* st, bool print_extended_info) const { |
873 // get_priority assumes osthread initialized |
874 // get_priority assumes osthread initialized |
874 if (osthread() != NULL) { |
875 if (osthread() != NULL) { |
875 int os_prio; |
876 int os_prio; |
876 if (os::get_native_priority(this, &os_prio) == OS_OK) { |
877 if (os::get_native_priority(this, &os_prio) == OS_OK) { |
877 st->print("os_prio=%d ", os_prio); |
878 st->print("os_prio=%d ", os_prio); |
878 } |
879 } |
|
880 |
|
881 st->print("cpu=%.2fms ", |
|
882 os::thread_cpu_time(const_cast<Thread*>(this), true) / 1000000.0 |
|
883 ); |
|
884 st->print("elapsed=%.2fs ", |
|
885 _statistical_info.getElapsedTime() / 1000.0 |
|
886 ); |
|
887 if (is_Java_thread() && (PrintExtendedThreadInfo || print_extended_info)) { |
|
888 size_t allocated_bytes = (size_t) const_cast<Thread*>(this)->cooked_allocated_bytes(); |
|
889 st->print("allocated=" SIZE_FORMAT "%s ", |
|
890 byte_size_in_proper_unit(allocated_bytes), |
|
891 proper_unit_for_byte_size(allocated_bytes) |
|
892 ); |
|
893 st->print("defined_classes=" INT64_FORMAT " ", _statistical_info.getDefineClassCount()); |
|
894 } |
|
895 |
879 st->print("tid=" INTPTR_FORMAT " ", p2i(this)); |
896 st->print("tid=" INTPTR_FORMAT " ", p2i(this)); |
880 osthread()->print_on(st); |
897 osthread()->print_on(st); |
881 } |
898 } |
882 ThreadsSMRSupport::print_info_on(this, st); |
899 ThreadsSMRSupport::print_info_on(this, st); |
883 st->print(" "); |
900 st->print(" "); |
2869 print_thread_state_on(tty); |
2886 print_thread_state_on(tty); |
2870 } |
2887 } |
2871 #endif // PRODUCT |
2888 #endif // PRODUCT |
2872 |
2889 |
2873 // Called by Threads::print() for VM_PrintThreads operation |
2890 // Called by Threads::print() for VM_PrintThreads operation |
2874 void JavaThread::print_on(outputStream *st) const { |
2891 void JavaThread::print_on(outputStream *st, bool print_extended_info) const { |
2875 st->print_raw("\""); |
2892 st->print_raw("\""); |
2876 st->print_raw(get_thread_name()); |
2893 st->print_raw(get_thread_name()); |
2877 st->print_raw("\" "); |
2894 st->print_raw("\" "); |
2878 oop thread_oop = threadObj(); |
2895 oop thread_oop = threadObj(); |
2879 if (thread_oop != NULL) { |
2896 if (thread_oop != NULL) { |
2880 st->print("#" INT64_FORMAT " ", (int64_t)java_lang_Thread::thread_id(thread_oop)); |
2897 st->print("#" INT64_FORMAT " ", (int64_t)java_lang_Thread::thread_id(thread_oop)); |
2881 if (java_lang_Thread::is_daemon(thread_oop)) st->print("daemon "); |
2898 if (java_lang_Thread::is_daemon(thread_oop)) st->print("daemon "); |
2882 st->print("prio=%d ", java_lang_Thread::priority(thread_oop)); |
2899 st->print("prio=%d ", java_lang_Thread::priority(thread_oop)); |
2883 } |
2900 } |
2884 Thread::print_on(st); |
2901 Thread::print_on(st, print_extended_info); |
2885 // print guess for valid stack memory region (assume 4K pages); helps lock debugging |
2902 // print guess for valid stack memory region (assume 4K pages); helps lock debugging |
2886 st->print_cr("[" INTPTR_FORMAT "]", (intptr_t)last_Java_sp() & ~right_n_bits(12)); |
2903 st->print_cr("[" INTPTR_FORMAT "]", (intptr_t)last_Java_sp() & ~right_n_bits(12)); |
2887 if (thread_oop != NULL) { |
2904 if (thread_oop != NULL) { |
2888 st->print_cr(" java.lang.Thread.State: %s", java_lang_Thread::thread_status_name(thread_oop)); |
2905 st->print_cr(" java.lang.Thread.State: %s", java_lang_Thread::thread_status_name(thread_oop)); |
2889 } |
2906 } |
4529 return the_owner; |
4546 return the_owner; |
4530 } |
4547 } |
4531 |
4548 |
4532 // Threads::print_on() is called at safepoint by VM_PrintThreads operation. |
4549 // Threads::print_on() is called at safepoint by VM_PrintThreads operation. |
4533 void Threads::print_on(outputStream* st, bool print_stacks, |
4550 void Threads::print_on(outputStream* st, bool print_stacks, |
4534 bool internal_format, bool print_concurrent_locks) { |
4551 bool internal_format, bool print_concurrent_locks, |
|
4552 bool print_extended_info) { |
4535 char buf[32]; |
4553 char buf[32]; |
4536 st->print_raw_cr(os::local_time_string(buf, sizeof(buf))); |
4554 st->print_raw_cr(os::local_time_string(buf, sizeof(buf))); |
4537 |
4555 |
4538 st->print_cr("Full thread dump %s (%s %s):", |
4556 st->print_cr("Full thread dump %s (%s %s):", |
4539 Abstract_VM_Version::vm_name(), |
4557 Abstract_VM_Version::vm_name(), |