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

*** ** * ** ***


```
public 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 |
|---|---|
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintLayoutStatistics#DURATION_OF_CHILD_MEASURES() = 5` |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintLayoutStatistics#DURATION_OF_LAYOUT() = 7` |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintLayoutStatistics#DURATION_OF_MEASURES() = 6` |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintLayoutStatistics#NUMBER_OF_CHILD_MEASURES() = 4` |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintLayoutStatistics#NUMBER_OF_CHILD_VIEWS() = 3` |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintLayoutStatistics#NUMBER_OF_EQUATIONS() = 9` |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintLayoutStatistics#NUMBER_OF_LAYOUTS() = 1` |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintLayoutStatistics#NUMBER_OF_ON_MEASURES() = 2` |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintLayoutStatistics#NUMBER_OF_SIMPLE_EQUATIONS() = 10` |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintLayoutStatistics#NUMBER_OF_VARIABLES() = 8` |

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

| ### Public methods |
|---|---|
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintLayoutStatistics#attach(androidx.constraintlayout.widget.ConstraintLayout)(https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintLayout constraintLayout)` Attach to a ConstraintLayout to gather statistics on its layout performance |
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintLayoutStatistics` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintLayoutStatistics#clone()()` Create a copy of the statistics |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintLayoutStatistics#detach()()` Detach from a ConstraintLayout |
| `long` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintLayoutStatistics#getValue(int)(int type)` get the value of a statistic |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintLayoutStatistics#logSummary(java.lang.String)(https://developer.android.com/reference/java/lang/String.html tag)` Log a summary of the statistics |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintLayoutStatistics#logSummary(java.lang.String,androidx.constraintlayout.widget.ConstraintLayoutStatistics)(https://developer.android.com/reference/java/lang/String.html tag, https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintLayoutStatistics prev)` log a summary of the stats compared to another statics |
| `void` | `https://developer.android.com/reference/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)

```
public static final int DURATION_OF_CHILD_MEASURES = 5
```

### DURATION_OF_LAYOUT

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

```
public static final int DURATION_OF_LAYOUT = 7
```

### DURATION_OF_MEASURES

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

```
public static final int DURATION_OF_MEASURES = 6
```

### NUMBER_OF_CHILD_MEASURES

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

```
public static final int NUMBER_OF_CHILD_MEASURES = 4
```

### NUMBER_OF_CHILD_VIEWS

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

```
public static final int NUMBER_OF_CHILD_VIEWS = 3
```

### NUMBER_OF_EQUATIONS

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

```
public static final int NUMBER_OF_EQUATIONS = 9
```

### NUMBER_OF_LAYOUTS

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

```
public static final int NUMBER_OF_LAYOUTS = 1
```

### NUMBER_OF_ON_MEASURES

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

```
public static final int NUMBER_OF_ON_MEASURES = 2
```

### NUMBER_OF_SIMPLE_EQUATIONS

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

```
public static final int NUMBER_OF_SIMPLE_EQUATIONS = 10
```

### NUMBER_OF_VARIABLES

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

```
public static final int NUMBER_OF_VARIABLES = 8
```

## Public constructors

### ConstraintLayoutStatistics

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

```
public ConstraintLayoutStatistics(ConstraintLayout constraintLayout)
```

Measure performance information about ConstraintLayout

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

### ConstraintLayoutStatistics

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

```
public ConstraintLayoutStatistics(ConstraintLayoutStatistics copy)
```

Copy a layout Stats useful for comparing two stats

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

## Public methods

### attach

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

```
public void attach(ConstraintLayout constraintLayout)
```

Attach to a ConstraintLayout to gather statistics on its layout performance

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

### clone

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

```
public ConstraintLayoutStatistics clone()
```

Create a copy of the statistics

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

### detach

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

```
public void detach()
```

Detach from a ConstraintLayout

### getValue

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

```
public long getValue(int type)
```

get the value of a statistic

| Parameters |
|---|---|
| `int type` |   |

| Returns |
|---|---|
| `long` |   |

### logSummary

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

```
public void logSummary(String tag)
```

Log a summary of the statistics

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/lang/String.html tag` |   |

### logSummary

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

```
public void logSummary(String tag, ConstraintLayoutStatistics prev)
```

log a summary of the stats compared to another statics

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/lang/String.html tag` | used in Log.v(tag, ...) |
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintLayoutStatistics prev` | the previous stats to compare to |

### reset

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

```
public void reset()
```

Clear the current metrics