< prev index next >

src/hotspot/share/runtime/thread.cpp

Print this page

        

@@ -239,10 +239,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;
   _nested_threads_hazard_ptr = NULL;
   _nested_threads_hazard_ptr_cnt = 0;

@@ -877,10 +880,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 (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 (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);
   }
   if (_threads_hazard_ptr != NULL) {
     st->print("_threads_hazard_ptr=" INTPTR_FORMAT, p2i(_threads_hazard_ptr));
< prev index next >