added option Throughput widge to observe transmissions/receptions separately if desired

This commit is contained in:
adamson 2017-02-11 15:52:03 +00:00 committed by Tom Goff
parent c616699d77
commit c147d5b2f5

View file

@ -572,7 +572,7 @@ proc exec_observer_callback { node execnum cmd result status } {
##### #####
################################################################################
array set thruConfig { show 1 avg 1 thresh 250.0 width 10 color #FF0000 }
array set thruConfig { show 1 up 1 down 1 avg 1 thresh 250.0 width 10 color #FF0000 }
# netgraph names of pipe nodes
array set throughput_cache { }
@ -597,7 +597,12 @@ proc widget_thru_config {} {
checkbutton $wi.tlab.avg \
-text "Use exponentially weighted moving average" \
-variable thruConfig(avg)
pack $wi.tlab.show_thru $wi.tlab.avg -side top -anchor w -padx 4
checkbutton $wi.tlab.down \
-text "Include transmissions" -variable thruConfig(down)
checkbutton $wi.tlab.up \
-text "Include receptions" -variable thruConfig(up)
pack $wi.tlab.show_thru $wi.tlab.avg $wi.tlab.down \
$wi.tlab.up -side top -anchor w -padx 4
pack $wi.tlab -side top
frame $wi.msg -borderwidth 4
@ -807,7 +812,14 @@ proc widget_thru_periodic { now } {
set div [expr { (1000.0 / 8.0) * $dt }]
set kbps_down [expr { ([lindex $bytes 0]-[lindex $bytes2 0]) / $div }]
set kbps_up [expr { ([lindex $bytes 1]-[lindex $bytes2 1]) / $div }]
set kbps [expr {$kbps_down + $kbps_up}]
set kbps 0.0
if { $thruConfig(up) } {
set kbps [expr {$kbps + $kbps_up}]
}
if { $thruConfig(down) } {
set kbps [expr {$kbps + $kbps_down}]
}
#set kbps [expr {$kbps_down + $kbps_up}]
if { $thruConfig(avg) } {
if { ![info exists link_thru_avg_stats($key)] } {
@ -920,6 +932,7 @@ proc getstats_link_ifname { link } {
set ifname [ifcByPeer $lnode2 $lnode1]
}
if { $node_num < 0 } { return "" }
set node_num [format %x $node_num]
# TODO: need to determine session number used by daemon
# instead this uses a '*' character for a regexp match against