33#ifndef _RTEMS_RECORDCLIENT_H
34#define _RTEMS_RECORDCLIENT_H
36#include "recorddata.h"
51#define RTEMS_RECORD_CLIENT_MAXIMUM_CPU_COUNT 32
54 RTEMS_RECORD_CLIENT_SUCCESS,
55 RTEMS_RECORD_CLIENT_ERROR_INVALID_MAGIC,
56 RTEMS_RECORD_CLIENT_ERROR_UNKNOWN_FORMAT,
57 RTEMS_RECORD_CLIENT_ERROR_UNSUPPORTED_VERSION,
58 RTEMS_RECORD_CLIENT_ERROR_UNSUPPORTED_CPU,
59 RTEMS_RECORD_CLIENT_ERROR_UNSUPPORTED_CPU_MAX,
60 RTEMS_RECORD_CLIENT_ERROR_DOUBLE_CPU_MAX,
61 RTEMS_RECORD_CLIENT_ERROR_DOUBLE_PER_CPU_COUNT,
62 RTEMS_RECORD_CLIENT_ERROR_NO_CPU_MAX,
63 RTEMS_RECORD_CLIENT_ERROR_NO_MEMORY,
64 RTEMS_RECORD_CLIENT_ERROR_PER_CPU_ITEMS_OVERFLOW
65} rtems_record_client_status;
67typedef rtems_record_client_status ( *rtems_record_client_handler )(
78 uint64_t time_accumulated;
85#define RTEMS_RECORD_CLIENT_HOLD_BACK_REALLOCATION_LIMIT 0x100000
133 uint64_t to_bt_scaler;
137 uint32_t per_cpu_items;
140 rtems_record_item_64 format_64;
144 rtems_record_client_status ( *consume )(
149 rtems_record_client_handler handler;
152 uint32_t header[ 2 ];
153 rtems_record_client_status status;
168 rtems_record_client_handler handler,
197static inline void rtems_record_client_set_handler(
199 rtems_record_client_handler handler
202 ctx->handler = handler;
205static inline uint64_t rtems_record_client_bintime_to_nanoseconds(
210 uint64_t nanoseconds;
212 ns_per_sec = 1000000000ULL;
213 nanoseconds = ns_per_sec * ( (uint32_t) ( bt >> 32 ) );
214 nanoseconds += ( ns_per_sec * (uint32_t) bt ) >> 32;
219static inline void rtems_record_client_bintime_to_seconds_and_nanoseconds(
222 uint32_t *nanoseconds
227 ns_per_sec = 1000000000ULL;
228 *seconds = (uint32_t) ( bt >> 32 );
229 *nanoseconds = (uint32_t) ( ( ns_per_sec * (uint32_t) bt ) >> 32 );
rtems_record_client_status rtems_record_client_init(rtems_record_client_context *ctx, rtems_record_client_handler handler, void *arg)
Initializes a record client.
Definition: record-client.c:634
void rtems_record_client_destroy(rtems_record_client_context *ctx)
Drains all internal buffers and frees the allocated resources.
Definition: record-client.c:704
rtems_record_event
The record events.
Definition: recorddata.h:90
rtems_record_client_status rtems_record_client_run(rtems_record_client_context *ctx, const void *buf, size_t n)
Runs the record client to consume new stream data.
Definition: record-client.c:657
Definition: recordclient.h:132
Definition: recordclient.h:87
bool uptime_low_valid
If true, then uptime low value is valid.
Definition: recordclient.h:106
uint64_t last_bt
The binary time of the last item.
Definition: recordclient.h:96
rtems_record_item_64 * items
Storage for hold back items.
Definition: recordclient.h:119
size_t item_capacity
The item capacity of the hold back storage.
Definition: recordclient.h:124
bool hold_back
If true, then hold back items.
Definition: recordclient.h:111
rtems_record_client_uptime uptime
Event time to uptime maintenance.
Definition: recordclient.h:91
size_t item_index
The index for the next hold back item.
Definition: recordclient.h:129
uint32_t uptime_low
Last RTEMS_RECORD_UPTIME_LOW data.
Definition: recordclient.h:101
Definition: recordclient.h:75
The 32-bit format record item.
Definition: recorddata.h:1200