Loading...
Searching...
No Matches
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
9#pragma once
10
22
23#include <stdint.h>
24#include "cib.h"
25#include "net/l2util.h"
26#include "mutex.h"
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
35#ifndef NETSTATS_NB_SIZE
36#define NETSTATS_NB_SIZE (8)
37#endif
38
42#ifndef NETSTATS_NB_QUEUE_SIZE
43#define NETSTATS_NB_QUEUE_SIZE (4)
44#endif
45
50#define NETSTATS_LAYER2 (0x01)
51#define NETSTATS_IPV6 (0x02)
52#define NETSTATS_RPL (0x03)
53#define NETSTATS_ALL (0xFF)
55
59typedef struct {
61 uint32_t tx_mcast_count;
63 uint32_t tx_success;
66 uint32_t tx_failed;
67 uint32_t tx_bytes;
68 uint32_t rx_count;
69 uint32_t rx_bytes;
71
75typedef struct {
76#if IS_USED(MODULE_NETSTATS_NEIGHBOR_TX_TIME) || DOXYGEN
77 uint32_t time_tx_avg;
78#endif
79#if IS_USED(MODULE_NETSTATS_NEIGHBOR_ETX) || DOXYGEN
80 uint16_t etx;
81#endif
82#if IS_USED(MODULE_NETSTATS_NEIGHBOR_COUNT) || DOXYGEN
83 uint16_t tx_count;
84 uint16_t tx_fail;
85 uint16_t rx_count;
86#endif
87 uint16_t last_updated;
88 uint16_t last_halved;
90 uint8_t l2_addr_len;
91 uint8_t freshness;
92#if IS_USED(MODULE_NETSTATS_NEIGHBOR_RSSI) || DOXYGEN
93 uint8_t rssi;
94#endif
95#if IS_USED(MODULE_NETSTATS_NEIGHBOR_LQI) || DOXYGEN
96 uint8_t lqi;
97#endif
99
129
130#ifdef __cplusplus
131}
132#endif
133
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:36
#define NETSTATS_NB_QUEUE_SIZE
The CIB size for tx correlation.
Definition netstats.h:43
Link-layer helper function definitions.
Mutex for thread synchronization.
circular integer buffer structure
Definition cib.h:44
Mutex structure.
Definition mutex.h:39
Stats per peer struct.
Definition netstats.h:75
uint8_t rssi
Average RSSI of received frames in abs([dBm])
Definition netstats.h:93
uint16_t last_halved
seconds timestamp of last halving
Definition netstats.h:88
uint16_t tx_fail
Number of sent frames that did not get ACKed.
Definition netstats.h:84
uint16_t tx_count
Number of sent frames to this peer.
Definition netstats.h:83
uint16_t etx
ETX of this peer.
Definition netstats.h:80
uint8_t l2_addr_len
Length of netstats_nb::l2_addr.
Definition netstats.h:90
uint32_t time_tx_avg
Average frame TX time in µs.
Definition netstats.h:77
uint8_t l2_addr[L2UTIL_ADDR_MAX_LEN]
Link layer address of the neighbor.
Definition netstats.h:89
uint16_t last_updated
seconds timestamp of last update
Definition netstats.h:87
uint8_t freshness
Freshness counter.
Definition netstats.h:91
uint8_t lqi
Average LQI of received frames.
Definition netstats.h:96
uint16_t rx_count
Number of received frames.
Definition netstats.h:85
L2 Peer Info struct.
Definition netstats.h:103
uint32_t stats_queue_time_tx[NETSTATS_NB_QUEUE_SIZE]
TX timestamp of stats_queue entries.
Definition netstats.h:117
mutex_t lock
Neighbor Table access lock.
Definition netstats.h:127
netstats_nb_t * stats_queue[NETSTATS_NB_QUEUE_SIZE]
send/callback mac association array
Definition netstats.h:112
cib_t stats_idx
CIB for the tx correlation.
Definition netstats.h:107
netstats_nb_t pstats[NETSTATS_NB_SIZE]
Per neighbor statistics array.
Definition netstats.h:122
Global statistics struct.
Definition netstats.h:59
uint32_t tx_bytes
sent bytes
Definition netstats.h:67
uint32_t rx_bytes
received bytes
Definition netstats.h:69
uint32_t tx_mcast_count
packets sent via multicast (including broadcast)
Definition netstats.h:61
uint32_t tx_failed
failed sending operations
Definition netstats.h:66
uint32_t tx_unicast_count
packets sent via unicast
Definition netstats.h:60
uint32_t rx_count
received (data) packets
Definition netstats.h:68
uint32_t tx_success
successful sending operations (either acknowledged or unconfirmed sending operation,...
Definition netstats.h:63