net: Add statistics how long packets have spent in RX path
Calculate how long on average net_pkt has spent on its way from network device driver to the application. The data is only calculated for UDP and TCP network packets. Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
parent
bb9c453777
commit
8d3b74ab61
6 changed files with 120 additions and 4 deletions
|
@ -97,9 +97,10 @@ struct net_pkt {
|
|||
struct net_if *orig_iface; /* Original network interface */
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NET_PKT_TIMESTAMP) || defined(CONFIG_NET_PKT_TXTIME)
|
||||
#if defined(CONFIG_NET_PKT_TIMESTAMP) || defined(CONFIG_NET_PKT_TXTIME) || \
|
||||
defined(CONFIG_NET_PKT_RXTIME_STATS)
|
||||
union {
|
||||
#if defined(CONFIG_NET_PKT_TIMESTAMP)
|
||||
#if defined(CONFIG_NET_PKT_TIMESTAMP) || defined(CONFIG_NET_PKT_RXTIME_STATS)
|
||||
/** Timestamp if available. */
|
||||
struct net_ptp_time timestamp;
|
||||
#endif /* CONFIG_NET_PKT_TIMESTAMP */
|
||||
|
|
|
@ -210,6 +210,14 @@ struct net_stats_tx_time {
|
|||
net_stats_t time_count;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Network packet receive times for calculating average RX time
|
||||
*/
|
||||
struct net_stats_rx_time {
|
||||
u64_t sum;
|
||||
net_stats_t count;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Traffic class statistics
|
||||
*/
|
||||
|
@ -222,6 +230,7 @@ struct net_stats_tc {
|
|||
} sent[NET_TC_TX_COUNT];
|
||||
|
||||
struct {
|
||||
struct net_stats_rx_time rx_time;
|
||||
net_stats_t pkts;
|
||||
net_stats_t bytes;
|
||||
u8_t priority;
|
||||
|
@ -288,6 +297,11 @@ struct net_stats {
|
|||
/** Network packet TX time statistics */
|
||||
struct net_stats_tx_time tx_time;
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NET_PKT_RXTIME_STATS)
|
||||
/** Network packet RX time statistics */
|
||||
struct net_stats_rx_time rx_time;
|
||||
#endif
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue