comparison src/share/vm/runtime/thread.cpp @ 6766:a7509aff1b06

7194254: jstack reports wrong thread priorities Reviewed-by: dholmes, sla, fparain Contributed-by: Dmytro Sheyko <dmytro_sheyko@hotmail.com>
author dholmes
date Mon, 17 Sep 2012 07:36:31 -0400
parents 6dfc6a541338
children c088e2e95e69
comparison
equal deleted inserted replaced
6749:a6fe94b9759f 6766:a7509aff1b06
834 } 834 }
835 835
836 void Thread::print_on(outputStream* st) const { 836 void Thread::print_on(outputStream* st) const {
837 // get_priority assumes osthread initialized 837 // get_priority assumes osthread initialized
838 if (osthread() != NULL) { 838 if (osthread() != NULL) {
839 st->print("prio=%d tid=" INTPTR_FORMAT " ", get_priority(this), this); 839 int os_prio;
840 if (os::get_native_priority(this, &os_prio) == OS_OK) {
841 st->print("os_prio=%d ", os_prio);
842 }
843 st->print("tid=" INTPTR_FORMAT " ", this);
840 osthread()->print_on(st); 844 osthread()->print_on(st);
841 } 845 }
842 debug_only(if (WizardMode) print_owned_locks_on(st);) 846 debug_only(if (WizardMode) print_owned_locks_on(st);)
843 } 847 }
844 848
2741 2745
2742 // Called by Threads::print() for VM_PrintThreads operation 2746 // Called by Threads::print() for VM_PrintThreads operation
2743 void JavaThread::print_on(outputStream *st) const { 2747 void JavaThread::print_on(outputStream *st) const {
2744 st->print("\"%s\" ", get_thread_name()); 2748 st->print("\"%s\" ", get_thread_name());
2745 oop thread_oop = threadObj(); 2749 oop thread_oop = threadObj();
2746 if (thread_oop != NULL && java_lang_Thread::is_daemon(thread_oop)) st->print("daemon "); 2750 if (thread_oop != NULL) {
2751 st->print("#" INT64_FORMAT " ", java_lang_Thread::thread_id(thread_oop));
2752 if (java_lang_Thread::is_daemon(thread_oop)) st->print("daemon ");
2753 st->print("prio=%d ", java_lang_Thread::priority(thread_oop));
2754 }
2747 Thread::print_on(st); 2755 Thread::print_on(st);
2748 // print guess for valid stack memory region (assume 4K pages); helps lock debugging 2756 // print guess for valid stack memory region (assume 4K pages); helps lock debugging
2749 st->print_cr("[" INTPTR_FORMAT "]", (intptr_t)last_Java_sp() & ~right_n_bits(12)); 2757 st->print_cr("[" INTPTR_FORMAT "]", (intptr_t)last_Java_sp() & ~right_n_bits(12));
2750 if (thread_oop != NULL && JDK_Version::is_gte_jdk15x_version()) { 2758 if (thread_oop != NULL && JDK_Version::is_gte_jdk15x_version()) {
2751 st->print_cr(" java.lang.Thread.State: %s", java_lang_Thread::thread_status_name(thread_oop)); 2759 st->print_cr(" java.lang.Thread.State: %s", java_lang_Thread::thread_status_name(thread_oop));
4268 4276
4269 VMThread::vm_thread()->print_on(st); 4277 VMThread::vm_thread()->print_on(st);
4270 st->cr(); 4278 st->cr();
4271 Universe::heap()->print_gc_threads_on(st); 4279 Universe::heap()->print_gc_threads_on(st);
4272 WatcherThread* wt = WatcherThread::watcher_thread(); 4280 WatcherThread* wt = WatcherThread::watcher_thread();
4273 if (wt != NULL) wt->print_on(st); 4281 if (wt != NULL) {
4274 st->cr(); 4282 wt->print_on(st);
4283 st->cr();
4284 }
4275 CompileBroker::print_compiler_threads_on(st); 4285 CompileBroker::print_compiler_threads_on(st);
4276 st->flush(); 4286 st->flush();
4277 } 4287 }
4278 4288
4279 // Threads::print_on_error() is called by fatal error handler. It's possible 4289 // Threads::print_on_error() is called by fatal error handler. It's possible