# otMleCounters Struct Reference

# otMleCounters


`#include <openthread/thread.h>`

Represents the Thread MLE counters.

## Summary

| ### Public attributes ||
|---|---|
| `https://openthread.io/reference/struct/ot-mle-counters#structot_mle_counters_1ab76ac7c6d6a8998eb159dcf6e0316700` | `uint16_t` Number of attach attempts while device was detached. |
| `https://openthread.io/reference/struct/ot-mle-counters#structot_mle_counters_1af12f85cf175560fa122ef7c9015236c9` | `uint16_t` Number of attempts to attach to find a better parent (parent search). |
| `https://openthread.io/reference/struct/ot-mle-counters#structot_mle_counters_1a3133604c00b3597ce3a3e48eb3e4b2c7` | `uint16_t` Number of attempts to attach to a better partition. |
| `https://openthread.io/reference/struct/ot-mle-counters#structot_mle_counters_1a1e0382809fb1e2545a99fec4b1d3c829` | `uint16_t` Number of times device entered OT_DEVICE_ROLE_CHILD role. |
| `https://openthread.io/reference/struct/ot-mle-counters#structot_mle_counters_1a74da501852ca5036981063292858c67d` | `uint64_t` Number of milliseconds device has been in OT_DEVICE_ROLE_CHILD role. |
| `https://openthread.io/reference/struct/ot-mle-counters#structot_mle_counters_1a22f94545ca98912b660743a77dab0952` | `uint16_t` Number of times device entered OT_DEVICE_ROLE_DETACHED role. |
| `https://openthread.io/reference/struct/ot-mle-counters#structot_mle_counters_1ae8c0bf15bc94aad807939842c0a3556a` | `uint64_t` Number of milliseconds device has been in OT_DEVICE_ROLE_DETACHED role. |
| `https://openthread.io/reference/struct/ot-mle-counters#structot_mle_counters_1a4cc081feda704f37617fcabd8e6ca77e` | `uint16_t` Number of times device entered OT_DEVICE_ROLE_DISABLED role. |
| `https://openthread.io/reference/struct/ot-mle-counters#structot_mle_counters_1aaaa4e348f4c8fddeb13d84d6cb5f0021` | `uint64_t` Number of milliseconds device has been in OT_DEVICE_ROLE_DISABLED role. |
| `https://openthread.io/reference/struct/ot-mle-counters#structot_mle_counters_1ace53f3d4a5ab641dadc47a190c944ec9` | `uint16_t` Number of times device entered OT_DEVICE_ROLE_LEADER role. |
| `https://openthread.io/reference/struct/ot-mle-counters#structot_mle_counters_1a479327d251c1a32ae13ce552bb326db2` | `uint64_t` Number of milliseconds device has been in OT_DEVICE_ROLE_LEADER role. |
| `https://openthread.io/reference/struct/ot-mle-counters#structot_mle_counters_1ac70934637c1b1551024fbd8d0969a663` | `uint16_t` Number of times device changed its parent. |
| `https://openthread.io/reference/struct/ot-mle-counters#structot_mle_counters_1afbaa1769915e7a62dbcb6f1fe11af328` | `uint16_t` Number of changes to partition ID. |
| `https://openthread.io/reference/struct/ot-mle-counters#structot_mle_counters_1ab25ea870953f326ec34a18e1d3b80b46` | `uint16_t` Number of times device entered OT_DEVICE_ROLE_ROUTER role. |
| `https://openthread.io/reference/struct/ot-mle-counters#structot_mle_counters_1ab4a7c489bb916304513ee91b22e9831a` | `uint64_t` Number of milliseconds device has been in OT_DEVICE_ROLE_ROUTER role. |
| `https://openthread.io/reference/struct/ot-mle-counters#structot_mle_counters_1aa8a3a725ee317f8aa088b2c5edd06e0f` | `uint64_t` Number of milliseconds tracked by previous counters. |

## Public attributes

### mAttachAttempts

```
uint16_t otMleCounters::mAttachAttempts
```
Number of attach attempts while device was detached.

### mBetterParentAttachAttempts

```
uint16_t otMleCounters::mBetterParentAttachAttempts
```
Number of attempts to attach to find a better parent (parent search).

### mBetterPartitionAttachAttempts

```
uint16_t otMleCounters::mBetterPartitionAttachAttempts
```
Number of attempts to attach to a better partition.

### mChildRole

```
uint16_t otMleCounters::mChildRole
```
Number of times device entered OT_DEVICE_ROLE_CHILD role.

### mChildTime

```
uint64_t otMleCounters::mChildTime
```
Number of milliseconds device has been in OT_DEVICE_ROLE_CHILD role.

### mDetachedRole

```
uint16_t otMleCounters::mDetachedRole
```
Number of times device entered OT_DEVICE_ROLE_DETACHED role.

### mDetachedTime

```
uint64_t otMleCounters::mDetachedTime
```
Number of milliseconds device has been in OT_DEVICE_ROLE_DETACHED role.

### mDisabledRole

```
uint16_t otMleCounters::mDisabledRole
```
Number of times device entered OT_DEVICE_ROLE_DISABLED role.

### mDisabledTime

```
uint64_t otMleCounters::mDisabledTime
```
Number of milliseconds device has been in OT_DEVICE_ROLE_DISABLED role.

### mLeaderRole

```
uint16_t otMleCounters::mLeaderRole
```
Number of times device entered OT_DEVICE_ROLE_LEADER role.

### mLeaderTime

```
uint64_t otMleCounters::mLeaderTime
```
Number of milliseconds device has been in OT_DEVICE_ROLE_LEADER role.

### mParentChanges

```
uint16_t otMleCounters::mParentChanges
```
Number of times device changed its parent.

A parent change can happen if device detaches from its current parent and attaches to a different one, or even while device is attached when the periodic parent search feature is enabled (please see option OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE).

### mPartitionIdChanges

```
uint16_t otMleCounters::mPartitionIdChanges
```
Number of changes to partition ID.

### mRouterRole

```
uint16_t otMleCounters::mRouterRole
```
Number of times device entered OT_DEVICE_ROLE_ROUTER role.

### mRouterTime

```
uint64_t otMleCounters::mRouterTime
```
Number of milliseconds device has been in OT_DEVICE_ROLE_ROUTER role.

### mTrackedTime

```
uint64_t otMleCounters::mTrackedTime
```
Number of milliseconds tracked by previous counters.

## Resources

OpenThread API Reference topics originate from the source code, available
on [GitHub](https://github.com/openthread/openthread/tree/main/include/openthread).
For more information, or to contribute to our documentation, refer to
[Resources](https://openthread.io/resources).