Exemple #1
0
U64 openavbListenerGetStat(tl_state_t *pTLState, tl_stat_t stat)
{
	AVB_TRACE_ENTRY(AVB_TRACE_TL);
	U64 val = 0;

	if (!pTLState) {
		AVB_LOG_ERROR("Invalid TLState");
		AVB_TRACE_EXIT(AVB_TRACE_TL);
		return 0;
	}

	listener_data_t *pListenerData = pTLState->pPvtListenerData;
	if (!pListenerData) {
		AVB_LOG_ERROR("Invalid private listener data");
		AVB_TRACE_EXIT(AVB_TRACE_TL);
		return 0;
	}

	LOCK_STATS();
	switch (stat) {
		case TL_STAT_TX_CALLS:
		case TL_STAT_TX_FRAMES:
		case TL_STAT_TX_LATE:
		case TL_STAT_TX_BYTES:
			break;
		case TL_STAT_RX_CALLS:
			val = pListenerData->stats.totalCalls;
			break;
		case TL_STAT_RX_FRAMES:
			val = pListenerData->stats.totalFrames;
			break;
		case TL_STAT_RX_LOST:
			val = pListenerData->stats.totalLost;
			break;
		case TL_STAT_RX_BYTES:
			val = pListenerData->stats.totalBytes;
			break;
	}
	UNLOCK_STATS();

	AVB_TRACE_EXIT(AVB_TRACE_TL);
	return val;
}
void openavbTalkerAddStat(tl_state_t *pTLState, tl_stat_t stat, U64 val)
{
	AVB_TRACE_ENTRY(AVB_TRACE_TL);

	if (!pTLState) {
		AVB_LOG_ERROR("Invalid TLState");
		AVB_TRACE_EXIT(AVB_TRACE_TL);
		return;
	}

	talker_data_t *pTalkerData = pTLState->pPvtTalkerData;
	if (!pTalkerData) {
		AVB_LOG_ERROR("Invalid private talker data");
		AVB_TRACE_EXIT(AVB_TRACE_TL);
		return;
	}

	LOCK_STATS();
	switch (stat) {
		case TL_STAT_TX_CALLS:
			pTalkerData->stats.totalCalls += val;
			break;
		case TL_STAT_TX_FRAMES:
			pTalkerData->stats.totalFrames += val;
			break;
		case TL_STAT_TX_LATE:
			pTalkerData->stats.totalLate += val;
			break;
		case TL_STAT_TX_BYTES:
			pTalkerData->stats.totalBytes += val;
			break;
		case TL_STAT_RX_CALLS:
		case TL_STAT_RX_FRAMES:
		case TL_STAT_RX_LOST:
		case TL_STAT_RX_BYTES:
			break;
	}
	UNLOCK_STATS();

	AVB_TRACE_EXIT(AVB_TRACE_TL);
}
Exemple #3
0
void openavbListenerClearStats(tl_state_t *pTLState)
{
	AVB_TRACE_ENTRY(AVB_TRACE_TL);

	if (!pTLState) {
		AVB_LOG_ERROR("Invalid TLState");
		AVB_TRACE_EXIT(AVB_TRACE_TL);
		return;
	}

	listener_data_t *pListenerData = pTLState->pPvtListenerData;
	if (!pListenerData) {
		AVB_LOG_ERROR("Invalid private listener data");
		AVB_TRACE_EXIT(AVB_TRACE_TL);
		return;
	}

	LOCK_STATS();
	memset(&pListenerData->stats, 0, sizeof(pListenerData->stats));
	UNLOCK_STATS();

	AVB_TRACE_EXIT(AVB_TRACE_TL);
}