# 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)

*** ** * ** ***


```
public interface Counter
```

<br />

*** ** * ** ***

Handle for emitting `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` or `https://developer.android.com/reference/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 methods |
|---|---|
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/tracing/Counter#name()()` |
| `abstract void` | `https://developer.android.com/reference/androidx/tracing/Counter#setValue(kotlin.Double)(double value)` 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/androidx/tracing/Counter#name()`. |
| `abstract void` | `https://developer.android.com/reference/androidx/tracing/Counter#setValue(kotlin.Long)(long value)` 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/androidx/tracing/Counter#name()`. |

## Public methods

### name

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

```
abstract @NonNull String name()
```

### setValue

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

```
abstract void setValue(double value)
```

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/androidx/tracing/Counter#name()`.

### setValue

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

```
abstract void setValue(long value)
```

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/androidx/tracing/Counter#name()`.