Statistics

group 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

const struct dds_stat_keyvalue *dds_lookup_statistic(const struct dds_statistics *stat, const char *name)

Lookup a specific value by name.

This looks up the specified name in the list of keys in stat and returns the address of the key-value pair if present, a null pointer if not. If stat is a null pointer, it returns a null pointer.

Parameters
  • stat[in] statistics object to lookup a name in (or NULL)

  • name[in] name to look for

Returns

The address of the key-value pair inside stat, or NULL if stat is NULL or name does not match a key in `stat.

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.[anonymous] 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