File espos_health_policy.h¶
FileList > espos_health > include > espos_health_policy.h
Go to the source code of this file
#include <stdbool.h>#include <stddef.h>#include <stdint.h>#include "esp_err.h"#include "espos_health.h"
Classes¶
| Type | Name |
|---|---|
| struct | espos_health_heap_t |
| struct | espos_health_policy_cfg_t |
| struct | espos_health_policy_port_t |
| struct | espos_health_policy_t |
| struct | espos_health_watched_t |
Public Functions¶
| Type | Name |
|---|---|
| void | espos_health_policy_init (espos_health_policy_t * p, const espos_health_policy_port_t * port, void * ctx, const espos_health_policy_cfg_t * cfg) |
| void | espos_health_policy_kick (espos_health_policy_t * p, void * task) Stamp task alive. |
| espos_health_state_t | espos_health_policy_memory (const espos_health_policy_cfg_t * cfg, const espos_health_heap_t * heap, char * message, size_t message_size, uint32_t * flags) |
| uint32_t | espos_health_policy_tick (espos_health_policy_t * p) One tick. |
| espos_health_state_t | espos_health_policy_trough (const espos_health_policy_cfg_t * cfg, const espos_health_heap_t * h, char * message, size_t message_size) The lowMemory rule on its own: state, message and flags for a heap reading. |
| esp_err_t | espos_health_policy_unwatch (espos_health_policy_t * p, void * task) |
| esp_err_t | espos_health_policy_watch (espos_health_policy_t * p, void * task, const char * name, uint32_t timeout_ms) Register task (a second call for the same task updates it). |
Macros¶
| Type | Name |
|---|---|
| define | ESPOS_HEALTH_TASK_NAME_MAX 16 |
| define | ESPOS_HEALTH_WATCHED_MAX 8 |
Public Functions Documentation¶
function espos_health_policy_init¶
void espos_health_policy_init (
espos_health_policy_t * p,
const espos_health_policy_port_t * port,
void * ctx,
const espos_health_policy_cfg_t * cfg
)
function espos_health_policy_kick¶
Stamp task alive.
Lock-free; unknown tasks are ignored.
function espos_health_policy_memory¶
espos_health_state_t espos_health_policy_memory (
const espos_health_policy_cfg_t * cfg,
const espos_health_heap_t * heap,
char * message,
size_t message_size,
uint32_t * flags
)
function espos_health_policy_tick¶
One tick.
Reports lowMemory (and taskStalled once a task is watched), then counts. Returns the strike count after this tick โ 0 when nothing fatal is held โ so the caller can log "strike 2/3: <key>". When the count reaches cfg.strikes the record is stored, restarting is set and port->restart() is called; a port whose restart returns (the host) sees no further action.
function espos_health_policy_trough¶
The lowMemory rule on its own: state, message and flags for a heap reading.
espos_health_state_t espos_health_policy_trough (
const espos_health_policy_cfg_t * cfg,
const espos_health_heap_t * h,
char * message,
size_t message_size
)
Exposed for tests and for a consumer that wants the same thresholds.
function espos_health_policy_unwatch¶
function espos_health_policy_watch¶
Register task (a second call for the same task updates it).
esp_err_t espos_health_policy_watch (
espos_health_policy_t * p,
void * task,
const char * name,
uint32_t timeout_ms
)
ESP_ERR_NO_MEM when full.
Macro Definition Documentation¶
define ESPOS_HEALTH_TASK_NAME_MAX¶
define ESPOS_HEALTH_WATCHED_MAX¶
The documentation for this class was generated from the following file espos_health/include/espos_health_policy.h