JavaHeapDumpRequestBuilder


@RequiresApi(api = 35)
class JavaHeapDumpRequestBuilder : 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 functions

JavaHeapDumpRequestBuilder
setBufferSizeKb(bufferSizeKb: Int)

Set the buffer size in kilobytes for this profiling request.

Inherited functions

From androidx.core.os.ProfilingRequestBuilder
ProfilingRequest

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

JavaHeapDumpRequestBuilder

Set a CancellationSignal to request cancellation of the requested trace.

JavaHeapDumpRequestBuilder
setTag(tag: String)

Add data to help identify the output.

Public constructors

JavaHeapDumpRequestBuilder

Added in 1.15.0
JavaHeapDumpRequestBuilder()

Public functions

setBufferSizeKb

Added in 1.15.0
fun setBufferSizeKb(bufferSizeKb: Int): JavaHeapDumpRequestBuilder

Set the buffer size in kilobytes for this profiling request.