//-------------------------------------------------------------------------------------------------- void TestMdc_Stat ( void ) { pa_mdc_PktStatistics_t dataStatistics; dataStatistics.transmittedBytesCount = 123456789; dataStatistics.receivedBytesCount = 369258147; /* Set the statistics value to the pa */ pa_mdcSimu_SetDataFlowStatistics(&dataStatistics); uint64_t rxBytes; uint64_t txBytes; /* Get the statistics and check the values */ le_result_t res = le_mdc_GetBytesCounters(&rxBytes, &txBytes); LE_ASSERT(res == LE_OK); LE_ASSERT(rxBytes == dataStatistics.receivedBytesCount); LE_ASSERT(txBytes == dataStatistics.transmittedBytesCount); /* Reset counter, check again statistics (0 values expected) */ res = le_mdc_ResetBytesCounter(); LE_ASSERT(res == LE_OK); res = le_mdc_GetBytesCounters(&rxBytes, &txBytes); LE_ASSERT(res == LE_OK); LE_ASSERT(rxBytes == 0); LE_ASSERT(txBytes == 0); }
//-------------------------------------------------------------------------------------------------- static void TestMdc_Stat ( void ) { uint64_t rxBytes; uint64_t txBytes; pa_mdc_PktStatistics_t dataStatistics; /* Set the statistics value to the pa */ dataStatistics.transmittedBytesCount = 123456789; dataStatistics.receivedBytesCount = 369258147; pa_mdcSimu_SetDataFlowStatistics(&dataStatistics); /* Get the statistics and check the values */ LE_ASSERT_OK(le_mdc_GetBytesCounters(&rxBytes, &txBytes)); LE_ASSERT(rxBytes == dataStatistics.receivedBytesCount); LE_ASSERT(txBytes == dataStatistics.transmittedBytesCount); /* Reset counter, check again statistics (0 values expected) */ LE_ASSERT_OK(le_mdc_ResetBytesCounter()); LE_ASSERT_OK(le_mdc_GetBytesCounters(&rxBytes, &txBytes)); LE_ASSERT(rxBytes == 0); LE_ASSERT(txBytes == 0); /* Stop and start statistics counters */ LE_ASSERT_OK(le_mdc_StopBytesCounter()); LE_ASSERT_OK(le_mdc_StartBytesCounter()); }
// ------------------------------------------------------------------------------------------------- static void Datainfo ( char* buffer ///< [OUT] On success or failure, a message is written to this buffer. ) { uint64_t rxBytes=0; uint64_t txBytes=0; if (le_mdc_GetBytesCounters(&rxBytes,&txBytes) != LE_OK) { sprintf(buffer, "Failed to get bytes statistics."); return; } sprintf(buffer, "Data bytes statistics: Received: %"PRIu64", Transmitted: %"PRIu64" ", rxBytes, txBytes); }