[cli] mac/mle counters reset (#4341)

* Add counters reset cli command
This commit is contained in:
Piotr Koziar
2019-11-20 03:35:06 +01:00
committed by Jonathan Hui
parent ab3a1ef6d4
commit 61088c7782
2 changed files with 30 additions and 4 deletions
+18 -3
View File
@@ -892,9 +892,9 @@ void Interpreter::ProcessCounters(int argc, char *argv[])
mServer->OutputFormat("mac\r\n");
mServer->OutputFormat("mle\r\n");
}
else if (argc == 1)
else if (strcmp(argv[0], "mac") == 0)
{
if (strcmp(argv[0], "mac") == 0)
if (argc == 1)
{
const otMacCounters *macCounters = otLinkGetCounters(mInstance);
@@ -930,7 +930,18 @@ void Interpreter::ProcessCounters(int argc, char *argv[])
mServer->OutputFormat(" RxErrFcs: %d\r\n", macCounters->mRxErrFcs);
mServer->OutputFormat(" RxErrOther: %d\r\n", macCounters->mRxErrOther);
}
else if (strcmp(argv[0], "mle") == 0)
else if ((argc == 2) && (strcmp(argv[0], "reset") == 0))
{
otLinkResetCounters(mInstance);
}
else
{
ExitNow(error = OT_ERROR_INVALID_ARGS);
}
}
else if (strcmp(argv[0], "mle") == 0)
{
if (argc == 1)
{
const otMleCounters *mleCounters = otThreadGetMleCounters(mInstance);
@@ -945,6 +956,10 @@ void Interpreter::ProcessCounters(int argc, char *argv[])
mleCounters->mBetterPartitionAttachAttempts);
mServer->OutputFormat("Parent Changes: %d\r\n", mleCounters->mParentChanges);
}
else if ((argc == 2) && (strcmp(argv[0], "reset") == 0))
{
otThreadResetMleCounters(mInstance);
}
else
{
ExitNow(error = OT_ERROR_INVALID_ARGS);