Revert "IDEA-320414 Add waiting on read lock to indexing diagnostics (relates to IJPL-117)"

This reverts commit 86202ed8

GitOrigin-RevId: 21fbf7a3d69330a4c6e8d1074382306632e04e64
This commit is contained in:
Elena Shaverdova
2023-05-29 20:21:46 +00:00
committed by intellij-monorepo-bot
parent a977cc87aa
commit d481c0d67e
9 changed files with 10 additions and 38 deletions
@@ -44,7 +44,6 @@ import java.util.List;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
@@ -316,11 +315,8 @@ public final class IndexUpdateRunner {
indexingJob.setLocationBeingIndexed(fileIndexingJob);
@NotNull Supplier<@NotNull Boolean> fileTypeChangeChecker = CachedFileType.getFileTypeChangeChecker();
FileType type = FileTypeRegistry.getInstance().getFileTypeByFile(file, fileContent.getBytes());
long timeBeforeReadAction = System.nanoTime();
AtomicLong readActionWaitingTime = new AtomicLong();
FileIndexesValuesApplier applier = ReadAction
.nonBlocking(() -> {
readActionWaitingTime.set(System.nanoTime() - timeBeforeReadAction);
myIndexingAttemptCount.incrementAndGet();
FileType fileType = fileTypeChangeChecker.get() ? type : null;
return myFileBasedIndex.indexFileContent(indexingJob.myProject, fileContent, fileType);
@@ -333,7 +329,7 @@ public final class IndexUpdateRunner {
LOG.trace("File indexing attempts = " + myIndexingAttemptCount.longValue() + ", indexed file count = " + myIndexingSuccessfulCount.longValue());
}
writeIndexesForFile(indexingJob, fileIndexingJob, applier, startTime, length, contentLoadingTime, readActionWaitingTime.get());
writeIndexesForFile(indexingJob, fileIndexingJob, applier, startTime, length, contentLoadingTime);
}
catch (ProcessCanceledException e) {
// Push back the file.
@@ -354,14 +350,12 @@ public final class IndexUpdateRunner {
@NotNull FileIndexesValuesApplier applier,
long startTime,
long length,
long contentLoadingTime,
long readActionWaitingTime) {
long contentLoadingTime) {
if (myIndexWriteExecutor != null) {
myIndexWriteExecutor.execute(() -> doWriteIndexesForFile(indexingJob, fileIndexingJob, applier, startTime, length,
contentLoadingTime, readActionWaitingTime));
myIndexWriteExecutor.execute(() -> doWriteIndexesForFile(indexingJob, fileIndexingJob, applier, startTime, length, contentLoadingTime));
}
else {
doWriteIndexesForFile(indexingJob, fileIndexingJob, applier, startTime, length, contentLoadingTime, readActionWaitingTime);
doWriteIndexesForFile(indexingJob, fileIndexingJob, applier, startTime, length, contentLoadingTime);
}
}
@@ -370,8 +364,7 @@ public final class IndexUpdateRunner {
@NotNull FileIndexesValuesApplier applier,
long startTime,
long length,
long contentLoadingTime,
long readActionWaitingTime) {
long contentLoadingTime) {
VirtualFile file = fileIndexingJob.file;
try {
applier.apply(file);
@@ -383,7 +376,6 @@ public final class IndexUpdateRunner {
applier.stats,
processingTime,
contentLoadingTime,
readActionWaitingTime,
length,
applier.isWriteValuesSeparately,
applier.getSeparateApplicationTimeNanos()
@@ -26,8 +26,6 @@ class IndexingFileSetStatistics(private val project: Project, val fileSetName: S
var contentLoadingTimeInAllThreads: TimeNano = 0
var readActionWaitingTimeInAllThreads: TimeNano = 0
var numberOfIndexedFiles: Int = 0
var listOfFilesFullyIndexedByExtensions = arrayListOf<String>()
@@ -77,7 +75,6 @@ class IndexingFileSetStatistics(private val project: Project, val fileSetName: S
fileStatistics: FileIndexingStatistics,
processingTime: TimeNano,
contentLoadingTime: TimeNano,
readActionWaitingTime: Long,
fileSize: BytesNumber,
valuesAppliedSeparately: Boolean,
separateApplicationTime: TimeNano
@@ -91,7 +88,6 @@ class IndexingFileSetStatistics(private val project: Project, val fileSetName: S
}
processingTimeInAllThreads += processingTime
contentLoadingTimeInAllThreads += contentLoadingTime
readActionWaitingTimeInAllThreads += readActionWaitingTime
val perIndexerEvaluationOfValueChangerTimes = fileStatistics.perIndexerEvaluateIndexValueTimes.toMutableMap()
fileStatistics.perIndexerEvaluatingIndexValueRemoversTimes.forEach { (indexId, time) ->
perIndexerEvaluationOfValueChangerTimes[indexId] = time + perIndexerEvaluationOfValueChangerTimes.getOrDefault(indexId, 0)
@@ -120,8 +116,7 @@ class IndexingFileSetStatistics(private val project: Project, val fileSetName: S
indexedFiles += IndexedFile(getIndexedFilePath(file), fileStatistics.wasFullyIndexedByExtensions)
}
if (processingTime > SLOW_FILE_PROCESSING_THRESHOLD_MS * 1_000_000) {
slowIndexedFiles.addElement(SlowIndexedFile(file.name, processingTime,
evaluationOfIndexValueChangerTime, contentLoadingTime, readActionWaitingTime))
slowIndexedFiles.addElement(SlowIndexedFile(file.name, processingTime, evaluationOfIndexValueChangerTime, contentLoadingTime))
}
allValuesAppliedSeparately = allValuesAppliedSeparately && valuesAppliedSeparately
allSeparateApplicationTimeInAllThreads += separateApplicationTime
@@ -185,7 +185,6 @@ interface DumbIndexingTimes {
val totalUpdatingTime: TimeNano
val updatingEnd: ZonedDateTime
val contentLoadingVisibleDuration: Duration
val readLockWaitingVisibleDuration: Duration
val refreshedScanFilesDuration: Duration
val pausedDuration: Duration
val appliedAllValuesSeparately: Boolean
@@ -737,7 +737,6 @@ data class ProjectDumbIndexingHistoryImpl(override val project: Project) : Proje
override var totalUpdatingTime: TimeNano,
override var updatingEnd: ZonedDateTime = updatingStart,
override var contentLoadingVisibleDuration: Duration = Duration.ZERO,
override var readLockWaitingVisibleDuration: Duration = Duration.ZERO,
override var refreshedScanFilesDuration: Duration = Duration.ZERO,
override var pausedDuration: Duration = Duration.ZERO,
override var appliedAllValuesSeparately: Boolean = true,
@@ -5,6 +5,5 @@ data class SlowIndexedFile(
val fileName: String,
val processingTime: TimeNano,
val evaluationOfIndexValueChangerTime: TimeNano,
val contentLoadingTime: TimeNano,
val readLockWaitingTime: TimeNano
val contentLoadingTime: TimeNano
)
@@ -55,7 +55,6 @@ fun IndexingFileSetStatistics.toJsonStatistics(visibleTimeToAllThreadsTimeRatio:
filesFullyIndexedByExtensions = listOfFilesFullyIndexedByExtensions,
totalIndexingVisibleTime = convertAllThreadsTimeToVisibleDuration(processingTimeInAllThreads, visibleTimeToAllThreadsTimeRatio),
contentLoadingVisibleTime = convertAllThreadsTimeToVisibleDuration(contentLoadingTimeInAllThreads, visibleTimeToAllThreadsTimeRatio),
readActionWaitingVisibleTime = convertAllThreadsTimeToVisibleDuration(readActionWaitingTimeInAllThreads, visibleTimeToAllThreadsTimeRatio),
numberOfTooLargeForIndexingFiles = numberOfTooLargeForIndexingFiles,
slowIndexedFiles = slowIndexedFiles.biggestElements.map { it.toJson() },
isAppliedAllValuesSeparately = allValuesAppliedSeparately,
@@ -72,8 +71,7 @@ fun SlowIndexedFile.toJson() = JsonFileProviderIndexStatistics.JsonSlowIndexedFi
fileName = fileName,
processingTime = JsonDuration(processingTime),
evaluationOfIndexValueChangerTime = JsonDuration(evaluationOfIndexValueChangerTime),
contentLoadingTime = JsonDuration(contentLoadingTime),
readLockWaitingTime = JsonDuration(readLockWaitingTime)
contentLoadingTime = JsonDuration(contentLoadingTime)
)
fun IndexingFileSetStatistics.IndexedFile.toJson() = JsonFileProviderIndexStatistics.JsonIndexedFile(
@@ -124,7 +122,6 @@ fun DumbIndexingTimes.toJson() =
scanningIds = scanningIds.toSortedSet(),
totalWallTimeWithPauses = JsonDuration(totalUpdatingTime),
contentLoadingVisibleTime = JsonDuration(contentLoadingVisibleDuration.toNanos()),
readLockWaitingVisibleTime = JsonDuration(readLockWaitingVisibleDuration.toNanos()),
refreshedFilesScanTime = JsonDuration(refreshedScanFilesDuration.toNanos()),
isAppliedAllValuesSeparately = appliedAllValuesSeparately,
separateApplyingIndexesVisibleTime = JsonDuration(separateValueApplicationVisibleTime),
@@ -176,7 +173,6 @@ private fun ProjectScanningHistoryImpl.changeToJson(): JsonProjectScanningHistor
private fun ProjectDumbIndexingHistoryImpl.changeToJson(): JsonProjectDumbIndexingHistory {
val timesImpl = times as ProjectDumbIndexingHistoryImpl.DumbIndexingTimesImpl
timesImpl.contentLoadingVisibleDuration = Duration.ofNanos(providerStatistics.sumOf { it.contentLoadingVisibleTime.nano })
timesImpl.readLockWaitingVisibleDuration = Duration.ofNanos(providerStatistics.sumOf { it.readActionWaitingVisibleTime.nano })
if (providerStatistics.all { it.isAppliedAllValuesSeparately }) {
timesImpl.appliedAllValuesSeparately = true
timesImpl.separateValueApplicationVisibleTime = providerStatistics.sumOf { it.separateApplyingIndexesVisibleTime.nano }
@@ -17,7 +17,6 @@ data class JsonFileProviderIndexStatistics(
*/
val totalIndexingVisibleTime: JsonDuration = JsonDuration(0),
val contentLoadingVisibleTime: JsonDuration = JsonDuration(0),
val readActionWaitingVisibleTime: JsonDuration = JsonDuration(0),
val numberOfTooLargeForIndexingFiles: Int = 0,
val slowIndexedFiles: List<JsonSlowIndexedFile> = emptyList(),
val filesFullyIndexedByExtensions: List<String> = emptyList(),
@@ -36,8 +35,7 @@ data class JsonFileProviderIndexStatistics(
val fileName: String = "",
val processingTime: JsonDuration = JsonDuration(0),
val evaluationOfIndexValueChangerTime: JsonDuration = JsonDuration(0),
val contentLoadingTime: JsonDuration = JsonDuration(0),
val readLockWaitingTime: JsonDuration = JsonDuration(0)
val contentLoadingTime: JsonDuration = JsonDuration(0)
)
@JsonIgnoreProperties(ignoreUnknown = true)
@@ -67,7 +67,6 @@ data class JsonProjectScanningHistoryTimes(
data class JsonProjectDumbIndexingHistoryTimes(
val scanningIds: Set<Long> = setOf(),
val contentLoadingVisibleTime: JsonDuration = JsonDuration(),
val readLockWaitingVisibleTime: JsonDuration = JsonDuration(),
val refreshedFilesScanTime: JsonDuration = JsonDuration(),
val isAppliedAllValuesSeparately: Boolean = true,
val separateApplyingIndexesVisibleTime: JsonDuration = JsonDuration(),
@@ -1327,7 +1327,6 @@ private fun JsonProjectDumbIndexingHistory.generateDumbIndexingHtml(target: Appe
}
tr { td("Scanning time for refreshed files"); td(times.refreshedFilesScanTime.presentableDuration()) }
tr { td("Content loading time"); td(times.contentLoadingVisibleTime.presentableDuration()) }
tr { td("Read lock waiting time"); td(times.readLockWaitingVisibleTime.presentableDuration()) }
tr {
td("Index writing time")
td(if (times.isAppliedAllValuesSeparately)
@@ -1358,14 +1357,13 @@ private fun JsonProjectDumbIndexingHistory.generateDumbIndexingHtml(target: Appe
thead {
tr {
th("$SECTION_SLOW_FILES_TITLE (> ${IndexingFileSetStatistics.SLOW_FILE_PROCESSING_THRESHOLD_MS} ms)") {
colSpan = "6"
colSpan = "5"
}
}
tr {
th("Provider name")
th("File")
th("Content loading time")
th("Waiting for read lock time")
th("Indexes values evaluation time")
th("Total processing time")
}
@@ -1378,7 +1376,6 @@ private fun JsonProjectDumbIndexingHistory.generateDumbIndexingHtml(target: Appe
td(if (index == 0) providerStatistic.providerName else "^")
td(slowFile.fileName)
td(slowFile.contentLoadingTime.presentableDuration())
td(slowFile.readLockWaitingTime.presentableDuration())
td(slowFile.evaluationOfIndexValueChangerTime.presentableDuration())
td(slowFile.processingTime.presentableDuration())
}
@@ -1492,7 +1489,6 @@ private fun JsonProjectDumbIndexingHistory.generateDumbIndexingHtml(target: Appe
th("Provider name")
th("Total processing time")
th("Content loading time")
th("Waiting for read lock time")
th("Number of indexed files")
th("Number of files indexed by $INDEX_INFRA_EXTENSIONS")
th("Number of too large for indexing files")
@@ -1508,7 +1504,6 @@ private fun JsonProjectDumbIndexingHistory.generateDumbIndexingHtml(target: Appe
td(providerStats.providerName)
td(providerStats.totalIndexingVisibleTime.presentableDuration())
td(providerStats.contentLoadingVisibleTime.presentableDuration())
td(providerStats.readActionWaitingVisibleTime.presentableDuration())
td(providerStats.totalNumberOfIndexedFiles.toString())
td(providerStats.totalNumberOfFilesFullyIndexedByExtensions.toString())
td(providerStats.numberOfTooLargeForIndexingFiles.toString())