TuyaOS
tuya_devos_health.h
浏览该文件的文档.
1
12#ifndef __TUYA_DEVOS_HEALTH_H__
13#define __TUYA_DEVOS_HEALTH_H__
14
15#include "tuya_cloud_com_defs.h"
16#include "tuya_hal_thread.h"
17#include "tal_mutex.h"
18#include "uni_pointer.h"
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
24// 默认health monitor检测时间间隔(暂定)
25#define HEALTH_SLEEP_INTERVAL (5)
26// 默认系统上报健康状态时间
27#define HEALTH_REPORT_INTERVAL (60 * 60)
28// 默认系统最小free内存门限设置为5K,正常访问云端、FLASH需要4K内存以上(暂定)
29#define HEALTH_FREE_MEM_THRESHOLD (1024*8)
30// 默认系统最小内存块门限设置为5K,正常访问云端、FLASH需要一次性分配4K内存以上(暂定)
31#define HEALTH_LARGEST_MEM_BLOK_THRESHOLD (1024*5)
32// 默认系统HTTP访问拒绝、sign校验错误次数
33#define HEALTH_HTTP_FAILED_THRESHOLD (5)
34
35// 默认系统最大workq depth
36#define HEALTH_WORKQ_THRESHOLD (50)
37// 默认系统最大msgq num
38#define HEALTH_MSGQ_THRESHOLD (50)
39// 默认系统最大timeq num
40#define HEALTH_TIMEQ_THRESHOLD (100)
41
42//health指标,必须在g_health_policy顺序定义,不然global type重新分配会不准
43typedef INT_T HEALTH_MONITOR_RULE_E;
44#define HEALTH_RULE_FREE_MEM_SIZE 0
45#define HEALTH_RULE_MAX_MEM_SIZE 1
46#define HEALTH_RULE_ATOP_REFUSE 2
47#define HEALTH_RULE_ATOP_SIGN_FAILED 3
48#define HEALTH_RULE_WORKQ_DEPTH 4
49#define HEALTH_RULE_MSGQ_NUM 5
50#define HEALTH_RULE_TIMER_NUM 6
51#define HEALTH_RULE_FEED_WATCH_DOG 7
52#define HEALTH_RULE_RUNTIME_REPT 8
53
54typedef VOID (*health_notify_cb)();
55typedef BOOL_T(*health_query_cb)();
56
57typedef struct {
58 INT_T type; // 检测指标
59 UINT_T threshold; // 门限(发生次数)
60 UINT_T detect_period; // 检测周期
61 health_query_cb query_cb; // 指标查询回调,如果事件型可填NULL
62 health_notify_cb notify_cb; // 指标通知回调
64
65typedef struct {
66 INT_T type;
68
77INT_T tuya_devos_health_init_and_start(CONST INT_T watch_dog_interval, CONST INT_T monitor_detect_interval);
78
89INT_T tuya_devos_add_health_item(UINT_T threshold, UINT_T period, health_query_cb query, health_notify_cb notify);
90
98
106VOID tuya_devos_update_health_item_period(INT_T type, UINT_T period);
107
115VOID tuya_devos_update_health_item_threshold(INT_T type, UINT_T threshold);
116
122
123#ifdef __cplusplus
124}
125#endif
126
127#endif
Definition: tuya_devos_health.h:57
Definition: tuya_devos_health.h:65
Common process - adapter the mutex api provide by OS
VOID tuya_devos_update_health_item_period(INT_T type, UINT_T period)
update health item period
INT_T tuya_devos_health_init_and_start(CONST INT_T watch_dog_interval, CONST INT_T monitor_detect_interval)
devos health init function
VOID tuya_devos_dump_health_item(VOID)
dump health item
VOID tuya_devos_delete_health_item(INT_T type)
delete health item
VOID tuya_devos_update_health_item_threshold(INT_T type, UINT_T threshold)
update health item threshold
INT_T tuya_devos_add_health_item(UINT_T threshold, UINT_T period, health_query_cb query, health_notify_cb notify)
add health item
Common process - Initialization
tuya bidirection list module