diff options
author | Florian Pritz <bluewind@xinu.at> | 2016-07-21 19:59:30 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2016-07-21 19:59:30 +0200 |
commit | 40d80853ce253690d1934e77c64076b6c1f038dd (patch) | |
tree | a2f78f050583abc5f0deee62adda32a2cb877ab5 | |
parent | 9e1108d3957b6738414a0df408d10598718e8cd5 (diff) | |
download | bin-40d80853ce253690d1934e77c64076b6c1f038dd.tar.gz bin-40d80853ce253690d1934e77c64076b6c1f038dd.tar.xz |
qos.pl: Fix possibly incorrect display of total-tc
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rwxr-xr-x | qos.pl | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -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 { |