more clean separation of automatic thread dumps captured on different occasions
authorpeter <peter@jetbrains.com>
Thu, 5 Feb 2015 11:55:14 +0000 (12:55 +0100)
committerpeter <peter@jetbrains.com>
Thu, 5 Feb 2015 13:05:14 +0000 (14:05 +0100)
platform/core-impl/src/com/intellij/diagnostic/PerformanceWatcher.java
platform/core-impl/src/org/jetbrains/ide/PooledThreadExecutor.java
platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionProgressIndicator.java

index 021b45e97023e75ebbd91d462d42224f4c891f50..2d68aa5056d64182a5972f080c532da1ca64a58f 100644 (file)
@@ -175,7 +175,7 @@ public class PerformanceWatcher implements ApplicationComponent {
             //System.out.println("EDT is not responding at " + myPrintDateFormat.format(new Date()));
             myCurHangLogDir = new File(mySessionLogDir, myDateFormat.format(new Date()));
           }
-          dumpThreads(false);
+          dumpThreads("", false);
         }
       }
       else {
@@ -197,7 +197,7 @@ public class PerformanceWatcher implements ApplicationComponent {
   }
 
   private String getLogDirForHang() {
-    StringBuilder name = new StringBuilder(myCurHangLogDir.getName());
+    StringBuilder name = new StringBuilder("freeze-" + myCurHangLogDir.getName());
     name.append("-").append(myUnresponsiveDuration);
     if (myStacktraceCommonPart != null && !myStacktraceCommonPart.isEmpty()) {
       final StackTraceElement element = myStacktraceCommonPart.get(0);
@@ -206,13 +206,13 @@ public class PerformanceWatcher implements ApplicationComponent {
     return name.toString();
   }
 
-  public void dumpThreads(boolean millis) {
+  public void dumpThreads(String pathPrefix, boolean millis) {
     if (shallNotWatch()) return;
 
     final String suffix = millis ? "-" + String.valueOf(System.currentTimeMillis()) : "";
     myCurHangLogDir.mkdirs();
 
-    File f = new File(myCurHangLogDir, "threadDump-" + myDateFormat.format(new Date()) + suffix + ".txt");
+    File f = new File(myCurHangLogDir, pathPrefix + "threadDump-" + myDateFormat.format(new Date()) + suffix + ".txt");
     FileOutputStream fos;
     try {
       fos = new FileOutputStream(f);
index 914df3e29486b3ab098d13bb0a1490d2552e3823..d75aaf0216f84609ff039b85dee66138f78cfb83 100644 (file)
@@ -65,7 +65,7 @@ public final class PooledThreadExecutor  {
         };
         if (ApplicationInfoImpl.getShadowInstance().isEAP() && count > ourReasonableThreadPoolSize) {
           LOG.info("Not enough pooled threads; dumping threads into a file");
-          PerformanceWatcher.getInstance().dumpThreads(true);
+          PerformanceWatcher.getInstance().dumpThreads("newPooledThread/", true);
         }
         thread.setPriority(Thread.NORM_PRIORITY - 1);
         return thread;
index 973e2d11b2c9ca95981fdc110aef4b8cc1e167b2..5daf8d4801977f9951bb7d1ccdb58145c681473b 100644 (file)
@@ -337,7 +337,7 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement
       }
 
       if (Registry.is("dump.threads.on.empty.lookup") && myLookup.isCalculating() && myLookup.getItems().isEmpty()) {
-        PerformanceWatcher.getInstance().dumpThreads(true);
+        PerformanceWatcher.getInstance().dumpThreads("emptyLookup/", true);
       }
 
       if (!myLookup.showLookup()) {