add mac layer counter (#90)

* add mac layer counter

* add more counters and Doxygen for MAC counters

* have a seperate counter for acked data transmission and refine the code based on the comments

* refine counters for acked and unacked transmissions

* fix check test error

* refine code style and use VerifyOrExit to exit

* move all events tracker to tx/rx done task, and add more counters

* fix other error counter

* refine counters structure to be clearer

* add Doxygen for the added thread errors

* fix conflicts
This commit is contained in:
Lu Wang
2016-06-12 15:32:51 +08:00
committed by Jonathan Hui
parent 3576322262
commit 9a7fa9b80e
7 changed files with 281 additions and 36 deletions
+42
View File
@@ -52,6 +52,7 @@ const struct Command Interpreter::sCommands[] =
{ "channel", &ProcessChannel },
{ "childtimeout", &ProcessChildTimeout },
{ "contextreusedelay", &ProcessContextIdReuseDelay },
{ "counter", &ProcessCounters },
{ "extaddr", &ProcessExtAddress },
{ "extpanid", &ProcessExtPanId },
{ "ipaddr", &ProcessIpAddr },
@@ -217,6 +218,47 @@ exit:
AppendResult(error);
}
void Interpreter::ProcessCounters(int argc, char *argv[])
{
if (argc == 0)
{
sServer->OutputFormat("mac\r\n");
sServer->OutputFormat("Done\r\n");
}
else
{
if (strcmp(argv[0], "mac") == 0)
{
const otMacCounters *counters = otGetMacCounters();
sServer->OutputFormat("TxTotal: %d\r\n", counters->mTxTotal);
sServer->OutputFormat(" TxAckRequested: %d\r\n", counters->mTxAckRequested);
sServer->OutputFormat(" TxAcked: %d\r\n", counters->mTxAcked);
sServer->OutputFormat(" TxNoAckRequested: %d\r\n", counters->mTxNoAckRequested);
sServer->OutputFormat(" TxData: %d\r\n", counters->mTxData);
sServer->OutputFormat(" TxDataPoll: %d\r\n", counters->mTxDataPoll);
sServer->OutputFormat(" TxBeacon: %d\r\n", counters->mTxBeacon);
sServer->OutputFormat(" TxBeaconRequest: %d\r\n", counters->mTxBeaconRequest);
sServer->OutputFormat(" TxOther: %d\r\n", counters->mTxOther);
sServer->OutputFormat(" TxRetry: %d\r\n", counters->mTxRetry);
sServer->OutputFormat(" TxErrCca: %d\r\n", counters->mTxErrCca);
sServer->OutputFormat("RxTotal: %d\r\n", counters->mRxTotal);
sServer->OutputFormat(" RxData: %d\r\n", counters->mRxData);
sServer->OutputFormat(" RxDataPoll: %d\r\n", counters->mRxDataPoll);
sServer->OutputFormat(" RxBeacon: %d\r\n", counters->mRxBeacon);
sServer->OutputFormat(" RxBeaconRequest: %d\r\n", counters->mRxBeaconRequest);
sServer->OutputFormat(" RxOther: %d\r\n", counters->mRxOther);
sServer->OutputFormat(" RxWhitelistFiltered: %d\r\n", counters->mRxWhitelistFiltered);
sServer->OutputFormat(" RxDestAddrFiltered: %d\r\n", counters->mRxDestAddrFiltered);
sServer->OutputFormat(" RxErrNoFrame: %d\r\n", counters->mRxErrNoFrame);
sServer->OutputFormat(" RxErrNoUnknownNeighbor: %d\r\n", counters->mRxErrUnknownNeighbor);
sServer->OutputFormat(" RxErrInvalidSrcAddr: %d\r\n", counters->mRxErrInvalidSrcAddr);
sServer->OutputFormat(" RxErrSec: %d\r\n", counters->mRxErrSec);
sServer->OutputFormat(" RxErrFcs: %d\r\n", counters->mRxErrFcs);
sServer->OutputFormat(" RxErrOther: %d\r\n", counters->mRxErrOther);
}
}
}
void Interpreter::ProcessExtAddress(int argc, char *argv[])
{
const uint8_t *extAddress = otGetExtendedAddress();