Good morning,
I'm doing some network measurements with a program that collects data from the folder /sys/class/net/<if>/statistics.
In my measurement program, I have a line of code stating that, in a 1 second reading, the rx_dropped and tx_dropped values cannot be higher than the rx_packets and tx_packets values, respectively.
In other words, in 1 second of measurement, the number of received packets that are dropped by the system cannot be higher than the total received packets in that moment (and the same for transmitted packets).
However, I started questioning this logic. In Linux systems, are dropped packets counted in the rx_packets file, or are they dropped before they are even counted has a received packet? The same for the transmitted packets.
If those packets are indeed counted in rx_packets and tx_packets, since my logic applies to 1 second measurements, is it ok to state that the refresh time between the values in rx_dropped and rx_packets is way below 1 second? Otherwise, in 1 second the packets could be counted to rx_packets, but only in the following second would they be dropped and counted for rx_dropped.
Any kind of help is very much appreciated, since I've been doing some research and can't find absolutely nothing on the matter.
I'm doing some network measurements with a program that collects data from the folder /sys/class/net/<if>/statistics.
In my measurement program, I have a line of code stating that, in a 1 second reading, the rx_dropped and tx_dropped values cannot be higher than the rx_packets and tx_packets values, respectively.
In other words, in 1 second of measurement, the number of received packets that are dropped by the system cannot be higher than the total received packets in that moment (and the same for transmitted packets).
However, I started questioning this logic. In Linux systems, are dropped packets counted in the rx_packets file, or are they dropped before they are even counted has a received packet? The same for the transmitted packets.
If those packets are indeed counted in rx_packets and tx_packets, since my logic applies to 1 second measurements, is it ok to state that the refresh time between the values in rx_dropped and rx_packets is way below 1 second? Otherwise, in 1 second the packets could be counted to rx_packets, but only in the following second would they be dropped and counted for rx_dropped.
Any kind of help is very much appreciated, since I've been doing some research and can't find absolutely nothing on the matter.