Queuing Statistics

All Python classes for queuing disciplines (and their queuing classes, if classful) provide a get_stats() method to access queuing statistics. This method returns a QStats object which contains the statistics that are common across queuing disciplines/classes. Queuing disciplines/classes (e.g. HTB) that maintain additional statistics subclass QStats to provide access to those statistics.

QStats

class QStats

QStats holds statistics for either queuing classes or queuing disciplines.

Statistics that are common across all queuing disciplines are accessible as properties. The rest are accessible via getter methods, which subclasses may use to convert to properties.

property bitrate: int

Consumed bandwidth measured in bits/sec

property packetrate: int

Consumed bandwidth measured in packets/sec

property bytes_sent: int

Number of bytes sent.

property packets_sent: int

Number of packets sent.

property dropped_packets: int

Number of packets dropped.

property requeued_packets: int

Number of packets that were requeued for some reason.

get_overlimits() int

Number of times a packet was delayed due to rate limits.

get_byte_backlog() int

Queue backlog in bytes

get_packet_backlog() int

Queue backlog in packets

init_from_output(line_group_iter: LineGroupIter) bool

Initialize attributes from the lines in line_group_iter. The iterator returns the lines of the output of tc -s qdisc ls (or tc class ls) for a single qdisc (or queueing class); the first line of the output has already been consumed, and the 2nd line is the next to be returned.

dump(outfile: TextIO, width: Optional[int] = None) None

Dump the common stats to outfile. There is one stat per line of output. Each line has the format:

header: value

The header: part occupies at least width characters.