# TracingConfig.Builder

Artifact: [androidx.webkit:webkit](https://developer.android.com/jetpack/androidx/releases/webkit) [View Source](https://cs.android.com/search?q=file:androidx/webkit/TracingConfig.java+class:androidx.webkit.TracingConfig.Builder) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/webkit#1.1.0)

*** ** * ** ***

<br />

```
class TracingConfig.Builder
```

<br />

*** ** * ** ***

Builder used to create `https://developer.android.com/reference/kotlin/androidx/webkit/TracingConfig` objects.

Examples:

````kotlin
  // Create a configuration with default options: `https://developer.android.com/reference/kotlin/androidx/webkit/TracingConfig#CATEGORIES_NONE()`,
  // `https://developer.android.com/reference/kotlin/androidx/webkit/TracingConfig#RECORD_CONTINUOUSLY()`.
  
      new TracingConfig.Builder().build()
      
  // Record trace events from the "web developer" predefined category sets.
  // Uses a ring buffer (the default `https://developer.android.com/reference/kotlin/androidx/webkit/TracingConfig#RECORD_CONTINUOUSLY()` mode) for
  // internal storage during tracing.
  
        
   
    
```kotlin
new TracingConfig.Builder().addCategories(CATEGORIES_WEB_DEVELOPER).build()
```

   
      
      
  // Record trace events from the "rendering" and "input latency" predefined
  // category sets.
  
        
   
    
```kotlin
new TracingConfig.Builder().addCategories(CATEGORIES_RENDERING,
                                    CATEGORIES_INPUT_LATENCY).build()
```

   
      
      
  // Record only the trace events from the "browser" category.
  
        
   
    
```kotlin
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).
  
        
   
    
```kotlin
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.
  
        
   
    
```kotlin
new TracingConfig.Builder().addCategories(CATEGORIES_WEB_DEVELOPER)
                             .addCategories("disabled-by-default-v8.gc")
                             .setTracingMode(RECORD_UNTIL_FULL).build()
```

   
      
    
````

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/webkit/TracingConfig.Builder#Builder()()` Default constructor for Builder. |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/webkit/TracingConfig.Builder` | `https://developer.android.com/reference/kotlin/androidx/webkit/TracingConfig.Builder#addCategories(java.lang.String...)(categories: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>)` Adds custom categories to be included in trace output. |
| `https://developer.android.com/reference/kotlin/androidx/webkit/TracingConfig.Builder` | `https://developer.android.com/reference/kotlin/androidx/webkit/TracingConfig.Builder#addCategories(java.util.Collection<java.lang.String>)(categories: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-collection/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-collection/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>)` Adds custom categories to be included in trace output. |
| `https://developer.android.com/reference/kotlin/androidx/webkit/TracingConfig.Builder` | `https://developer.android.com/reference/kotlin/androidx/webkit/TracingConfig.Builder#addCategories(int...)(predefinedCategories: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>)` Adds predefined sets of categories to be included in the trace output. |
| `https://developer.android.com/reference/kotlin/androidx/webkit/TracingConfig` | `https://developer.android.com/reference/kotlin/androidx/webkit/TracingConfig.Builder#build()()` Build `https://developer.android.com/reference/kotlin/androidx/webkit/TracingConfig` using the current settings. |
| `https://developer.android.com/reference/kotlin/androidx/webkit/TracingConfig.Builder` | `https://developer.android.com/reference/kotlin/androidx/webkit/TracingConfig.Builder#setTracingMode(int)(tracingMode: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Sets the tracing mode for this configuration. |

## Public constructors

### Builder

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/webkit#1.1.0)

```
Builder()
```

Default constructor for Builder.

## Public functions

### addCategories

```
fun addCategories(categories: Array<String!>): TracingConfig.Builder
```

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](https://www.chromium.org/developers/how-tos/trace-event-profiling-tool) for more details.

| Parameters |
|---|---|
| `categories: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>` | A list of category patterns. A category pattern can contain wildcards, e.g. "blink\*" or full category name e.g. "renderer.scheduler". |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/webkit/TracingConfig.Builder` | The builder to facilitate chaining. |

### addCategories

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/webkit#1.1.0)

```
fun addCategories(categories: (Mutable)Collection<String!>): TracingConfig.Builder
```

Adds custom categories to be included in trace output.

Same as `https://developer.android.com/reference/kotlin/androidx/webkit/TracingConfig.Builder#addCategories(java.lang.String...)` but allows to pass a Collection as a parameter.

| Parameters |
|---|---|
| `categories: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-collection/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-collection/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>` | A list of category patterns. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/webkit/TracingConfig.Builder` | The builder to facilitate chaining. |

### addCategories

```
fun addCategories(predefinedCategories: IntArray<Int>): TracingConfig.Builder
```

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

A predefined category set can be one of `https://developer.android.com/reference/kotlin/androidx/webkit/TracingConfig#CATEGORIES_NONE()`, `https://developer.android.com/reference/kotlin/androidx/webkit/TracingConfig#CATEGORIES_ALL()`, `https://developer.android.com/reference/kotlin/androidx/webkit/TracingConfig#CATEGORIES_ANDROID_WEBVIEW()`, `https://developer.android.com/reference/kotlin/androidx/webkit/TracingConfig#CATEGORIES_WEB_DEVELOPER()`, `https://developer.android.com/reference/kotlin/androidx/webkit/TracingConfig#CATEGORIES_INPUT_LATENCY()`, `https://developer.android.com/reference/kotlin/androidx/webkit/TracingConfig#CATEGORIES_RENDERING()`, `https://developer.android.com/reference/kotlin/androidx/webkit/TracingConfig#CATEGORIES_JAVASCRIPT_AND_RENDERING()` or `https://developer.android.com/reference/kotlin/androidx/webkit/TracingConfig#CATEGORIES_FRAME_VIEWER()`.

| Parameters |
|---|---|
| `predefinedCategories: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>` | A list or bitmask of predefined category sets. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/webkit/TracingConfig.Builder` | The builder to facilitate chaining. |

### build

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/webkit#1.1.0)

```
fun build(): TracingConfig
```

Build `https://developer.android.com/reference/kotlin/androidx/webkit/TracingConfig` using the current settings.

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/webkit/TracingConfig` | The `https://developer.android.com/reference/kotlin/androidx/webkit/TracingConfig` with the current settings. |

### setTracingMode

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/webkit#1.1.0)

```
fun setTracingMode(tracingMode: Int): TracingConfig.Builder
```

Sets the tracing mode for this configuration. When tracingMode is not set explicitly, the default is `https://developer.android.com/reference/android/webkit/TracingConfig.html#RECORD_CONTINUOUSLY`.

| Parameters |
|---|---|
| `tracingMode: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The tracing mode to use, one of `https://developer.android.com/reference/kotlin/androidx/webkit/TracingConfig#RECORD_UNTIL_FULL()` or `https://developer.android.com/reference/kotlin/androidx/webkit/TracingConfig#RECORD_CONTINUOUSLY()`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/webkit/TracingConfig.Builder` | The builder to facilitate chaining. |