# ConstraintLayoutStatistics

Artifact: [androidx.constraintlayout:constraintlayout](https://developer.android.com/jetpack/androidx/releases/constraintlayout) [View Source](https://cs.android.com/search?q=file:androidx/constraintlayout/widget/ConstraintLayoutStatistics.java+class:androidx.constraintlayout.widget.ConstraintLayoutStatistics) Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

*** ** * ** ***


```
class ConstraintLayoutStatistics
```

<br />

*** ** * ** ***

This provide metrics of the complexity of the layout that is being solved. The intent is for developers using the too to track the evolution of their UI Typically the developer will monitor the computations on every callback of mConstraintLayout.addOnLayoutChangeListener(this::callback);

## Summary

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintLayoutStatistics#DURATION_OF_CHILD_MEASURES() = 5` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintLayoutStatistics#DURATION_OF_LAYOUT() = 7` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintLayoutStatistics#DURATION_OF_MEASURES() = 6` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintLayoutStatistics#NUMBER_OF_CHILD_MEASURES() = 4` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintLayoutStatistics#NUMBER_OF_CHILD_VIEWS() = 3` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintLayoutStatistics#NUMBER_OF_EQUATIONS() = 9` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintLayoutStatistics#NUMBER_OF_LAYOUTS() = 1` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintLayoutStatistics#NUMBER_OF_ON_MEASURES() = 2` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintLayoutStatistics#NUMBER_OF_SIMPLE_EQUATIONS() = 10` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintLayoutStatistics#NUMBER_OF_VARIABLES() = 8` |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintLayoutStatistics#ConstraintLayoutStatistics(androidx.constraintlayout.widget.ConstraintLayout)(constraintLayout: https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintLayout!)` Measure performance information about ConstraintLayout |
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintLayoutStatistics#ConstraintLayoutStatistics(androidx.constraintlayout.widget.ConstraintLayoutStatistics)(copy: https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintLayoutStatistics!)` Copy a layout Stats useful for comparing two stats |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintLayoutStatistics#attach(androidx.constraintlayout.widget.ConstraintLayout)(constraintLayout: https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintLayout!)` Attach to a ConstraintLayout to gather statistics on its layout performance |
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintLayoutStatistics!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintLayoutStatistics#clone()()` Create a copy of the statistics |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintLayoutStatistics#detach()()` Detach from a ConstraintLayout |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintLayoutStatistics#getValue(int)(type: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` get the value of a statistic |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintLayoutStatistics#logSummary(java.lang.String)(tag: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!)` Log a summary of the statistics |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintLayoutStatistics#logSummary(java.lang.String,androidx.constraintlayout.widget.ConstraintLayoutStatistics)(tag: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!, prev: https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintLayoutStatistics!)` log a summary of the stats compared to another statics |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintLayoutStatistics#reset()()` Clear the current metrics |

## Constants

### DURATION_OF_CHILD_MEASURES

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

```
const val DURATION_OF_CHILD_MEASURES = 5: Int
```

### DURATION_OF_LAYOUT

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

```
const val DURATION_OF_LAYOUT = 7: Int
```

### DURATION_OF_MEASURES

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

```
const val DURATION_OF_MEASURES = 6: Int
```

### NUMBER_OF_CHILD_MEASURES

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

```
const val NUMBER_OF_CHILD_MEASURES = 4: Int
```

### NUMBER_OF_CHILD_VIEWS

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

```
const val NUMBER_OF_CHILD_VIEWS = 3: Int
```

### NUMBER_OF_EQUATIONS

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

```
const val NUMBER_OF_EQUATIONS = 9: Int
```

### NUMBER_OF_LAYOUTS

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

```
const val NUMBER_OF_LAYOUTS = 1: Int
```

### NUMBER_OF_ON_MEASURES

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

```
const val NUMBER_OF_ON_MEASURES = 2: Int
```

### NUMBER_OF_SIMPLE_EQUATIONS

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

```
const val NUMBER_OF_SIMPLE_EQUATIONS = 10: Int
```

### NUMBER_OF_VARIABLES

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

```
const val NUMBER_OF_VARIABLES = 8: Int
```

## Public constructors

### ConstraintLayoutStatistics

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

```
ConstraintLayoutStatistics(constraintLayout: ConstraintLayout!)
```

Measure performance information about ConstraintLayout

| Parameters |
|---|---|
| `constraintLayout: https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintLayout!` |   |

### ConstraintLayoutStatistics

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

```
ConstraintLayoutStatistics(copy: ConstraintLayoutStatistics!)
```

Copy a layout Stats useful for comparing two stats

| Parameters |
|---|---|
| `copy: https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintLayoutStatistics!` |   |

## Public functions

### attach

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

```
fun attach(constraintLayout: ConstraintLayout!): Unit
```

Attach to a ConstraintLayout to gather statistics on its layout performance

| Parameters |
|---|---|
| `constraintLayout: https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintLayout!` |   |

### clone

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

```
fun clone(): ConstraintLayoutStatistics!
```

Create a copy of the statistics

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintLayoutStatistics!` | a copy |

### detach

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

```
fun detach(): Unit
```

Detach from a ConstraintLayout

### getValue

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

```
fun getValue(type: Int): Long
```

get the value of a statistic

| Parameters |
|---|---|
| `type: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` |   |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` |   |

### logSummary

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

```
fun logSummary(tag: String!): Unit
```

Log a summary of the statistics

| Parameters |
|---|---|
| `tag: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` |   |

### logSummary

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

```
fun logSummary(tag: String!, prev: ConstraintLayoutStatistics!): Unit
```

log a summary of the stats compared to another statics

| Parameters |
|---|---|
| `tag: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | used in Log.v(tag, ...) |
| `prev: https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintLayoutStatistics!` | the previous stats to compare to |

### reset

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

```
fun reset(): Unit
```

Clear the current metrics