# Health Monitor Service

- [API Reference](https://docs.qualcomm.com/doc/80-41102-2/topic/_doxygen_rst_file__doxygen_sources_taf_hms_interface_h.html#file-taf-hms-interface-h)

Components need access to the TelAF Health Monitor to get information about CPU usage and RAM usage.

## IPC interfaces binding

The functions of this API are provided by the **tafHMSSvc** application service.

The following example illustrates how to bind to TelAF Health Monitor services.

bindings:
    {
        clientExe.clientComponent.taf_hms -> tafHMSvc.taf_hms
    }
    Copy to clipboard

## Get the total CPU usage

The API of [taf\_hms\_GetCpuLoad()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00509_1a72a7b8d6e1eb405197b492ce44943ae4.html#Documentationa00509_1a72a7b8d6e1eb405197b492ce44943ae4) provides the current total CPU usage in percentage.

le_result_t result;
    double cpuLoadValue;
    result = taf_hms_GetCpuLoad(&cpuLoadValue);
    if(result == LE_OK)
    {
        LE_INFO("CPU Load Idle Percentage: %.2f%%\n",cpuLoadValue);
    }
    else
    {
        LE_INFO("Failed ! to get CPU Load information");
    }
    Copy to clipboard

## Get the total number of CPU cores

The API of [taf\_hms\_GetCpuCoreNum()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00509_1a89e30bf46ae6bd188326019fbf59ed39.html#Documentationa00509_1a89e30bf46ae6bd188326019fbf59ed39) provides the total number of CPU cores.

uint32_t cpuCoreNum = taf_hms_GetCpuCoreNum(&cpuCoreNum);
    Copy to clipboard

## Get individual CPU core usage

The API of [taf\_hms\_GetIndvCoreUsage()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00509_1acca61a5be69ed9b7887424ee98b07227.html#Documentationa00509_1acca61a5be69ed9b7887424ee98b07227) provides the total CPU usage of individual core.

le_result_t result;
    uint32_t core_id = 0;
    result = taf_hms_GetIndvCoreUsage(core_id, &cpuUsage);
    if (result == LE_OK)
    {
      LE_INFO("CPU Usage for core %d %d\n", core_id, cpuUsage);
    }
    Copy to clipboard

## Get memory information

The API of [taf\_hms\_GetRamMemInfo()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00509_1af5082b914d53a2d9e2aed2fa3dcbc6bd.html#Documentationa00509_1af5082b914d53a2d9e2aed2fa3dcbc6bd) provides the current RAM in total, used and free memory information.

le_result_t result;
    uint32_t ramTotalMem, ramUsedMem, ramFreeMem;
    result = taf_hms_GetRamMemInfo( &ramTotalMem, &ramUsedMem, &ramFreeMem);
    if(result == LE_OK)
    {
        LE_INFO(" Total Memory: %d kB\n", ramTotalMem);
        LE_INFO(" Used Memory: %d kB\n", ramUsedMem);
        LE_INFO(" Free Memory: %d kB\n", ramFreeMem);
    }
    else
    {
        LE_INFO("Failed ! to get RAM information");
    }
    Copy to clipboard

## Get UBI device information

The following APIs are provided for UBI device information [taf\_hms\_GetUbiDevInfoList()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00509_1a5cc95fdfe595a293a46e0263ca81b94e.html#Documentationa00509_1a5cc95fdfe595a293a46e0263ca81b94e) Gets the list of available UBI device information. [taf\_hms\_DeleteUbiDevInfoList()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00509_1ac09115ea045121eacc68a8e15d872819.html#Documentationa00509_1ac09115ea045121eacc68a8e15d872819) Deletes the UBI list reference. [taf\_hms\_GetFirstUbiDevInfo()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00509_1aa6423e11663e13743013697c3f36e539.html#Documentationa00509_1aa6423e11663e13743013697c3f36e539) Gets the first UBI device Info object reference in the list. [taf\_hms\_GetNextUbiDevInfo()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00509_1a6c2ce24c5b041dde361dbfd33455855a.html#Documentationa00509_1a6c2ce24c5b041dde361dbfd33455855a) Gets the next UBI device Info object reference in the list. [taf\_hms\_GetUbiDevMaxEraseCnt()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00509_1a30c6c180a1fd7659f6ee588994ceefeb.html#Documentationa00509_1a30c6c180a1fd7659f6ee588994ceefeb) Gets UBI information for current maximum erase count. [taf\_hms\_GetUbiDevBadBlkCnt()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00509_1a992cc00b0d72430d3007e00aa846f393.html#Documentationa00509_1a992cc00b0d72430d3007e00aa846f393) Gets UBI information for bad block count. [taf\_hms\_GetUbiDevId()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00509_1aa67423a7945bcb2cf07a8c16bfc7205f.html#Documentationa00509_1aa67423a7945bcb2cf07a8c16bfc7205f) Gets UBI device ID.

taf_hms_UbiDevInfoListRef_t ubiDevListRef = taf_hms_GetUbiDevInfoList();
    taf_hms_UbiDevInfoRef_t UbiDevInfo = taf_hms_GetFirstUbiDevInfo(ubiDevListRef);
    uint32_t ubiDeviceListSize;
    result = taf_hms_GetUbiDevInfoListSize(ubiDevListRef, &ubiDeviceListSize);
    while (UbiDevInfo != NULL and ubiDeviceListSize--)
    {
        uint32_t ubiEraseCount;
        result = taf_hms_GetUbiDevEc(UbiDevInfo, &ubiEraseCount);
    
        uint32_t ubiBadblock;
        result = taf_hms_GetUbiDevBbc(UbiDevInfo, &ubiBadblock);
    
        if (ubiDeviceListSize > 0) {
            UbiDevInfo = taf_hms_GetNextUbiDevInfo(ubiDevListRef);
        }
    }
    Copy to clipboard

## Get UBI volume information

The following APIs are provided for UBI volume information [taf\_hms\_GetFirstUbiVolInfo()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00509_1a6fff05077d81400f0156c5da32e862d6.html#Documentationa00509_1a6fff05077d81400f0156c5da32e862d6) Gets the first UBI volume Info object reference in the list. [taf\_hms\_GetNextUbiVolInfo()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00509_1a55e8d1b0ae814a1c4e147aa2fd5eda2a.html#Documentationa00509_1a55e8d1b0ae814a1c4e147aa2fd5eda2a) Gets the next UBI volume Info object reference in the list. [taf\_hms\_GetUbiVolName()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00509_1a996e0c8bdac6de29768391c2842cdff1.html#Documentationa00509_1a996e0c8bdac6de29768391c2842cdff1) Gets name of UBI volume. [taf\_hms\_GetUbiVolSize()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00509_1a70106b33369f50b8d43cfc8dba795921.html#Documentationa00509_1a70106b33369f50b8d43cfc8dba795921) Gets size of UBI volume. [taf\_hms\_GetUbiVolId()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00509_1a13e5b19eace5d00c0bc8e6334a6b8c4a.html#Documentationa00509_1a13e5b19eace5d00c0bc8e6334a6b8c4a) Gets UBI volume ID.

taf_hms_UbiVolInfoListRef_t ubiVolListRef = taf_hms_GetUbiVolInfoList();
    taf_hms_UbiVolInfoRef_t UbiVolInfo = taf_hms_GetFirstUbiVolInfo(ubiVolListRef);
    uint32_t ubiVolumeListSize;
    result = taf_hms_GetUbiVolInfoListSize(ubiVolListRef, &ubiVolumeListSize);
    while (UbiVolInfo != NULL and ubiVolumeListSize--)
    {
        char ubiVolName[NAME_SIZE];
        memset(ubiVolName, 0, NAME_SIZE);
        taf_hms_GetUbiVolName(UbiVolInfo, ubiVolName, sizeof(ubiVolName));
    
        uint32_t ubiVolSize;
        result = taf_hms_GetUbiVolSize(UbiVolInfo, &ubiVolSize);
    
        if (ubiVolumeListSize > 0) {
            UbiVolInfo = taf_hms_GetNextUbiVolInfo(ubiVolListRef);
        }
    }
    Copy to clipboard

## Get MTD device information

The following APIs are provided for MTD device information taf\_hms\_GetMtdInfoList() Gets the list of available MTD information. taf\_hms\_DeleteMtdInfoList() Deletes the MTD list reference. taf\_hms\_GetFirstMtdInfo() Gets the first MtdInfo object reference in the list. taf\_hms\_GetNextMtdInfo() Gets the next MtdInfo object reference in the list. [taf\_hms\_GetMtdDevName()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00509_1aa637adcf4d949c2d72f3ceff1c5656a2.html#Documentationa00509_1aa637adcf4d949c2d72f3ceff1c5656a2) Gets MTD device name. [taf\_hms\_GetMtdDevBlkSize()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00509_1aabfeb6c5f6c887ddabda1dbf1e0e0e4b.html#Documentationa00509_1aabfeb6c5f6c887ddabda1dbf1e0e0e4b) Gets MTD information for block size. [taf\_hms\_GetMtdDevId()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00509_1ac0b7aa9301eb969e6ea19220e66e8b30.html#Documentationa00509_1ac0b7aa9301eb969e6ea19220e66e8b30) Gets MTD device ID. [taf\_hms\_GetMtdDevBlkCnt()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00509_1a1e9e0c85f46ba845ab1564b7594c2fc6.html#Documentationa00509_1a1e9e0c85f46ba845ab1564b7594c2fc6) Gets MTD block count.

taf_hms_MtdInfoListRef_t mtdListRef = taf_hms_GetMtdInfoList();
    taf_hms_MtdInfoRef_t MtdInfo = taf_hms_GetFirstMtdInfo(mtdListRef);
    uint32_t mtdDevListSize;
    result = taf_hms_GetMtdInfoListSize(mtdListRef, &mtdDevListSize);
    while (MtdInfo != NULL and mtdDevListSize--)
    {
        char MtdDevName[NAME_SIZE];
        memset(MtdDevName, 0, NAME_SIZE);
        taf_hms_GetMtdDevName(MtdInfo, MtdDevName, sizeof(MtdDevName));
    
        if (mtdDevListSize > 0) {
            MtdInfo = taf_hms_GetNextMtdInfo(mtdListRef);
        }
    }
    Copy to clipboard

## Modem event notification

[taf\_hms\_AddModemEvtHandler()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00509_1a28c3dafe9f27869ef3e9af87bd3c47b8.html#Documentationa00509_1a28c3dafe9f27869ef3e9af87bd3c47b8) is for the application to register an event handler for modem event. When the status of modem changes, the service will notify the client through that registered event handler.

When the notification is not needed, [taf\_hms\_RemoveModemEvtHandler()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00509_1a7c12220e7f1ff5a77752104f14bcf981.html#Documentationa00509_1a7c12220e7f1ff5a77752104f14bcf981) is used to de-register the event handler to release.

The following example illustrates how to register and get the modem information,

// Event handler for receiving notification from hms service
     void ModemStatusHandler
     (
         taf_hms_ModemEvtType_t        eventType,
         taf_hms_ModemEvtSeverity_t    eventLevel,
         taf_hms_ModemEventRef_t       eventRef,
         void* contextPtr
     )
     {
         LE_INFO("Event Type: %s. Event Level: %s Event Reference: %p\n",
             ModemEventTypeToStr(eventType), ModemEventLevelToStr(eventLevel), eventRef);
         le_result_t result = taf_hms_ReleaseModemEvt(eventRef);
     }
    
     taf_hms_ModemEvtHandlerRef_t modemStatusHandlerRef = NULL;
     // Thread to register the handler
    
     void* Test_taf_Hms_AddModemEvtHandler(void* cxtPtr)
     {
         taf_hms_ConnectService();
         modemStatusHandlerRef = taf_hms_AddModemEvtHandler(
             (taf_hms_ModemEvtHandlerFunc_t)ModemStatusHandler, NULL);
         le_event_RunLoop();
         return NULL;
     }
    
     //Creates a thread to register the handler and receive notification.
     le_thread_Ref_t threadRef = le_thread_Create("ModemCrashMonitorThread",
         Test_taf_Hms_AddModemEvtHandler, (void*)semRef);
    
     // De-register the hanlder when not need.
     taf_hms_RemoveModemEvtHandler(modemStatusHandlerRef);
    Copy to clipboard

## Get (re)boot reason

The API of [taf\_hms\_GetResetInformation()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00509_1a0b0445541c21afb0af28ecd078f2aef6.html#Documentationa00509_1a0b0445541c21afb0af28ecd078f2aef6) provides the (re)boot reason for this boot up. For each reset reason, an information string is provided to specify the reset cause. These strings are listed in the table below. This list may be partially supported by some platforms.

| Reset type | Reset reason | Description |
| --- | --- | --- |
| TAF\_HMS\_RESET\_UNKNOWN | unknown | Unknown case |
| TAF\_HMS\_RESET\_CRASH | panic | Kernel crash |
| TAF\_HMS\_RESET\_CRASH | telaf crash | TelAF crash |
| TAF\_HMS\_RESET\_CRASH | [‘xxx’ crash] | [Reserved: ‘xxx’ crash] |
| TAF\_HMS\_RESET\_UPDATE | recovery | System recovery |
| TAF\_HMS\_RESET\_UPDATE | [‘telaf’ update] | [Reserved: TelAF update] |
| TAF\_HMS\_RESET\_UPDATE | [‘configuration’ update] | [Reserved: Configuration update] |
| TAF\_HMS\_RESET\_UPDATE | [‘xxx’ update] | [Reserved: ‘xxx’ update] |
| TAF\_HMS\_RESET\_CORRUPTED | dm-verity device corrupted | dm-verity device was corrupted |
| TAF\_HMS\_RESET\_CORRUPTED | [‘telaf image’ corrupted] | [Reserved: TelAF image was corrupted] |
| TAF\_HMS\_RESET\_CORRUPTED | [‘xxx image’ corrupted] | [Reserved: ‘xxx’ was corrupted] |
| TAF\_HMS\_RESET\_AUTH\_FAILED | [‘telaf’ auth failed] | [Reserved: TelAF auth failed] |
| TAF\_HMS\_RESET\_AUTH\_FAILED | [‘xxx’ auth failed] | [Reserved: ‘xxx’ auth failed] |
| TAF\_HMS\_RESET\_USER | user | Not defined user reboot |
| TAF\_HMS\_RESET\_USER | bootloader | reboot bootloader/fastboot continue |
| TAF\_HMS\_RESET\_USER | dm-verity enforcing | dm-verity operation |
| TAF\_HMS\_RESET\_USER | keys clear | dm-verity operation |
| TAF\_HMS\_RESET\_WDOG | watchdog bark | Watchdog bark |
| TAF\_HMS\_RESET\_WDOG | [‘xxx’ watchdog bark] | [Reserved: ‘xxx’ watchdog bark] |
| TAF\_HMS\_RESET\_HARD | rtc | RTC alarm boot |
| TAF\_HMS\_RESET\_HARD | [Hardware switch] | [Reserved: Hardware switch] |
| TAF\_HMS\_RESET\_HARD | [Power down] | [Reserved: Power source unplugged] |
| TAF\_HMS\_RESET\_TEMP\_CRIT | [Critical Temp] | [Reserved: Critical voltage level] |
| TAF\_HMS\_RESET\_VOLT\_CRIT | [Critical Voltage] | [Reserved: Critical temperature LV] |

le_result_t result;
    taf_hms_Reset_t reset;
    char resetSpecificInfoStr[TAF_HMS_MAX_RESET_LEN] ={0};
    
    // Get the (re)boot reason.
    result = taf_hms_GetResetInformation(&reset, resetSpecificInfoStr, TAF_HMS_MAX_RESET_LEN);
    LE_INFO("Reset info - type: %d, sub string: %s", (int)reset, resetSpecificInfoStr);
    Copy to clipboard

Last Published: Jun 09, 2026

[Previous Topic
GPIO Service](https://docs.qualcomm.com/bundle/publicresource/80-41102-2/topics/page_c_tafgpio.md) [Next Topic
Sensor Management Service](https://docs.qualcomm.com/bundle/publicresource/80-41102-2/topics/page_c_tafsensor.md)