Debug probes support.
Debug probes is a dynamic attach mechanism which installs multiple hooks into coroutines machinery. It slows down all coroutine-related code, but in return provides a lot of diagnostic information, including asynchronous stack-traces and coroutine dumps (similar to ThreadMXBean.dumpAllThreads and
jstack via DebugProbes.dumpCoroutines. All introspecting methods throw IllegalStateException if debug probes were not installed.
probeCoroutineResumedis invoked on every Continuation.resume.
probeCoroutineSuspendedis invoked on every continuation suspension.
probeCoroutineCreatedis invoked on every coroutine creation using stdlib intrinsics.
Every created coroutine is stored in a concurrent hash map and hash map is looked up and updated on each suspension and resumption.
If DebugProbes.enableCreationStackTraces is enabled, stack trace of the current thread is captured on each created coroutine that is a rough equivalent of throwing an exception per each created coroutine.
Dumps all active coroutines into the given output stream, providing a consistent snapshot of all existing coroutines at the moment of invocation. The output of this method is similar to
jstack or a full thread dump. It can be used as the replacement to "Dump threads" action.
Whether coroutine creation stack traces should be captured. When enabled, for each created coroutine a stack trace of the current thread is captured and attached to the coroutine. This option can be useful during local debug sessions, but is recommended to be disabled in production environments to avoid stack trace dumping overhead.