TracingConfig.Builder

public class TracingConfig.Builder


Builder used to create TracingConfig objects.

Examples:

  // Create a configuration with default options: CATEGORIES_NONE,
  // RECORD_CONTINUOUSLY.
  
      
new TracingConfig.Builder().build()
// Record trace events from the "web developer" predefined category sets. // Uses a ring buffer (the default RECORD_CONTINUOUSLY mode) for // internal storage during tracing.
new TracingConfig.Builder().addCategories(CATEGORIES_WEB_DEVELOPER).build()
// Record trace events from the "rendering" and "input latency" predefined // category sets.
new TracingConfig.Builder().addCategories(CATEGORIES_RENDERING,
                                    CATEGORIES_INPUT_LATENCY).build()
// Record only the trace events from the "browser" category.
new TracingConfig.Builder().addCategories("browser").build()
// Record only the trace events matching the "blink*" and "renderer*" patterns // (e.g. "blink.animations", "renderer_host" and "renderer.scheduler" categories).
new TracingConfig.Builder().addCategories("blink*","renderer*").build()
// Record events from the "web developer" predefined category set and events from // the "disabled-by-default-v8.gc" category to understand where garbage collection // is being triggered. Uses a limited size buffer for internal storage during tracing.
new TracingConfig.Builder().addCategories(CATEGORIES_WEB_DEVELOPER)
                             .addCategories("disabled-by-default-v8.gc")
                             .setTracingMode(RECORD_UNTIL_FULL).build()

Summary

Public constructors

Default constructor for Builder.

Public methods

@NonNull TracingConfig.Builder
addCategories(@NonNull String[] categories)

Adds custom categories to be included in trace output.

@NonNull TracingConfig.Builder

Adds custom categories to be included in trace output.

@NonNull TracingConfig.Builder
addCategories(@NonNull int[] predefinedCategories)

Adds predefined sets of categories to be included in the trace output.

@NonNull TracingConfig

Build TracingConfig using the current settings.

@NonNull TracingConfig.Builder
setTracingMode(int tracingMode)

Sets the tracing mode for this configuration.

Public constructors

Builder

Added in 1.1.0
public Builder()

Default constructor for Builder.

Public methods

addCategories

public @NonNull TracingConfig.Builder addCategories(@NonNull String[] categories)

Adds custom categories to be included in trace output. Note that the categories are defined by the currently-in-use version of WebView. They live in chromium code and are not part of the Android API. See chromium documentation on tracing for more details.

Parameters
@NonNull String[] categories

A list of category patterns. A category pattern can contain wildcards, e.g. "blink*" or full category name e.g. "renderer.scheduler".

Returns
@NonNull TracingConfig.Builder

The builder to facilitate chaining.

addCategories

Added in 1.1.0
public @NonNull TracingConfig.Builder addCategories(@NonNull Collection<String> categories)

Adds custom categories to be included in trace output. Same as addCategories but allows to pass a Collection as a parameter.

Parameters
@NonNull Collection<String> categories

A list of category patterns.

Returns
@NonNull TracingConfig.Builder

The builder to facilitate chaining.

addCategories

public @NonNull TracingConfig.Builder addCategories(@NonNull int[] predefinedCategories)

Adds predefined sets of categories to be included in the trace output. A predefined category set can be one of CATEGORIES_NONE, CATEGORIES_ALL, CATEGORIES_ANDROID_WEBVIEW, CATEGORIES_WEB_DEVELOPER, CATEGORIES_INPUT_LATENCY, CATEGORIES_RENDERING, CATEGORIES_JAVASCRIPT_AND_RENDERING or CATEGORIES_FRAME_VIEWER.

Parameters
@NonNull int[] predefinedCategories

A list or bitmask of predefined category sets.

Returns
@NonNull TracingConfig.Builder

The builder to facilitate chaining.

build

Added in 1.1.0
public @NonNull TracingConfig build()

Build TracingConfig using the current settings.

Returns
@NonNull TracingConfig

The TracingConfig with the current settings.

setTracingMode

Added in 1.1.0
public @NonNull TracingConfig.Builder setTracingMode(int tracingMode)

Sets the tracing mode for this configuration. When tracingMode is not set explicitly, the default is RECORD_CONTINUOUSLY.

Parameters
int tracingMode

The tracing mode to use, one of RECORD_UNTIL_FULL or RECORD_CONTINUOUSLY.

Returns
@NonNull TracingConfig.Builder

The builder to facilitate chaining.