mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PerformanceMonitor: do not create empty dirs if not necessary
This commit is contained in:
@@ -97,7 +97,6 @@ public class PerformanceWatcher implements ApplicationComponent {
|
||||
|
||||
myLogDir = new File(PathManager.getLogPath() + "/threadDumps-" + myDateFormat.format(new Date())
|
||||
+ "-" + ApplicationInfo.getInstance().getBuild().asString());
|
||||
myLogDir.mkdirs();
|
||||
myCurHangLogDir = myLogDir;
|
||||
|
||||
try {
|
||||
@@ -165,7 +164,6 @@ public class PerformanceWatcher implements ApplicationComponent {
|
||||
if (myUnresponsiveDuration == UNRESPONSIVE_THRESHOLD) {
|
||||
//System.out.println("EDT is not responding at " + myPrintDateFormat.format(new Date()));
|
||||
myCurHangLogDir = new File(myLogDir, myDateFormat.format(new Date()));
|
||||
myCurHangLogDir.mkdirs();
|
||||
}
|
||||
if (myUnresponsiveDuration >= UNRESPONSIVE_THRESHOLD) {
|
||||
dumpThreads(false);
|
||||
@@ -174,7 +172,9 @@ public class PerformanceWatcher implements ApplicationComponent {
|
||||
else {
|
||||
if (myUnresponsiveDuration >= UNRESPONSIVE_THRESHOLD) {
|
||||
//System.out.println("EDT was unresponsive for " + myUnresponsiveDuration + " seconds");
|
||||
myCurHangLogDir.renameTo(new File(myLogDir, getLogDirForHang()));
|
||||
if (myCurHangLogDir.exists()) {
|
||||
myCurHangLogDir.renameTo(new File(myLogDir, getLogDirForHang()));
|
||||
}
|
||||
myUnresponsiveDuration = 0;
|
||||
myCurHangLogDir = myLogDir;
|
||||
|
||||
@@ -199,6 +199,8 @@ public class PerformanceWatcher implements ApplicationComponent {
|
||||
|
||||
public void dumpThreads(boolean millis) {
|
||||
final String suffix = millis ? "-" + String.valueOf(System.currentTimeMillis()) : "";
|
||||
myCurHangLogDir.mkdirs();
|
||||
|
||||
File f = new File(myCurHangLogDir, "threadDump-" + myDateFormat.format(new Date()) + suffix + ".txt");
|
||||
FileOutputStream fos;
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user