PlatformThreadContextElement


public abstract class PlatformThreadContextElement extends AbstractCoroutineContextElement implements PropagationToken, AutoCloseable


We use the PlatformThreadContextElement construct to know when a coroutine has suspended, and about to resume on a Thread.

Summary

Public methods

void
CoroutineContext.Element
@NonNull String

The category that a trace section belongs to.

@NonNull List<@NonNull Long>

The underlying Perfetto flow ids that can be used to determine the causality for a given trace section.

@NonNull String

The name of the code section as it appears in a trace.

void

The category that a trace section belongs to.

void

The name of the code section as it appears in a trace.

Public methods

close

Added in 2.0.0-alpha05
public void close()

contextElementOrNull

@DelicateTracingApi
public CoroutineContext.Element contextElementOrNull()
Returns
CoroutineContext.Element

a CoroutineContext.Element that needs to be installed in the kotlinx.coroutines.currentCoroutineContext prior to dispatching the suspending block of code being traced; if the token is being used in a suspending context.

getCategory

Added in 2.0.0-alpha05
public @NonNull String getCategory()

The category that a trace section belongs to.

getFlowIds

Added in 2.0.0-alpha05
public @NonNull List<@NonNull LonggetFlowIds()

The underlying Perfetto flow ids that can be used to determine the causality for a given trace section.

getName

Added in 2.0.0-alpha05
public @NonNull String getName()

The name of the code section as it appears in a trace.

setCategory

Added in 2.0.0-alpha05
public void setCategory(@NonNull String value)

The category that a trace section belongs to.

setName

Added in 2.0.0-alpha05
public void setName(@NonNull String value)

The name of the code section as it appears in a trace.