XTOS / OPEN SOURCE REAL-TIME SYSTEMOPEN SOURCE · VERSION 0.9.0 · BUILD FROM SOURCE
libxtos-rtxtos_spsc_get_stats

xtos_spsc_get_stats

Reads queue push, pop, rejection, and overwrite counters.

On this page

Declaration

c
#include <xtos/spsc.h>

void xtos_spsc_get_stats(const struct xtos_spsc_queue *queue,
                         struct xtos_spsc_stats *stats);

Parameters

ParameterTypeDescription
queueconst struct xtos_spsc_queue *Queue pointer; NULL causes a silent return.
statsstruct xtos_spsc_stats *Non-NULL output structure supplied by the caller.

Output fields

FieldTypeMeaning
pusheduint64_tNumber of complete frames successfully pushed.
poppeduint64_tNumber of complete frames successfully popped.
rejected_fulluint64_tNumber of push attempts rejected because the queue was full.
rejected_invaliduint64_tNumber of push attempts rejected for invalid arguments.
overwrittenuint64_tNumber 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.