Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

MB-100: render visualize-rebalance timeline in real scale

So that it's easy to compare different runs.

Change-Id: I08282039cf7e5fc1895f8648d5e767843d256575
Reviewed-on: http://review.couchbase.org/25002
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
  • Loading branch information...
commit 7ff8bdc1536960e295b03e19183dc9e7c1802a05 1 parent 2da45f0
Aliaksey Kandratsenka (aka Aliaksei Kandratsenka) alk authored alk committed

Showing 1 changed file with 20 additions and 5 deletions. Show diff stats Hide diff stats

  1. +20 5 scripts/visualize-rebalance.rb
25 scripts/visualize-rebalance.rb
@@ -133,7 +133,7 @@ def next_node_event(node, it)
133 133 $earliest_time = $timelines.flatten.select {|e| e.kind_of?(Numeric)}.min
134 134
135 135 def ts_to_y(ts)
136   - 100 + (ts - $earliest_time) / ($latest_time - $earliest_time) * 10000
  136 + 10 + (ts - $earliest_time)
137 137 end
138 138
139 139 # pp $timelines
@@ -149,14 +149,27 @@ def do_svg(filename, width, height)
149 149 end
150 150 end
151 151
152   -$width_per_node = 200
  152 +$width_per_node = 300
  153 +
  154 +lower_edge = ts_to_y($latest_time)+10
  155 +right_edge = $width_per_node * ($timelines.size + 1)
  156 +
  157 +do_svg(ARGV[0]+".svg", right_edge, lower_edge) do |img|
  158 + pos = $width_per_node*0.5
  159 + time = 100
  160 + while time < ($latest_time - $earliest_time)
  161 + y = ts_to_y(time + $earliest_time)
  162 + width = ((time % 1000 == 0) ? 8 : 2)
  163 + img.line(0, y, right_edge, y, :'stroke-width' => width, :stroke => 'blue', :opacity => 0.2)
  164 + img.text(pos + 6, y + 20 + width * 0.5 + 6, time.to_s, "font-size" => "20px")
  165 + time += 100
  166 + end
153 167
154   -do_svg(ARGV[0]+".svg", $width_per_node * $timelines.size, 12000) do |img|
155 168 $timelines.each_with_index do |(_node, lines), idx|
156 169 lines.reverse!
157   - pos = (idx + 0.5) * $width_per_node
  170 + pos = (idx + 1 + 0.5) * $width_per_node
158 171 # general timeline
159   - img.line pos, 0, pos, 11000, :'stroke-width' => 1, :opacity => 1.0, :stroke => '#000'
  172 + img.line pos, 0, pos, lower_edge, :'stroke-width' => 1, :opacity => 1.0, :stroke => '#000'
160 173
161 174 lines.each do |(start, done, type)|
162 175 start_y = ts_to_y(start)
@@ -173,3 +186,5 @@ def do_svg(filename, width, height)
173 186 end
174 187 end
175 188 end
  189 +
  190 +puts "events range: #{Time.at($earliest_time)}..#{Time.at($latest_time)} (#{$latest_time-$earliest_time})"

0 comments on commit 7ff8bdc

Please sign in to comment.
Something went wrong with that request. Please try again.