changeset 247:33a77b567b62

Bug 3293: [REFACTORING] Realtime deadlock detector implementation Reviewed-by: ykubota https://github.com/HeapStats/heapstats/pull/115
author Yasumasa Suenaga <yasuenag@gmail.com>
date Wed, 02 Aug 2017 14:46:00 +0900
parents b3d1289e4539
children 3c68803ba91b
files ChangeLog agent/heapstats.conf.in agent/src/heapstats-engines/Makefile.am agent/src/heapstats-engines/Makefile.in agent/src/heapstats-engines/configuration.cpp agent/src/heapstats-engines/deadlockDetector.cpp agent/src/heapstats-engines/deadlockDetector.hpp agent/src/heapstats-engines/deadlockFinder.cpp agent/src/heapstats-engines/deadlockFinder.hpp agent/src/heapstats-engines/globals.hpp agent/src/heapstats-engines/libmain.cpp agent/src/heapstats-engines/logMain.cpp agent/src/heapstats-engines/util.hpp agent/test/deadlock/NoDeadLock.java agent/test/race-condition/MonitorContendedEnter/MonitorContendedEnter/buildenv.sh agent/test/race-condition/MonitorContendedEnter/MonitorContendedEnter/heapstats-deadlock.conf agent/test/race-condition/MonitorContendedEnter/MonitorContendedEnter/test.py agent/test/race-condition/MonitorContendedEnter/MonitorContendedEnter/testcase/Test.java agent/test/race-condition/MonitorContendedEnter/MonitorContendedEnter_safepoint/buildenv.sh agent/test/race-condition/MonitorContendedEnter/MonitorContendedEnter_safepoint/heapstats-deadlock.conf agent/test/race-condition/MonitorContendedEnter/MonitorContendedEnter_safepoint/test.py agent/test/race-condition/MonitorContendedEnter/MonitorContendedEnter_safepoint/testcase agent/test/race-condition/MonitorContendedEnter/MonitorContendedEntered/buildenv.sh agent/test/race-condition/MonitorContendedEnter/MonitorContendedEntered/heapstats-deadlock.conf agent/test/race-condition/MonitorContendedEnter/MonitorContendedEntered/test.py agent/test/race-condition/MonitorContendedEnter/MonitorContendedEntered/testcase/Test.java agent/test/race-condition/MonitorContendedEnter/MonitorContendedEntered_safepoint/buildenv.sh agent/test/race-condition/MonitorContendedEnter/MonitorContendedEntered_safepoint/heapstats-deadlock.conf agent/test/race-condition/MonitorContendedEnter/MonitorContendedEntered_safepoint/test.py agent/test/race-condition/MonitorContendedEnter/MonitorContendedEntered_safepoint/testcase agent/test/race-condition/MonitorContendedEntered/MonitorContendedEnter/buildenv.sh agent/test/race-condition/MonitorContendedEntered/MonitorContendedEnter/heapstats-deadlock.conf agent/test/race-condition/MonitorContendedEntered/MonitorContendedEnter/test.py agent/test/race-condition/MonitorContendedEntered/MonitorContendedEnter/testcase/Test.java agent/test/race-condition/MonitorContendedEntered/MonitorContendedEnter_safepoint/buildenv.sh agent/test/race-condition/MonitorContendedEntered/MonitorContendedEnter_safepoint/heapstats-deadlock.conf agent/test/race-condition/MonitorContendedEntered/MonitorContendedEnter_safepoint/test.py agent/test/race-condition/MonitorContendedEntered/MonitorContendedEnter_safepoint/testcase agent/test/race-condition/MonitorContendedEntered/MonitorContendedEntered/buildenv.sh agent/test/race-condition/MonitorContendedEntered/MonitorContendedEntered/heapstats-deadlock.conf agent/test/race-condition/MonitorContendedEntered/MonitorContendedEntered/test.py agent/test/race-condition/MonitorContendedEntered/MonitorContendedEntered/testcase/Test.java agent/test/race-condition/MonitorContendedEntered/MonitorContendedEntered_safepoint/buildenv.sh agent/test/race-condition/MonitorContendedEntered/MonitorContendedEntered_safepoint/heapstats-deadlock.conf agent/test/race-condition/MonitorContendedEntered/MonitorContendedEntered_safepoint/test.py agent/test/race-condition/MonitorContendedEntered/MonitorContendedEntered_safepoint/testcase agent/test/race-condition/testlist.txt
diffstat 47 files changed, 1427 insertions(+), 1085 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Jul 24 21:16:53 2017 +0900
+++ b/ChangeLog	Wed Aug 02 14:46:00 2017 +0900
@@ -1,3 +1,7 @@
+2017-08-02 Yasumasa Suenaga <yasuenag@gmail.com>
+
+	* Bug 3293: [REFACTORING] Realtime deadlock detector implementation
+
 2017-07-24 Yasumasa Suenaga <yasuenag@gmail.com>
 
 	* Bug 3429: [REGRESSION] Cannot build HeapStats Agent on RHEL
--- a/agent/heapstats.conf.in	Mon Jul 24 21:16:53 2017 +0900
+++ b/agent/heapstats.conf.in	Wed Aug 02 14:46:00 2017 +0900
@@ -18,8 +18,6 @@
 trigger_on_dump=true
 
 # deadlock check
-# This feature is experimental. It might be a cause of HotSpot internal error
-# when you set this flag to true.
 check_deadlock=false
 
 # Trigger logging setting
--- a/agent/src/heapstats-engines/Makefile.am	Mon Jul 24 21:16:53 2017 +0900
+++ b/agent/src/heapstats-engines/Makefile.am	Wed Aug 02 14:46:00 2017 +0900
@@ -6,7 +6,7 @@
                   snapShotContainer.cpp classContainer.cpp gcWatcher.cpp      \
                   logMain.cpp jvmSockCmd.cpp signalManager.cpp logManager.cpp \
                   archiveMaker.cpp cmdArchiver.cpp fsUtil.cpp                 \
-                  jniZipArchiver.cpp deadlockFinder.cpp vmVariables.cpp       \
+                  jniZipArchiver.cpp deadlockDetector.cpp vmVariables.cpp     \
                   vmFunctions.cpp configuration.cpp overrider.cpp             \
                   threadRecorder.cpp heapstatsMBean.cpp overrideFunc.S        \
                   trapSender.cpp
--- a/agent/src/heapstats-engines/Makefile.in	Mon Jul 24 21:16:53 2017 +0900
+++ b/agent/src/heapstats-engines/Makefile.in	Wed Aug 02 14:46:00 2017 +0900
@@ -125,7 +125,7 @@
 	classContainer.cpp gcWatcher.cpp logMain.cpp jvmSockCmd.cpp \
 	signalManager.cpp logManager.cpp archiveMaker.cpp \
 	cmdArchiver.cpp fsUtil.cpp jniZipArchiver.cpp \
-	deadlockFinder.cpp vmVariables.cpp vmFunctions.cpp \
+	deadlockDetector.cpp vmVariables.cpp vmFunctions.cpp \
 	configuration.cpp overrider.cpp threadRecorder.cpp \
 	heapstatsMBean.cpp overrideFunc.S trapSender.cpp pcreRegex.cpp \
 	arch/x86/x86BitMapMarker.cpp \
@@ -154,7 +154,7 @@
 	libheapstats_engine_avx_2_0_so-cmdArchiver.$(OBJEXT) \
 	libheapstats_engine_avx_2_0_so-fsUtil.$(OBJEXT) \
 	libheapstats_engine_avx_2_0_so-jniZipArchiver.$(OBJEXT) \
-	libheapstats_engine_avx_2_0_so-deadlockFinder.$(OBJEXT) \
+	libheapstats_engine_avx_2_0_so-deadlockDetector.$(OBJEXT) \
 	libheapstats_engine_avx_2_0_so-vmVariables.$(OBJEXT) \
 	libheapstats_engine_avx_2_0_so-vmFunctions.$(OBJEXT) \
 	libheapstats_engine_avx_2_0_so-configuration.$(OBJEXT) \
@@ -183,7 +183,7 @@
 	classContainer.cpp gcWatcher.cpp logMain.cpp jvmSockCmd.cpp \
 	signalManager.cpp logManager.cpp archiveMaker.cpp \
 	cmdArchiver.cpp fsUtil.cpp jniZipArchiver.cpp \
-	deadlockFinder.cpp vmVariables.cpp vmFunctions.cpp \
+	deadlockDetector.cpp vmVariables.cpp vmFunctions.cpp \
 	configuration.cpp overrider.cpp threadRecorder.cpp \
 	heapstatsMBean.cpp overrideFunc.S trapSender.cpp pcreRegex.cpp \
 	arch/arm/armBitMapMarker.cpp \
@@ -211,7 +211,7 @@
 	libheapstats_engine_neon_2_0_so-cmdArchiver.$(OBJEXT) \
 	libheapstats_engine_neon_2_0_so-fsUtil.$(OBJEXT) \
 	libheapstats_engine_neon_2_0_so-jniZipArchiver.$(OBJEXT) \
-	libheapstats_engine_neon_2_0_so-deadlockFinder.$(OBJEXT) \
+	libheapstats_engine_neon_2_0_so-deadlockDetector.$(OBJEXT) \
 	libheapstats_engine_neon_2_0_so-vmVariables.$(OBJEXT) \
 	libheapstats_engine_neon_2_0_so-vmFunctions.$(OBJEXT) \
 	libheapstats_engine_neon_2_0_so-configuration.$(OBJEXT) \
@@ -238,7 +238,7 @@
 	classContainer.cpp gcWatcher.cpp logMain.cpp jvmSockCmd.cpp \
 	signalManager.cpp logManager.cpp archiveMaker.cpp \
 	cmdArchiver.cpp fsUtil.cpp jniZipArchiver.cpp \
-	deadlockFinder.cpp vmVariables.cpp vmFunctions.cpp \
+	deadlockDetector.cpp vmVariables.cpp vmFunctions.cpp \
 	configuration.cpp overrider.cpp threadRecorder.cpp \
 	heapstatsMBean.cpp overrideFunc.S trapSender.cpp pcreRegex.cpp \
 	arch/arm/armBitMapMarker.cpp arch/x86/x86BitMapMarker.cpp
@@ -265,7 +265,7 @@
 	libheapstats_engine_none_2_0_so-cmdArchiver.$(OBJEXT) \
 	libheapstats_engine_none_2_0_so-fsUtil.$(OBJEXT) \
 	libheapstats_engine_none_2_0_so-jniZipArchiver.$(OBJEXT) \
-	libheapstats_engine_none_2_0_so-deadlockFinder.$(OBJEXT) \
+	libheapstats_engine_none_2_0_so-deadlockDetector.$(OBJEXT) \
 	libheapstats_engine_none_2_0_so-vmVariables.$(OBJEXT) \
 	libheapstats_engine_none_2_0_so-vmFunctions.$(OBJEXT) \
 	libheapstats_engine_none_2_0_so-configuration.$(OBJEXT) \
@@ -294,7 +294,7 @@
 	classContainer.cpp gcWatcher.cpp logMain.cpp jvmSockCmd.cpp \
 	signalManager.cpp logManager.cpp archiveMaker.cpp \
 	cmdArchiver.cpp fsUtil.cpp jniZipArchiver.cpp \
-	deadlockFinder.cpp vmVariables.cpp vmFunctions.cpp \
+	deadlockDetector.cpp vmVariables.cpp vmFunctions.cpp \
 	configuration.cpp overrider.cpp threadRecorder.cpp \
 	heapstatsMBean.cpp overrideFunc.S trapSender.cpp pcreRegex.cpp \
 	arch/x86/x86BitMapMarker.cpp \
@@ -322,7 +322,7 @@
 	libheapstats_engine_sse2_2_0_so-cmdArchiver.$(OBJEXT) \
 	libheapstats_engine_sse2_2_0_so-fsUtil.$(OBJEXT) \
 	libheapstats_engine_sse2_2_0_so-jniZipArchiver.$(OBJEXT) \
-	libheapstats_engine_sse2_2_0_so-deadlockFinder.$(OBJEXT) \
+	libheapstats_engine_sse2_2_0_so-deadlockDetector.$(OBJEXT) \
 	libheapstats_engine_sse2_2_0_so-vmVariables.$(OBJEXT) \
 	libheapstats_engine_sse2_2_0_so-vmFunctions.$(OBJEXT) \
 	libheapstats_engine_sse2_2_0_so-configuration.$(OBJEXT) \
@@ -349,7 +349,7 @@
 	classContainer.cpp gcWatcher.cpp logMain.cpp jvmSockCmd.cpp \
 	signalManager.cpp logManager.cpp archiveMaker.cpp \
 	cmdArchiver.cpp fsUtil.cpp jniZipArchiver.cpp \
-	deadlockFinder.cpp vmVariables.cpp vmFunctions.cpp \
+	deadlockDetector.cpp vmVariables.cpp vmFunctions.cpp \
 	configuration.cpp overrider.cpp threadRecorder.cpp \
 	heapstatsMBean.cpp overrideFunc.S trapSender.cpp pcreRegex.cpp \
 	arch/x86/x86BitMapMarker.cpp \
@@ -377,7 +377,7 @@
 	libheapstats_engine_sse3_2_0_so-cmdArchiver.$(OBJEXT) \
 	libheapstats_engine_sse3_2_0_so-fsUtil.$(OBJEXT) \
 	libheapstats_engine_sse3_2_0_so-jniZipArchiver.$(OBJEXT) \
-	libheapstats_engine_sse3_2_0_so-deadlockFinder.$(OBJEXT) \
+	libheapstats_engine_sse3_2_0_so-deadlockDetector.$(OBJEXT) \
 	libheapstats_engine_sse3_2_0_so-vmVariables.$(OBJEXT) \
 	libheapstats_engine_sse3_2_0_so-vmFunctions.$(OBJEXT) \
 	libheapstats_engine_sse3_2_0_so-configuration.$(OBJEXT) \
@@ -404,7 +404,7 @@
 	classContainer.cpp gcWatcher.cpp logMain.cpp jvmSockCmd.cpp \
 	signalManager.cpp logManager.cpp archiveMaker.cpp \
 	cmdArchiver.cpp fsUtil.cpp jniZipArchiver.cpp \
-	deadlockFinder.cpp vmVariables.cpp vmFunctions.cpp \
+	deadlockDetector.cpp vmVariables.cpp vmFunctions.cpp \
 	configuration.cpp overrider.cpp threadRecorder.cpp \
 	heapstatsMBean.cpp overrideFunc.S trapSender.cpp pcreRegex.cpp \
 	arch/x86/x86BitMapMarker.cpp \
@@ -432,7 +432,7 @@
 	libheapstats_engine_sse4_2_0_so-cmdArchiver.$(OBJEXT) \
 	libheapstats_engine_sse4_2_0_so-fsUtil.$(OBJEXT) \
 	libheapstats_engine_sse4_2_0_so-jniZipArchiver.$(OBJEXT) \
-	libheapstats_engine_sse4_2_0_so-deadlockFinder.$(OBJEXT) \
+	libheapstats_engine_sse4_2_0_so-deadlockDetector.$(OBJEXT) \
 	libheapstats_engine_sse4_2_0_so-vmVariables.$(OBJEXT) \
 	libheapstats_engine_sse4_2_0_so-vmFunctions.$(OBJEXT) \
 	libheapstats_engine_sse4_2_0_so-configuration.$(OBJEXT) \
@@ -662,7 +662,7 @@
 	snapShotProcessor.cpp snapShotContainer.cpp classContainer.cpp \
 	gcWatcher.cpp logMain.cpp jvmSockCmd.cpp signalManager.cpp \
 	logManager.cpp archiveMaker.cpp cmdArchiver.cpp fsUtil.cpp \
-	jniZipArchiver.cpp deadlockFinder.cpp vmVariables.cpp \
+	jniZipArchiver.cpp deadlockDetector.cpp vmVariables.cpp \
 	vmFunctions.cpp configuration.cpp overrider.cpp \
 	threadRecorder.cpp heapstatsMBean.cpp overrideFunc.S \
 	trapSender.cpp $(am__append_1)
@@ -871,7 +871,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheapstats_engine_avx_2_0_so-classContainer.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheapstats_engine_avx_2_0_so-cmdArchiver.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheapstats_engine_avx_2_0_so-configuration.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheapstats_engine_avx_2_0_so-deadlockFinder.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheapstats_engine_avx_2_0_so-deadlockDetector.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheapstats_engine_avx_2_0_so-fsUtil.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheapstats_engine_avx_2_0_so-gcWatcher.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheapstats_engine_avx_2_0_so-heapstatsMBean.Po@am__quote@
@@ -903,7 +903,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheapstats_engine_neon_2_0_so-classContainer.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheapstats_engine_neon_2_0_so-cmdArchiver.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheapstats_engine_neon_2_0_so-configuration.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheapstats_engine_neon_2_0_so-deadlockFinder.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheapstats_engine_neon_2_0_so-deadlockDetector.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheapstats_engine_neon_2_0_so-fsUtil.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheapstats_engine_neon_2_0_so-gcWatcher.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheapstats_engine_neon_2_0_so-heapstatsMBean.Po@am__quote@
@@ -935,7 +935,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheapstats_engine_none_2_0_so-classContainer.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheapstats_engine_none_2_0_so-cmdArchiver.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheapstats_engine_none_2_0_so-configuration.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheapstats_engine_none_2_0_so-deadlockFinder.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheapstats_engine_none_2_0_so-deadlockDetector.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheapstats_engine_none_2_0_so-fsUtil.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheapstats_engine_none_2_0_so-gcWatcher.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheapstats_engine_none_2_0_so-heapstatsMBean.Po@am__quote@
@@ -967,7 +967,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheapstats_engine_sse2_2_0_so-classContainer.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheapstats_engine_sse2_2_0_so-cmdArchiver.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheapstats_engine_sse2_2_0_so-configuration.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheapstats_engine_sse2_2_0_so-deadlockFinder.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheapstats_engine_sse2_2_0_so-deadlockDetector.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheapstats_engine_sse2_2_0_so-fsUtil.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheapstats_engine_sse2_2_0_so-gcWatcher.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheapstats_engine_sse2_2_0_so-heapstatsMBean.Po@am__quote@
@@ -999,7 +999,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheapstats_engine_sse3_2_0_so-classContainer.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheapstats_engine_sse3_2_0_so-cmdArchiver.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheapstats_engine_sse3_2_0_so-configuration.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheapstats_engine_sse3_2_0_so-deadlockFinder.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheapstats_engine_sse3_2_0_so-deadlockDetector.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheapstats_engine_sse3_2_0_so-fsUtil.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheapstats_engine_sse3_2_0_so-gcWatcher.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheapstats_engine_sse3_2_0_so-heapstatsMBean.Po@am__quote@
@@ -1031,7 +1031,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheapstats_engine_sse4_2_0_so-classContainer.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheapstats_engine_sse4_2_0_so-cmdArchiver.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheapstats_engine_sse4_2_0_so-configuration.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheapstats_engine_sse4_2_0_so-deadlockFinder.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheapstats_engine_sse4_2_0_so-deadlockDetector.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheapstats_engine_sse4_2_0_so-fsUtil.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheapstats_engine_sse4_2_0_so-gcWatcher.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheapstats_engine_sse4_2_0_so-heapstatsMBean.Po@am__quote@
@@ -1495,19 +1495,19 @@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_avx_2_0_so_CXXFLAGS) $(CXXFLAGS) -c -o libheapstats_engine_avx_2_0_so-jniZipArchiver.obj `if test -f 'jniZipArchiver.cpp'; then $(CYGPATH_W) 'jniZipArchiver.cpp'; else $(CYGPATH_W) '$(srcdir)/jniZipArchiver.cpp'; fi`
 
-libheapstats_engine_avx_2_0_so-deadlockFinder.o: deadlockFinder.cpp
-@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_avx_2_0_so_CXXFLAGS) $(CXXFLAGS) -MT libheapstats_engine_avx_2_0_so-deadlockFinder.o -MD -MP -MF $(DEPDIR)/libheapstats_engine_avx_2_0_so-deadlockFinder.Tpo -c -o libheapstats_engine_avx_2_0_so-deadlockFinder.o `test -f 'deadlockFinder.cpp' || echo '$(srcdir)/'`deadlockFinder.cpp
-@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libheapstats_engine_avx_2_0_so-deadlockFinder.Tpo $(DEPDIR)/libheapstats_engine_avx_2_0_so-deadlockFinder.Po
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='deadlockFinder.cpp' object='libheapstats_engine_avx_2_0_so-deadlockFinder.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_avx_2_0_so_CXXFLAGS) $(CXXFLAGS) -c -o libheapstats_engine_avx_2_0_so-deadlockFinder.o `test -f 'deadlockFinder.cpp' || echo '$(srcdir)/'`deadlockFinder.cpp
-
-libheapstats_engine_avx_2_0_so-deadlockFinder.obj: deadlockFinder.cpp
-@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_avx_2_0_so_CXXFLAGS) $(CXXFLAGS) -MT libheapstats_engine_avx_2_0_so-deadlockFinder.obj -MD -MP -MF $(DEPDIR)/libheapstats_engine_avx_2_0_so-deadlockFinder.Tpo -c -o libheapstats_engine_avx_2_0_so-deadlockFinder.obj `if test -f 'deadlockFinder.cpp'; then $(CYGPATH_W) 'deadlockFinder.cpp'; else $(CYGPATH_W) '$(srcdir)/deadlockFinder.cpp'; fi`
-@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libheapstats_engine_avx_2_0_so-deadlockFinder.Tpo $(DEPDIR)/libheapstats_engine_avx_2_0_so-deadlockFinder.Po
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='deadlockFinder.cpp' object='libheapstats_engine_avx_2_0_so-deadlockFinder.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_avx_2_0_so_CXXFLAGS) $(CXXFLAGS) -c -o libheapstats_engine_avx_2_0_so-deadlockFinder.obj `if test -f 'deadlockFinder.cpp'; then $(CYGPATH_W) 'deadlockFinder.cpp'; else $(CYGPATH_W) '$(srcdir)/deadlockFinder.cpp'; fi`
+libheapstats_engine_avx_2_0_so-deadlockDetector.o: deadlockDetector.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_avx_2_0_so_CXXFLAGS) $(CXXFLAGS) -MT libheapstats_engine_avx_2_0_so-deadlockDetector.o -MD -MP -MF $(DEPDIR)/libheapstats_engine_avx_2_0_so-deadlockDetector.Tpo -c -o libheapstats_engine_avx_2_0_so-deadlockDetector.o `test -f 'deadlockDetector.cpp' || echo '$(srcdir)/'`deadlockDetector.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libheapstats_engine_avx_2_0_so-deadlockDetector.Tpo $(DEPDIR)/libheapstats_engine_avx_2_0_so-deadlockDetector.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='deadlockDetector.cpp' object='libheapstats_engine_avx_2_0_so-deadlockDetector.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_avx_2_0_so_CXXFLAGS) $(CXXFLAGS) -c -o libheapstats_engine_avx_2_0_so-deadlockDetector.o `test -f 'deadlockDetector.cpp' || echo '$(srcdir)/'`deadlockDetector.cpp
+
+libheapstats_engine_avx_2_0_so-deadlockDetector.obj: deadlockDetector.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_avx_2_0_so_CXXFLAGS) $(CXXFLAGS) -MT libheapstats_engine_avx_2_0_so-deadlockDetector.obj -MD -MP -MF $(DEPDIR)/libheapstats_engine_avx_2_0_so-deadlockDetector.Tpo -c -o libheapstats_engine_avx_2_0_so-deadlockDetector.obj `if test -f 'deadlockDetector.cpp'; then $(CYGPATH_W) 'deadlockDetector.cpp'; else $(CYGPATH_W) '$(srcdir)/deadlockDetector.cpp'; fi`
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libheapstats_engine_avx_2_0_so-deadlockDetector.Tpo $(DEPDIR)/libheapstats_engine_avx_2_0_so-deadlockDetector.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='deadlockDetector.cpp' object='libheapstats_engine_avx_2_0_so-deadlockDetector.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_avx_2_0_so_CXXFLAGS) $(CXXFLAGS) -c -o libheapstats_engine_avx_2_0_so-deadlockDetector.obj `if test -f 'deadlockDetector.cpp'; then $(CYGPATH_W) 'deadlockDetector.cpp'; else $(CYGPATH_W) '$(srcdir)/deadlockDetector.cpp'; fi`
 
 libheapstats_engine_avx_2_0_so-vmVariables.o: vmVariables.cpp
 @am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_avx_2_0_so_CXXFLAGS) $(CXXFLAGS) -MT libheapstats_engine_avx_2_0_so-vmVariables.o -MD -MP -MF $(DEPDIR)/libheapstats_engine_avx_2_0_so-vmVariables.Tpo -c -o libheapstats_engine_avx_2_0_so-vmVariables.o `test -f 'vmVariables.cpp' || echo '$(srcdir)/'`vmVariables.cpp
@@ -1971,19 +1971,19 @@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_neon_2_0_so_CXXFLAGS) $(CXXFLAGS) -c -o libheapstats_engine_neon_2_0_so-jniZipArchiver.obj `if test -f 'jniZipArchiver.cpp'; then $(CYGPATH_W) 'jniZipArchiver.cpp'; else $(CYGPATH_W) '$(srcdir)/jniZipArchiver.cpp'; fi`
 
-libheapstats_engine_neon_2_0_so-deadlockFinder.o: deadlockFinder.cpp
-@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_neon_2_0_so_CXXFLAGS) $(CXXFLAGS) -MT libheapstats_engine_neon_2_0_so-deadlockFinder.o -MD -MP -MF $(DEPDIR)/libheapstats_engine_neon_2_0_so-deadlockFinder.Tpo -c -o libheapstats_engine_neon_2_0_so-deadlockFinder.o `test -f 'deadlockFinder.cpp' || echo '$(srcdir)/'`deadlockFinder.cpp
-@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libheapstats_engine_neon_2_0_so-deadlockFinder.Tpo $(DEPDIR)/libheapstats_engine_neon_2_0_so-deadlockFinder.Po
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='deadlockFinder.cpp' object='libheapstats_engine_neon_2_0_so-deadlockFinder.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_neon_2_0_so_CXXFLAGS) $(CXXFLAGS) -c -o libheapstats_engine_neon_2_0_so-deadlockFinder.o `test -f 'deadlockFinder.cpp' || echo '$(srcdir)/'`deadlockFinder.cpp
-
-libheapstats_engine_neon_2_0_so-deadlockFinder.obj: deadlockFinder.cpp
-@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_neon_2_0_so_CXXFLAGS) $(CXXFLAGS) -MT libheapstats_engine_neon_2_0_so-deadlockFinder.obj -MD -MP -MF $(DEPDIR)/libheapstats_engine_neon_2_0_so-deadlockFinder.Tpo -c -o libheapstats_engine_neon_2_0_so-deadlockFinder.obj `if test -f 'deadlockFinder.cpp'; then $(CYGPATH_W) 'deadlockFinder.cpp'; else $(CYGPATH_W) '$(srcdir)/deadlockFinder.cpp'; fi`
-@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libheapstats_engine_neon_2_0_so-deadlockFinder.Tpo $(DEPDIR)/libheapstats_engine_neon_2_0_so-deadlockFinder.Po
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='deadlockFinder.cpp' object='libheapstats_engine_neon_2_0_so-deadlockFinder.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_neon_2_0_so_CXXFLAGS) $(CXXFLAGS) -c -o libheapstats_engine_neon_2_0_so-deadlockFinder.obj `if test -f 'deadlockFinder.cpp'; then $(CYGPATH_W) 'deadlockFinder.cpp'; else $(CYGPATH_W) '$(srcdir)/deadlockFinder.cpp'; fi`
+libheapstats_engine_neon_2_0_so-deadlockDetector.o: deadlockDetector.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_neon_2_0_so_CXXFLAGS) $(CXXFLAGS) -MT libheapstats_engine_neon_2_0_so-deadlockDetector.o -MD -MP -MF $(DEPDIR)/libheapstats_engine_neon_2_0_so-deadlockDetector.Tpo -c -o libheapstats_engine_neon_2_0_so-deadlockDetector.o `test -f 'deadlockDetector.cpp' || echo '$(srcdir)/'`deadlockDetector.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libheapstats_engine_neon_2_0_so-deadlockDetector.Tpo $(DEPDIR)/libheapstats_engine_neon_2_0_so-deadlockDetector.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='deadlockDetector.cpp' object='libheapstats_engine_neon_2_0_so-deadlockDetector.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_neon_2_0_so_CXXFLAGS) $(CXXFLAGS) -c -o libheapstats_engine_neon_2_0_so-deadlockDetector.o `test -f 'deadlockDetector.cpp' || echo '$(srcdir)/'`deadlockDetector.cpp
+
+libheapstats_engine_neon_2_0_so-deadlockDetector.obj: deadlockDetector.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_neon_2_0_so_CXXFLAGS) $(CXXFLAGS) -MT libheapstats_engine_neon_2_0_so-deadlockDetector.obj -MD -MP -MF $(DEPDIR)/libheapstats_engine_neon_2_0_so-deadlockDetector.Tpo -c -o libheapstats_engine_neon_2_0_so-deadlockDetector.obj `if test -f 'deadlockDetector.cpp'; then $(CYGPATH_W) 'deadlockDetector.cpp'; else $(CYGPATH_W) '$(srcdir)/deadlockDetector.cpp'; fi`
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libheapstats_engine_neon_2_0_so-deadlockDetector.Tpo $(DEPDIR)/libheapstats_engine_neon_2_0_so-deadlockDetector.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='deadlockDetector.cpp' object='libheapstats_engine_neon_2_0_so-deadlockDetector.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_neon_2_0_so_CXXFLAGS) $(CXXFLAGS) -c -o libheapstats_engine_neon_2_0_so-deadlockDetector.obj `if test -f 'deadlockDetector.cpp'; then $(CYGPATH_W) 'deadlockDetector.cpp'; else $(CYGPATH_W) '$(srcdir)/deadlockDetector.cpp'; fi`
 
 libheapstats_engine_neon_2_0_so-vmVariables.o: vmVariables.cpp
 @am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_neon_2_0_so_CXXFLAGS) $(CXXFLAGS) -MT libheapstats_engine_neon_2_0_so-vmVariables.o -MD -MP -MF $(DEPDIR)/libheapstats_engine_neon_2_0_so-vmVariables.Tpo -c -o libheapstats_engine_neon_2_0_so-vmVariables.o `test -f 'vmVariables.cpp' || echo '$(srcdir)/'`vmVariables.cpp
@@ -2433,19 +2433,19 @@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_none_2_0_so_CXXFLAGS) $(CXXFLAGS) -c -o libheapstats_engine_none_2_0_so-jniZipArchiver.obj `if test -f 'jniZipArchiver.cpp'; then $(CYGPATH_W) 'jniZipArchiver.cpp'; else $(CYGPATH_W) '$(srcdir)/jniZipArchiver.cpp'; fi`
 
-libheapstats_engine_none_2_0_so-deadlockFinder.o: deadlockFinder.cpp
-@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_none_2_0_so_CXXFLAGS) $(CXXFLAGS) -MT libheapstats_engine_none_2_0_so-deadlockFinder.o -MD -MP -MF $(DEPDIR)/libheapstats_engine_none_2_0_so-deadlockFinder.Tpo -c -o libheapstats_engine_none_2_0_so-deadlockFinder.o `test -f 'deadlockFinder.cpp' || echo '$(srcdir)/'`deadlockFinder.cpp
-@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libheapstats_engine_none_2_0_so-deadlockFinder.Tpo $(DEPDIR)/libheapstats_engine_none_2_0_so-deadlockFinder.Po
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='deadlockFinder.cpp' object='libheapstats_engine_none_2_0_so-deadlockFinder.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_none_2_0_so_CXXFLAGS) $(CXXFLAGS) -c -o libheapstats_engine_none_2_0_so-deadlockFinder.o `test -f 'deadlockFinder.cpp' || echo '$(srcdir)/'`deadlockFinder.cpp
-
-libheapstats_engine_none_2_0_so-deadlockFinder.obj: deadlockFinder.cpp
-@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_none_2_0_so_CXXFLAGS) $(CXXFLAGS) -MT libheapstats_engine_none_2_0_so-deadlockFinder.obj -MD -MP -MF $(DEPDIR)/libheapstats_engine_none_2_0_so-deadlockFinder.Tpo -c -o libheapstats_engine_none_2_0_so-deadlockFinder.obj `if test -f 'deadlockFinder.cpp'; then $(CYGPATH_W) 'deadlockFinder.cpp'; else $(CYGPATH_W) '$(srcdir)/deadlockFinder.cpp'; fi`
-@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libheapstats_engine_none_2_0_so-deadlockFinder.Tpo $(DEPDIR)/libheapstats_engine_none_2_0_so-deadlockFinder.Po
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='deadlockFinder.cpp' object='libheapstats_engine_none_2_0_so-deadlockFinder.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_none_2_0_so_CXXFLAGS) $(CXXFLAGS) -c -o libheapstats_engine_none_2_0_so-deadlockFinder.obj `if test -f 'deadlockFinder.cpp'; then $(CYGPATH_W) 'deadlockFinder.cpp'; else $(CYGPATH_W) '$(srcdir)/deadlockFinder.cpp'; fi`
+libheapstats_engine_none_2_0_so-deadlockDetector.o: deadlockDetector.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_none_2_0_so_CXXFLAGS) $(CXXFLAGS) -MT libheapstats_engine_none_2_0_so-deadlockDetector.o -MD -MP -MF $(DEPDIR)/libheapstats_engine_none_2_0_so-deadlockDetector.Tpo -c -o libheapstats_engine_none_2_0_so-deadlockDetector.o `test -f 'deadlockDetector.cpp' || echo '$(srcdir)/'`deadlockDetector.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libheapstats_engine_none_2_0_so-deadlockDetector.Tpo $(DEPDIR)/libheapstats_engine_none_2_0_so-deadlockDetector.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='deadlockDetector.cpp' object='libheapstats_engine_none_2_0_so-deadlockDetector.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_none_2_0_so_CXXFLAGS) $(CXXFLAGS) -c -o libheapstats_engine_none_2_0_so-deadlockDetector.o `test -f 'deadlockDetector.cpp' || echo '$(srcdir)/'`deadlockDetector.cpp
+
+libheapstats_engine_none_2_0_so-deadlockDetector.obj: deadlockDetector.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_none_2_0_so_CXXFLAGS) $(CXXFLAGS) -MT libheapstats_engine_none_2_0_so-deadlockDetector.obj -MD -MP -MF $(DEPDIR)/libheapstats_engine_none_2_0_so-deadlockDetector.Tpo -c -o libheapstats_engine_none_2_0_so-deadlockDetector.obj `if test -f 'deadlockDetector.cpp'; then $(CYGPATH_W) 'deadlockDetector.cpp'; else $(CYGPATH_W) '$(srcdir)/deadlockDetector.cpp'; fi`
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libheapstats_engine_none_2_0_so-deadlockDetector.Tpo $(DEPDIR)/libheapstats_engine_none_2_0_so-deadlockDetector.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='deadlockDetector.cpp' object='libheapstats_engine_none_2_0_so-deadlockDetector.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_none_2_0_so_CXXFLAGS) $(CXXFLAGS) -c -o libheapstats_engine_none_2_0_so-deadlockDetector.obj `if test -f 'deadlockDetector.cpp'; then $(CYGPATH_W) 'deadlockDetector.cpp'; else $(CYGPATH_W) '$(srcdir)/deadlockDetector.cpp'; fi`
 
 libheapstats_engine_none_2_0_so-vmVariables.o: vmVariables.cpp
 @am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_none_2_0_so_CXXFLAGS) $(CXXFLAGS) -MT libheapstats_engine_none_2_0_so-vmVariables.o -MD -MP -MF $(DEPDIR)/libheapstats_engine_none_2_0_so-vmVariables.Tpo -c -o libheapstats_engine_none_2_0_so-vmVariables.o `test -f 'vmVariables.cpp' || echo '$(srcdir)/'`vmVariables.cpp
@@ -2895,19 +2895,19 @@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_sse2_2_0_so_CXXFLAGS) $(CXXFLAGS) -c -o libheapstats_engine_sse2_2_0_so-jniZipArchiver.obj `if test -f 'jniZipArchiver.cpp'; then $(CYGPATH_W) 'jniZipArchiver.cpp'; else $(CYGPATH_W) '$(srcdir)/jniZipArchiver.cpp'; fi`
 
-libheapstats_engine_sse2_2_0_so-deadlockFinder.o: deadlockFinder.cpp
-@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_sse2_2_0_so_CXXFLAGS) $(CXXFLAGS) -MT libheapstats_engine_sse2_2_0_so-deadlockFinder.o -MD -MP -MF $(DEPDIR)/libheapstats_engine_sse2_2_0_so-deadlockFinder.Tpo -c -o libheapstats_engine_sse2_2_0_so-deadlockFinder.o `test -f 'deadlockFinder.cpp' || echo '$(srcdir)/'`deadlockFinder.cpp
-@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libheapstats_engine_sse2_2_0_so-deadlockFinder.Tpo $(DEPDIR)/libheapstats_engine_sse2_2_0_so-deadlockFinder.Po
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='deadlockFinder.cpp' object='libheapstats_engine_sse2_2_0_so-deadlockFinder.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_sse2_2_0_so_CXXFLAGS) $(CXXFLAGS) -c -o libheapstats_engine_sse2_2_0_so-deadlockFinder.o `test -f 'deadlockFinder.cpp' || echo '$(srcdir)/'`deadlockFinder.cpp
-
-libheapstats_engine_sse2_2_0_so-deadlockFinder.obj: deadlockFinder.cpp
-@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_sse2_2_0_so_CXXFLAGS) $(CXXFLAGS) -MT libheapstats_engine_sse2_2_0_so-deadlockFinder.obj -MD -MP -MF $(DEPDIR)/libheapstats_engine_sse2_2_0_so-deadlockFinder.Tpo -c -o libheapstats_engine_sse2_2_0_so-deadlockFinder.obj `if test -f 'deadlockFinder.cpp'; then $(CYGPATH_W) 'deadlockFinder.cpp'; else $(CYGPATH_W) '$(srcdir)/deadlockFinder.cpp'; fi`
-@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libheapstats_engine_sse2_2_0_so-deadlockFinder.Tpo $(DEPDIR)/libheapstats_engine_sse2_2_0_so-deadlockFinder.Po
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='deadlockFinder.cpp' object='libheapstats_engine_sse2_2_0_so-deadlockFinder.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_sse2_2_0_so_CXXFLAGS) $(CXXFLAGS) -c -o libheapstats_engine_sse2_2_0_so-deadlockFinder.obj `if test -f 'deadlockFinder.cpp'; then $(CYGPATH_W) 'deadlockFinder.cpp'; else $(CYGPATH_W) '$(srcdir)/deadlockFinder.cpp'; fi`
+libheapstats_engine_sse2_2_0_so-deadlockDetector.o: deadlockDetector.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_sse2_2_0_so_CXXFLAGS) $(CXXFLAGS) -MT libheapstats_engine_sse2_2_0_so-deadlockDetector.o -MD -MP -MF $(DEPDIR)/libheapstats_engine_sse2_2_0_so-deadlockDetector.Tpo -c -o libheapstats_engine_sse2_2_0_so-deadlockDetector.o `test -f 'deadlockDetector.cpp' || echo '$(srcdir)/'`deadlockDetector.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libheapstats_engine_sse2_2_0_so-deadlockDetector.Tpo $(DEPDIR)/libheapstats_engine_sse2_2_0_so-deadlockDetector.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='deadlockDetector.cpp' object='libheapstats_engine_sse2_2_0_so-deadlockDetector.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_sse2_2_0_so_CXXFLAGS) $(CXXFLAGS) -c -o libheapstats_engine_sse2_2_0_so-deadlockDetector.o `test -f 'deadlockDetector.cpp' || echo '$(srcdir)/'`deadlockDetector.cpp
+
+libheapstats_engine_sse2_2_0_so-deadlockDetector.obj: deadlockDetector.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_sse2_2_0_so_CXXFLAGS) $(CXXFLAGS) -MT libheapstats_engine_sse2_2_0_so-deadlockDetector.obj -MD -MP -MF $(DEPDIR)/libheapstats_engine_sse2_2_0_so-deadlockDetector.Tpo -c -o libheapstats_engine_sse2_2_0_so-deadlockDetector.obj `if test -f 'deadlockDetector.cpp'; then $(CYGPATH_W) 'deadlockDetector.cpp'; else $(CYGPATH_W) '$(srcdir)/deadlockDetector.cpp'; fi`
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libheapstats_engine_sse2_2_0_so-deadlockDetector.Tpo $(DEPDIR)/libheapstats_engine_sse2_2_0_so-deadlockDetector.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='deadlockDetector.cpp' object='libheapstats_engine_sse2_2_0_so-deadlockDetector.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_sse2_2_0_so_CXXFLAGS) $(CXXFLAGS) -c -o libheapstats_engine_sse2_2_0_so-deadlockDetector.obj `if test -f 'deadlockDetector.cpp'; then $(CYGPATH_W) 'deadlockDetector.cpp'; else $(CYGPATH_W) '$(srcdir)/deadlockDetector.cpp'; fi`
 
 libheapstats_engine_sse2_2_0_so-vmVariables.o: vmVariables.cpp
 @am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_sse2_2_0_so_CXXFLAGS) $(CXXFLAGS) -MT libheapstats_engine_sse2_2_0_so-vmVariables.o -MD -MP -MF $(DEPDIR)/libheapstats_engine_sse2_2_0_so-vmVariables.Tpo -c -o libheapstats_engine_sse2_2_0_so-vmVariables.o `test -f 'vmVariables.cpp' || echo '$(srcdir)/'`vmVariables.cpp
@@ -3357,19 +3357,19 @@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_sse3_2_0_so_CXXFLAGS) $(CXXFLAGS) -c -o libheapstats_engine_sse3_2_0_so-jniZipArchiver.obj `if test -f 'jniZipArchiver.cpp'; then $(CYGPATH_W) 'jniZipArchiver.cpp'; else $(CYGPATH_W) '$(srcdir)/jniZipArchiver.cpp'; fi`
 
-libheapstats_engine_sse3_2_0_so-deadlockFinder.o: deadlockFinder.cpp
-@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_sse3_2_0_so_CXXFLAGS) $(CXXFLAGS) -MT libheapstats_engine_sse3_2_0_so-deadlockFinder.o -MD -MP -MF $(DEPDIR)/libheapstats_engine_sse3_2_0_so-deadlockFinder.Tpo -c -o libheapstats_engine_sse3_2_0_so-deadlockFinder.o `test -f 'deadlockFinder.cpp' || echo '$(srcdir)/'`deadlockFinder.cpp
-@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libheapstats_engine_sse3_2_0_so-deadlockFinder.Tpo $(DEPDIR)/libheapstats_engine_sse3_2_0_so-deadlockFinder.Po
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='deadlockFinder.cpp' object='libheapstats_engine_sse3_2_0_so-deadlockFinder.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_sse3_2_0_so_CXXFLAGS) $(CXXFLAGS) -c -o libheapstats_engine_sse3_2_0_so-deadlockFinder.o `test -f 'deadlockFinder.cpp' || echo '$(srcdir)/'`deadlockFinder.cpp
-
-libheapstats_engine_sse3_2_0_so-deadlockFinder.obj: deadlockFinder.cpp
-@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_sse3_2_0_so_CXXFLAGS) $(CXXFLAGS) -MT libheapstats_engine_sse3_2_0_so-deadlockFinder.obj -MD -MP -MF $(DEPDIR)/libheapstats_engine_sse3_2_0_so-deadlockFinder.Tpo -c -o libheapstats_engine_sse3_2_0_so-deadlockFinder.obj `if test -f 'deadlockFinder.cpp'; then $(CYGPATH_W) 'deadlockFinder.cpp'; else $(CYGPATH_W) '$(srcdir)/deadlockFinder.cpp'; fi`
-@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libheapstats_engine_sse3_2_0_so-deadlockFinder.Tpo $(DEPDIR)/libheapstats_engine_sse3_2_0_so-deadlockFinder.Po
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='deadlockFinder.cpp' object='libheapstats_engine_sse3_2_0_so-deadlockFinder.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_sse3_2_0_so_CXXFLAGS) $(CXXFLAGS) -c -o libheapstats_engine_sse3_2_0_so-deadlockFinder.obj `if test -f 'deadlockFinder.cpp'; then $(CYGPATH_W) 'deadlockFinder.cpp'; else $(CYGPATH_W) '$(srcdir)/deadlockFinder.cpp'; fi`
+libheapstats_engine_sse3_2_0_so-deadlockDetector.o: deadlockDetector.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_sse3_2_0_so_CXXFLAGS) $(CXXFLAGS) -MT libheapstats_engine_sse3_2_0_so-deadlockDetector.o -MD -MP -MF $(DEPDIR)/libheapstats_engine_sse3_2_0_so-deadlockDetector.Tpo -c -o libheapstats_engine_sse3_2_0_so-deadlockDetector.o `test -f 'deadlockDetector.cpp' || echo '$(srcdir)/'`deadlockDetector.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libheapstats_engine_sse3_2_0_so-deadlockDetector.Tpo $(DEPDIR)/libheapstats_engine_sse3_2_0_so-deadlockDetector.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='deadlockDetector.cpp' object='libheapstats_engine_sse3_2_0_so-deadlockDetector.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_sse3_2_0_so_CXXFLAGS) $(CXXFLAGS) -c -o libheapstats_engine_sse3_2_0_so-deadlockDetector.o `test -f 'deadlockDetector.cpp' || echo '$(srcdir)/'`deadlockDetector.cpp
+
+libheapstats_engine_sse3_2_0_so-deadlockDetector.obj: deadlockDetector.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_sse3_2_0_so_CXXFLAGS) $(CXXFLAGS) -MT libheapstats_engine_sse3_2_0_so-deadlockDetector.obj -MD -MP -MF $(DEPDIR)/libheapstats_engine_sse3_2_0_so-deadlockDetector.Tpo -c -o libheapstats_engine_sse3_2_0_so-deadlockDetector.obj `if test -f 'deadlockDetector.cpp'; then $(CYGPATH_W) 'deadlockDetector.cpp'; else $(CYGPATH_W) '$(srcdir)/deadlockDetector.cpp'; fi`
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libheapstats_engine_sse3_2_0_so-deadlockDetector.Tpo $(DEPDIR)/libheapstats_engine_sse3_2_0_so-deadlockDetector.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='deadlockDetector.cpp' object='libheapstats_engine_sse3_2_0_so-deadlockDetector.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_sse3_2_0_so_CXXFLAGS) $(CXXFLAGS) -c -o libheapstats_engine_sse3_2_0_so-deadlockDetector.obj `if test -f 'deadlockDetector.cpp'; then $(CYGPATH_W) 'deadlockDetector.cpp'; else $(CYGPATH_W) '$(srcdir)/deadlockDetector.cpp'; fi`
 
 libheapstats_engine_sse3_2_0_so-vmVariables.o: vmVariables.cpp
 @am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_sse3_2_0_so_CXXFLAGS) $(CXXFLAGS) -MT libheapstats_engine_sse3_2_0_so-vmVariables.o -MD -MP -MF $(DEPDIR)/libheapstats_engine_sse3_2_0_so-vmVariables.Tpo -c -o libheapstats_engine_sse3_2_0_so-vmVariables.o `test -f 'vmVariables.cpp' || echo '$(srcdir)/'`vmVariables.cpp
@@ -3819,19 +3819,19 @@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_sse4_2_0_so_CXXFLAGS) $(CXXFLAGS) -c -o libheapstats_engine_sse4_2_0_so-jniZipArchiver.obj `if test -f 'jniZipArchiver.cpp'; then $(CYGPATH_W) 'jniZipArchiver.cpp'; else $(CYGPATH_W) '$(srcdir)/jniZipArchiver.cpp'; fi`
 
-libheapstats_engine_sse4_2_0_so-deadlockFinder.o: deadlockFinder.cpp
-@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_sse4_2_0_so_CXXFLAGS) $(CXXFLAGS) -MT libheapstats_engine_sse4_2_0_so-deadlockFinder.o -MD -MP -MF $(DEPDIR)/libheapstats_engine_sse4_2_0_so-deadlockFinder.Tpo -c -o libheapstats_engine_sse4_2_0_so-deadlockFinder.o `test -f 'deadlockFinder.cpp' || echo '$(srcdir)/'`deadlockFinder.cpp
-@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libheapstats_engine_sse4_2_0_so-deadlockFinder.Tpo $(DEPDIR)/libheapstats_engine_sse4_2_0_so-deadlockFinder.Po
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='deadlockFinder.cpp' object='libheapstats_engine_sse4_2_0_so-deadlockFinder.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_sse4_2_0_so_CXXFLAGS) $(CXXFLAGS) -c -o libheapstats_engine_sse4_2_0_so-deadlockFinder.o `test -f 'deadlockFinder.cpp' || echo '$(srcdir)/'`deadlockFinder.cpp
-
-libheapstats_engine_sse4_2_0_so-deadlockFinder.obj: deadlockFinder.cpp
-@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_sse4_2_0_so_CXXFLAGS) $(CXXFLAGS) -MT libheapstats_engine_sse4_2_0_so-deadlockFinder.obj -MD -MP -MF $(DEPDIR)/libheapstats_engine_sse4_2_0_so-deadlockFinder.Tpo -c -o libheapstats_engine_sse4_2_0_so-deadlockFinder.obj `if test -f 'deadlockFinder.cpp'; then $(CYGPATH_W) 'deadlockFinder.cpp'; else $(CYGPATH_W) '$(srcdir)/deadlockFinder.cpp'; fi`
-@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libheapstats_engine_sse4_2_0_so-deadlockFinder.Tpo $(DEPDIR)/libheapstats_engine_sse4_2_0_so-deadlockFinder.Po
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='deadlockFinder.cpp' object='libheapstats_engine_sse4_2_0_so-deadlockFinder.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_sse4_2_0_so_CXXFLAGS) $(CXXFLAGS) -c -o libheapstats_engine_sse4_2_0_so-deadlockFinder.obj `if test -f 'deadlockFinder.cpp'; then $(CYGPATH_W) 'deadlockFinder.cpp'; else $(CYGPATH_W) '$(srcdir)/deadlockFinder.cpp'; fi`
+libheapstats_engine_sse4_2_0_so-deadlockDetector.o: deadlockDetector.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_sse4_2_0_so_CXXFLAGS) $(CXXFLAGS) -MT libheapstats_engine_sse4_2_0_so-deadlockDetector.o -MD -MP -MF $(DEPDIR)/libheapstats_engine_sse4_2_0_so-deadlockDetector.Tpo -c -o libheapstats_engine_sse4_2_0_so-deadlockDetector.o `test -f 'deadlockDetector.cpp' || echo '$(srcdir)/'`deadlockDetector.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libheapstats_engine_sse4_2_0_so-deadlockDetector.Tpo $(DEPDIR)/libheapstats_engine_sse4_2_0_so-deadlockDetector.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='deadlockDetector.cpp' object='libheapstats_engine_sse4_2_0_so-deadlockDetector.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_sse4_2_0_so_CXXFLAGS) $(CXXFLAGS) -c -o libheapstats_engine_sse4_2_0_so-deadlockDetector.o `test -f 'deadlockDetector.cpp' || echo '$(srcdir)/'`deadlockDetector.cpp
+
+libheapstats_engine_sse4_2_0_so-deadlockDetector.obj: deadlockDetector.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_sse4_2_0_so_CXXFLAGS) $(CXXFLAGS) -MT libheapstats_engine_sse4_2_0_so-deadlockDetector.obj -MD -MP -MF $(DEPDIR)/libheapstats_engine_sse4_2_0_so-deadlockDetector.Tpo -c -o libheapstats_engine_sse4_2_0_so-deadlockDetector.obj `if test -f 'deadlockDetector.cpp'; then $(CYGPATH_W) 'deadlockDetector.cpp'; else $(CYGPATH_W) '$(srcdir)/deadlockDetector.cpp'; fi`
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libheapstats_engine_sse4_2_0_so-deadlockDetector.Tpo $(DEPDIR)/libheapstats_engine_sse4_2_0_so-deadlockDetector.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='deadlockDetector.cpp' object='libheapstats_engine_sse4_2_0_so-deadlockDetector.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_sse4_2_0_so_CXXFLAGS) $(CXXFLAGS) -c -o libheapstats_engine_sse4_2_0_so-deadlockDetector.obj `if test -f 'deadlockDetector.cpp'; then $(CYGPATH_W) 'deadlockDetector.cpp'; else $(CYGPATH_W) '$(srcdir)/deadlockDetector.cpp'; fi`
 
 libheapstats_engine_sse4_2_0_so-vmVariables.o: vmVariables.cpp
 @am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libheapstats_engine_sse4_2_0_so_CXXFLAGS) $(CXXFLAGS) -MT libheapstats_engine_sse4_2_0_so-vmVariables.o -MD -MP -MF $(DEPDIR)/libheapstats_engine_sse4_2_0_so-vmVariables.Tpo -c -o libheapstats_engine_sse4_2_0_so-vmVariables.o `test -f 'vmVariables.cpp' || echo '$(srcdir)/'`vmVariables.cpp
--- a/agent/src/heapstats-engines/configuration.cpp	Mon Jul 24 21:16:53 2017 +0900
+++ b/agent/src/heapstats-engines/configuration.cpp	Wed Aug 02 14:46:00 2017 +0900
@@ -462,7 +462,7 @@
                        triggerOnDump->get() ? "true" : "false");
 
   /* Output status of deadlock check. */
-  logger->printInfoMsg("Deadlock check (experimental feature) = %s",
+  logger->printInfoMsg("Deadlock check = %s",
                        checkDeadlock->get() ? "true" : "false");
 
   /* Output status of logging triggers. */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agent/src/heapstats-engines/deadlockDetector.cpp	Wed Aug 02 14:46:00 2017 +0900
@@ -0,0 +1,355 @@
+/*!
+ * \file deadlockDetector.cpp
+ * \brief This file is used by find deadlock.
+ * Copyright (C) 2017 Yasumasa Suenaga
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+#include <jvmti.h>
+#include <jni.h>
+
+#include <pthread.h>
+#include <sched.h>
+
+#ifdef HAVE_ATOMIC
+#include <atomic>
+#else
+#include <cstdatomic>
+#endif
+
+#include <map>
+
+#include "globals.hpp"
+#include "elapsedTimer.hpp"
+#include "libmain.hpp"
+#include "callbackRegister.hpp"
+#include "deadlockDetector.hpp"
+
+
+#define BUFFER_SZ 256
+
+
+/*!
+ * \brief Processing flag.
+ */
+static std::atomic_int processing(0);
+
+/*!
+ * \brief Monitor owner map.
+ */
+static std::map<jint, jint> monitor_owners;
+
+/*!
+ * \brief Monitor waiters list.
+ */
+static std::map<jint, jint> waiter_list;
+
+/*!
+ * \brief Mutex for maps
+ */
+static pthread_mutex_t mutex = PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP;
+
+
+namespace dldetector {
+
+  /*!
+   * \brief Send SNMP Trap which contains deadlock information.
+   * \param nowTime    [in]  The time of deadlock occurred.
+   * \param numThreads [in]  Number of threads which are related to deadlock.
+   * \param name       [in]  Thread name of deadlock occurred.
+   */
+  static void sendSNMPTrap(TMSecTime nowTime,
+                           int numThreads, const char *name) {
+    /* OIDs */
+    char trapOID[50] = OID_DEADLOCKALERT;
+    oid OID_ALERT_DATE[] = {SNMP_OID_HEAPALERT, 1};
+    oid OID_DEAD_COUNT[] = {SNMP_OID_DEADLOCKALERT, 1};
+    oid OID_DEAD_NAME[] = {SNMP_OID_DEADLOCKALERT, 2};
+
+    char buf[BUFFER_SZ];
+
+    TTrapSender sender;
+    sender.setSysUpTime();
+    sender.setTrapOID(trapOID);
+
+    /* Set alert datetime. */
+    snprintf(buf, BUFFER_SZ - 1, "%llu", nowTime);
+    sender.addValue(OID_ALERT_DATE, OID_LENGTH(OID_ALERT_DATE), buf,
+                    SNMP_VAR_TYPE_COUNTER64);
+
+    /* Set thread count. */
+    snprintf(buf, BUFFER_SZ - 1, "%d", numThreads);
+    sender.addValue(OID_DEAD_COUNT, OID_LENGTH(OID_DEAD_COUNT), buf,
+                    SNMP_VAR_TYPE_COUNTER32);
+
+    /* Set thread name. */
+    sender.addValue(OID_DEAD_NAME, OID_LENGTH(OID_DEAD_NAME), name,
+                    SNMP_VAR_TYPE_STRING);
+
+    /* Send trap. */
+    if (unlikely(sender.sendTrap() != SNMP_PROC_SUCCESS)) {
+      /* Ouput message and clean up. */
+      sender.clearValues();
+      logger->printWarnMsg("Could not send SNMP trap for deadlock!");
+    }
+  }
+
+  /*!
+   * \brief Notify deadlock occurrence via stdout/err and SNMP Trap.
+   * \param jvmti      [in]  JVMTI environment.
+   * \oaram env        [in]  JNI environment.
+   * \param thread     [in]  jthread object which deadlock triggered.
+   * \param monitor    [in]  Monitor object.
+   * \param numThreads [in]  Number of threads which are related to deadlock.
+   */
+  static void notifyDeadlockOccurrence(jvmtiEnv *jvmti, JNIEnv *env,
+                                       jthread thread, jobject monitor,
+                                       int numThreads) {
+    TProcessMark mark(processing);
+
+    TMSecTime nowTime = (TMSecTime)getNowTimeSec();
+
+    jvmtiThreadInfo threadInfo = {0};
+    jvmti->GetThreadInfo(thread, &threadInfo);
+
+    logger->printCritMsg(
+                "ALERT(DEADLOCK): Deadlock occurred! count: %d, thread: \"%s\"",
+                numThreads, threadInfo.name);
+
+    if (conf->SnmpSend()->get()) {
+      sendSNMPTrap(nowTime, numThreads, threadInfo.name);
+    }
+
+    jvmti->Deallocate((unsigned char *)threadInfo.name);
+
+    if (conf->TriggerOnLogLock()->get()) {
+      TElapsedTimer elapsedTime("Take LogInfo");
+      int result = logManager->collectLog(jvmti, env,
+                                          OccurredDeadlock, nowTime, "");
+      if (unlikely(result != 0)) {
+        logger->printWarnMsg("Could not collect log archive.");
+      }
+    }
+
+    if (unlikely(conf->KillOnError()->get())) {
+      forcedAbortJVM(jvmti, env, "deadlock occurred");
+    }
+  }
+
+  /*!
+   * \brief Event handler of JVMTI MonitorContendedEnter for finding deadlock.
+   * \param jvmti  [in] JVMTI environment.
+   * \param env    [in] JNI environment of the event (current) thread.
+   * \param thread [in] JNI local reference to the thread attempting to enter
+   *                    the monitor.
+   * \param object [in] JNI local reference to the monitor.
+   */
+  void JNICALL OnMonitorContendedEnter(
+                 jvmtiEnv *jvmti, JNIEnv *env, jthread thread, jobject object) {
+    /* Check owned monitors */
+    jint monitor_cnt;
+    jobject *owned_monitors;
+    if (isError(jvmti, jvmti->GetOwnedMonitorInfo(thread,
+                                                  &monitor_cnt,
+                                                  &owned_monitors))) {
+      logger->printWarnMsg("Could not get owned monitor info (%p)\n",
+                           *(void **)thread);
+      return;
+    }
+    if (monitor_cnt == 0) { // This thread does not have a monitor.
+      jvmti->Deallocate((unsigned char *)owned_monitors);
+      return;
+    }
+
+    jint monitor_hash;
+    jint thread_hash;
+    jvmti->GetObjectHashCode(thread, &thread_hash);
+    jvmti->GetObjectHashCode(object, &monitor_hash);
+
+    ENTER_PTHREAD_SECTION(&mutex);
+    {
+      /* Avoid JDK-8185164 */
+      bool canSkip = true;
+
+      /* Store all owned monitors to owner list */
+      for (int idx = 0; idx < monitor_cnt; idx++) {
+        jint current_monitor_hash;
+        jvmti->GetObjectHashCode(owned_monitors[idx], &current_monitor_hash);
+        if (current_monitor_hash == monitor_hash) {
+          continue;
+        }
+        monitor_owners[current_monitor_hash] = thread_hash;
+        canSkip = false;
+      }
+      jvmti->Deallocate((unsigned char *)owned_monitors);
+
+      if (!canSkip) {
+        /* Add to waiters list */
+        jvmti->GetObjectHashCode(object, &monitor_hash);
+        waiter_list[thread_hash] = monitor_hash;
+
+        /* Check deadlock */
+        int numThreads = 1;
+        while (true) {
+          numThreads++;
+
+          auto owner_itr = monitor_owners.find(monitor_hash);
+          if (owner_itr == monitor_owners.end()) {
+            break;  // No deadlock
+          }
+
+          auto waiter_itr = waiter_list.find(owner_itr->second);
+          if (waiter_itr == waiter_list.end()) {
+            break; // No deadlock
+          }
+
+          owner_itr = monitor_owners.find(waiter_itr->second);
+          if (owner_itr == monitor_owners.end()) {
+            break; // No deadlock
+          }
+
+          if (owner_itr->second == thread_hash) {
+            // Deadlock!!
+            notifyDeadlockOccurrence(jvmti, env, thread, object, numThreads);
+            break;
+          }
+
+          monitor_hash = waiter_itr->second;
+        }
+      }
+    }
+    EXIT_PTHREAD_SECTION(&mutex);
+  }
+
+
+  /*!
+   * \brief Event handler of JVMTI MonitorContendedEntered for finding deadlock.
+   * \param jvmti  [in] JVMTI environment.
+   * \param env    [in] JNI environment of the event (current) thread.
+   * \param thread [in] JNI local reference to the thread attempting to enter
+   *                    the monitor.
+   * \param object [in] JNI local reference to the monitor.
+   */
+  void JNICALL OnMonitorContendedEntered(
+                 jvmtiEnv *jvmti, JNIEnv *env, jthread thread, jobject object) {
+    /* Check owned monitors */
+    jint monitor_cnt;
+    jobject *owned_monitors;
+    if (isError(jvmti, jvmti->GetOwnedMonitorInfo(thread,
+                                                  &monitor_cnt,
+                                                  &owned_monitors))) {
+      logger->printWarnMsg("Could not get owned monitor info (%p)\n",
+                           *(void **)thread);
+      return;
+    }
+    if (monitor_cnt <= 1) { // This thread does not have other monitor(s).
+      jvmti->Deallocate((unsigned char *)owned_monitors);
+      return;
+    }
+
+    ENTER_PTHREAD_SECTION(&mutex);
+    {
+      /* Remove all owned monitors from owner list */
+      for (int idx = 0; idx < monitor_cnt; idx++) {
+        jint monitor_hash;
+        jvmti->GetObjectHashCode(owned_monitors[idx], &monitor_hash);
+        monitor_owners.erase(monitor_hash);
+      }
+      jvmti->Deallocate((unsigned char *)owned_monitors);
+
+      /* Remove thread from waiters list */
+      jint thread_hash;
+      jvmti->GetObjectHashCode(thread, &thread_hash);
+      waiter_list.erase(thread_hash);
+    }
+    EXIT_PTHREAD_SECTION(&mutex);
+  }
+
+
+  /*!
+   * \brief Deadlock detector initializer.
+   * \param jvmti    [in]  JVMTI environment
+   * \parma isOnLoad [in]  OnLoad phase or not (Live phase).
+   * \return Process result.
+   * \warning This function MUST be called only once.
+   */
+  bool initialize(jvmtiEnv *jvmti, bool isOnLoad) {
+    jvmtiCapabilities capabilities = {0};
+    capabilities.can_get_monitor_info = 1;
+    if (isOnLoad) {
+      /*
+       * can_get_owned_monitor_info must be set at OnLoad phase.
+       *
+       * See also:
+       *   hotspot/src/share/vm/prims/jvmtiManageCapabilities.cpp
+       */
+      capabilities.can_get_owned_monitor_info = 1;
+    }
+    TMonitorContendedEnterCallback::mergeCapabilities(&capabilities);
+    if (isError(jvmti, jvmti->AddCapabilities(&capabilities))) {
+      logger->printCritMsg(
+                      "Couldn't set event capabilities for deadlock detector.");
+      return false;
+    }
+
+    /*
+     * All JVMTI events are not fired at this point.
+     * So we need not to lock this operation.
+     */
+    monitor_owners.clear();
+    waiter_list.clear();
+
+    TMonitorContendedEnterCallback::registerCallback(&OnMonitorContendedEnter);
+    TMonitorContendedEnterCallback::switchEventNotification(jvmti,
+                                                            JVMTI_ENABLE);
+    TMonitorContendedEnteredCallback::registerCallback(
+                                                 &OnMonitorContendedEntered);
+    TMonitorContendedEnteredCallback::switchEventNotification(jvmti,
+                                                              JVMTI_ENABLE);
+
+    return true;
+  }
+
+  /*!
+   * \brief Deadlock detector finalizer.
+   *        This function unregisters JVMTI callback for deadlock detection.
+   * \param jvmti [in]  JVMTI environment
+   */
+  void finalize(jvmtiEnv *jvmti) {
+    TMonitorContendedEnterCallback::unregisterCallback(
+                                                &OnMonitorContendedEnter);
+    TMonitorContendedEnteredCallback::unregisterCallback(
+                                                &OnMonitorContendedEntered);
+
+    /* Refresh JVMTI event callbacks */
+    registerJVMTICallbacks(jvmti);
+
+    while (processing > 0) {
+      sched_yield();
+    }
+
+    ENTER_PTHREAD_SECTION(&mutex);
+    {
+      monitor_owners.clear();
+      waiter_list.clear();
+    }
+    EXIT_PTHREAD_SECTION(&mutex);
+  }
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agent/src/heapstats-engines/deadlockDetector.hpp	Wed Aug 02 14:46:00 2017 +0900
@@ -0,0 +1,72 @@
+/*!
+ * \file deadlockDetector.hpp
+ * \brief This file is used by find deadlock.
+ * Copyright (C) 2017 Yasumasa Suenaga
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+#ifndef _DEADLOCK_DETECTOR_H
+#define _DEADLOCK_DETECTOR_H
+
+#include <jvmti.h>
+#include <jni.h>
+
+
+namespace dldetector {
+
+  /*!
+   * \brief Event handler of JVMTI MonitorContendedEnter for finding deadlock.
+   * \param jvmti  [in] JVMTI environment.
+   * \param env    [in] JNI environment of the event (current) thread.
+   * \param thread [in] JNI local reference to the thread attempting to enter
+   *                    the monitor.
+   * \param object [in] JNI local reference to the monitor.
+   */
+  void JNICALL OnMonitorContendedEnter(jvmtiEnv *jvmti, JNIEnv *env,
+                                       jthread thread, jobject object);
+
+  /*!
+   * \brief Event handler of JVMTI MonitorContendedEntered for finding deadlock.
+   * \param jvmti  [in] JVMTI environment.
+   * \param env    [in] JNI environment of the event (current) thread.
+   * \param thread [in] JNI local reference to the thread attempting to enter
+   *                    the monitor.
+   * \param object [in] JNI local reference to the monitor.
+   */
+  void JNICALL OnMonitorContendedEntered(jvmtiEnv *jvmti, JNIEnv *env,
+                                         jthread thread, jobject object);
+
+  /*!
+   * \brief Deadlock detector initializer.
+   * \param jvmti    [in]  JVMTI environment
+   * \param isOnLoad [in]  OnLoad phase or not (Live phase).
+   * \return Process result.
+   * \warning This function MUST be called only once.
+   */
+  bool initialize(jvmtiEnv *jvmti, bool isOnLoad);
+
+  /*!
+   * \brief Deadlock detector finalizer.
+   *        This function unregisters JVMTI callback for deadlock detection.
+   * \param jvmti [in]  JVMTI environment
+   */
+  void finalize(jvmtiEnv *jvmti);
+
+};
+
+#endif  // _DEADLOCK_DETECTOR_H
--- a/agent/src/heapstats-engines/deadlockFinder.cpp	Mon Jul 24 21:16:53 2017 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,687 +0,0 @@
-/*!
- * \file deadlockFinder.cpp
- * \brief This file is used by find deadlock.
- * Copyright (C) 2011-2017 Nippon Telegraph and Telephone Corporation
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- */
-
-#include <sys/syscall.h>
-
-#include "globals.hpp"
-#include "vmFunctions.hpp"
-#include "vmVariables.hpp"
-#include "libmain.hpp"
-#include "deadlockFinder.hpp"
-
-/* Defines. */
-
-/*!
- * \brief Thread state macro.<br>
- *        This value means the thread is existing on native code.<br>
- *        Definition of "enum JavaThreadState".
- *        (_thread_in_native state is used in JVMTI:JvmtiThreadEventTransition)
- * \sa hotspot/src/share/vm/utilities/globalDefinitions.hpp
- */
-#define THREAD_IN_NATIVE 4
-
-/*!
- * \brief Thread state macro.<br>
- *        This value means the thread is existing on VM.<br>
- *        Definition of "enum JavaThreadState".
- * \sa hotspot/src/share/vm/utilities/globalDefinitions.hpp
- */
-#define THREAD_IN_VM 6
-/*!
- * \brief Thread state macro.<br>
- *        This value means the thread is existing on Java.<br>
- *        Definition of "enum JavaThreadState".
- * \sa hotspot/src/share/vm/utilities/globalDefinitions.hpp
- */
-#define THREAD_IN_JAVA 8
-
-
-/* Class static variables. */
-
-/*!
- * \brief Singleton instance of TDeadlockFinder.
- */
-TDeadlockFinder *TDeadlockFinder::inst = NULL;
-
-
-/*!
- * \brief Event handler of JVMTI MonitorContendedEnter for finding deadlock.
- * \param jvmti  [in] JVMTI environment.
- * \param env    [in] JNI environment of the event (current) thread.
- * \param thread [in] JNI local reference to the thread attempting to enter
- *                    the monitor.
- * \param object [in] JNI local reference to the monitor.
- * \warning Sometimes this callback is called synchronizing or synchronized
- *          at safepoint.<br>Please be carefully calling inner function of JVM.
- */
-void JNICALL OnMonitorContendedEnterForDeadlock(jvmtiEnv *jvmti, JNIEnv *env,
-                                                jthread thread,
-                                                jobject object) {
-  /* Check deadlock. */
-  TDeadlockList *list = NULL;
-  int threadCnt = 0;
-  char threadName[256] = {0};
-  threadCnt = TDeadlockFinder::checkDeadlock(object, &list);
-
-  /* Deadlock is not occurred. */
-  if (likely(threadCnt == 0)) {
-    return;
-  }
-
-  /* Get thread name. */
-  {
-    jvmtiThreadInfo threadInfo = {0};
-    jvmti->GetThreadInfo(thread, &threadInfo);
-    strncpy(threadName, threadInfo.name, 255);
-
-    /* Cleanup. */
-    jvmti->Deallocate((unsigned char *)threadInfo.name);
-    env->DeleteLocalRef(threadInfo.thread_group);
-    env->DeleteLocalRef(threadInfo.context_class_loader);
-  }
-
-  /* Raise alert. */
-  logger->printCritMsg(
-      "ALERT(DEADLOCK): occurred deadlock. threadCount: %d, threadName: \"%s\"",
-      threadCnt, threadName);
-
-  /* Print deadlock threads. */
-  for (TDeadlockList *item = list; item != NULL; item = item->next) {
-    /* Get thread information. */
-    TJavaThreadInfo threadInfo = {0};
-    getThreadDetailInfo(jvmti, env, item->thread, &threadInfo);
-
-    logger->printWarnMsg("thread name: %s, prio: %d", threadInfo.name,
-                         threadInfo.priority);
-
-    /* Cleanup. */
-    free(threadInfo.name);
-    free(threadInfo.state);
-  }
-
-  /* Cleanup deadlock thread list. */
-  TDeadlockFinder::freeDeadlockList(list);
-
-  /* Get now date and time. */
-  TMSecTime nowTime = (TMSecTime)getNowTimeSec();
-
-  if (conf->SnmpSend()->get()) {
-    TDeadlockFinder::inst->sendSNMPTrap(nowTime, threadCnt, threadName);
-  }
-
-  if (conf->TriggerOnLogLock()->get()) {
-    try {
-      /* Invoke log collection. */
-      TDeadlockFinder::inst->notify(nowTime);
-    } catch (...) {
-      logger->printWarnMsg("Log collection (deadlock) failed.");
-    }
-  } else if (unlikely(conf->KillOnError()->get())) {
-    /*
-     * Abort JVM process if kill_on_error is enabled.
-     * If trigger_on_loglock is enabled, this code is skipped because we give
-     * a chance to collect logs. abort() should be called by logging process.
-     */
-    forcedAbortJVM(jvmti, env, "deadlock occurred");
-  }
-}
-
-/* Class methods. */
-
-/*!
- * \brief Global initialization.
- * \return Process result.
- * \param event [in] Callback is used on deadlock occurred.
- * \warning Please call only once from main thread.
- */
-bool TDeadlockFinder::globalInitialize(TDeadlockEventFunc event) {
-  /* Variable for return code. */
-  bool result = true;
-
-  try {
-    inst = new TDeadlockFinder(event);
-  } catch (...) {
-    logger->printCritMsg("Cannot initialize TDeadlockFinder.");
-    result = false;
-  }
-
-  return result;
-}
-
-/*!
- * \brief Global finalization of deadlock finder.
- */
-void TDeadlockFinder::globalFinalize(void) {
-  delete inst;
-  inst = NULL;
-}
-
-/*!
- * \brief Set JVMTI functional capabilities.
- * \param capabilities [out] JVMTI capabilities to add.
- * \param isOnLoad     [in]  OnLoad phase or not (Live phase).
- */
-void TDeadlockFinder::setCapabilities(jvmtiCapabilities *capabilities,
-                                      bool isOnLoad) {
-  /* Set capabilities for monitor events. */
-  if (conf->CheckDeadlock()->get()) {
-    capabilities->can_generate_monitor_events = 1;
-  }
-
-  /* Set capabilities for thread dump which is made by JVMTI function. */
-  capabilities->can_get_source_file_name = 1;
-  capabilities->can_get_line_numbers = 1;
-  capabilities->can_get_monitor_info = 1;
-
-  /*
-   * can_get_owned_monitor_stack_depth_info and
-   * can_get_current_contended_monitor must be set at OnLoad phase.
-   *
-   * See also:
-   *   hotspot/src/share/vm/prims/jvmtiManageCapabilities.cpp
-   */
-  if (isOnLoad) {
-    capabilities->can_get_owned_monitor_stack_depth_info = 1;
-    capabilities->can_get_current_contended_monitor = 1;
-  }
-}
-
-/*!
-* \brief TDeadlockFinder constructor.
-* \param event [in] Callback is used on deadlock occurred.
-*/
-TDeadlockFinder::TDeadlockFinder(TDeadlockEventFunc event)
-    : TAgentThread("HeapStats Deadlock Finder"), occurTime(0) {
-  /* Sanity check. */
-  if (unlikely(event == NULL)) {
-    throw "Event callback is NULL.";
-  }
-  callFunc = event;
-}
-
-/*!
- * \brief TDeadlockFinder destructor.
- */
-TDeadlockFinder::~TDeadlockFinder(void) { /* none. */ }
-
-/*!
- * \brief Send SNMP trap which contains deadlock information.
- * \param nowTime The time of deadlock occurred.
- * \param threadCnt Number of threads which are related to deadlock.
- * \param name Thread name of deadlock occurred.
- */
-void TDeadlockFinder::sendSNMPTrap(TMSecTime nowTime,
-                                        int threadCnt, const char *name) {
-  /* Trap OID. */
-  char trapOID[50] = OID_DEADLOCKALERT;
-  oid OID_ALERT_DATE[] = {SNMP_OID_HEAPALERT, 1};
-  oid OID_DEAD_COUNT[] = {SNMP_OID_DEADLOCKALERT, 1};
-  oid OID_DEAD_NAME[] = {SNMP_OID_DEADLOCKALERT, 2};
-  char buff[256] = {0};
-
-  try {
-    /* Send resource trap. */
-    TTrapSender sender;
-
-    /* Setting sysUpTime */
-    sender.setSysUpTime();
-
-    /* Setting trapOID. */
-    sender.setTrapOID(trapOID);
-
-    /* Set alert date. */
-    snprintf(buff, 255, "%llu", nowTime);
-    sender.addValue(OID_ALERT_DATE, OID_LENGTH(OID_ALERT_DATE), buff,
-                    SNMP_VAR_TYPE_COUNTER64);
-
-    /* Set thread count. */
-    snprintf(buff, 255, "%d", threadCnt);
-    sender.addValue(OID_DEAD_COUNT, OID_LENGTH(OID_DEAD_COUNT), buff,
-                    SNMP_VAR_TYPE_COUNTER32);
-
-    /* Set thread name. */
-    sender.addValue(OID_DEAD_NAME, OID_LENGTH(OID_DEAD_NAME), name,
-                    SNMP_VAR_TYPE_STRING);
-
-    /* Send trap. */
-    if (unlikely(sender.sendTrap() != SNMP_PROC_SUCCESS)) {
-      /* Ouput message and clean up. */
-      sender.clearValues();
-      throw 1;
-    }
-
-  } catch (...) {
-    logger->printWarnMsg("Send SNMP deadlock trap failed!");
-  }
-}
-
-/*!
- * \brief Check deadlock.
- * \param monitor [in]  Monitor object of thread contended.
- * \param list    [out] List of deadlock occurred threads.
- * \return Number of deadlock occurred threads.<br>
- *         Value is 0, if deadlock isn't occurred.
- */
-int TDeadlockFinder::checkDeadlock(jobject monitor, TDeadlockList **list) {
-  /* Sanity check. */
-  if (unlikely(monitor == NULL || list == NULL)) {
-    return 0;
-  }
-
-  TVMFunctions *vmFunc = TVMFunctions::getInstance();
-  TVMVariables *vmVal = TVMVariables::getInstance();
-  int deadlockCount = 0;
-  void *thisThreadPtr = vmFunc->GetThread();
-  void *thread_lock = *(void **)vmVal->getThreadsLock();
-  if (unlikely(thisThreadPtr == NULL || thread_lock == NULL)) {
-    /*
-     * Thread class in JVM and thread lock should be set.
-     * TDeadlockFinder::checkDeadlock() is called by MonitorContendedEnter
-     * JVMTI event. If this event is fired, current (this) thread must be
-     * live.
-     */
-    logger->printWarnMsg(
-          "Deadlock detection failed: Cannot get current thread info.");
-    return 0;
-  }
-
-  /* Get self thread id. */
-  pid_t threadId = syscall(SYS_gettid);
-
-  int *status = (int *)incAddress(thisThreadPtr,
-                                  vmVal->getOfsJavaThreadThreadState());
-  int original_status = *status;
-
-  /*
-   * Normally thread status is "_thread_in_native"
-   * when thread is running in JVMTI event.
-   * But thread status maybe changed "_thread_in_vm",
-   * if call "get_lock_owner" and set true to paramter "doLock".
-   * If VMThread found this thread has such status
-   * when call "examine_state_of_thread" at synchronizing safepoint,
-   * By JVM decided that the thread is waiting VM and callback,
-   * thread state at safepoint set "_call_back" flag.
-   * Besides, at end of JVMTI envent callback,
-   * thread was changed thread status to "_thread_in_native_trans"
-   * from "_thread_in_vm"
-   * and JVM check thread about running status at safepoint.
-   * JVM misunderstand deadlock occurred, so JVM abort by self.
-   * Why JVM misunderstood.
-   *  1, Safepoint code wait "_thread_in_native_trans" thread.
-   *  2, "_call_back" flag means wait VM and callback.
-   *  -> VMThread wait the thread and the thread wait VMThread.
-   *
-   * So thread status reset here by force.
-   */
-  *status = THREAD_IN_VM;
-
-  /* Check deadlock. */
-  bool foundDeadlock = findDeadLock(threadId, monitor);
-
-  if (unlikely(foundDeadlock)) {
-    /* Get threads. */
-    getLockedThreads(threadId, monitor, list);
-
-    /* Count list item. */
-    for (TDeadlockList *item = (*list); item != NULL; item = item->next) {
-      deadlockCount++;
-    }
-  }
-
-  if (*status == THREAD_IN_VM) {
-    /*
-     * Reset "_thread_state".
-     *
-     * CAUTION!!
-     *   According to the comment of Monitor::lock_without_safepoint_check() in
-     *   hotspot/src/share/vm/runtime/mutex.cpp:
-     *     If this is called with thread state set to be in VM, the safepoint
-     *     synchronization code will deadlock!
-     */
-    *status = original_status;
-
-    bool needLock = !vmFunc->MonitorOwnedBySelf(thread_lock);
-
-    /*
-     * Lock monitor to avoiding a collision
-     * with safepoint operation to "ThreadSafepointState".
-     * E.g. "examine_state_of_thread".
-     */
-    if (likely(needLock)) {
-      if (isAtSafepoint()) {
-        vmFunc->MonitorLockWithoutSafepointCheck(thread_lock);
-      } else {
-        vmFunc->MonitorLock(thread_lock);
-      }
-    }
-
-    /* Reset "_safepoint_state". */
-    vmFunc->ThreadSafepointStateDestroy(thisThreadPtr);
-    vmFunc->ThreadSafepointStateCreate(thisThreadPtr);
-
-    /* Release monitor. */
-    if (likely(needLock)) {
-      vmFunc->MonitorUnlock(thread_lock);
-    }
-  }
-
-  return deadlockCount;
-}
-
-/*!
- * \brief JThread entry point.
- * \param jvmti [in] JVMTI environment object.
- * \param jni   [in] JNI environment object.
- * \param data  [in] Pointer of TDeadlockFinder.
- */
-void JNICALL
-    TDeadlockFinder::entryPoint(jvmtiEnv *jvmti, JNIEnv *jni, void *data) {
-  /* Get self. */
-  TDeadlockFinder *controller = (TDeadlockFinder *)data;
-  /* Change running state. */
-  controller->_isRunning = true;
-
-  /* Loop for agent run. */
-  while (!controller->_terminateRequest) {
-    /* Variable for notification flag. */
-    bool needProcess = false;
-
-    ENTER_PTHREAD_SECTION(&controller->mutex) {
-      /* If no exists request. */
-      if (likely(controller->_numRequests == 0)) {
-        /* Wait for notification or termination. */
-        pthread_cond_wait(&controller->mutexCond, &controller->mutex);
-      }
-
-      /* If exists request. */
-      if (likely(controller->_numRequests > 0)) {
-        controller->_numRequests--;
-        needProcess = true;
-
-        /* Load and pop last deadlock datetime. */
-        controller->occurTime = controller->timeList.front();
-        controller->timeList.pop();
-      }
-    }
-    EXIT_PTHREAD_SECTION(&controller->mutex)
-
-    /* If get notification. */
-    if (likely(needProcess)) {
-      /* Call event callback. */
-      (*controller->callFunc)(jvmti, jni, OccurredDeadlock);
-    }
-  }
-
-  /* Change running state */
-  controller->_isRunning = false;
-}
-
-/*!
- * \brief Make and begin Jthread.
- * \param jvmti [in] JVMTI environment object.
- * \param env   [in] JNI environment object.
- */
-void TDeadlockFinder::start(jvmtiEnv *jvmti, JNIEnv *env) {
-  /* Call super class's method. */
-  TAgentThread::start(jvmti, env, TDeadlockFinder::entryPoint, this,
-                      JVMTI_THREAD_MIN_PRIORITY);
-}
-
-/*!
- * \brief Notify occurred deadlock to this thread from other thread.
- * \param aTime [in] Time of occurred deadlock.
- */
-void TDeadlockFinder::notify(jlong aTime) {
-  bool raiseException = true;
-  /* Send notification and count notify. */
-  ENTER_PTHREAD_SECTION(&this->mutex) {
-    try {
-      /* Store and count data. */
-      timeList.push(aTime);
-      this->_numRequests++;
-
-      /* Notify occurred deadlock. */
-      pthread_cond_signal(&this->mutexCond);
-
-      /* Reset exception flag. */
-      raiseException = false;
-    } catch (...) {
-      /*
-       * Maybe faield to allocate memory at "std:queue<T>::push()".
-       * So we throw exception again at after release lock.
-       */
-    }
-  }
-  EXIT_PTHREAD_SECTION(&this->mutex)
-
-  if (unlikely(raiseException)) {
-    throw "Failed to TDeadlockFinder notify";
-  }
-}
-
-/*!
- * \brief DeadLock search (recursive call).
- * \param startId [in] Thread id of TDeadlockFinder caller.
- * \param monitor [in] Monitor object of thread contended.
- */
-FASTCALL bool TDeadlockFinder::findDeadLock(pid_t startId, jobject monitor) {
-  TVMFunctions *vmFunc = TVMFunctions::getInstance();
-  TVMVariables *vmVal = TVMVariables::getInstance();
-  void *threadPtr = NULL;
-  int *status = NULL;
-  void *nativeThread = NULL;
-  pid_t *ownerId = NULL;
-  void *contendedMonitor = NULL;
-  jobject monitorOop = NULL;
-
-  /* Get owner thread of this monitor. */
-  threadPtr = vmFunc->GetLockOwner(monitor, !isAtSafepoint());
-
-  /* No deadlock (no owner thread of this monitor). */
-  if (unlikely(threadPtr == NULL)) {
-    return false;
-  }
-
-  /* Go deadlock check!!! */
-  /* Is owner thread is self ? */
-
-  /* Get OSThread ptr related to JavaThread. */
-  nativeThread =
-      (void *)*(ptrdiff_t *)incAddress(threadPtr,
-                                       vmVal->getOfsJavaThreadOsthread());
-
-  /* If failure get native thread. */
-  if (unlikely(nativeThread == NULL)) {
-    return false;
-  }
-
-  /* Get nid (LWP ID). */
-  ownerId = (pid_t *)incAddress(nativeThread, vmVal->getOfsOSThreadThreadId());
-
-  /* If occurred deadlock. */
-  if (unlikely(*ownerId == startId)) {
-    /* DeadLock !!! */
-    return true;
-  }
-
-  /* Thread status check. */
-  status = (int *)incAddress(threadPtr, vmVal->getOfsJavaThreadThreadState());
-  if ((*status == THREAD_IN_JAVA) || (*status == THREAD_IN_VM)) {
-    /* Owner thread is running. */
-    return false;
-  }
-
-  /* Get ObjectMonitor pointer. */
-  contendedMonitor = (void *)*(ptrdiff_t *)incAddress(
-                         threadPtr, vmVal->getOfsThreadCurrentPendingMonitor());
-  /* If pointer is illegal. */
-  if (unlikely(contendedMonitor == NULL)) {
-    return false;
-  }
-
-  monitorOop = (jobject)incAddress(contendedMonitor,
-                                   vmVal->getOfsObjectMonitorObject());
-  /* If java thread already has monitor. */
-  if (unlikely((monitorOop == NULL) || (monitorOop == monitor))) {
-    return false;
-  }
-
-  /* No deadlock in "this" thread. */
-
-  /* Execute recursive call. */
-  return findDeadLock(startId, monitorOop);
-}
-
-/*!
- * \brief Get threads which has occurred deadlock.
- * \param startId [in]  Thread id of TDeadlockFinder caller.
- * \param monitor [in]  Monitor object of thread contended.
- * \param list    [out] List of deadlock occurred threads.
- */
-void TDeadlockFinder::getLockedThreads(pid_t startId, jobject monitor,
-                                       TDeadlockList **list) {
-  TVMFunctions *vmFunc = TVMFunctions::getInstance();
-  TVMVariables *vmVal = TVMVariables::getInstance();
-  pid_t *ownerId = NULL;
-  TDeadlockList *listHead = NULL;
-  TDeadlockList *oldRec = NULL;
-  bool flagFailure = false;
-
-  /* Infinite loop. */
-  while (true) {
-    void *threadPtr = NULL;
-    void *nativeThread = NULL;
-    void *contendedMonitor = NULL;
-    jthread jThreadObj = NULL;
-    TDeadlockList *threadRec = NULL;
-
-    /* Get owner thread of this monitor. */
-    threadPtr = vmFunc->GetLockOwner(monitor, !isAtSafepoint());
-
-    if (unlikely(threadPtr == NULL)) {
-      /* Shouldn't reach to here. */
-      logger->printDebugMsg(
-          "Deadlock detection failed: Cannot get lock owner thread.");
-      flagFailure = true;
-      break;
-    }
-
-    /* Convert to jni object. */
-    jThreadObj = (jthread)incAddress(threadPtr,
-                                     vmVal->getOfsJavaThreadThreadObj());
-
-    /* Create list item. */
-    threadRec = (TDeadlockList *)malloc(sizeof(TDeadlockList));
-    if (unlikely(threadRec == NULL)) {
-      /* Shouldn't reach to here. */
-      logger->printWarnMsg(
-          "Deadlock detection failed: Cannot allocate memory for "
-          "TDeadLockList.");
-      flagFailure = true;
-      break;
-    }
-
-    /* Store thread. */
-    threadRec->thread = jThreadObj;
-    threadRec->next = NULL;
-    if (likely(oldRec != NULL)) {
-      oldRec->next = threadRec;
-    } else {
-      listHead = threadRec;
-    }
-    oldRec = threadRec;
-
-    /* Get OSThread ptr related to JavaThread. */
-    nativeThread =
-        (void *)*(ptrdiff_t *)incAddress(threadPtr,
-                                         vmVal->getOfsJavaThreadOsthread());
-
-    if (unlikely(nativeThread == NULL)) {
-      /* Shouldn't reach to here. */
-      logger->printDebugMsg(
-          "Deadlock detection failed: Cannot get native thread.");
-      flagFailure = true;
-      break;
-    }
-
-    /* Get nid (LWP ID). */
-    ownerId = (pid_t *)incAddress(nativeThread,
-                                  vmVal->getOfsOSThreadThreadId());
-
-    /* If all thread already has collected. */
-    if (*ownerId == startId) {
-      break;
-    }
-
-    /* Get ObjectMonitor pointer. */
-    contendedMonitor = (void *)*(ptrdiff_t *)incAddress(
-                         threadPtr, vmVal->getOfsThreadCurrentPendingMonitor());
-
-    if (unlikely(contendedMonitor == NULL)) {
-      /* Shouldn't reach to here. */
-      logger->printDebugMsg(
-          "Deadlock detection failed: Cannot get contended monitor.");
-      flagFailure = true;
-      break;
-    }
-
-    monitor = (jobject)incAddress(contendedMonitor,
-                                  vmVal->getOfsObjectMonitorObject());
-
-    /* If illegal state. */
-    if (unlikely(monitor == NULL)) {
-      /* Shouldn't reach to here. */
-      logger->printDebugMsg(
-          "Deadlock detection failed: Cannot get monitor object.");
-      flagFailure = true;
-      break;
-    }
-  }
-
-  /* If failure get deadlock threads. */
-  if (unlikely(flagFailure)) {
-    freeDeadlockList(listHead);
-  } else {
-    (*list) = listHead;
-  }
-
-  return;
-}
-
-/*!
- * \brief Deallocate deadlock thread list.
- * \param list [in] List of deadlock occurred threads.
- */
-void TDeadlockFinder::freeDeadlockList(TDeadlockList *list) {
-  /* Sanity check. */
-  if (unlikely(list == NULL)) {
-    return;
-  }
-
-  /* Cleanup. */
-  for (TDeadlockList *next = list->next; next != NULL;) {
-    TDeadlockList *listItem = next;
-    next = next->next;
-
-    free(listItem);
-  }
-  free(list);
-}
--- a/agent/src/heapstats-engines/deadlockFinder.hpp	Mon Jul 24 21:16:53 2017 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,227 +0,0 @@
-/*!
- * \file deadlockFinder.hpp
- * \brief This file is used by find deadlock.
- * Copyright (C) 2011-2016 Nippon Telegraph and Telephone Corporation
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- */
-
-#ifndef _DEADLOCK_FINDER_H
-#define _DEADLOCK_FINDER_H
-
-#include <jvmti.h>
-#include <jni.h>
-
-#include <queue>
-
-#include "util.hpp"
-#include "agentThread.hpp"
-
-/*!
- * \brief This macro deginate calling function by using registry.
- */
-#ifndef __amd64__
-#define FASTCALL __attribute__((regparm(2)))
-#else
-#define FASTCALL
-#endif
-
-/*!
- * \brief This type is callback to periodic calling by timer.
- * \param jvmti [in] JVMTI environment object.
- * \param env   [in] JNI environment object.
- * \param cause [in] Cause of invoke function.<br>Maybe "OccurredDeadlock".
- */
-typedef void (*TDeadlockEventFunc)(jvmtiEnv *jvmti, JNIEnv *env,
-                                   TInvokeCause cause);
-
-
-/*!
- * \brief This type is stored deadlock occurred thread list.
- */
-struct TDeadlockList {
-  jthread thread;
-  /*!< A thread of deadlock occurred. */
-  TDeadlockList *next;
-  /*!< Next record item. */
-};
-
-/*!
- * \brief Event handler of JVMTI MonitorContendedEnter for finding deadlock.
- * \param jvmti  [in] JVMTI environment.
- * \param env    [in] JNI environment of the event (current) thread.
- * \param thread [in] JNI local reference to the thread attempting to enter
- *                    the monitor.
- * \param object [in] JNI local reference to the monitor.
- * \warning Sometimes this callback is called synchronizing or synchronized
- *          at safepoint.<br>Please be carefully calling inner function of JVM.
- */
-void JNICALL OnMonitorContendedEnterForDeadlock(jvmtiEnv *jvmti, JNIEnv *env,
-                                                jthread thread, jobject object);
-
-/*!
- * \brief This class is searching deadlock.
- */
-class TDeadlockFinder : public TAgentThread {
- public:
-  /*!
-   * \brief Global initialization.
-   * \return Process result.
-   * \param event [in] Callback is used on deadlock occurred.
-   * \warning Please call only once from main thread.
-   */
-  static bool globalInitialize(TDeadlockEventFunc event);
-
-  /*!
-   * \brief Global finalization of deadlock finder.
-   */
-  static void globalFinalize(void);
-
-  /*!
-   * \brief Set JVMTI functional capabilities.
-   * \param capabilities [out] JVMTI capabilities to add.
-   * \param isOnLoad     [in]  OnLoad phase or not (Live phase).
-   */
-  static void setCapabilities(jvmtiCapabilities *capabilities, bool isOnLoad);
-
-  using TAgentThread::start;
-
-  /*!
-   * \brief Make and begin Jthread.
-   * \param jvmti [in] JVMTI environment object.
-   * \param env   [in] JNI environment object.
-   */
-  void start(jvmtiEnv *jvmti, JNIEnv *env);
-
-  using TAgentThread::notify;
-
-  /*!
-   * \brief Notify occurred deadlock to this thread from other thread.
-   * \param aTime [in] Time of occurred deadlock.
-   */
-  void notify(jlong aTime);
-
-  /*!
-   * \brief Send SNMP trap which contains deadlock information.
-   * \param nowTime The time of deadlock occurred.
-   * \param threadCnt Number of threads which are related to deadlock.
-   * \param name Thread name of deadlock occurred.
-   */
-  void sendSNMPTrap(TMSecTime nowTime, int threadCnt, const char *name);
-
-  /*!
-   * \brief Check deadlock.
-   * \param monitor [in]  Monitor object of thread contended.
-   * \param list    [out] List of deadlock occurred threads.
-   * \return Number of deadlock occurred threads.<br>
-   *         Value is 0, if deadlock isn't occurred.
-   */
-  static int checkDeadlock(jobject monitor, TDeadlockList **list);
-
-  /*!
-   * \brief Deallocate deadlock thread list.
-   * \param list [in] List of deadlock occurred threads.
-   */
-  static void freeDeadlockList(TDeadlockList *list);
-
-  /*!
-   * \brief Get deadlock time.
-   * \return Time of finally occurred deadlock until now.
-   */
-  const inline jlong getDeadlockTime(void) { return occurTime; };
-
-  /*!
-   * \brief Get singleton instance of TDeadlockFinder.
-   * \return Singleton instance of TDeadlockFinder.
-   */
-  static TDeadlockFinder *getInstance() { return inst; };
-
- protected:
-  /*!
-   * \brief TDeadlockFinder constructor.
-   * \param event [in] Callback is used on deadlock occurred.
-   */
-  TDeadlockFinder(TDeadlockEventFunc event);
-
-  /*!
-   * \brief TDeadlockFinder destructor.
-   */
-  virtual ~TDeadlockFinder(void);
-
-  /*!
-   * \brief Event handler of JVMTI MonitorContendedEnter for finding
-   *        deadlock.
-   * \param jvmti  [in] JVMTI environment.
-   * \param env    [in] JNI environment of the event (current) thread.
-   * \param thread [in] JNI local reference to the thread attempting
-   *                    to enter the monitor.
-   * \param object [in] JNI local reference to the monitor.
-   * \warning Sometimes this callback is called synchronizing or
-   *          synchronized at safepoint.<br>Please be carefully calling
-   *          inner function of JVM.
-   */
-  friend void JNICALL
-      OnMonitorContendedEnterForDeadlock(jvmtiEnv *jvmti, JNIEnv *env,
-                                         jthread thread, jobject object);
-
-  /*!
-   * \brief JThread entry point.
-   * \param jvmti [in] JVMTI environment object.
-   * \param jni   [in] JNI environment object.
-   * \param data  [in] Pointer of TDeadlockFinder.
-   */
-  static void JNICALL entryPoint(jvmtiEnv *jvmti, JNIEnv *jni, void *data);
-
-  /*!
-   * \brief DeadLock search (recursive call).
-   * \param startId [in] Thread id of TDeadlockFinder caller.
-   * \param monitor [in] Monitor object of thread contended.
-   * \return Is found deadlock.
-   */
-  static FASTCALL bool findDeadLock(pid_t startId, jobject monitor);
-
-  /*!
-   * \brief Get threads which has occurred deadlock.
-   * \param startId [in]  Thread id of TDeadlockFinder caller.
-   * \param monitor [in]  Monitor object of thread contended.
-   * \param list    [out] List of deadlock occurred threads.
-   */
-  static void getLockedThreads(pid_t startId, jobject monitor,
-                               TDeadlockList **list);
-
- private:
-  /*!
-   * \brief Singleton instance of TDeadlockFinder.
-   */
-  static TDeadlockFinder *inst;
-
-  /*!
-   * \brief Callback for event on deadlock occurred.
-   */
-  TDeadlockEventFunc callFunc;
-
-  /*!
-   * \brief Time of finally occurred deadlock until now.
-   */
-  volatile jlong occurTime;
-
-  /*!
-   * \brief Queue of occurred deadlock datetime.
-   */
-  std::queue<jlong> timeList;
-};
-
-#endif  // _DEADLOCK_FINDER_H
--- a/agent/src/heapstats-engines/globals.hpp	Mon Jul 24 21:16:53 2017 +0900
+++ b/agent/src/heapstats-engines/globals.hpp	Wed Aug 02 14:46:00 2017 +0900
@@ -43,9 +43,6 @@
 extern TTimer *logTimer;
 extern TTimer *timer;
 
-#include "deadlockFinder.hpp"
-extern TDeadlockFinder *lockFinder;
-
 #include "symbolFinder.hpp"
 extern TSymbolFinder *symFinder;
 
--- a/agent/src/heapstats-engines/libmain.cpp	Mon Jul 24 21:16:53 2017 +0900
+++ b/agent/src/heapstats-engines/libmain.cpp	Wed Aug 02 14:46:00 2017 +0900
@@ -30,7 +30,7 @@
 #include "elapsedTimer.hpp"
 #include "snapShotMain.hpp"
 #include "logMain.hpp"
-#include "deadlockFinder.hpp"
+#include "deadlockDetector.hpp"
 #include "callbackRegister.hpp"
 #include "threadRecorder.hpp"
 #include "heapstatsMBean.hpp"
@@ -162,6 +162,11 @@
       /* Suspend threads. */
       SetThreadEnable(jvmti, env, false);
 
+      /* Suspend deadlock detector. */
+      if (conf->CheckDeadlock()->get()) {
+        dldetector::finalize(jvmti);
+      }
+
       /* Suspend thread status logging. */
       if (conf->ThreadRecordEnable()->get()) {
         TThreadRecorder::finalize(jvmti, env,
@@ -198,7 +203,17 @@
       /* Restart threads. */
       SetThreadEnable(jvmti, env, true);
 
-      /* Suspend thread status logging. */
+      /* Start deadlock detector. */
+      if (conf->CheckDeadlock()->get()) {
+        jvmtiCapabilities capabilities = {0};
+        dldetector::initialize(jvmti, false);
+        if (isError(jvmti, jvmti->AddCapabilities(&capabilities))) {
+          logger->printCritMsg(
+                      "Couldn't set event capabilities for deadlock detector.");
+        }
+      }
+
+      /* Start thread status logging. */
       if (conf->ThreadRecordEnable()->get()) {
         TThreadRecorder::initialize(
             jvmti, env, conf->ThreadRecordBufferSize()->get() * 1024 * 1024);
@@ -386,6 +401,10 @@
     /* Stop and disable each thread. */
     SetThreadEnable(jvmti, env, false);
 
+    if (conf->CheckDeadlock()->get()) {
+      dldetector::finalize(jvmti);
+    }
+
     if (conf->ThreadRecordEnable()->get()) {
       TThreadRecorder::finalize(jvmti, env,
                                 conf->ThreadRecordFileName()->get());
@@ -431,9 +450,6 @@
   /* Set capability for object tagging. */
   capabilities.can_tag_objects = 1;
 
-  /* Set capabilities for Deadlock detector. */
-  TDeadlockFinder::setCapabilities(&capabilities, isOnLoad);
-
   /* Set capabilities for Thread Recording. */
   TThreadRecorder::setCapabilities(&capabilities);
 
@@ -478,9 +494,9 @@
 
   /* Setup MonitorContendedEnter event. */
   if (conf->CheckDeadlock()->get()) {
-    TMonitorContendedEnterCallback::mergeCapabilities(&capabilities);
-    TMonitorContendedEnterCallback::registerCallback(
-        &OnMonitorContendedEnterForDeadlock);
+    if (!dldetector::initialize(jvmti, isOnLoad)) {
+      return DLDETECTOR_SETUP_FAILED;
+    }
   }
 
   /* Setup VMInit event. */
--- a/agent/src/heapstats-engines/logMain.cpp	Mon Jul 24 21:16:53 2017 +0900
+++ b/agent/src/heapstats-engines/logMain.cpp	Wed Aug 02 14:46:00 2017 +0900
@@ -71,11 +71,6 @@
 volatile sig_atomic_t flagAllLogSignal;
 
 /*!
- * \brief Flag of abortion by deadlock occurred.
- */
-bool abortionByDeadlock = false;
-
-/*!
  * \brief processing flag
  */
 static std::atomic_int processing(0);
@@ -171,32 +166,6 @@
 }
 
 /*!
- * \brief Callback for deadlock trap and log.
- * \param jvmti [in] JVMTI environment object.
- * \param env   [in] JNI environment object.
- * \param cause [in] Cause of taking a snapshot.<br>
- *                   This value is always OccurredDeadlock.
- */
-void onOccurredDeadLock(jvmtiEnv *jvmti, JNIEnv *env, TInvokeCause cause) {
-  TProcessMark mark(processing);
-
-  /* Get now date and time. */
-  TMSecTime occurTime = TDeadlockFinder::getInstance()->getDeadlockTime();
-
-  /* Collect log. */
-  if (unlikely(!TakeLogInfo(jvmti, env, cause, occurTime, ""))) {
-    logger->printWarnMsg("Failure collect log on occurred deadlock.");
-  }
-
-  /* If enable to abort JVM by force on occurred deadlock. */
-  if (unlikely(conf->KillOnError()->get())) {
-    /* Set flag for avoid to deadlock which wait self thread termination. */
-    abortionByDeadlock = true;
-    forcedAbortJVM(jvmti, env, "deadlock occurred");
-  }
-}
-
-/*!
  * \brief JVM resource exhausted event.
  * \param jvmti       [in] JVMTI environment object.
  * \param env         [in] JNI environment object.
@@ -304,12 +273,6 @@
     TResourceExhaustedCallback::switchEventNotification(jvmti, mode);
   }
 
-  /* If collect log when occurred deadlock. */
-  if (conf->CheckDeadlock()->get()) {
-    /* Enable monitor contended event. */
-    TMonitorContendedEnterCallback::switchEventNotification(jvmti, mode);
-  }
-
   return SUCCESS;
 }
 
@@ -334,15 +297,6 @@
     /* Reset signal flag even if non-processed signal is exist. */
     flagLogSignal = 0;
     flagAllLogSignal = 0;
-
-    if (conf->CheckDeadlock()->get() && !abortionByDeadlock) {
-      /* Switch deadlock finder state. */
-      if (enable) {
-        TDeadlockFinder::getInstance()->start(jvmti, env);
-      } else {
-        TDeadlockFinder::getInstance()->stop();
-      }
-    }
   } catch (const char *errMsg) {
     logger->printWarnMsg(errMsg);
   }
@@ -446,14 +400,6 @@
 jint onAgentInitForLog(void) {
   /* Create thread instances that controlled log trigger. */
   try {
-    if (conf->CheckDeadlock()->get()) {
-      if (unlikely(!TDeadlockFinder::globalInitialize(&onOccurredDeadLock))) {
-        logger->printWarnMsg("Failed to initialize deadlock finder.");
-        conf->CheckDeadlock()->set(false);
-        conf->TriggerOnLogLock()->set(false);
-      }
-    }
-
     logTimer = new TTimer(&intervalLogProc, "HeapStats Log Timer");
   } catch (const char *errMsg) {
     logger->printCritMsg(errMsg);
@@ -481,11 +427,6 @@
   delete logTimer;
   logTimer = NULL;
 
-  /* Destroy deadlock finder object. */
-  if (conf->CheckDeadlock()->get()) {
-    TDeadlockFinder::globalFinalize();
-  }
-
   /* Destroy log manager. */
   delete logManager;
   logManager = NULL;
--- a/agent/src/heapstats-engines/util.hpp	Mon Jul 24 21:16:53 2017 +0900
+++ b/agent/src/heapstats-engines/util.hpp	Wed Aug 02 14:46:00 2017 +0900
@@ -166,6 +166,10 @@
  * \brief SNMP setup failed.
  */
 #define SNMP_SETUP_FAILED 0x08
+/*!
+ * \brief Deadlock detector setup failed.
+ */
+#define DLDETECTOR_SETUP_FAILED 0x09
 
 /*!
  * \brief This macro is notification catch signal to signal watcher thread.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agent/test/deadlock/NoDeadLock.java	Wed Aug 02 14:46:00 2017 +0900
@@ -0,0 +1,36 @@
+
+public class NoDeadLock implements Runnable{
+
+  private Object lock;
+
+  public NoDeadLock(Object lock){
+    this.lock = lock;
+  }
+
+  public void run(){
+
+    synchronized(lock){
+
+      try{
+        Thread.sleep(3000);
+      }
+      catch(Exception e){
+        e.printStackTrace();
+      }
+
+      System.out.println("lock succeeded.");
+    }
+
+  }
+
+  public static void main(String[] args) throws Exception{
+    int locks = Integer.parseInt(args[0]);
+
+    for(int idx = 0; idx < locks; idx++){
+      (new Thread(new NoDeadLock(NoDeadLock.class))).start();
+    }
+
+  }
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agent/test/race-condition/MonitorContendedEnter/MonitorContendedEnter/buildenv.sh	Wed Aug 02 14:46:00 2017 +0900
@@ -0,0 +1,27 @@
+<< LICENSE
+Copyright (C) 2017 Yasumasa Suenaga
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+LICENSE
+
+#!/bin/sh
+
+export CLASSPATH=testcase
+export MAINCLASS=Test
+unset JAVA_OPTS
+export HEAPSTATS_CONF=heapstats-deadlock.conf
+
+$JAVA_HOME/bin/javac $TEST_TARGET/testcase/Test.java
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agent/test/race-condition/MonitorContendedEnter/MonitorContendedEnter/heapstats-deadlock.conf	Wed Aug 02 14:46:00 2017 +0900
@@ -0,0 +1,68 @@
+# heapstats_agent 2.0.0
+# heapstats_agent 2.0.0 configuration file.
+attach=true
+
+# Output file setting
+file=heapstats_snapshot.dat
+heaplogfile=heapstats_log.csv
+archivefile=heapstats_analyze.zip
+logfile=
+loglevel=INFO
+reduce_snapshot=true
+
+# SnapShot type
+collect_reftree=true
+
+# Trigger snapshot setting
+trigger_on_fullgc=true
+trigger_on_dump=true
+
+# deadlock check
+check_deadlock=true
+
+# Trigger logging setting
+trigger_on_logerror=true
+trigger_on_logsignal=true
+trigger_on_loglock=true
+
+# Rank setting
+rank_level=5
+rank_order=delta
+
+# Alert setting
+alert_percentage=50
+
+# Alert threshold for java heap usage.
+# "0" means disabled.
+javaheap_alert_percentage=95
+
+# Alert threshold for metaspace usage (in MB).
+# "0" means disabled.
+metaspace_alert_threshold=0
+
+# Timer setting
+snapshot_interval=0
+log_interval=300
+
+first_collect=true
+logsignal_normal=
+logsignal_all=SIGUSR2
+signal_reload=SIGHUP
+
+# Thread recording
+thread_record_enable=false
+thread_record_buffer_size=100  # Set buffer size in MB.
+thread_record_filename=heapstats-thread-records.htr
+thread_record_iotracer=/usr/local/etc/iotracer/IoTrace.class
+
+# Snmp setting
+snmp_send=true
+snmp_target=localhost
+snmp_comname=public
+# You can check library path with `net-snmp-config --netsnmp-libs`
+snmp_libpath=/usr/lib64/libnetsnmp.so
+
+logdir=./tmp
+archive_command=/usr/bin/zip %archivefile% -jr %logdir%
+
+kill_on_error=false
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agent/test/race-condition/MonitorContendedEnter/MonitorContendedEnter/test.py	Wed Aug 02 14:46:00 2017 +0900
@@ -0,0 +1,25 @@
+'''
+Copyright (C) 2017 Yasumasa Suenaga
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+'''
+
+import sys, os
+sys.path.append(os.pardir + "/../")
+
+import common
+
+
+common.initialize("dldetector::OnMonitorContendedEnter", common.return_true, "dldetector::OnMonitorContendedEnter", common.return_true, False)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agent/test/race-condition/MonitorContendedEnter/MonitorContendedEnter/testcase/Test.java	Wed Aug 02 14:46:00 2017 +0900
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2017 Yasumasa Suenaga
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+
+
+public class Test implements Runnable{
+
+  private final Object lock1;
+  private final Object lock2;
+
+  public Test(Object lock1, Object lock2){
+    this.lock1 = lock1;
+    this.lock2 = lock2;
+  }
+
+  public void run(){
+    try{
+      synchronized(lock1){
+        Thread.sleep(3000);
+        synchronized(lock2){
+          System.out.println("Test error");
+          System.exit(-1);
+        }
+      }
+    }
+    catch(Exception e){
+      e.printStackTrace();
+    }
+  }
+
+  public static void main(String[] args) throws Exception{
+    Object lock1 = new Object();
+    Object lock2 = new Object();
+
+    Thread th1 = new Thread(new Test(lock1, lock2));
+    Thread th2 = new Thread(new Test(lock2, lock1));
+    th1.setDaemon(true);
+    th2.setDaemon(true);
+    th1.start();
+    th2.start();
+
+    Thread.sleep(7000);
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agent/test/race-condition/MonitorContendedEnter/MonitorContendedEnter_safepoint/buildenv.sh	Wed Aug 02 14:46:00 2017 +0900
@@ -0,0 +1,1 @@
+../MonitorContendedEnter/buildenv.sh
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agent/test/race-condition/MonitorContendedEnter/MonitorContendedEnter_safepoint/heapstats-deadlock.conf	Wed Aug 02 14:46:00 2017 +0900
@@ -0,0 +1,1 @@
+../MonitorContendedEnter/heapstats-deadlock.conf
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agent/test/race-condition/MonitorContendedEnter/MonitorContendedEnter_safepoint/test.py	Wed Aug 02 14:46:00 2017 +0900
@@ -0,0 +1,25 @@
+'''
+Copyright (C) 2017 Yasumasa Suenaga
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+'''
+
+import sys, os
+sys.path.append(os.pardir + "/../")
+
+import common
+
+
+common.initialize("dldetector::OnMonitorContendedEnter", common.return_true, "dldetector::OnMonitorContendedEnter", common.return_true, False, at_safepoint=True)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agent/test/race-condition/MonitorContendedEnter/MonitorContendedEnter_safepoint/testcase	Wed Aug 02 14:46:00 2017 +0900
@@ -0,0 +1,1 @@
+../MonitorContendedEnter/testcase
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agent/test/race-condition/MonitorContendedEnter/MonitorContendedEntered/buildenv.sh	Wed Aug 02 14:46:00 2017 +0900
@@ -0,0 +1,27 @@
+<< LICENSE
+Copyright (C) 2017 Yasumasa Suenaga
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+LICENSE
+
+#!/bin/sh
+
+export CLASSPATH=testcase
+export MAINCLASS=Test
+unset JAVA_OPTS
+export HEAPSTATS_CONF=heapstats-deadlock.conf
+
+$JAVA_HOME/bin/javac $TEST_TARGET/testcase/Test.java
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agent/test/race-condition/MonitorContendedEnter/MonitorContendedEntered/heapstats-deadlock.conf	Wed Aug 02 14:46:00 2017 +0900
@@ -0,0 +1,68 @@
+# heapstats_agent 2.0.0
+# heapstats_agent 2.0.0 configuration file.
+attach=true
+
+# Output file setting
+file=heapstats_snapshot.dat
+heaplogfile=heapstats_log.csv
+archivefile=heapstats_analyze.zip
+logfile=
+loglevel=INFO
+reduce_snapshot=true
+
+# SnapShot type
+collect_reftree=true
+
+# Trigger snapshot setting
+trigger_on_fullgc=true
+trigger_on_dump=true
+
+# deadlock check
+check_deadlock=true
+
+# Trigger logging setting
+trigger_on_logerror=true
+trigger_on_logsignal=true
+trigger_on_loglock=true
+
+# Rank setting
+rank_level=5
+rank_order=delta
+
+# Alert setting
+alert_percentage=50
+
+# Alert threshold for java heap usage.
+# "0" means disabled.
+javaheap_alert_percentage=95
+
+# Alert threshold for metaspace usage (in MB).
+# "0" means disabled.
+metaspace_alert_threshold=0
+
+# Timer setting
+snapshot_interval=0
+log_interval=300
+
+first_collect=true
+logsignal_normal=
+logsignal_all=SIGUSR2
+signal_reload=SIGHUP
+
+# Thread recording
+thread_record_enable=false
+thread_record_buffer_size=100  # Set buffer size in MB.
+thread_record_filename=heapstats-thread-records.htr
+thread_record_iotracer=/usr/local/etc/iotracer/IoTrace.class
+
+# Snmp setting
+snmp_send=true
+snmp_target=localhost
+snmp_comname=public
+# You can check library path with `net-snmp-config --netsnmp-libs`
+snmp_libpath=/usr/lib64/libnetsnmp.so
+
+logdir=./tmp
+archive_command=/usr/bin/zip %archivefile% -jr %logdir%
+
+kill_on_error=false
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agent/test/race-condition/MonitorContendedEnter/MonitorContendedEntered/test.py	Wed Aug 02 14:46:00 2017 +0900
@@ -0,0 +1,25 @@
+'''
+Copyright (C) 2017 Yasumasa Suenaga
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+'''
+
+import sys, os
+sys.path.append(os.pardir + "/../")
+
+import common
+
+
+common.initialize("dldetector::OnMonitorContendedEnter", common.return_true, "dldetector::OnMonitorContendedEntered", common.return_true, True)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agent/test/race-condition/MonitorContendedEnter/MonitorContendedEntered/testcase/Test.java	Wed Aug 02 14:46:00 2017 +0900
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2017 Yasumasa Suenaga
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+
+
+public class Test implements Runnable{
+
+  private final Object lock;
+
+  public Test(Object lock){
+    this.lock = lock;
+  }
+
+  public void run(){
+    try{
+      synchronized(lock){
+        Thread.sleep(3000);
+      }
+    }
+    catch(Exception e){
+      e.printStackTrace();
+    }
+  }
+
+  public static void main(String[] args) throws Exception{
+    Object lock1 = new Object();
+    Object lock2 = new Object();
+
+    Thread th1 = new Thread(new Test(lock1));
+    Thread th2 = new Thread(new Test(lock1));
+    th1.start();
+    th2.start();
+
+    Thread th3 = new Thread(new Test(lock2));
+    Thread th4 = new Thread(new Test(lock2));
+
+    th3.start();
+    th4.start();
+
+    th1.join();
+    th2.join();
+    th3.join();
+    th4.join();
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agent/test/race-condition/MonitorContendedEnter/MonitorContendedEntered_safepoint/buildenv.sh	Wed Aug 02 14:46:00 2017 +0900
@@ -0,0 +1,1 @@
+../MonitorContendedEntered/buildenv.sh
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agent/test/race-condition/MonitorContendedEnter/MonitorContendedEntered_safepoint/heapstats-deadlock.conf	Wed Aug 02 14:46:00 2017 +0900
@@ -0,0 +1,1 @@
+../MonitorContendedEntered/heapstats-deadlock.conf
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agent/test/race-condition/MonitorContendedEnter/MonitorContendedEntered_safepoint/test.py	Wed Aug 02 14:46:00 2017 +0900
@@ -0,0 +1,25 @@
+'''
+Copyright (C) 2017 Yasumasa Suenaga
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+'''
+
+import sys, os
+sys.path.append(os.pardir + "/../")
+
+import common
+
+
+common.initialize("dldetector::OnMonitorContendedEnter", common.return_true, "dldetector::OnMonitorContendedEntered", common.return_true, True, at_safepoint=True)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agent/test/race-condition/MonitorContendedEnter/MonitorContendedEntered_safepoint/testcase	Wed Aug 02 14:46:00 2017 +0900
@@ -0,0 +1,1 @@
+../MonitorContendedEntered/testcase
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agent/test/race-condition/MonitorContendedEntered/MonitorContendedEnter/buildenv.sh	Wed Aug 02 14:46:00 2017 +0900
@@ -0,0 +1,27 @@
+<< LICENSE
+Copyright (C) 2017 Yasumasa Suenaga
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+LICENSE
+
+#!/bin/sh
+
+export CLASSPATH=testcase
+export MAINCLASS=Test
+unset JAVA_OPTS
+export HEAPSTATS_CONF=heapstats-deadlock.conf
+
+$JAVA_HOME/bin/javac $TEST_TARGET/testcase/Test.java
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agent/test/race-condition/MonitorContendedEntered/MonitorContendedEnter/heapstats-deadlock.conf	Wed Aug 02 14:46:00 2017 +0900
@@ -0,0 +1,68 @@
+# heapstats_agent 2.0.0
+# heapstats_agent 2.0.0 configuration file.
+attach=true
+
+# Output file setting
+file=heapstats_snapshot.dat
+heaplogfile=heapstats_log.csv
+archivefile=heapstats_analyze.zip
+logfile=
+loglevel=INFO
+reduce_snapshot=true
+
+# SnapShot type
+collect_reftree=true
+
+# Trigger snapshot setting
+trigger_on_fullgc=true
+trigger_on_dump=true
+
+# deadlock check
+check_deadlock=true
+
+# Trigger logging setting
+trigger_on_logerror=true
+trigger_on_logsignal=true
+trigger_on_loglock=true
+
+# Rank setting
+rank_level=5
+rank_order=delta
+
+# Alert setting
+alert_percentage=50
+
+# Alert threshold for java heap usage.
+# "0" means disabled.
+javaheap_alert_percentage=95
+
+# Alert threshold for metaspace usage (in MB).
+# "0" means disabled.
+metaspace_alert_threshold=0
+
+# Timer setting
+snapshot_interval=0
+log_interval=300
+
+first_collect=true
+logsignal_normal=
+logsignal_all=SIGUSR2
+signal_reload=SIGHUP
+
+# Thread recording
+thread_record_enable=false
+thread_record_buffer_size=100  # Set buffer size in MB.
+thread_record_filename=heapstats-thread-records.htr
+thread_record_iotracer=/usr/local/etc/iotracer/IoTrace.class
+
+# Snmp setting
+snmp_send=true
+snmp_target=localhost
+snmp_comname=public
+# You can check library path with `net-snmp-config --netsnmp-libs`
+snmp_libpath=/usr/lib64/libnetsnmp.so
+
+logdir=./tmp
+archive_command=/usr/bin/zip %archivefile% -jr %logdir%
+
+kill_on_error=false
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agent/test/race-condition/MonitorContendedEntered/MonitorContendedEnter/test.py	Wed Aug 02 14:46:00 2017 +0900
@@ -0,0 +1,25 @@
+'''
+Copyright (C) 2017 Yasumasa Suenaga
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+'''
+
+import sys, os
+sys.path.append(os.pardir + "/../")
+
+import common
+
+
+common.initialize("dldetector::OnMonitorContendedEntered", common.return_true, "dldetector::OnMonitorContendedEnter", common.return_true, True)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agent/test/race-condition/MonitorContendedEntered/MonitorContendedEnter/testcase/Test.java	Wed Aug 02 14:46:00 2017 +0900
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2017 Yasumasa Suenaga
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+
+
+public class Test implements Runnable{
+
+  private final Object lock;
+
+  public Test(Object lock){
+    this.lock = lock;
+  }
+
+  public void run(){
+    try{
+      synchronized(lock){
+        Thread.sleep(3000);
+      }
+    }
+    catch(Exception e){
+      e.printStackTrace();
+    }
+  }
+
+  public static void main(String[] args) throws Exception{
+    Object lock1 = new Object();
+    Object lock2 = new Object();
+
+    Thread th1 = new Thread(new Test(lock1));
+    Thread th2 = new Thread(new Test(lock1));
+    th1.start();
+    th2.start();
+
+    Thread th3 = new Thread(new Test(lock2));
+    Thread th4 = new Thread(new Test(lock2));
+
+    th3.start();
+    th4.start();
+
+    th1.join();
+    th2.join();
+    th3.join();
+    th4.join();
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agent/test/race-condition/MonitorContendedEntered/MonitorContendedEnter_safepoint/buildenv.sh	Wed Aug 02 14:46:00 2017 +0900
@@ -0,0 +1,1 @@
+../MonitorContendedEnter/buildenv.sh
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agent/test/race-condition/MonitorContendedEntered/MonitorContendedEnter_safepoint/heapstats-deadlock.conf	Wed Aug 02 14:46:00 2017 +0900
@@ -0,0 +1,1 @@
+../MonitorContendedEnter/heapstats-deadlock.conf
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agent/test/race-condition/MonitorContendedEntered/MonitorContendedEnter_safepoint/test.py	Wed Aug 02 14:46:00 2017 +0900
@@ -0,0 +1,25 @@
+'''
+Copyright (C) 2017 Yasumasa Suenaga
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+'''
+
+import sys, os
+sys.path.append(os.pardir + "/../")
+
+import common
+
+
+common.initialize("dldetector::OnMonitorContendedEntered", common.return_true, "dldetector::OnMonitorContendedEnter", common.return_true, True, at_safepoint=True)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agent/test/race-condition/MonitorContendedEntered/MonitorContendedEnter_safepoint/testcase	Wed Aug 02 14:46:00 2017 +0900
@@ -0,0 +1,1 @@
+../MonitorContendedEnter/testcase
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agent/test/race-condition/MonitorContendedEntered/MonitorContendedEntered/buildenv.sh	Wed Aug 02 14:46:00 2017 +0900
@@ -0,0 +1,27 @@
+<< LICENSE
+Copyright (C) 2017 Yasumasa Suenaga
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+LICENSE
+
+#!/bin/sh
+
+export CLASSPATH=testcase
+export MAINCLASS=Test
+unset JAVA_OPTS
+export HEAPSTATS_CONF=heapstats-deadlock.conf
+
+$JAVA_HOME/bin/javac $TEST_TARGET/testcase/Test.java
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agent/test/race-condition/MonitorContendedEntered/MonitorContendedEntered/heapstats-deadlock.conf	Wed Aug 02 14:46:00 2017 +0900
@@ -0,0 +1,68 @@
+# heapstats_agent 2.0.0
+# heapstats_agent 2.0.0 configuration file.
+attach=true
+
+# Output file setting
+file=heapstats_snapshot.dat
+heaplogfile=heapstats_log.csv
+archivefile=heapstats_analyze.zip
+logfile=
+loglevel=INFO
+reduce_snapshot=true
+
+# SnapShot type
+collect_reftree=true
+
+# Trigger snapshot setting
+trigger_on_fullgc=true
+trigger_on_dump=true
+
+# deadlock check
+check_deadlock=true
+
+# Trigger logging setting
+trigger_on_logerror=true
+trigger_on_logsignal=true
+trigger_on_loglock=true
+
+# Rank setting
+rank_level=5
+rank_order=delta
+
+# Alert setting
+alert_percentage=50
+
+# Alert threshold for java heap usage.
+# "0" means disabled.
+javaheap_alert_percentage=95
+
+# Alert threshold for metaspace usage (in MB).
+# "0" means disabled.
+metaspace_alert_threshold=0
+
+# Timer setting
+snapshot_interval=0
+log_interval=300
+
+first_collect=true
+logsignal_normal=
+logsignal_all=SIGUSR2
+signal_reload=SIGHUP
+
+# Thread recording
+thread_record_enable=false
+thread_record_buffer_size=100  # Set buffer size in MB.
+thread_record_filename=heapstats-thread-records.htr
+thread_record_iotracer=/usr/local/etc/iotracer/IoTrace.class
+
+# Snmp setting
+snmp_send=true
+snmp_target=localhost
+snmp_comname=public
+# You can check library path with `net-snmp-config --netsnmp-libs`
+snmp_libpath=/usr/lib64/libnetsnmp.so
+
+logdir=./tmp
+archive_command=/usr/bin/zip %archivefile% -jr %logdir%
+
+kill_on_error=false
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agent/test/race-condition/MonitorContendedEntered/MonitorContendedEntered/test.py	Wed Aug 02 14:46:00 2017 +0900
@@ -0,0 +1,25 @@
+'''
+Copyright (C) 2017 Yasumasa Suenaga
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+'''
+
+import sys, os
+sys.path.append(os.pardir + "/../")
+
+import common
+
+
+common.initialize("dldetector::OnMonitorContendedEntered", common.return_true, "dldetector::OnMonitorContendedEntered", common.return_true, False)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agent/test/race-condition/MonitorContendedEntered/MonitorContendedEntered/testcase/Test.java	Wed Aug 02 14:46:00 2017 +0900
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2017 Yasumasa Suenaga
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+
+
+public class Test implements Runnable{
+
+  private final Object lock;
+
+  public Test(Object lock){
+    this.lock = lock;
+  }
+
+  public void run(){
+    try{
+      synchronized(lock){
+        Thread.sleep(3000);
+      }
+    }
+    catch(Exception e){
+      e.printStackTrace();
+    }
+  }
+
+  public static void main(String[] args) throws Exception{
+    Object lock1 = new Object();
+    Object lock2 = new Object();
+
+    Thread th1 = new Thread(new Test(lock1));
+    Thread th2 = new Thread(new Test(lock1));
+    th1.start();
+    th2.start();
+
+    Thread th3 = new Thread(new Test(lock2));
+    Thread th4 = new Thread(new Test(lock2));
+
+    th3.start();
+    th4.start();
+
+    th1.join();
+    th2.join();
+    th3.join();
+    th4.join();
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agent/test/race-condition/MonitorContendedEntered/MonitorContendedEntered_safepoint/buildenv.sh	Wed Aug 02 14:46:00 2017 +0900
@@ -0,0 +1,1 @@
+../MonitorContendedEntered/buildenv.sh
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agent/test/race-condition/MonitorContendedEntered/MonitorContendedEntered_safepoint/heapstats-deadlock.conf	Wed Aug 02 14:46:00 2017 +0900
@@ -0,0 +1,1 @@
+../MonitorContendedEntered/heapstats-deadlock.conf
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agent/test/race-condition/MonitorContendedEntered/MonitorContendedEntered_safepoint/test.py	Wed Aug 02 14:46:00 2017 +0900
@@ -0,0 +1,25 @@
+'''
+Copyright (C) 2017 Yasumasa Suenaga
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+'''
+
+import sys, os
+sys.path.append(os.pardir + "/../")
+
+import common
+
+
+common.initialize("dldetector::OnMonitorContendedEntered", common.return_true, "dldetector::OnMonitorContendedEntered", common.return_true, False, at_safepoint=True)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agent/test/race-condition/MonitorContendedEntered/MonitorContendedEntered_safepoint/testcase	Wed Aug 02 14:46:00 2017 +0900
@@ -0,0 +1,1 @@
+../MonitorContendedEntered/testcase
\ No newline at end of file
--- a/agent/test/race-condition/testlist.txt	Mon Jul 24 21:16:53 2017 +0900
+++ b/agent/test/race-condition/testlist.txt	Wed Aug 02 14:46:00 2017 +0900
@@ -3,3 +3,5 @@
 ThreadExhausted/*
 SnapShotProcessor/*
 GCWatcher/*
+MonitorContendedEnter/*
+MonitorContendedEntered/*