gnrc_sixlowpan_frag_stats: add average fragments per datagram statistic
This commit is contained in:
parent
81d348cafd
commit
ed9f43ab3a
@ -35,6 +35,8 @@ typedef struct {
|
||||
* reassembly buffer is full */
|
||||
unsigned frag_full; /**< counts the number of events that there where
|
||||
* no @ref gnrc_sixlowpan_frag_fb_t available */
|
||||
unsigned datagrams; /**< reassembled datagrams */
|
||||
unsigned fragments; /**< total fragments of reassembled fragments */
|
||||
#if defined(MODULE_GNRC_SIXLOWPAN_FRAG_VRB) || DOXYGEN
|
||||
unsigned vrb_full; /**< counts the number of events where the virtual
|
||||
* reassembly buffer is full */
|
||||
|
||||
@ -580,6 +580,20 @@ static void _tmp_rm(gnrc_sixlowpan_frag_rb_t *rbuf)
|
||||
#endif /* CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_DEL_TIMER */
|
||||
}
|
||||
|
||||
#if IS_USED(MODULE_GNRC_SIXLOWPAN_FRAG_STATS)
|
||||
static inline unsigned _count_frags(gnrc_sixlowpan_frag_rb_t *rbuf)
|
||||
{
|
||||
unsigned frags = 0;
|
||||
gnrc_sixlowpan_frag_rb_int_t *frag = rbuf->super.ints;
|
||||
|
||||
while (frag) {
|
||||
frag = frag->next;
|
||||
frags++;
|
||||
}
|
||||
return frags;
|
||||
}
|
||||
#endif
|
||||
|
||||
int gnrc_sixlowpan_frag_rb_dispatch_when_complete(gnrc_sixlowpan_frag_rb_t *rbuf,
|
||||
gnrc_netif_hdr_t *netif_hdr)
|
||||
{
|
||||
@ -610,6 +624,10 @@ int gnrc_sixlowpan_frag_rb_dispatch_when_complete(gnrc_sixlowpan_frag_rb_t *rbuf
|
||||
new_netif_hdr->lqi = netif_hdr->lqi;
|
||||
new_netif_hdr->rssi = netif_hdr->rssi;
|
||||
LL_APPEND(rbuf->pkt, netif);
|
||||
#if IS_USED(MODULE_GNRC_SIXLOWPAN_FRAG_STATS)
|
||||
gnrc_sixlowpan_frag_stats_get()->fragments += _count_frags(rbuf);
|
||||
gnrc_sixlowpan_frag_stats_get()->datagrams++;
|
||||
#endif
|
||||
gnrc_sixlowpan_dispatch_recv(rbuf->pkt, NULL, 0);
|
||||
_tmp_rm(rbuf);
|
||||
}
|
||||
|
||||
@ -28,6 +28,8 @@ int _gnrc_6lo_frag_stats(int argc, char **argv)
|
||||
#ifdef MODULE_GNRC_SIXLOWPAN_FRAG_VRB
|
||||
printf("VRB full: %u\n", stats->vrb_full);
|
||||
#endif
|
||||
printf("frags complete: %u\n", stats->fragments);
|
||||
printf("dgs complete: %u\n", stats->datagrams);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user