diff --git a/java/compiler/charts/intellij.java.compiler.charts.iml b/java/compiler/charts/intellij.java.compiler.charts.iml
index 1d0c5f3ebda1..dd9aed09e9f9 100644
--- a/java/compiler/charts/intellij.java.compiler.charts.iml
+++ b/java/compiler/charts/intellij.java.compiler.charts.iml
@@ -32,12 +32,12 @@
+
-
\ No newline at end of file
diff --git a/java/compiler/charts/src/com/intellij/java/compiler/charts/CompilationChartsProjectActivity.kt b/java/compiler/charts/src/com/intellij/java/compiler/charts/CompilationChartsProjectActivity.kt
index 69c64fb84833..46485c270f0e 100644
--- a/java/compiler/charts/src/com/intellij/java/compiler/charts/CompilationChartsProjectActivity.kt
+++ b/java/compiler/charts/src/com/intellij/java/compiler/charts/CompilationChartsProjectActivity.kt
@@ -5,14 +5,12 @@ import com.fasterxml.jackson.core.JsonFactory
import com.fasterxml.jackson.core.JsonProcessingException
import com.fasterxml.jackson.core.type.TypeReference
import com.fasterxml.jackson.databind.ObjectMapper
+import com.fasterxml.jackson.module.kotlin.KotlinModule
import com.intellij.build.BuildProgressListener
import com.intellij.build.BuildViewManager
import com.intellij.build.events.FinishBuildEvent
import com.intellij.build.events.StartBuildEvent
import com.intellij.compiler.server.CustomBuilderMessageHandler
-import com.intellij.java.compiler.charts.jps.ChartsBuilderService.COMPILATION_STATISTIC_BUILDER_ID
-import com.intellij.java.compiler.charts.jps.ChartsBuilderService.COMPILATION_STATUS_BUILDER_ID
-import com.intellij.java.compiler.charts.jps.CompileStatisticBuilderMessage.*
import com.intellij.java.compiler.charts.ui.CompilationChartsBuildEvent
import com.intellij.openapi.diagnostic.Logger
import com.intellij.openapi.project.Project
@@ -26,6 +24,8 @@ class CompilationChartsProjectActivity : ProjectActivity {
companion object {
private val LOG: Logger = Logger.getInstance(CompilationChartsProjectActivity::class.java)
const val COMPILATION_CHARTS_KEY: String = "compilation.charts"
+ const val COMPILATION_STATISTIC_BUILDER_ID: String = "jps.compile.statistic"
+ const val COMPILATION_STATUS_BUILDER_ID: String = "jps.compile.status"
}
override suspend fun execute(project: Project) {
@@ -54,7 +54,7 @@ class CompilationChartsProjectActivity : ProjectActivity {
}
private class CompilationChartsMessageHandler : CustomBuilderMessageHandler {
- private val json = ObjectMapper(JsonFactory())
+ private val json = ObjectMapper(JsonFactory()).registerModule(KotlinModule.Builder().build())
private val states: Queue = ArrayDeque()
private var currentState: CompilationChartsBuildEvent? = null
private val defaultUUID: UUID = UUID.randomUUID()
diff --git a/java/compiler/charts/src/com/intellij/java/compiler/charts/CompilationChartsViewModel.kt b/java/compiler/charts/src/com/intellij/java/compiler/charts/CompilationChartsViewModel.kt
index c0167c72513e..207d9a3934d8 100644
--- a/java/compiler/charts/src/com/intellij/java/compiler/charts/CompilationChartsViewModel.kt
+++ b/java/compiler/charts/src/com/intellij/java/compiler/charts/CompilationChartsViewModel.kt
@@ -2,7 +2,6 @@
package com.intellij.java.compiler.charts
import com.intellij.java.compiler.charts.CompilationChartsViewModel.Modules.EventKey
-import com.intellij.java.compiler.charts.jps.CompileStatisticBuilderMessage.*
import com.jetbrains.rd.framework.impl.RdList
import com.jetbrains.rd.framework.impl.RdMap
import com.jetbrains.rd.framework.impl.RdProperty
@@ -37,15 +36,13 @@ class CompilationChartsViewModel(val lifetime: Lifetime) {
}
private fun index(threadId: Long): Int {
- var index: Int? = threadIndexes[threadId]
+ val index: Int? = threadIndexes[threadId]
if (index != null) return index
synchronized(threadIndexes) {
- index = threadIndexes[threadId]
- if (index != null) return index!!
-
- index = threadIndexes.size
- threadIndexes[threadId] = index!!
- return index!!
+ val updateAndGetIndex = { threadId: Long ->
+ threadIndexes.size.also { newIndex -> threadIndexes[threadId] = newIndex }
+ }
+ return threadIndexes[threadId] ?: updateAndGetIndex(threadId)
}
}
diff --git a/java/compiler/charts/src/com/intellij/java/compiler/charts/messages.kt b/java/compiler/charts/src/com/intellij/java/compiler/charts/messages.kt
new file mode 100644
index 000000000000..346bc0b29b04
--- /dev/null
+++ b/java/compiler/charts/src/com/intellij/java/compiler/charts/messages.kt
@@ -0,0 +1,38 @@
+// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
+package com.intellij.java.compiler.charts
+
+interface TargetEvent {
+ val name: String
+ val type: String
+ val isTest: Boolean
+ val isFileBased: Boolean
+ val time: Long
+ val thread: Long
+}
+
+data class StartTarget(
+ override val name: String,
+ override val type: String,
+ override val isTest: Boolean,
+ override val isFileBased: Boolean,
+ override val thread: Long,
+ override val time: Long,
+) : TargetEvent
+
+data class FinishTarget(
+ override val name: String,
+ override val type: String,
+ override val isTest: Boolean,
+ override val isFileBased: Boolean,
+ override val thread: Long,
+ override val time: Long,
+) : TargetEvent
+
+data class CpuMemoryStatistics(
+ val heapUsed: Long,
+ val heapMax: Long,
+ val nonHeapUsed: Long,
+ val nonHeapMax: Long,
+ val cpu: Long,
+ val time: Long,
+)
\ No newline at end of file