Sha256: 0b4616ab3fb1a771a58ff3b604c0a13d1a5631da92d116170f553c21947a8d6f
Contents?: true
Size: 1.07 KB
Versions: 14
Compression:
Stored size: 1.07 KB
Contents
#!/usr/bin/env ruby require 'rbbt-util' require 'rbbt/util/simpleopt' $0 = "rbbt #{$previous_commands*""} #{ File.basename(__FILE__) }" if $previous_commands options = SOPT.setup <<EOF Monitor throughput $ rbbt tsv throughput Display summary information. Works with Tokyocabinet HDB and BDB as well. -h--help Help EOF SOPT.usage if options[:help] start = Time.now count = 0 max = 0 avg = 0 all = [] scale = 5 while line = STDIN.gets count += 1 last ||= Time.now if Time.now - last >= 1.0 / scale Log.clear_line puts "Reading #{ Log.color :blue, count*scale } per second. Max #{ Log.color :blue, max*scale }. Average #{Log.color :blue, avg*scale}" max = count > max ? count : max last = Time.now all << count avg = Misc.mean(all).to_i if all.length > 3 count = 0 end end all << count puts "Total #{Log.color :blue, Misc.sum(all).to_i} in #{Log.color :blue, (Time.now - start).to_i} seconds -- #{Log.color :green, (Misc.sum(all).to_f / (Time.now - start)).to_i } per second. Max #{Log.color :blue, max*scale}. Average #{Log.color :green, avg*scale}"
Version data entries
14 entries across 14 versions & 1 rubygems