< prev index next >
src/os/windows/vm/os_windows.cpp
Print this page
rev 10257 : 8149036: Add tracing for thread related events at os level
Reviewed-by:
*** 33,42 ****
--- 33,43 ----
#include "code/vtableStubs.hpp"
#include "compiler/compileBroker.hpp"
#include "compiler/disassembler.hpp"
#include "interpreter/interpreter.hpp"
#include "jvm_windows.h"
+ #include "logging/log.hpp"
#include "memory/allocation.inline.hpp"
#include "memory/filemap.hpp"
#include "mutex_windows.inline.hpp"
#include "oops/oop.inline.hpp"
#include "os_share_windows.hpp"
*** 434,453 ****
--- 435,458 ----
int res = 30115; // non-java thread
if (thread->is_Java_thread()) {
res = 20115; // java thread
}
+ log_debug(os)("Thread is alive (tid: " UINTX_FORMAT ").", os::current_thread_id());
+
// Install a win32 structured exception handler around every thread created
// by VM, so VM can generate error dump when an exception occurred in non-
// Java thread (e.g. VM thread).
__try {
thread->run();
} __except(topLevelExceptionFilter(
(_EXCEPTION_POINTERS*)_exception_info())) {
// Nothing to do.
}
+ log_debug(os)("Thread finished (tid: " UINTX_FORMAT ").", os::current_thread_id());
+
// One less thread is executing
// When the VMThread gets here, the main thread may have already exited
// which frees the CodeHeap containing the Atomic::add code
if (thread != VMThread::vm_thread() && VMThread::vm_thread() != NULL) {
Atomic::dec_ptr((intptr_t*)&os::win32::_os_thread_count);
*** 507,516 ****
--- 512,525 ----
// Initial thread state is RUNNABLE
osthread->set_state(RUNNABLE);
thread->set_osthread(osthread);
+
+ log_debug(os)("Thread attached (tid: " UINTX_FORMAT ").",
+ os::current_thread_id());
+
return true;
}
bool os::create_main_thread(JavaThread* thread) {
#ifdef ASSERT
*** 603,617 ****
--- 612,631 ----
thread,
CREATE_SUSPENDED | STACK_SIZE_PARAM_IS_A_RESERVATION,
&thread_id);
if (thread_handle == NULL) {
+ log_warning(os)("Failed to start thread - _beginthreadex failed (%s).",
+ os::errno_name(errno));
+
// Need to clean up stuff we've allocated so far
CloseHandle(osthread->interrupt_event());
thread->set_osthread(NULL);
delete osthread;
return NULL;
+ } else {
+ log_debug(os)("Thread started (tid: %u)", thread_id);
}
Atomic::inc_ptr((intptr_t*)&os::win32::_os_thread_count);
// Store info on the Win32 thread into the OSThread
< prev index next >