parallelism
The maximum concurrency of the traced dispatcher label, or null when unknown. Meant to feed PoolSampler's parallelism argument.
Returns a value only for "default" and "io", and only when the wrapped base provider is DefaultDispatcherProvider; for any other label ("main") or base (a test provider, a custom one) it returns null. On targets with no verified source (Native, JS, Wasm) it returns null too.
The values are INFERRED from documented defaults, not read from the live scheduler: on the JVM and Android default is max(2, availableProcessors) and io is the kotlinx.coroutines.io.parallelism system property when it is a positive integer, else max(64, availableProcessors). They can be wrong if the scheduler is configured another way, and for limitedParallelism views. Dispatchers.Default and Dispatchers.IO share one thread pool with independent permits, so this is a per-dispatcher limit on concurrent segments, not a thread count.
Example:
val stats = StatsSink(TraceLevel.Pool)
val traced = DefaultDispatcherProvider.traced(stats)
val sampler = PoolSampler(stats, sink, traced::parallelism)Requires opting in to ExperimentalStructuredCoroutines.
Receiver
the traced provider.
Return
the inferred maximum concurrency, or null when unknown.
Parameters
dispatcher label, "default" or "io".