mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-06 03:21:12 +07:00
Don't subscribe to events on app initialization
Otherwise, subscription causes ~100-200ms degradation in the "app initialization" metric. Besides, subscribing so early is not necessary anyway since kill signal might come only after the project is opened (1+ minute after the test started). GitOrigin-RevId: 04b3c398fe1c370b4a072f1475c16a90020a49fd
This commit is contained in:
committed by
intellij-monorepo-bot
parent
38b8372efd
commit
ae9ca3dde6
@@ -92,6 +92,25 @@ private object ProjectLoadedService {
|
||||
}
|
||||
}
|
||||
|
||||
private fun subscribeToStopProfile() {
|
||||
if (ApplicationManagerEx.isInIntegrationTest()) {
|
||||
try {
|
||||
EventsBus.subscribe("ProfileStopSubscriber") { event: StopProfilerEvent ->
|
||||
try {
|
||||
getCurrentProfilerHandler().stopProfiling(event.data)
|
||||
}
|
||||
catch (t: Throwable) {
|
||||
LOG.info("Error stop profiling", t)
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (connectException: ConnectException) {
|
||||
// Some integration tests don't start event bus server. e.g com.jetbrains.rdct.cwm.distributed.connectionTypes.LocalRelayTest
|
||||
LOG.info("Subscription to stop profiling failed", connectException)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun runOnProjectInit(project: Project) {
|
||||
if (System.getProperty("ide.performance.screenshot") != null) {
|
||||
(ProjectLoadedService.registerScreenshotTaking(System.getProperty("ide.performance.screenshot"),
|
||||
@@ -110,6 +129,9 @@ private fun runOnProjectInit(project: Project) {
|
||||
|
||||
LOG.info("Start Execution")
|
||||
PerformanceTestSpan.startSpan()
|
||||
|
||||
subscribeToStopProfile()
|
||||
|
||||
val profilerSettings = initializeProfilerSettingsForIndexing()
|
||||
if (profilerSettings != null) {
|
||||
try {
|
||||
@@ -191,22 +213,6 @@ class ProjectLoaded : ApplicationInitializedListener {
|
||||
{ PerformanceTestSpan.getContext() },
|
||||
{ takeFullScreenshot(it) })
|
||||
}
|
||||
|
||||
if (ApplicationManagerEx.isInIntegrationTest()) {
|
||||
try {
|
||||
EventsBus.subscribe(this) { event: StopProfilerEvent ->
|
||||
try {
|
||||
getCurrentProfilerHandler().stopProfiling(event.data)
|
||||
} catch (t: Throwable) {
|
||||
LOG.info("Error stop profiling", t)
|
||||
}
|
||||
}
|
||||
} catch (connectException: ConnectException) {
|
||||
// Some integration tests don't start event bus server. e.g com.jetbrains.rdct.cwm.distributed.connectionTypes.LocalRelayTest
|
||||
LOG.info("Subscription to stop profiling failed", connectException)
|
||||
}
|
||||
|
||||
}
|
||||
if (ApplicationManagerEx.getApplicationEx().isLightEditMode) {
|
||||
LightEditService.getInstance().editorManager.addListener(object : LightEditorListener {
|
||||
override fun afterSelect(editorInfo: LightEditorInfo?) {
|
||||
|
||||
Reference in New Issue
Block a user