print the offending event also

This commit is contained in:
Alexey Kudravtsev
2016-01-11 14:57:19 +03:00
parent c24a0985b3
commit 1104ccd19b
4 changed files with 12 additions and 10 deletions
@@ -1156,7 +1156,7 @@ public class IdeEventQueue extends EventQueue {
private final FrequentEventDetector myFrequentEventDetector = new FrequentEventDetector(1009, 100);
@Override
public void postEvent(@NotNull AWTEvent theEvent) {
myFrequentEventDetector.eventHappened();
myFrequentEventDetector.eventHappened(theEvent);
super.postEvent(theEvent);
}
@@ -47,7 +47,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
@SuppressWarnings({"SSBasedInspection"})
@SuppressWarnings("SSBasedInspection")
public class LaterInvocator {
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.application.impl.LaterInvocator");
private static final boolean DEBUG = LOG.isDebugEnabled();
@@ -83,7 +83,7 @@ public class LaterInvocator {
private static final List<Object> ourModalEntities = ContainerUtil.createLockFreeCopyOnWriteList();
private static final List<RunnableInfo> ourQueue = new ArrayList<RunnableInfo>(); //protected by LOCK
private static volatile int ourQueueSkipCount = 0; // optimization
private static volatile int ourQueueSkipCount; // optimization
private static final FlushQueue ourFlushQueueRunnable = new FlushQueue();
private static final Stack<AWTEvent> ourEventStack = new Stack<AWTEvent>(); // guarded by RUN_LOCK
@@ -136,7 +136,7 @@ public class LaterInvocator {
@NotNull
static ActionCallback invokeLater(@NotNull Runnable runnable, @NotNull ModalityState modalityState, @NotNull Condition<?> expired) {
ourFrequentEventDetector.eventHappened();
ourFrequentEventDetector.eventHappened(runnable);
final ActionCallback callback = new ActionCallback();
RunnableInfo runnableInfo = new RunnableInfo(runnable, modalityState, expired, callback);
@@ -77,7 +77,7 @@ public class RefreshQueueImpl extends RefreshQueue implements Disposable {
public void run() {
try {
myRefreshIndicator.start();
AccessToken token = HeavyProcessLatch.INSTANCE.processStarted("Doing file refresh. " + session.toString());
AccessToken token = HeavyProcessLatch.INSTANCE.processStarted("Doing file refresh. " + session);
try {
doScan(session);
}
@@ -96,7 +96,7 @@ public class RefreshQueueImpl extends RefreshQueue implements Disposable {
}
}
});
myEventCounter.eventHappened();
myEventCounter.eventHappened(session);
}
private void doScan(RefreshSessionImpl session) {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -53,7 +53,7 @@ public class FrequentEventDetector {
myLevel = level;
}
public void eventHappened() {
public void eventHappened(@NotNull Object event) {
if (myEventsPosted.incrementAndGet() > myEventCountThreshold) {
boolean shouldLog = false;
@@ -75,12 +75,14 @@ public class FrequentEventDetector {
logTrace = existingTraceId == null;
if (logTrace) {
myRecentTraces.put(trace, traceId = myLastTraceId.incrementAndGet());
} else {
}
else {
traceId = existingTraceId;
}
}
String message = "Too many events posted, #" + traceId + (logTrace ? "\n" + trace : "");
String message = "Too many events posted, #" + traceId + ". Event: "+event +
(logTrace ? "\n" + trace : "");
if (myLevel == Level.INFO) {
LOG.info(message);
}