netstats.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 INRIA
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
21 #include <stdint.h>
22 #include "cib.h"
23 #include "net/l2util.h"
24 #include "mutex.h"
25 
26 #ifndef NET_NETSTATS_H
27 #define NET_NETSTATS_H
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
36 #ifndef NETSTATS_NB_SIZE
37 #define NETSTATS_NB_SIZE (8)
38 #endif
39 
43 #ifndef NETSTATS_NB_QUEUE_SIZE
44 #define NETSTATS_NB_QUEUE_SIZE (4)
45 #endif
46 
51 #define NETSTATS_LAYER2 (0x01)
52 #define NETSTATS_IPV6 (0x02)
53 #define NETSTATS_RPL (0x03)
54 #define NETSTATS_ALL (0xFF)
60 typedef struct {
61  uint32_t tx_unicast_count;
62  uint32_t tx_mcast_count;
64  uint32_t tx_success;
67  uint32_t tx_failed;
68  uint32_t tx_bytes;
69  uint32_t rx_count;
70  uint32_t rx_bytes;
71 } netstats_t;
72 
76 typedef struct {
77 #if IS_USED(MODULE_NETSTATS_NEIGHBOR_TX_TIME) || DOXYGEN
78  uint32_t time_tx_avg;
79 #endif
80 #if IS_USED(MODULE_NETSTATS_NEIGHBOR_ETX) || DOXYGEN
81  uint16_t etx;
82 #endif
83 #if IS_USED(MODULE_NETSTATS_NEIGHBOR_COUNT) || DOXYGEN
84  uint16_t tx_count;
85  uint16_t tx_fail;
86  uint16_t rx_count;
87 #endif
88  uint16_t last_updated;
89  uint16_t last_halved;
90  uint8_t l2_addr[L2UTIL_ADDR_MAX_LEN];
91  uint8_t l2_addr_len;
92  uint8_t freshness;
93 #if IS_USED(MODULE_NETSTATS_NEIGHBOR_RSSI) || DOXYGEN
94  uint8_t rssi;
95 #endif
96 #if IS_USED(MODULE_NETSTATS_NEIGHBOR_LQI) || DOXYGEN
97  uint8_t lqi;
98 #endif
100 
104 typedef struct {
109 
114 
118  uint32_t stats_queue_time_tx[NETSTATS_NB_QUEUE_SIZE];
119 
124 
130 
131 #ifdef __cplusplus
132 }
133 #endif
134 
135 #endif /* NET_NETSTATS_H */
Circular integer buffer interface.
#define L2UTIL_ADDR_MAX_LEN
maximum expected length for addresses
Definition: l2util.h:37
#define NETSTATS_NB_SIZE
The max number of entries in the peer stats table.
Definition: netstats.h:37
#define NETSTATS_NB_QUEUE_SIZE
The CIB size for tx correlation.
Definition: netstats.h:44
Link-layer helper function definitions.
Mutex for thread synchronization.
circular integer buffer structure
Definition: cib.h:34
Mutex structure.
Definition: mutex.h:129
Stats per peer struct.
Definition: netstats.h:76
uint8_t rssi
Average RSSI of received frames in abs([dBm])
Definition: netstats.h:94
uint16_t last_halved
seconds timestamp of last halving
Definition: netstats.h:89
uint16_t tx_fail
Number of sent frames that did not get ACKed.
Definition: netstats.h:85
uint16_t tx_count
Number of sent frames to this peer.
Definition: netstats.h:84
uint16_t etx
ETX of this peer.
Definition: netstats.h:81
uint8_t l2_addr_len
Length of netstats_nb::l2_addr.
Definition: netstats.h:91
uint32_t time_tx_avg
Average frame TX time in ┬Ás.
Definition: netstats.h:78
uint16_t last_updated
seconds timestamp of last update
Definition: netstats.h:88
uint8_t freshness
Freshness counter.
Definition: netstats.h:92
uint8_t lqi
Average LQI of received frames.
Definition: netstats.h:97
uint16_t rx_count
Number of received frames.
Definition: netstats.h:86
L2 Peer Info struct.
Definition: netstats.h:104
mutex_t lock
Neighbor Table access lock.
Definition: netstats.h:128
cib_t stats_idx
CIB for the tx correlation.
Definition: netstats.h:108
Global statistics struct.
Definition: netstats.h:60
uint32_t tx_bytes
sent bytes
Definition: netstats.h:68
uint32_t rx_bytes
received bytes
Definition: netstats.h:70
uint32_t tx_mcast_count
packets sent via multicast (including broadcast)
Definition: netstats.h:62
uint32_t tx_failed
failed sending operations
Definition: netstats.h:67
uint32_t tx_unicast_count
packets sent via unicast
Definition: netstats.h:61
uint32_t rx_count
received (data) packets
Definition: netstats.h:69
uint32_t tx_success
successful sending operations (either acknowledged or unconfirmed sending operation,...
Definition: netstats.h:64