TraceSectionMetric


@ExperimentalMetricApi
public final class TraceSectionMetric extends Metric


Captures the time taken by named trace section - a named begin / end pair matching the provided sectionName.

Select how matching sections are resolved into a duration metric with mode, and configure if sections outside the target process are included with targetPackageOnly.

The following TraceSectionMetric counts the number of JIT method compilations that occur within a trace:

TraceSectionMetric(
sectionName = "JIT Compiling %",
mode = TraceSectionMetric.Mode.Sum
)

Note that non-terminating slices in the trace (where duration = -1) are always ignored by this metric.

Summary

Nested types

public sealed class TraceSectionMetric.Mode

Average duration of trace sections matching sectionName in the trace.

Counts the number of observed instances of a trace section matching sectionName in the trace.

Captures the duration of the first instance of sectionName in the trace.

Reports the maximum observed duration for a trace section matching sectionName in the trace.

Reports the maximum observed duration for a trace section matching sectionName in the trace.

Captures the sum of all instances of sectionName in the trace.

Public constructors

TraceSectionMetric(
    @NonNull String sectionName,
    @NonNull TraceSectionMetric.Mode mode,
    @NonNull String label,
    boolean targetPackageOnly
)

Public constructors

TraceSectionMetric

Added in 1.3.0
public TraceSectionMetric(
    @NonNull String sectionName,
    @NonNull TraceSectionMetric.Mode mode,
    @NonNull String label,
    boolean targetPackageOnly
)