gen_write_load.tcl 372 B

123456789101112131415
  1. source tests/support/redis.tcl
  2. proc gen_write_load {host port seconds} {
  3. set start_time [clock seconds]
  4. set r [redis $host $port 1]
  5. $r select 9
  6. while 1 {
  7. $r set [expr rand()] [expr rand()]
  8. if {[clock seconds]-$start_time > $seconds} {
  9. exit 0
  10. }
  11. }
  12. }
  13. gen_write_load [lindex $argv 0] [lindex $argv 1] [lindex $argv 2]