< prev index next >

src/os/solaris/vm/os_solaris.cpp

Print this page
rev 10257 : 8149036: Add tracing for thread related events at os level
Reviewed-by: coleenp

@@ -30,10 +30,11 @@
 #include "code/vtableStubs.hpp"
 #include "compiler/compileBroker.hpp"
 #include "compiler/disassembler.hpp"
 #include "interpreter/interpreter.hpp"
 #include "jvm_solaris.h"
+#include "logging/log.hpp"
 #include "memory/allocation.inline.hpp"
 #include "memory/filemap.hpp"
 #include "mutex_solaris.inline.hpp"
 #include "oops/oop.inline.hpp"
 #include "os_share_solaris.hpp"

@@ -734,10 +735,13 @@
   OSThread* osthr = thread->osthread();
 
   osthr->set_lwp_id(_lwp_self());  // Store lwp in case we are bound
   thread->_schedctl = (void *) schedctl_init();
 
+  log_debug(os)("Thread is alive (tid: " UINTX_FORMAT ").",
+    os::current_thread_id());
+
   if (UseNUMA) {
     int lgrp_id = os::numa_get_group_id();
     if (lgrp_id != -1) {
       thread->set_lgrp_id(lgrp_id);
     }

@@ -779,10 +783,12 @@
   // which frees the CodeHeap containing the Atomic::dec code
   if (thread != VMThread::vm_thread() && VMThread::vm_thread() != NULL) {
     Atomic::dec(&os::Solaris::_os_thread_count);
   }
 
+  log_debug(os)("Thread finished (tid: " UINTX_FORMAT ").", os::current_thread_id());
+
   if (UseDetachedThreads) {
     thr_exit(NULL);
     ShouldNotReachHere();
   }
   return NULL;

@@ -851,10 +857,13 @@
 
   // initialize signal mask for this thread
   // and save the caller's signal mask
   os::Solaris::hotspot_sigmask(thread);
 
+  log_debug(os)("Thread attached (tid: " UINTX_FORMAT ").",
+    os::current_thread_id());
+
   return true;
 }
 
 bool os::create_main_thread(JavaThread* thread) {
 #ifdef ASSERT

@@ -973,17 +982,18 @@
   osthread->set_lwp_id(-1);
   osthread->set_thread_id(-1);
 
   status = thr_create(NULL, stack_size, java_start, thread, flags, &tid);
   if (status != 0) {
-    if (PrintMiscellaneous && (Verbose || WizardMode)) {
-      perror("os::create_thread");
-    }
+    log_warning(os)("Failed to start thread - thr_create failed (%s)",
+      strerror(status));
     thread->set_osthread(NULL);
     // Need to clean up stuff we've allocated so far
     delete osthread;
     return false;
+  } else {
+    log_debug(os)("Thread started (tid: " UINTX_FORMAT ").", (uintx) tid);
   }
 
   Atomic::inc(&os::Solaris::_os_thread_count);
 
   // Store info on the Solaris thread into the OSThread
< prev index next >