# Statistics

group (DDS Statistics)

  A quick-and-dirty provisional interface

  Warning

  Unstable API

  Enums

  enum dds_stat_kind

    Kind of statistical value.

    Values:

    enumerator DDS_STAT_KIND_UINT32

      value is a 32-bit unsigned integer

    enumerator DDS_STAT_KIND_UINT64

      value is a 64-bit unsigned integer

    enumerator DDS_STAT_KIND_LENGTHTIME

      value is integral(length(t) dt)

  Functions

  struct dds_statistics *dds_create_statistics(dds_entity_t entity)

    Allocate a new statistics object for entity.

    This allocates and populates a newly allocated `struct dds_statistics` for the specified entity.

    Parameters:

      - entity – [in] the handle of the entity

    Returns:

      a newly allocated and populated statistics structure or NULL if entity is invalid or doesn’t support any statistics.

  dds_return_t dds_refresh_statistics(struct dds_statistics *stat)

    Update a previously created statistics structure with current values.

    Only the time stamp and the values (and “opaque”) may change. The set of keys and the types of the values do not change.

    Parameters:

      - stat – [inout] statistics structure to update the values of

    Return values:

      - DDS_RETCODE_OK – the data was successfully updated

      - DDS_RETCODE_BAD_PARAMETER – stats is a null pointer or the referenced entity no longer exists

      - DDS_RETCODE_PRECONDITION_NOT_MET – library was deinitialized

    Returns:

      success or an error indication

  void dds_delete_statistics(struct dds_statistics *stat)

    Free a previously created statistics object.

    This frees the statistics object. Passing a null pointer is a no-op. The operation succeeds also if the referenced entity no longer exists.

    Parameters:

      - stat – [in] statistics object to free

  struct dds_stat_keyvalue
    #include <dds_statistics.h>

    KeyValue statistics entry.

    Public Members

    const char *name

      name, memory owned by library

    enum dds_stat_kind kind

      value type

    uint32_t u32

      used if kind == DDS_STAT_KIND_UINT32

    uint64_t u64

      used if kind == DDS_STAT_KIND_UINT64

    uint64_t lengthtime

      used if kind == DDS_STAT_KIND_LENGTHTIME

    union dds_stat_keyvalue u

      value

  struct dds_statistics
    #include <dds_statistics.h>

    Statistics container.

    Public Members

    dds_entity_t entity

      handle of entity to which this set of values applies

    uint64_t opaque

      internal data

    dds_time_t time

      time stamp of latest call to dds_refresh_statistics()

    size_t count

      number of key-value pairs

    struct dds_stat_keyvalue kv[]

      data