#!/usr/bin/perl -w use strict; my (%sent, %oldsent, %comp, %drop, %olddrop); while (1) { open FILE, "/sbin/tc -s qdisc show dev ppp0 |"; my $queue; while () { $queue = $1 if ($_ =~ /qdisc ([^:]+):/); $sent{$queue} = $1 if ($_ =~ /Sent (\d+) bytes/); $comp{$queue} = $1 if ($_ =~ /backlog (\d+)p/); $drop{$queue} = $1 if ($_ =~ /dropped (\d+),/); } close FILE; foreach my $q (keys %sent) { print " $q", "\t", scalar ($sent{$q} - ((defined $oldsent{$q}) ? $oldsent{$q} : 0)), "\t\t", "Backlog: ", (defined $comp{$q}) ? $comp{$q} : 0, "p\t\tDropped: ", scalar ($drop{$q} - ((defined $olddrop{$q}) ? $olddrop{$q} : 0)), "\n"; } %oldsent=%sent; %olddrop=%drop; sleep(1); print "\n"; }