|
libwebsockets
Lightweight C library for HTML5 websockets
|
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Functions | |
| LWS_VISIBLE LWS_EXTERN struct lws_adapt * | lws_adapt_create (int num_levels, uint32_t ewma_halflife_short_us, uint32_t ewma_halflife_long_us) |
| LWS_VISIBLE LWS_EXTERN void | lws_adapt_destroy (struct lws_adapt **padapt) |
| LWS_VISIBLE LWS_EXTERN void | lws_adapt_report (struct lws_adapt *adapt, int success, lws_usec_t us) |
| LWS_VISIBLE LWS_EXTERN void | lws_adapt_report_val (struct lws_adapt *adapt, uint64_t val, lws_usec_t us) |
| LWS_VISIBLE LWS_EXTERN int | lws_adapt_get_level (struct lws_adapt *adapt) |
| LWS_VISIBLE LWS_EXTERN uint64_t | lws_adapt_get_val (struct lws_adapt *adapt, int level, int is_short) |
| LWS_VISIBLE LWS_EXTERN struct lws_adapt * lws_adapt_create | ( | int | num_levels, |
| uint32_t | ewma_halflife_short_us, | ||
| uint32_t | ewma_halflife_long_us ) |
lws_adapt_create() - Create an adaptive performance tracking context
| num_levels | The number of discrete capability levels (0=Best, num_levels-1=Safest) |
| ewma_halflife_short_us | Half-life decay for short-term reaction (e.g. 5 seconds) |
| ewma_halflife_long_us | Half-life decay for long-term recovery (e.g. 60 seconds) |
Returns an opaque tracking object. Level 0 is considered the highest quality but most-demanding state. Level N is the safest fallback.
References LWS_EXTERN, and LWS_VISIBLE.
| LWS_VISIBLE LWS_EXTERN void lws_adapt_destroy | ( | struct lws_adapt ** | padapt | ) |
lws_adapt_destroy() - Destroy the adaptation tracking context
| padapt | Pointer to the adapt context pointer. |
References LWS_EXTERN, and LWS_VISIBLE.
| LWS_VISIBLE LWS_EXTERN void lws_adapt_report | ( | struct lws_adapt * | adapt, |
| int | success, | ||
| lws_usec_t | us ) |
lws_adapt_report() - Report success or failure of the current capability cycle
| adapt | The adaptation context |
| success | 0 if the system failed to meet constraints (lag, frame drop), 1 if it met them |
| us | Current timestamp in microseconds (e.g. from lws_now_usecs()) |
Records a data point. The underlying EWMAs will decay older points based on the elapsed time since the previous report.
References LWS_EXTERN, and LWS_VISIBLE.
| LWS_VISIBLE LWS_EXTERN void lws_adapt_report_val | ( | struct lws_adapt * | adapt, |
| uint64_t | val, | ||
| lws_usec_t | us ) |
lws_adapt_report_val() - Report an arbitrary value tracker for the current capability cycle
| adapt | The adaptation context |
| val | The arbitrary value to track via EWMA (e.g., ping duration) |
| us | Current timestamp in microseconds (e.g. from lws_now_usecs()) |
Records a data point tracking an arbitrary value.
References LWS_EXTERN, and LWS_VISIBLE.
| LWS_VISIBLE LWS_EXTERN int lws_adapt_get_level | ( | struct lws_adapt * | adapt | ) |
lws_adapt_get_level() - Query the recommended capability tier
| adapt | The adaptation context |
Returns the currently recommended level integer (0 ... num_levels-1). If the short-term EWMA falls below a drop threshold, it immediately degrades the recommended internal level. If both the short-term and long-term EWMAs for the lower level are highly stable and the exponential backoff from any previous failure has expired, it recommends an upgrade.
References LWS_EXTERN, and LWS_VISIBLE.
| LWS_VISIBLE LWS_EXTERN uint64_t lws_adapt_get_val | ( | struct lws_adapt * | adapt, |
| int | level, | ||
| int | is_short ) |
lws_adapt_get_val() - Query the EWMA value for a given level
| adapt | The adaptation context |
| level | The level to query |
| is_short | 1 to query the short term EWMA, 0 for the long term EWMA |
Returns the currently tracked EWMA value for a specific level.