JavaHeapDumpRequestBuilder


@RequiresApi(api = 35)
public final class JavaHeapDumpRequestBuilder extends ProfilingRequestBuilder


Request builder to create a request for a java heap dump from ProfilingManager.

val listener =
    Consumer<ProfilingResult> { profilingResult ->
        if (profilingResult.errorCode == ProfilingResult.ERROR_NONE) {
            doSomethingWithMyFile(profilingResult.resultFilePath)
        } else {
            doSomethingWithFailure(profilingResult.errorCode, profilingResult.errorMessage)
        }
    }

requestProfiling(
    context,
    JavaHeapDumpRequestBuilder()
        .setBufferSizeKb(123 /* Requested buffer size in KB */)
        .setTag("tag" /* Caller supplied tag for identification */)
        .build(),
    Dispatchers.IO.asExecutor(), // Your choice of executor for the callback to occur on.
    listener
)

Summary

Public constructors

Public methods

final @NonNull JavaHeapDumpRequestBuilder
setBufferSizeKb(int bufferSizeKb)

Set the buffer size in kilobytes for this profiling request.

Inherited methods

From androidx.core.os.ProfilingRequestBuilder
final @NonNull ProfilingRequest

Build the ProfilingRequest object which can be used with requestProfiling to request profiling.

final @NonNull JavaHeapDumpRequestBuilder

Set a CancellationSignal to request cancellation of the requested trace.

final @NonNull JavaHeapDumpRequestBuilder

Add data to help identify the output.

Public constructors

JavaHeapDumpRequestBuilder

Added in 1.15.0
public JavaHeapDumpRequestBuilder()

Public methods

setBufferSizeKb

Added in 1.15.0
public final @NonNull JavaHeapDumpRequestBuilder setBufferSizeKb(int bufferSizeKb)

Set the buffer size in kilobytes for this profiling request.