long (boolean isCancelled) { long currentTS = System.nanoTime(); long durationFirstResults = TimeUnit.NANOSECONDS.toMillis(firstItemFoundTS.get() - start); long duration = TimeUnit.NANOSECONDS.toMillis(currentTS - start); PsiElement element = SearchForUsagesRunnable.getPsiElement(searchFor); UsageViewEx view = usageViewRef.get(); Class<? extends PsiElement> targetClass = element != null ? element.getClass() : null; Language language = element != null ? ReadAction.compute(element::getLanguage) : null; SearchScope scope = null; if (element instanceof DataProvider) { scope = UsageView.USAGE_SCOPE.getData((DataProvider)element); } int numberOfUsagesFound = view == null ? 0 : view.getUsagesCount(); UsageViewStatisticsCollector.logSearchFinished(myProject, view, targetClass, scope, language, numberOfUsagesFound, durationFirstResults, duration, tooManyUsages.get(), isCancelled, CodeNavigateSource.FindToolWindow); return duration; }