-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not track coroutines with empty coroutine context in DebugProbes
Such coroutines typically are a subject for significant debugger overhead, can be observed with more conventional tools, and do not contribute to the state of the system that is typically observed with coroutines debugger Fixes #3782
- Loading branch information
Showing
3 changed files
with
58 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
kotlinx-coroutines-debug/test/StandardBuildersAreIgnoredTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Copyright 2016-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
package kotlinx.coroutines.debug | ||
|
||
import org.junit.Test | ||
import kotlin.test.* | ||
|
||
class StandardBuildersAreIgnoredTest : DebugTestBase() { | ||
|
||
@Test | ||
fun testBuildersAreMissingFromDump() = runTest { | ||
val fromSequence = sequence { | ||
while (true) { | ||
yield(1) | ||
} | ||
}.iterator() | ||
|
||
val fromIterator = iterator { | ||
while (true) { | ||
yield(1) | ||
} | ||
} | ||
// Start coroutines | ||
fromIterator.hasNext() | ||
fromSequence.hasNext() | ||
|
||
val coroutines = DebugProbes.dumpCoroutinesInfo() | ||
assertEquals(1, coroutines.size) | ||
} | ||
} |