Skip to main content

MCU Built-in Metrics

The Memfault SDK automatically collects a number of metrics without any additional code. This page lists all built-in metrics by platform.

For information on defining your own custom metrics, see the MCU Metrics documentation.

Core Metrics

These metrics are collected on all supported platforms.

Always Collected

MetricUnitsDescriptionNotes
MemfaultSdkMetric_IntervalMsmsDuration of the heartbeat intervale.g. 3600000; default interval is 1 hour
MemfaultSdkMetric_UnexpectedRebootCountcountUnexpected reboots since the last heartbeate.g. 0; non-zero values indicate unexpected reboots
operational_hourshoursOperational hours accumulated since the last heartbeate.g. 1; increments each heartbeat interval
operational_crashfree_hourshoursCrash-free operational hours since the last heartbeate.g. 1; resets to 0 after a crash

Conditionally Collected

The following core metrics are enabled by setting the corresponding macro in memfault_platform_config.h:

MetricUnitsDescriptionEnable macroNotes
sync_successfulcountSuccessful syncsMEMFAULT_METRICS_SYNC_SUCCESS 1
sync_failurecountFailed syncsMEMFAULT_METRICS_SYNC_SUCCESS 1
sync_memfault_successfulcountSuccessful Memfault syncsMEMFAULT_METRICS_MEMFAULT_SYNC_SUCCESS 1
sync_memfault_failurecountFailed Memfault syncsMEMFAULT_METRICS_MEMFAULT_SYNC_SUCCESS 1
connectivity_connected_time_msmsTime connected to the networkMEMFAULT_METRICS_CONNECTIVITY_CONNECTED_TIME 1e.g. 3540000 for ~59 min in a 1-hour interval
connectivity_expected_time_msmsTime the device was expected to be connectedMEMFAULT_METRICS_CONNECTIVITY_CONNECTED_TIME 1Compare with connectivity_connected_time_ms to compute uptime ratio
battery_soc_pct_drop%Battery state-of-charge drop since the last heartbeatMEMFAULT_METRICS_BATTERY_ENABLE 1e.g. 5; use with battery_discharge_duration_ms for drain rate
battery_discharge_duration_msmsDuration of battery dischargeMEMFAULT_METRICS_BATTERY_ENABLE 1Excludes time spent charging
battery_soc_pct%Current battery state of chargeMEMFAULT_METRICS_BATTERY_ENABLE 1e.g. 82
MemfaultSDKMetric_log_dropped_linescountLog lines dropped since the last heartbeatMEMFAULT_METRICS_LOGS_ENABLE 1Non-zero indicates log buffer pressure
MemfaultSDKMetric_log_recorded_linescountLog lines recorded since the last heartbeatMEMFAULT_METRICS_LOGS_ENABLE 1
uptime_ssDevice uptimeMEMFAULT_METRICS_UPTIME_ENABLE 1Monotonically increasing since last POR

The Battery and Connectivity core metrics are also available on all platforms when enabled. See the Core Metrics documentation for details.

FreeRTOS

These metrics are available on FreeRTOS-based platforms. To use them, add the Memfault FreeRTOS port files from ports/freertos/ to your project and include the built-in metric definitions in your memfault_metrics_heartbeat_config.def:

#include "ports/freertos/config/memfault_metrics_heartbeat_freertos_config.def"

ESP-IDF users get these automatically when CONFIG_MEMFAULT_FREERTOS_TASK_RUNTIME_STATS=y.

MetricUnitsDescriptionConditionNotes
cpu_usage_pct% (÷100)CPU usage percentageAlways when port is includede.g. 4500 = 45.00%
cpu1_usage_pct% (÷100)Core 1 CPU usage percentageMEMFAULT_FREERTOS_RUNTIME_STATS_MULTI_CORE_SPLIT 1Dual-core ESP32 etc.
timer_task_stack_free_bytesbytesFree bytes in the FreeRTOS timer task stackMEMFAULT_FREERTOS_COLLECT_TIMER_STACK_FREE_BYTES 1e.g. 512; low values may indicate stack overflow risk
memory_idle_pct_max%Peak idle task stack usageMEMFAULT_METRICS_THREADS_DEFAULTS 1
memory_tmr_svc_pct_max%Peak timer service task stack usageMEMFAULT_METRICS_THREADS_DEFAULTS 1

Zephyr

Zephyr built-in metrics are organized by the Kconfig option that enables them. Use menuconfig to explore available options under the MEMFAULT submenu.

Default Metrics (CONFIG_MEMFAULT_METRICS_DEFAULT_SET_ENABLE)

MetricUnitsDescriptionAdditional requirementNotes
cpu_usage_pct% (÷100)Total CPU active percentageCONFIG_THREAD_RUNTIME_STATS=y, Zephyr ≥ 3.0e.g. 4500 = 45.00%
TimerTaskCpuUsage%CPU usage of the timer taskCONFIG_THREAD_RUNTIME_STATS=yRaw permille value
AllTasksCpuUsage%Aggregate CPU usage across all tasksCONFIG_THREAD_RUNTIME_STATS=y
TimerTaskFreeStackbytesFree stack bytes for the timer taskCONFIG_THREAD_STACK_INFO=ye.g. 384; low values may indicate stack overflow risk
FileSystem_BytesFreebytesFree bytes in the filesystemCONFIG_MEMFAULT_FS_BYTES_FREE_METRIC=y

Networking (CONFIG_MEMFAULT_METRICS_TCP_IP)

MetricUnitsDescriptionAdditional requirementNotes
net_bytes_receivedbytesTotal bytes received-
net_bytes_sentbytesTotal bytes sent-
net_tcp_recvcountTCP packets receivedCONFIG_NET_STATISTICS_TCP=y
net_tcp_sentcountTCP packets sentCONFIG_NET_STATISTICS_TCP=y
net_udp_recvcountUDP packets receivedCONFIG_NET_STATISTICS_UDP=y
net_udp_sentcountUDP packets sentCONFIG_NET_STATISTICS_UDP=y

Wi-Fi (CONFIG_MEMFAULT_METRICS_WIFI)

MetricUnitsDescriptionExampleNotes
wifi_connected_time_msmsTime connected to Wi-Fi3540000Used to assess connection stability
wifi_disconnect_countcountWi-Fi disconnect count2Can help identify roaming or signal loss
wifi_standard_version-Wi-Fi standard802.11n802.11b/g/n/ac/ax
wifi_security_type-Security typeWPA2-PSKOpen, WPA2-PSK, WPA3, etc.
wifi_frequency_band-Frequency band2.42.4 or 5
wifi_primary_channelchannelPrimary channel ID61–11 (2.4 GHz), 36+ (5 GHz)
wifi_sta_rssidBmStation RSSI-65> −70 dBm is generally good
wifi_beacon_intervalTU (1.024 ms)Beacon interval100Typical values: 100 or 102 TU
wifi_dtim_intervalbeacon periodsDTIM interval3Higher DTIM reduces wake-ups; improves battery at cost of latency
wifi_twt_capablebooleanTWT (Target Wake Time) capable1Power-saving feature introduced in 802.11ax
wifi_tx_rate_mbpsMbpsTX rate72Varies dynamically with signal quality and AP capabilities
wifi_ap_oui-OUI of the associated access point00:1A:2BVendor identifier extracted from AP MAC

Bluetooth (CONFIG_MEMFAULT_METRICS_BLUETOOTH)

MetricUnitsDescriptionAdditional requirementNotes
bt_gatt_mtu_sizeoctetsGATT MTU size-e.g. 247; default is 23; higher = more efficient transfers
bt_connection_remote_info-Remote info: [version]:[mfr id].[subversion]CONFIG_BT_REMOTE_VERSION=ye.g. 0a:0059.0000
bt_connection_event_countcountConnection event count-
bt_connection_interval_usµsConnection interval-e.g. 45000 (45 ms); range 7.5 ms – 4 s
bt_connection_latencyintervalsConnection latency-Number of intervals the peripheral can skip
bt_connection_timeout10 msSupervision timeout-e.g. 400 = 4 s; connection dropped if no packet received in this window
bt_connection_rssidBmConnection RSSICONFIG_BT_CTLR_CONN_RSSI=ye.g. −55; > −70 dBm is generally good
bt_connected_time_msmsTime connected-
bt_disconnect_countcountDisconnect count-

CPU Temperature (CONFIG_MEMFAULT_METRICS_CPU_TEMP)

MetricUnitsDescriptionExampleNotes
thermal_cpu_c°C (÷10)CPU temperature27.5

Memory (CONFIG_MEMFAULT_METRICS_MEMORY_USAGE)

MetricUnitsDescriptionAdditional requirementNotes
memory_pct_max% (÷100)Peak heap utilization since last heartbeatZephyr ≥ 3.0e.g. 4800 = 48.00%
Heap_BytesFreebytesFree bytes in the heap-e.g. 28672

Thread Stack Defaults (CONFIG_MEMFAULT_METRICS_THREADS_DEFAULTS)

MetricUnitsDescriptionAdditional requirementNotes
memory_idle_pct_max%Peak idle thread stack usage-High values (near 100%) indicate near stack overflow
memory_sysworkq_pct_max%Peak system work queue stack usage-
memory_mflt_upload_pct_max%Peak Memfault upload thread stack usageCONFIG_MEMFAULT_PERIODIC_UPLOAD_USE_DEDICATED_WORKQUEUE=y

Boot Time (CONFIG_MEMFAULT_METRICS_BOOT_TIME)

MetricUnitsDescriptionExampleNotes
boot_time_msmsBoot time1250Time from reset to application ready

ESP-IDF

ESP-IDF built-in metrics are enabled via idf.py menuconfig under the Component config → Memfault submenu.

Memory (CONFIG_MEMFAULT_METRICS_MEMORY_USAGE)

MetricUnitsDescriptionExampleNotes
heap_free_bytesbytesFree bytes in the heap204800Current free heap
heap_largest_free_block_bytesbytesLargest contiguous free block in the heap131072Low values may indicate heap fragmentation
heap_allocated_blocks_countcountNumber of currently allocated heap blocks127
heap_min_free_bytesbytesMinimum free bytes ever in the heap98304High water mark since boot; indicates worst-case memory pressure
memory_pct_max% (÷100)Peak heap utilization since last heartbeat6200Divide by 100 for percentage: 62.00%

Wi-Fi (CONFIG_MEMFAULT_ESP_WIFI_METRICS)

MetricUnitsDescriptionExampleNotes
wifi_connected_time_msmsTime connected to Wi-Fi3540000Used to assess connection stability
wifi_sta_min_rssidBmMinimum observed station RSSI-72Worst-case signal during the interval; > −70 dBm is generally good
wifi_primary_channelchannelPrimary channel ID61–11 (2.4 GHz), 36+ (5 GHz)
wifi_security_type-Security typeWPA2_PSKOpen, WPA2_PSK, WPA3_PSK, etc.
wifi_standard_version-Wi-Fi standard802.11n802.11b/g/n/ac/ax
wifi_disconnect_countcountDisconnect count1Can help identify roaming or signal loss
wifi_ap_oui-OUI of the associated access point00:1A:2BVendor identifier extracted from AP MAC

CPU Temperature (CONFIG_MEMFAULT_METRICS_CPU_TEMP)

MetricUnitsDescriptionExampleNotes
thermal_cpu_c°C (÷10)CPU temperature452Divide by 10 for degrees Celsius: 45.2 °C
note

CPU temperature is not supported on the original ESP32.

Chip Info (CONFIG_MEMFAULT_METRICS_CHIP_ENABLE)

MetricUnitsDescriptionExampleNotes
flash_spi_manufacturer_id-24-bit RDID of the SPI flash chipc84017c84017 = GigaDevice GD25Q64 8 MiB
flash_spi_total_size_bytesbytesTotal SPI flash size83886088 MiB
esp_chip_revision-Chip model and revisionesp32s3-0.2

Network I/O (CONFIG_MEMFAULT_METRICS_NETWORK_IO)

Requires ESP-IDF ≥ 5.4.0.

MetricUnitsDescriptionExampleNotes
network_rx_bytesbytesTotal bytes received over the network1048576
network_tx_bytesbytesTotal bytes transmitted over the network524288

Boot Time (CONFIG_MEMFAULT_METRICS_BOOT_TIME)

MetricUnitsDescriptionExampleNotes
boot_time_msmsBoot time2100Time from reset to application ready

Flash Wear (CONFIG_MEMFAULT_METRICS_FLASH_ENABLE)

MetricUnitsDescriptionExampleNotes
flash_spi_write_bytesbytesTotal bytes written to SPI flash4096Typical minimum write is one 4 KiB sector
flash_spi_erase_bytesbytesTotal bytes erased on SPI flash4096Flash must be erased before writing

Deep Sleep (CONFIG_MEMFAULT_DEEP_SLEEP_SUPPORT)

These metrics are enabled automatically when CONFIG_MEMFAULT_DEEP_SLEEP_SUPPORT=y and can be individually disabled with CONFIG_MEMFAULT_DEEP_SLEEP_METRICS=n.

MetricUnitsDescriptionExampleNotes
deep_sleep_time_msmsTime spent in deep sleep55800000e.g. ~15.5 hours; use with active_time_ms to compute duty cycle
deep_sleep_wakeup_countcountNumber of deep sleep wakeups42
active_time_msmsTime spent out of deep sleep600000

FreeRTOS Task Runtime (CONFIG_MEMFAULT_FREERTOS_TASK_RUNTIME_STATS)

See FreeRTOS metrics above. Enabled on ESP-IDF via CONFIG_MEMFAULT_FREERTOS_TASK_RUNTIME_STATS=y.

LwIP (CONFIG_MEMFAULT_LWIP_METRICS)

Requires TCP_STATS and/or UDP_STATS to be enabled in your LwIP config.

MetricUnitsDescriptionLwIP requirementNotes
tcp_tx_countcountTCP packets sentTCP_STATS 1
tcp_rx_countcountTCP packets receivedTCP_STATS 1
tcp_drop_countcountTCP packets droppedTCP_STATS 1Non-zero may indicate network congestion
udp_tx_countcountUDP packets sentUDP_STATS 1
udp_rx_countcountUDP packets receivedUDP_STATS 1
udp_drop_countcountUDP packets droppedUDP_STATS 1Non-zero may indicate network congestion

MbedTLS (CONFIG_MEMFAULT_MBEDTLS_METRICS)

MetricUnitsDescriptionExampleNotes
mbedtls_mem_used_bytesbytesCurrent bytes allocated by mbedTLS12288
mbedtls_mem_max_bytesbytesMaximum bytes ever allocated by mbedTLS36864Peak typically occurs during TLS handshake

nRF Connect SDK (NCS)

NCS built-in metrics are defined in the Nordic SDK repository (not the Memfault SDK). The Memfault SDK provides the collection implementations. The source of truth for the metric definitions is:

nRF91 Series - LTE (CONFIG_MEMFAULT_NCS_LTE_METRICS)

MetricUnitsDescriptionExampleNotes
ncs_lte_time_to_connect_msmsTime to connect to the LTE network3200High values may indicate poor coverage or network congestion
ncs_lte_connection_loss_countcountNumber of connection lost events1
ncs_lte_psm_tau_secondssAssigned PSM tracking area update (TAU) timer3600
ncs_lte_psm_active_time_secondssActive time for PSM10Time modem stays awake after transmitting
ncs_lte_edrx_interval_msmsAssigned eDRX interval5120
ncs_lte_edrx_ptw_msmsAssigned eDRX paging time window (PTW)1280
ncs_lte_mode-LTE mode70 = None, 7 = LTE-M, 9 = NB-IoT
ncs_lte_on_time_msmsTime the modem is on360000
ncs_lte_reset_loop_detected_countcountTimes the modem detected a reset loop on the host0Non-zero: modem blocks network attaches for 30 min
ncs_lte_modem_fw_version-Modem firmware versionnrf9160_1.3.5
ncs_lte_operator-Network operatorAT&T
ncs_lte_snr_decibelsdBSignal-to-noise ratio15Higher is better
ncs_lte_rsrp_dbmdBmReference signal received power-95−70 to −80 dBm is good; below −100 dBm is poor
ncs_lte_tx_kilobyteskBKilobytes transmitted via the modem12
ncs_lte_rx_kilobyteskBKilobytes received via the modem24
ncs_lte_band-Assigned frequency band (3GPP enumeration)2Maps to 3GPP frequency band; see LTE band reference

nRF91 Series - Stack (CONFIG_MEMFAULT_NCS_STACK_METRICS)

MetricUnitsDescriptionExampleNotes
ncs_connection_poll_unused_stackbytesFree stack bytes in the LTE connection poll thread512Low values may indicate stack overflow risk

nRF52 / nRF53 / nRF54 Series - Bluetooth (CONFIG_MEMFAULT_NCS_BT_METRICS)

MetricUnitsDescriptionExampleNotes
ncs_bt_connection_time_msmsTotal Bluetooth connected time3540000
ncs_bt_connection_countcountNumber of Bluetooth connections3
ncs_bt_bond_countcountNumber of Bluetooth bonds1Persistent across resets

nRF52 / nRF53 / nRF54 Series - Stack (CONFIG_MEMFAULT_NCS_STACK_METRICS)

MetricUnitsDescriptionExampleNotes
ncs_bt_rx_unused_stackbytesFree stack bytes in the Bluetooth RX thread256Low values may indicate stack overflow risk
ncs_bt_tx_unused_stackbytesFree stack bytes in the Bluetooth TX thread384Low values may indicate stack overflow risk

npm13xx Battery (CONFIG_MEMFAULT_NRF_PLATFORM_BATTERY_NPM13XX)

MetricUnitsDescriptionExampleNotes
battery_voltageV (÷1000)Battery voltage3750Divide by 1000 for volts: 3.75 V