1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- set ::sleep_time 10
- set ::fail_port 30016
- set ::other_port 30001
- proc avg vector {
- set sum 0.0
- foreach x $vector {
- set sum [expr {$sum+$x}]
- }
- expr {$sum/[llength $vector]}
- }
- set samples {}
- while 1 {
- exec redis-cli -p $::fail_port debug sleep $::sleep_time > /dev/null &
- while 1 {
- set output [exec redis-cli -p $::other_port cluster nodes]
- if {[string match {*fail\?*} $output]} break
- after 100
- }
- puts "FAIL?"
- set start [clock milliseconds]
- while 1 {
- set output [exec redis-cli -p $::other_port cluster nodes]
- if {![string match {*fail\?*} $output]} break
- after 100
- }
- puts "FAIL"
- set now [clock milliseconds]
- set elapsed [expr {$now-$start}]
- puts $elapsed
- lappend samples $elapsed
- puts "AVG([llength $samples]): [avg $samples]"
- exec redis-cli -p $::fail_port ping
- after 2000
- }
|