Created
November 25, 2014 16:55
-
-
Save gswallow/f15eb90252069bf081fd to your computer and use it in GitHub Desktop.
Get TokuMX Checkpoint times and bytes written
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'mongo' | |
include Mongo | |
c = MongoClient.new('localhost') | |
last_lb = 0 | |
last_nlb = 0 | |
puts "Waiting until #{ARGV[0]} seconds" | |
until Time.now.sec == ARGV[0].to_i | |
puts Time.now.sec | |
sleep 1 | |
end | |
f = File.open('times.txt', 'a') | |
printf("%25s %25s %7s %20s %20s\n", "cp_begin","cp_end","cp_time","leaf_bytes","nonleaf_bytes") | |
f.printf("%25s %25s %7s %20s %20s\n", "cp_begin","cp_end","cp_time","leaf_bytes","nonleaf_bytes") | |
f.close | |
loop do | |
f = File.open('times.txt', 'a') | |
i = 0 | |
cp = c['admin'].command({"serverStatus" => 1})['ft']['checkpoint'] | |
lc = cp['lastComplete'] | |
nlb = cp['write']['nonleaf']['bytes']['uncompressed'] | |
lb = cp['write']['leaf']['bytes']['uncompressed'] | |
printf("%25s %25s %7s %20s %20s\n", lc['begin'], lc['end'], lc['time'], (lb - last_lb).to_s, (lb - last_nlb).to_s) | |
f.printf("%25s %25s %7s %20s %20s\n", lc['begin'], lc['end'], lc['time'], (lb - last_lb).to_s, (lb - last_nlb).to_s) | |
last_lb = lb if lb > last_lb | |
last_nlb = nlb if nlb > last_nlb | |
i = i.next | |
if i == 20 | |
printf("%25s %25s %7s %20s %20s\n", "cp_begin","cp_end","cp_time","leaf_bytes","nonleaf_bytes") | |
f.printf("%25s %25s %7s %20s %20s\n", "cp_begin","cp_end","cp_time","leaf_bytes","nonleaf_bytes") | |
i = 0 | |
end | |
f.close | |
sleep 60 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment