# Counter

Artifact: [androidx.tracing:tracing](https://developer.android.com/jetpack/androidx/releases/tracing) [View Source](https://cs.android.com/search?q=file:androidx/tracing/Counter.kt+class:androidx.tracing.Counter) Added in [2.0.5](https://developer.android.com/jetpack/androidx/releases/tracing#2.0.5)

*** ** * ** ***

Android/JVM
- android

  ```
  interface Counter
  ```

*** ** * ** ***

Handle for emitting `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` or `https://developer.android.com/reference/kotlin/androidx/tracing/Counter` counter event updates into a trace.

This allows you to monitor numeric values that change over time in a trace, such as the number of events in a queue, or memory usage.

## Summary

| ### Public functions |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/tracing/Counter#name()()` | android |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/tracing/Counter#setValue(kotlin.Double)(value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html)` Emits a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html` value into the trace for the provided `https://developer.android.com/reference/kotlin/androidx/tracing/Counter#name()`. | android |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/tracing/Counter#setValue(kotlin.Long)(value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Emits a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` value into the trace for the provided `https://developer.android.com/reference/kotlin/androidx/tracing/Counter#name()`. | android |

## Public functions

### name

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

```
fun name(): String
```

### setValue

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

```
fun setValue(value: Double): Unit
```

Emits a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html` value into the trace for the provided `https://developer.android.com/reference/kotlin/androidx/tracing/Counter#name()`.

### setValue

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

```
fun setValue(value: Long): Unit
```

Emits a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` value into the trace for the provided `https://developer.android.com/reference/kotlin/androidx/tracing/Counter#name()`.