< prev index next >

src/hotspot/share/runtime/thread.cpp

Print this page
rev 50303 : Thread Dump Extension (memory allocation)

@@ -235,10 +235,13 @@
   set_metadata_handles(new (ResourceObj::C_HEAP, mtClass) GrowableArray<Metadata*>(30, true));
   set_active_handles(NULL);
   set_free_handle_block(NULL);
   set_last_handle_mark(NULL);
 
+  _statistic_info.setStartTime(os::javaTimeMillis());
+  _statistic_info.setDefineClassCount(0);
+
   // This initial value ==> never claimed.
   _oops_do_parity = 0;
   _threads_hazard_ptr = NULL;
   _threads_list_ptr = NULL;
   _nested_threads_hazard_ptr_cnt = 0;

@@ -874,10 +877,25 @@
   if (osthread() != NULL) {
     int os_prio;
     if (os::get_native_priority(this, &os_prio) == OS_OK) {
       st->print("os_prio=%d ", os_prio);
     }
+
+    if (PrintExtendedThreadInfo && os::is_thread_cpu_time_supported()) {
+      st->print("cpu=%.2fms ",
+                os::thread_cpu_time(const_cast<Thread*>(this), true) / 1000000.0
+        );
+      st->print("elapsed=%.2fs ",
+                _statistic_info.getElepsedTime() / 1000.0);
+    }
+
+    if (PrintExtendedThreadInfo && is_Java_thread()) {
+      jlong allocated_bytes = const_cast<Thread*>(this)->cooked_allocated_bytes();
+      st->print("allocated=" JLONG_FORMAT "B ", allocated_bytes);
+      st->print("defined_classes=" INT64_FORMAT " ", _statistic_info.getDefineClassCount());
+    }
+
     st->print("tid=" INTPTR_FORMAT " ", p2i(this));
     osthread()->print_on(st);
   }
   ThreadsSMRSupport::print_info_on(this, st);
   st->print(" ");
< prev index next >