summaryrefslogtreecommitdiffstats
path: root/qos.pl
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2016-07-21 19:59:30 +0200
committerFlorian Pritz <bluewind@xinu.at>2016-07-21 19:59:30 +0200
commit40d80853ce253690d1934e77c64076b6c1f038dd (patch)
treea2f78f050583abc5f0deee62adda32a2cb877ab5 /qos.pl
parent9e1108d3957b6738414a0df408d10598718e8cd5 (diff)
downloadbin-40d80853ce253690d1934e77c64076b6c1f038dd.tar.gz
bin-40d80853ce253690d1934e77c64076b6c1f038dd.tar.xz
qos.pl: Fix possibly incorrect display of total-tc
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'qos.pl')
-rwxr-xr-xqos.pl12
1 files changed, 11 insertions, 1 deletions
diff --git a/qos.pl b/qos.pl
index 6462135..b953e69 100755
--- a/qos.pl
+++ b/qos.pl
@@ -213,6 +213,17 @@ sub print_output_table {
($rx_speed, $tx_speed) = get_interface_speed($device, $history_size_limit);
}
+ for my $class_id (keys %classes) {
+ if ($history_values->{$class_id}) {
+ my $total_time = reduce {$a + $b->{time_diff}} 0, @{$history_values->{$class_id}};
+ my $total_value = reduce {$a + $b->{value_diff}} 0, @{$history_values->{$class_id}};
+ my $speed = 0;
+
+ $speed = $total_value / $total_time if $total_time != 0;
+ $global_speed += $speed;
+ }
+ }
+
for my $row (@display_rows) {
for my $col (@{$row}) {
if ($col =~ /^total-.*/) {
@@ -245,7 +256,6 @@ sub print_output_table {
my $speed = 0;
$speed = $total_value / $total_time if $total_time != 0;
- $global_speed += $speed;
$output_buffer .= sprintf "%14s (%s): %11s %11s/s", $classes{$class_id}, $class_id, format_bytes($results->{$class_id}), format_bytes($speed);
} else {