Pass root to vcs performance listeners to infer relative file path (TBE-3093)

GitOrigin-RevId: 1830fec2bd163959108b7ec3d0ea47d3aa0db2c8
This commit is contained in:
Semyon Proshev
2023-12-08 15:40:41 +01:00
committed by intellij-monorepo-bot
parent 3659c6420a
commit c29cde5e1c
5 changed files with 14 additions and 6 deletions

View File

@@ -202,7 +202,7 @@ internal class FileHistoryFilterer(private val logData: VcsLogData, private val
val finish = start.elapsedNow()
FileHistoryPerformanceListener.EP_NAME.extensionList.forEach {
it.onFileHistoryFinished(project, filePath, finish)
it.onFileHistoryFinished(project, root, filePath, finish)
}
if (revisions.isEmpty()) return VisiblePack.EMPTY

View File

@@ -4,6 +4,7 @@ package com.intellij.vcs.log.history
import com.intellij.openapi.extensions.ExtensionPointName
import com.intellij.openapi.project.Project
import com.intellij.openapi.vcs.FilePath
import com.intellij.openapi.vfs.VirtualFile
import org.jetbrains.annotations.ApiStatus.Internal
import kotlin.time.Duration
@@ -15,5 +16,5 @@ interface FileHistoryPerformanceListener {
val EP_NAME = ExtensionPointName.create<FileHistoryPerformanceListener>("com.intellij.fileHistoryPerformanceListener")
}
fun onFileHistoryFinished(project: Project, path: FilePath, duration: Duration)
fun onFileHistoryFinished(project: Project, root: VirtualFile, path: FilePath, duration: Duration)
}

View File

@@ -5,6 +5,7 @@ import com.intellij.openapi.extensions.ExtensionPointName
import com.intellij.openapi.project.Project
import com.intellij.openapi.vcs.FilePath
import com.intellij.openapi.vcs.history.VcsRevisionNumber
import com.intellij.openapi.vfs.VirtualFile
import org.jetbrains.annotations.ApiStatus.Internal
import kotlin.time.Duration
@@ -16,5 +17,10 @@ interface GitAnnotationPerformanceListener {
val EP_NAME = ExtensionPointName.create<GitAnnotationPerformanceListener>("Git4Idea.gitAnnotationPerformanceListener")
}
fun onAnnotationFinished(project: Project, path: FilePath, revision: VcsRevisionNumber?, duration: Duration, provider: String)
fun onAnnotationFinished(project: Project,
root: VirtualFile,
path: FilePath,
revision: VcsRevisionNumber?,
duration: Duration,
provider: String)
}

View File

@@ -202,7 +202,7 @@ public final class GitAnnotationProvider implements AnnotationProviderEx, Cachea
if (another != null) {
GitFileAnnotation res = another.annotate(myProject, root, filePath, revision, file);
if (res != null) {
GitAnnotationProviderKt.reportAnnotationFinished(myProject, filePath, revision, start, another.getClass().getSimpleName());
GitAnnotationProviderKt.reportAnnotationFinished(myProject, root, filePath, revision, start, another.getClass().getSimpleName());
return res;
}
}
@@ -241,7 +241,7 @@ public final class GitAnnotationProvider implements AnnotationProviderEx, Cachea
GitFileAnnotation annotation = parseAnnotations(revision, file, root, output);
GitAnnotationProviderKt.reportAnnotationFinished(myProject, filePath, revision, start, "default");
GitAnnotationProviderKt.reportAnnotationFinished(myProject, root, filePath, revision, start, "default");
return annotation;
}

View File

@@ -30,6 +30,7 @@ internal fun getAnnotationFromCache(project: Project, file: VirtualFile): FileAn
}
internal fun reportAnnotationFinished(project: Project,
root: VirtualFile,
filePath: FilePath,
revision: VcsRevisionNumber?,
startMs: Long,
@@ -37,6 +38,6 @@ internal fun reportAnnotationFinished(project: Project,
val duration = (System.currentTimeMillis() - startMs).toDuration(DurationUnit.MILLISECONDS)
GitAnnotationPerformanceListener.EP_NAME.extensionList.forEach {
it.onAnnotationFinished(project, filePath, revision, duration, provider)
it.onAnnotationFinished(project, root, filePath, revision, duration, provider)
}
}