1 /** 2 * @file hi_os_stat.h 3 * 4 * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED. 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 /** 19 * @defgroup os_stat OS Status 20 * @ingroup osa 21 */ 22 23 #ifndef __HI_OS_STAT_H__ 24 #define __HI_OS_STAT_H__ 25 26 #include <hi_types_base.h> 27 28 #define HI_OS_STAT_MSG_WAIT_FAIL 0x1 /**< Used in the interrupt context.CNcomment:中断上下文使用CNend */ 29 #define HI_OS_STAT_MSG_SEND_FAIL 0x2 /**< The timeout period of the interrupt context configuration is not 0, 30 and the queue is full.CNcomment:中断上下文配置超时时间不为0, 31 队列满 CNend */ 32 #define HI_OS_STAT_SEM_WAIT_FAIL 0x4 /**< Used in the interrupt context.CNcomment:中断上下文使用CNend */ 33 #define HI_OS_STAT_SEM_SIGNAL_FAIL 0x8 /**< Repeated release.CNcomment:重复释放CNend */ 34 #define HI_OS_STAT_MUX_PEND_FAIL 0x10 /**< Used in the interrupt context.CNcomment:中断上下文使用CNend */ 35 #define HI_OS_STAT_MUX_POST_FAIL 0x20 /**< Cross-task use, not created.CNcomment:跨任务使用,未创建CNend */ 36 #define HI_OS_STAT_EVENT_WAIT_FAIL 0x40 /**< Used in the interrupt context.CNcomment:中断上下文使用 CNend */ 37 #define HI_OS_STAT_EVENT_SEND_FAIL 0x80 /**< Initialized EVT resources used up. 38 CNcomment:初始化EVT资源已经用完 CNend */ 39 #define HI_OS_STAT_EVENT_CLR_FAIL 0x100 /**< Invalid input argument.CNcomment:入参错误 CNend */ 40 #define HI_OS_STAT_SLEEP_FAIL 0x200 /**< Used in the interrupt context.CNcomment:中断上下文使用CNend */ 41 #define HI_OS_STAT_START_TIMER_FAIL 0x400 /**< Invalid input argument.CNcomment:入参错误 CNend */ 42 #define HI_OS_STAT_CREATE_TIMER_FAIL 0x800 /**< WorkQueue used up.CNcomment:创建定时器句柄失败 CNend */ 43 44 /** 45 * @ingroup os_stat 46 * System resource usage statistic.CNcomment:系统资源使用统计量。CNend 47 */ 48 typedef struct { 49 hi_u8 timer_usage; /**< Number of used system timers.CNcomment:当前使用系统定时器个数 CNend */ 50 hi_u8 task_usage; /**< Number of used tasks.CNcomment:当前使用任务个数 CNend */ 51 hi_u8 sem_usage; /**< Number of used semaphores.CNcomment:当前使用信号量个数 CNend */ 52 hi_u8 queue_usage; /**< Number of used message queues.CNcomment:当前使用消息队列个数 CNend */ 53 hi_u8 mux_usage; /**< Number of used mutexes.CNcomment:当前使用互斥锁个数 CNend */ 54 hi_u8 event_usage; /**< Number of used events.CNcomment:当前使用事件个数 CNend */ 55 hi_u16 err_info; /**< Error statistic HI_OS_STAT_XXX, used to log occurred errors. 56 CNcomment:错误统计量HI_OS_STAT_XXX,用于记录曾经出现过的错误 CNend */ 57 }hi_os_resource_use_stat; 58 59 /** 60 * @ingroup os_stat 61 * @brief Obtains the system resource usage.CNcomment:获取当前系统资源使用情况。CNend 62 * 63 * @par 描述: 64 * Obtains the system resource usage.CNcomment:获取当前系统资源使用情况。CNend 65 * 66 * @attention None 67 * @param os_resource_stat [OUT] type #hi_os_resource_use_stat*,System resource usage statistic. 68 CNcomment:系统资源使用统计量。CNend 69 * 70 * @retval #0 Success. 71 * @retval #Other Failure. For details, see hi_errno.h 72 * @par 依赖: 73 * @li hi_os_stat.h:Describes system resource usage APIs. 74 CNcomment:文件用于描述定时器相关接口。CNend 75 * @see None 76 */ 77 hi_u32 hi_os_get_resource_status(hi_os_resource_use_stat *os_resource_stat); 78 79 #endif 80 81