mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Qodana inspections: add statistics for inspections payload
GitOrigin-RevId: 2325bc4e2bf0c3d3e0f9adaa0b8722d3e6fa9ac3
This commit is contained in:
committed by
intellij-monorepo-bot
parent
8b3392ac70
commit
f204c6e6a8
@@ -4,10 +4,17 @@ package com.intellij.codeInspection.ex;
|
||||
public interface InspectListener {
|
||||
default void inspectionFinished(long start, long finish, long threadId, InspectionToolWrapper<?, ?> tool, InspectionKind kind) {}
|
||||
|
||||
default void activityFinished(long start, long finish, long threadId, ActivityKind activityKind) {}
|
||||
|
||||
enum InspectionKind {
|
||||
LOCAL,
|
||||
LOCAL_PRIORITY,
|
||||
GLOBAL_SIMPLE,
|
||||
GLOBAL
|
||||
}
|
||||
|
||||
enum ActivityKind {
|
||||
REFERENCE_SEARCH,
|
||||
GLOBAL_POST_RUN_ACTIVITIES
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,4 +12,15 @@ fun InspectListener.reportWhenInspectionFinished(toolWrapper: InspectionToolWrap
|
||||
inspectionFinished(start, System.nanoTime(), Thread.currentThread().id, toolWrapper, kind)
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
fun InspectListener.reportWhenActivityFinished(activityKind: InspectListener.ActivityKind, activity: Runnable) {
|
||||
val start = System.nanoTime()
|
||||
try {
|
||||
activity.run()
|
||||
activityFinished(start, System.nanoTime(), Thread.currentThread().id, activityKind)
|
||||
} catch (e: Throwable ) {
|
||||
activityFinished(start, System.nanoTime(), Thread.currentThread().id, activityKind)
|
||||
throw e
|
||||
}
|
||||
}
|
||||
+16
-3
@@ -76,6 +76,7 @@ import java.util.concurrent.*;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import static com.intellij.codeInspection.ex.InspectListener.InspectionKind.*;
|
||||
import static com.intellij.codeInspection.ex.InspectionEventsKt.reportWhenActivityFinished;
|
||||
import static com.intellij.codeInspection.ex.InspectionEventsKt.reportWhenInspectionFinished;
|
||||
|
||||
public class GlobalInspectionContextImpl extends GlobalInspectionContextEx {
|
||||
@@ -564,7 +565,12 @@ public class GlobalInspectionContextImpl extends GlobalInspectionContextEx {
|
||||
try {
|
||||
if (tool.isGraphNeeded()) {
|
||||
try {
|
||||
((RefManagerImpl)getRefManager()).findAllDeclarations();
|
||||
reportWhenActivityFinished(
|
||||
myInspectTopicPublisher,
|
||||
InspectListener.ActivityKind.REFERENCE_SEARCH,
|
||||
() -> {
|
||||
((RefManagerImpl)getRefManager()).findAllDeclarations();
|
||||
});
|
||||
}
|
||||
catch (Throwable e) {
|
||||
getStdJobDescriptors().BUILD_GRAPH.setDoneAmount(0);
|
||||
@@ -601,7 +607,16 @@ public class GlobalInspectionContextImpl extends GlobalInspectionContextEx {
|
||||
}
|
||||
}
|
||||
}
|
||||
reportWhenActivityFinished(
|
||||
myInspectTopicPublisher,
|
||||
InspectListener.ActivityKind.GLOBAL_POST_RUN_ACTIVITIES,
|
||||
() -> {
|
||||
processPostRunActivities(needRepeatSearchRequest);
|
||||
});
|
||||
addProblemsToView(globalTools);
|
||||
}
|
||||
|
||||
private void processPostRunActivities(List<InspectionToolWrapper<?, ?>> needRepeatSearchRequest) {
|
||||
for (GlobalInspectionContextExtension<?> extension : myExtensions.values()) {
|
||||
try {
|
||||
extension.performPostRunActivities(needRepeatSearchRequest, this);
|
||||
@@ -613,8 +628,6 @@ public class GlobalInspectionContextImpl extends GlobalInspectionContextEx {
|
||||
LOG.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
addProblemsToView(globalTools);
|
||||
}
|
||||
|
||||
public ActionCallback initializeViewIfNeeded() {
|
||||
|
||||
Reference in New Issue
Block a user