xtos_ spsc_ get_ stats
Reads queue push, pop, rejection, and overwrite counters.
On this page
Declaration
#include <xtos/spsc.h>
void xtos_spsc_get_stats(const struct xtos_spsc_queue *queue,
struct xtos_spsc_stats *stats);Parameters
| Parameter | Type | Description |
|---|---|---|
| queue | const struct xtos_spsc_queue * | Queue pointer; NULL causes a silent return. |
| stats | struct xtos_spsc_stats * | Non-NULL output structure supplied by the caller. |
Output fields
| Field | Type | Meaning |
|---|---|---|
| pushed | uint64_t | Number of complete frames successfully pushed. |
| popped | uint64_t | Number of complete frames successfully popped. |
| rejected_full | uint64_t | Number of push attempts rejected because the queue was full. |
| rejected_invalid | uint64_t | Number of push attempts rejected for invalid arguments. |
| overwritten | uint64_t | Number of frames overwritten by new frames; the current implementation never overwrites and reads 0. |
Return value
Returns no value; on valid input it writes the five counters individually.
Errors
No errno error return. See Notes for input restrictions.
Notes
- Each counter is read with a separate relaxed atomic load, not as a transactionally consistent snapshot; use it only for observation while concurrent.
- The current push path rejects a full queue rather than overwriting, so overwritten never increments in this implementation and reads as 0; the field remains for interface-level statistics extension.
Example
Source
This reference describes headers and implementation at OpenXTOS commit dd313955ad57542bcd2af8827157d1bbd0cf5e83.