4G_module/include/cmiot/cm_cpuinfo.h

78 lines
1.7 KiB
C
Raw Permalink Normal View History

2024-09-02 17:54:29 +08:00
/**
* @file cm_cpuinfo.h
* @brief cpu信息统计线使
* @copyright copyright © 2023 China Mobile IOT. All rights reserved.
* @author by ZXW
* @date 2023/6/29
*
* @defgroup CPUINFO
* @ingroup CPUINFO
* @{
*/
#ifndef __CM_CPUINFO_H__
#define __CM_CPUINFO_H__
#include <stdint.h>
#include "cm_os.h"
/** 线程信息*/
typedef struct{
osThreadId_t handle; /*!< 线程句柄*/
uint32_t scheduled_cnt; /*!< 系统调度次数*/
uint32_t tick_cnt; /*!< 累计占用tick计数*/
uint32_t last_tick; /*!< 线程切入时系统tick计数*/
} cm_thread_runtime_t;
/**
* @brief CPU运行信息
*
* @param [in] mode 0线1线
*
* @return 0 \n
*
*
* @details 线
*/
int32_t cm_cpuinfo_record_start(uint32_t mode);
/**
* @brief
*
* @param [out] info 线
* @param [out] cnt 线
* @param [out] total_tick CPU的tick计数
*
* @return 0 \n
*
*
* @details cpu占用率 = cm_thread_runtime_t->tick_cnt / total_tick * 100%
*/
int32_t cm_cpuinfo_record_read(cm_thread_runtime_t info[], uint32_t *cnt, uint32_t *total_tick);
/**
* @brief
*
* @return 0 \n
*
*
* @details More details
*/
int32_t cm_cpuinfo_record_stop(void);
/**
* @brief cpu唯一标识
*
* @return \n
* NULL
*
* @details CPU序列号
*/
const char *cm_cpuinfo_get_cpuid(void);
#endif