[mesh-forwarder] add time-in-queue statistics collection feature (#9170)

This commit adds the ability to collect statistics on the time
messages spend in the TX queue.

When enabled, a histogram of the time-in-queue is collected. The
time-in-queue is tracked for direct transmissions only, and is
measured as the duration from when a message is added to the TX queue
until it is passed to the MAC layer for transmission or dropped.

The histogram data consists of a number of bins, each representing a
range of time-in-queue values. The bin interval length and maximum
tracked interval can be configured using newly added configuration
options.

This commit also adds a new public OT API and a related CLI command
(`timeinqueue`) to get the collected statistics or reset the data.
This commit is contained in:
Abtin Keshavarzian
2023-07-10 13:34:35 -07:00
committed by GitHub
parent 1839f15417
commit e6df00dd66
9 changed files with 460 additions and 1 deletions
+20
View File
@@ -430,6 +430,26 @@ const otIpCounters *otThreadGetIp6Counters(otInstance *aInstance)
void otThreadResetIp6Counters(otInstance *aInstance) { AsCoreType(aInstance).Get<MeshForwarder>().ResetCounters(); }
#if OPENTHREAD_CONFIG_TX_QUEUE_STATISTICS_ENABLE
const uint32_t *otThreadGetTimeInQueueHistogram(otInstance *aInstance, uint16_t *aNumBins, uint32_t *aBinInterval)
{
AssertPointerIsNotNull(aNumBins);
AssertPointerIsNotNull(aBinInterval);
return AsCoreType(aInstance).Get<MeshForwarder>().GetTimeInQueueHistogram(*aNumBins, *aBinInterval);
}
uint32_t otThreadGetMaxTimeInQueue(otInstance *aInstance)
{
return AsCoreType(aInstance).Get<MeshForwarder>().GetMaxTimeInQueue();
}
void otThreadResetTimeInQueueStat(otInstance *aInstance)
{
return AsCoreType(aInstance).Get<MeshForwarder>().ResetTimeInQueueStat();
}
#endif
const otMleCounters *otThreadGetMleCounters(otInstance *aInstance)
{
return &AsCoreType(aInstance).Get<Mle::MleRouter>().GetCounters();