11bd4fe43Sopenharmony_ci/**
21bd4fe43Sopenharmony_ci * @file hi_os_stat.h
31bd4fe43Sopenharmony_ci *
41bd4fe43Sopenharmony_ci * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED.
51bd4fe43Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
61bd4fe43Sopenharmony_ci * you may not use this file except in compliance with the License.
71bd4fe43Sopenharmony_ci * You may obtain a copy of the License at
81bd4fe43Sopenharmony_ci *
91bd4fe43Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
101bd4fe43Sopenharmony_ci *
111bd4fe43Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
121bd4fe43Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
131bd4fe43Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
141bd4fe43Sopenharmony_ci * See the License for the specific language governing permissions and
151bd4fe43Sopenharmony_ci * limitations under the License.
161bd4fe43Sopenharmony_ci */
171bd4fe43Sopenharmony_ci
181bd4fe43Sopenharmony_ci/**
191bd4fe43Sopenharmony_ci * @defgroup os_stat OS Status
201bd4fe43Sopenharmony_ci * @ingroup osa
211bd4fe43Sopenharmony_ci */
221bd4fe43Sopenharmony_ci
231bd4fe43Sopenharmony_ci#ifndef __HI_OS_STAT_H__
241bd4fe43Sopenharmony_ci#define __HI_OS_STAT_H__
251bd4fe43Sopenharmony_ci
261bd4fe43Sopenharmony_ci#include <hi_types_base.h>
271bd4fe43Sopenharmony_ci
281bd4fe43Sopenharmony_ci#define HI_OS_STAT_MSG_WAIT_FAIL     0x1   /**< Used in the interrupt context.CNcomment:中断上下文使用CNend */
291bd4fe43Sopenharmony_ci#define HI_OS_STAT_MSG_SEND_FAIL     0x2   /**< The timeout period of the interrupt context configuration is not 0,
301bd4fe43Sopenharmony_ci                                              and the queue is full.CNcomment:中断上下文配置超时时间不为0,
311bd4fe43Sopenharmony_ci                                              队列满 CNend */
321bd4fe43Sopenharmony_ci#define HI_OS_STAT_SEM_WAIT_FAIL     0x4   /**< Used in the interrupt context.CNcomment:中断上下文使用CNend */
331bd4fe43Sopenharmony_ci#define HI_OS_STAT_SEM_SIGNAL_FAIL   0x8   /**< Repeated release.CNcomment:重复释放CNend */
341bd4fe43Sopenharmony_ci#define HI_OS_STAT_MUX_PEND_FAIL     0x10  /**< Used in the interrupt context.CNcomment:中断上下文使用CNend  */
351bd4fe43Sopenharmony_ci#define HI_OS_STAT_MUX_POST_FAIL     0x20  /**< Cross-task use, not created.CNcomment:跨任务使用,未创建CNend  */
361bd4fe43Sopenharmony_ci#define HI_OS_STAT_EVENT_WAIT_FAIL   0x40  /**< Used in the interrupt context.CNcomment:中断上下文使用 CNend */
371bd4fe43Sopenharmony_ci#define HI_OS_STAT_EVENT_SEND_FAIL   0x80  /**< Initialized EVT resources used up.
381bd4fe43Sopenharmony_ci                                              CNcomment:初始化EVT资源已经用完 CNend */
391bd4fe43Sopenharmony_ci#define HI_OS_STAT_EVENT_CLR_FAIL    0x100 /**< Invalid input argument.CNcomment:入参错误 CNend */
401bd4fe43Sopenharmony_ci#define HI_OS_STAT_SLEEP_FAIL        0x200 /**< Used in the interrupt context.CNcomment:中断上下文使用CNend  */
411bd4fe43Sopenharmony_ci#define HI_OS_STAT_START_TIMER_FAIL  0x400 /**< Invalid input argument.CNcomment:入参错误 CNend */
421bd4fe43Sopenharmony_ci#define HI_OS_STAT_CREATE_TIMER_FAIL 0x800 /**< WorkQueue used up.CNcomment:创建定时器句柄失败 CNend */
431bd4fe43Sopenharmony_ci
441bd4fe43Sopenharmony_ci/**
451bd4fe43Sopenharmony_ci * @ingroup os_stat
461bd4fe43Sopenharmony_ci * System resource usage statistic.CNcomment:系统资源使用统计量。CNend
471bd4fe43Sopenharmony_ci */
481bd4fe43Sopenharmony_citypedef struct {
491bd4fe43Sopenharmony_ci    hi_u8 timer_usage;  /**< Number of used system timers.CNcomment:当前使用系统定时器个数 CNend */
501bd4fe43Sopenharmony_ci    hi_u8 task_usage;   /**< Number of used tasks.CNcomment:当前使用任务个数 CNend */
511bd4fe43Sopenharmony_ci    hi_u8 sem_usage;    /**< Number of used semaphores.CNcomment:当前使用信号量个数 CNend */
521bd4fe43Sopenharmony_ci    hi_u8 queue_usage;  /**< Number of used message queues.CNcomment:当前使用消息队列个数 CNend */
531bd4fe43Sopenharmony_ci    hi_u8 mux_usage;    /**< Number of used mutexes.CNcomment:当前使用互斥锁个数 CNend */
541bd4fe43Sopenharmony_ci    hi_u8 event_usage;  /**< Number of used events.CNcomment:当前使用事件个数 CNend */
551bd4fe43Sopenharmony_ci    hi_u16 err_info;    /**< Error statistic HI_OS_STAT_XXX, used to log occurred errors.
561bd4fe43Sopenharmony_ci                           CNcomment:错误统计量HI_OS_STAT_XXX,用于记录曾经出现过的错误 CNend */
571bd4fe43Sopenharmony_ci}hi_os_resource_use_stat;
581bd4fe43Sopenharmony_ci
591bd4fe43Sopenharmony_ci/**
601bd4fe43Sopenharmony_ci* @ingroup  os_stat
611bd4fe43Sopenharmony_ci* @brief  Obtains the system resource usage.CNcomment:获取当前系统资源使用情况。CNend
621bd4fe43Sopenharmony_ci*
631bd4fe43Sopenharmony_ci* @par 描述:
641bd4fe43Sopenharmony_ci*           Obtains the system resource usage.CNcomment:获取当前系统资源使用情况。CNend
651bd4fe43Sopenharmony_ci*
661bd4fe43Sopenharmony_ci* @attention None
671bd4fe43Sopenharmony_ci* @param  os_resource_stat [OUT] type #hi_os_resource_use_stat*,System resource usage statistic.
681bd4fe43Sopenharmony_ciCNcomment:系统资源使用统计量。CNend
691bd4fe43Sopenharmony_ci*
701bd4fe43Sopenharmony_ci* @retval #0               Success.
711bd4fe43Sopenharmony_ci* @retval #Other           Failure. For details, see hi_errno.h
721bd4fe43Sopenharmony_ci* @par 依赖:
731bd4fe43Sopenharmony_ci*            @li hi_os_stat.h:Describes system resource usage APIs.
741bd4fe43Sopenharmony_ciCNcomment:文件用于描述定时器相关接口。CNend
751bd4fe43Sopenharmony_ci* @see  None
761bd4fe43Sopenharmony_ci*/
771bd4fe43Sopenharmony_cihi_u32 hi_os_get_resource_status(hi_os_resource_use_stat *os_resource_stat);
781bd4fe43Sopenharmony_ci
791bd4fe43Sopenharmony_ci#endif
801bd4fe43Sopenharmony_ci
81