< prev index next >

src/hotspot/share/runtime/thread.cpp

Print this page
rev 53271 : 8216981: Per thread IO statistics in JFR


 924   // get_priority assumes osthread initialized
 925   if (osthread() != NULL) {
 926     int os_prio;
 927     if (os::get_native_priority(this, &os_prio) == OS_OK) {
 928       st->print("os_prio=%d ", os_prio);
 929     }
 930 
 931     st->print("cpu=%.2fms ",
 932               os::thread_cpu_time(const_cast<Thread*>(this), true) / 1000000.0
 933               );
 934     st->print("elapsed=%.2fs ",
 935               _statistical_info.getElapsedTime() / 1000.0
 936               );
 937     if (is_Java_thread() && (PrintExtendedThreadInfo || print_extended_info)) {
 938       size_t allocated_bytes = (size_t) const_cast<Thread*>(this)->cooked_allocated_bytes();
 939       st->print("allocated=" SIZE_FORMAT "%s ",
 940                 byte_size_in_proper_unit(allocated_bytes),
 941                 proper_unit_for_byte_size(allocated_bytes)
 942                 );
 943       st->print("defined_classes=" INT64_FORMAT " ", _statistical_info.getDefineClassCount());

















 944     }
 945 
 946     st->print("tid=" INTPTR_FORMAT " ", p2i(this));
 947     osthread()->print_on(st);
 948   }
 949   ThreadsSMRSupport::print_info_on(this, st);
 950   st->print(" ");
 951   debug_only(if (WizardMode) print_owned_locks_on(st);)
 952 }
 953 
 954 // Thread::print_on_error() is called by fatal error handler. Don't use
 955 // any lock or allocate memory.
 956 void Thread::print_on_error(outputStream* st, char* buf, int buflen) const {
 957   assert(!(is_Compiler_thread() || is_Java_thread()), "Can't call name() here if it allocates");
 958 
 959   if (is_VM_thread())                 { st->print("VMThread"); }
 960   else if (is_GC_task_thread())       { st->print("GCTaskThread"); }
 961   else if (is_Watcher_thread())       { st->print("WatcherThread"); }
 962   else if (is_ConcurrentGC_thread())  { st->print("ConcurrentGCThread"); }
 963   else                                { st->print("Thread"); }




 924   // get_priority assumes osthread initialized
 925   if (osthread() != NULL) {
 926     int os_prio;
 927     if (os::get_native_priority(this, &os_prio) == OS_OK) {
 928       st->print("os_prio=%d ", os_prio);
 929     }
 930 
 931     st->print("cpu=%.2fms ",
 932               os::thread_cpu_time(const_cast<Thread*>(this), true) / 1000000.0
 933               );
 934     st->print("elapsed=%.2fs ",
 935               _statistical_info.getElapsedTime() / 1000.0
 936               );
 937     if (is_Java_thread() && (PrintExtendedThreadInfo || print_extended_info)) {
 938       size_t allocated_bytes = (size_t) const_cast<Thread*>(this)->cooked_allocated_bytes();
 939       st->print("allocated=" SIZE_FORMAT "%s ",
 940                 byte_size_in_proper_unit(allocated_bytes),
 941                 proper_unit_for_byte_size(allocated_bytes)
 942                 );
 943       st->print("defined_classes=" INT64_FORMAT " ", _statistical_info.getDefineClassCount());
 944 
 945       size_t file_written = (size_t) _statistical_info.getBytesWrittenToFile();
 946       size_t file_read = (size_t) _statistical_info.getBytesReadFromFile();
 947       size_t nw_written = (size_t) _statistical_info.getBytesWrittenToNetwork();
 948       size_t nw_read = (size_t) _statistical_info.getBytesReadFromNetwork();
 949       st->print("bytes_written_to_file=" SIZE_FORMAT "%s ",
 950                 byte_size_in_proper_unit(file_written),
 951                 proper_unit_for_byte_size(file_written));
 952       st->print("bytes_read_from_file=" SIZE_FORMAT "%s ",
 953                 byte_size_in_proper_unit(file_read),
 954                 proper_unit_for_byte_size(file_read));
 955       st->print("bytes_written_to_network=" SIZE_FORMAT "%s ",
 956                 byte_size_in_proper_unit(nw_written),
 957                 proper_unit_for_byte_size(nw_written));
 958       st->print("bytes_read_from_network=" SIZE_FORMAT "%s ",
 959                 byte_size_in_proper_unit(nw_read),
 960                 proper_unit_for_byte_size(nw_read));
 961     }
 962 
 963     st->print("tid=" INTPTR_FORMAT " ", p2i(this));
 964     osthread()->print_on(st);
 965   }
 966   ThreadsSMRSupport::print_info_on(this, st);
 967   st->print(" ");
 968   debug_only(if (WizardMode) print_owned_locks_on(st);)
 969 }
 970 
 971 // Thread::print_on_error() is called by fatal error handler. Don't use
 972 // any lock or allocate memory.
 973 void Thread::print_on_error(outputStream* st, char* buf, int buflen) const {
 974   assert(!(is_Compiler_thread() || is_Java_thread()), "Can't call name() here if it allocates");
 975 
 976   if (is_VM_thread())                 { st->print("VMThread"); }
 977   else if (is_GC_task_thread())       { st->print("GCTaskThread"); }
 978   else if (is_Watcher_thread())       { st->print("WatcherThread"); }
 979   else if (is_ConcurrentGC_thread())  { st->print("ConcurrentGCThread"); }
 980   else                                { st->print("Thread"); }


< prev index next >