CDI SDK
SDK for transporting chunks of data reliably and with low latency using a polled mode network driver.
Loading...
Searching...
No Matches
cloudwatch.c File Reference

This file contains internal definitions and implementation used with the SDK that is not part of the API. More...

#include "cloudwatch.h"
#include "cdi_logger_api.h"
#include "cdi_os_api.h"
#include "cloudwatch_sdk_metrics.h"
#include "internal_log.h"
#include "statistics.h"

Data Structures

struct  CloudWatchState
 Structure used to hold state data for statistics. More...
 

Functions

static void FifoFullCallback (const CdiFifoFullCbData *cb_data_ptr)
 
static void CalculateDeltas (CloudWatchState *cw_state_ptr, const CdiTransferStats *transfer_stats_ptr, CloudWatchCounterBasedDeltas *delta_stats_ptr)
 
static CDI_THREAD CloudWatchThread (void *ptr)
 
CdiReturnStatus CloudWatchCreate (CdiConnectionState *con_state_ptr, CloudWatchSdkMetricsHandle cw_sdk_handle, CloudWatchHandle *return_handle_ptr)
 
CdiReturnStatus CloudWatchDestroy (CloudWatchHandle handle)
 
CdiReturnStatus CloudWatchConfigure (CloudWatchHandle handle, const CdiStatsConfigData *stats_config_ptr)
 
void CloudWatchStatisticsMessage (CloudWatchHandle handle, int stats_count, const CdiTransferStats *transfer_stats_array)
 

Detailed Description

This file contains internal definitions and implementation used with the SDK that is not part of the API.

Function Documentation

◆ CalculateDeltas()

static void CalculateDeltas ( CloudWatchState * cw_state_ptr,
const CdiTransferStats * transfer_stats_ptr,
CloudWatchCounterBasedDeltas * delta_stats_ptr )
static

This function computes the differences in the statistics contained in two data sets.

Parameters
cw_state_ptrPointer to the CloudWatch statistics state.
transfer_stats_ptrAddress of the new statistics data set.
delta_stats_ptrPointer to where the results are to be written.

◆ CloudWatchConfigure()

CdiReturnStatus CloudWatchConfigure ( CloudWatchHandle handle,
const CdiStatsConfigData * stats_config_ptr )

Configure transfer statistics.

Parameters
handleThe handle of the connection to set statistics configuration.
stats_config_ptrPointer to stats configuration data.
Returns
A value from the CdiReturnStatus enumeration.

◆ CloudWatchCreate()

CdiReturnStatus CloudWatchCreate ( CdiConnectionState * con_state_ptr,
CloudWatchSdkMetricsHandle cw_sdk_handle,
CloudWatchHandle * return_handle_ptr )

Create an instance of the statistics component for the specified connection.

Parameters
con_state_ptrPointer to connection state data.
cw_sdk_handleCloudWatch SDK instance handle
return_handle_ptrAddress where to write returned statistics handle.
Returns
A value from the CdiReturnStatus enumeration.

◆ CloudWatchDestroy()

CdiReturnStatus CloudWatchDestroy ( CloudWatchHandle handle)

Free all resources related to the specified statistics component.

Parameters
handleHandle of statistics component.
Returns
A value from the CdiReturnStatus enumeration.

◆ CloudWatchStatisticsMessage()

void CloudWatchStatisticsMessage ( CloudWatchHandle handle,
int stats_count,
const CdiTransferStats * transfer_stats_array )

Process a message that contains new statistics to post to CloudWatch.

Parameters
handleHandle of statistics component.
stats_countNumber of array items in transfer_stats_array.
transfer_stats_arrayPointer to start of transfer stats array.

◆ CloudWatchThread()

static CDI_THREAD CloudWatchThread ( void * ptr)
static

Statistic gathering thread used to invoke registered callback functions when new statistics are available.

Parameters
ptrPointer to thread specific data. In this case, a pointer to CloudWatchState.
Returns
The return value is not used.

◆ FifoFullCallback()

static void FifoFullCallback ( const CdiFifoFullCbData * cb_data_ptr)
static

Function that will be called whenever the CloudWatch stats FIFO is full. It accumulates the new statistics into the set waiting at the head of the queue.

Parameters
cb_data_ptrThe address of the callback data structure cantaining the parameters provided by the FIFO.