<!DOCTYPE html>
<html>
<head>
</head>
<body>
<dl style="line-height: 1.5; margin-left: 2em">
<dt style="clear: both; float: left; font-weight: bold; width: 8em">Author</dt>
<dd style="margin-left: 8.5em">YUKI Hiroshi <shimo****@clear*****></dd>
<dt style="clear: both; float: left; font-weight: bold; width: 8em">Date</dt>
<dd style="margin-left: 8.5em">2015-04-17 22:37:15 +0900 (Fri, 17 Apr 2015)</dd>
<dt style="clear: both; float: left; font-weight: bold; width: 8em">New Revision</dt>
<dd style="margin-left: 8.5em"><a href="https://github.com/droonga/drndump/commit/c08c31a011e09e3c8c5b0855b5441d30829710d4">c08c31a011e09e3c8c5b0855b5441d30829710d4</a></dd>
<dt style="clear: both; float: left; font-weight: bold; width: 8em">Message</dt>
<dd style="margin-left: 8.5em"><pre style="border: 1px solid #aaa; font-family: Consolas, Menlo, "Liberation Mono", Courier, monospace; line-height: 1.2; padding: 0.5em; width: auto">Avoid zero divide error when the now time is same to previous time</pre></dd>
<dt style="clear: both; float: left; font-weight: bold; width: 8em">Modified files</dt>
<dd style="margin-left: 8.5em">
<ul>
<li><a href="https://github.com/droonga/drndump/commit/c08c31a011e09e3c8c5b0855b5441d30829710d4#diff-0">lib/drndump/dump_client.rb</a></li>
</ul>
</dd>
</dl>
<div class="diff-section" style="clear: both">
<table style="border-collapse: collapse; border: 1px solid #aaa">
<thead>
<tr class="diff-header" style="border: 1px solid #aaa">
<td colspan="3">
<pre style="border: 0; font-family: Consolas, Menlo, "Liberation Mono", Courier, monospace; line-height: 1.2; margin: 0; padding: 0.5em; white-space: normal; width: auto"><span class="diff-header" style="background-color: #eaf2f5; color: #999999; display: block; white-space: pre"> Modified: lib/drndump/dump_client.rb (+9 -2)</span>
<span class="diff-header-mark" style="background-color: #eaf2f5; color: #999999; display: block; white-space: pre">===================================================================</span>
</pre>
</td>
</tr>
</thead>
<tbody>
<tr>
<th class="diff-line-number" style="border: 1px solid #aaa">
<pre style="border: 0; font-family: Consolas, Menlo, "Liberation Mono", Courier, monospace; line-height: 1.2; margin: 0; padding: 0.5em; white-space: normal; width: auto"><span class="diff-line-number-hunk-header" style="display: block; white-space: pre"><a href="https://github.com/droonga/drndump/commit/c08c31a011e09e3c8c5b0855b5441d30829710d4#L0L144">...</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/droonga/drndump/commit/c08c31a011e09e3c8c5b0855b5441d30829710d4#L0L145">145</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/droonga/drndump/commit/c08c31a011e09e3c8c5b0855b5441d30829710d4#L0L146">146</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/droonga/drndump/commit/c08c31a011e09e3c8c5b0855b5441d30829710d4#L0L147">147</a></span>
<span class="diff-line-number-nothing" style="display: block; white-space: pre"> </span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/droonga/drndump/commit/c08c31a011e09e3c8c5b0855b5441d30829710d4#L0L148">148</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/droonga/drndump/commit/c08c31a011e09e3c8c5b0855b5441d30829710d4#L0L149">149</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/droonga/drndump/commit/c08c31a011e09e3c8c5b0855b5441d30829710d4#L0L150">150</a></span>
<span class="diff-line-number-hunk-header" style="display: block; white-space: pre"><a href="https://github.com/droonga/drndump/commit/c08c31a011e09e3c8c5b0855b5441d30829710d4#L0L151">...</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/droonga/drndump/commit/c08c31a011e09e3c8c5b0855b5441d30829710d4#L0L152">152</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/droonga/drndump/commit/c08c31a011e09e3c8c5b0855b5441d30829710d4#L0L153">153</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/droonga/drndump/commit/c08c31a011e09e3c8c5b0855b5441d30829710d4#L0L154">154</a></span>
<span class="diff-line-number-deleted" style="background-color: #ffaaaa; color: #000000; display: block; white-space: pre"><a href="https://github.com/droonga/drndump/commit/c08c31a011e09e3c8c5b0855b5441d30829710d4#L0L155">155</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/droonga/drndump/commit/c08c31a011e09e3c8c5b0855b5441d30829710d4#L0L156">156</a></span>
<span class="diff-line-number-deleted" style="background-color: #ffaaaa; color: #000000; display: block; white-space: pre"><a href="https://github.com/droonga/drndump/commit/c08c31a011e09e3c8c5b0855b5441d30829710d4#L0L157">157</a></span>
<span class="diff-line-number-nothing" style="display: block; white-space: pre"> </span>
<span class="diff-line-number-nothing" style="display: block; white-space: pre"> </span>
<span class="diff-line-number-nothing" style="display: block; white-space: pre"> </span>
<span class="diff-line-number-nothing" style="display: block; white-space: pre"> </span>
<span class="diff-line-number-nothing" style="display: block; white-space: pre"> </span>
<span class="diff-line-number-nothing" style="display: block; white-space: pre"> </span>
<span class="diff-line-number-nothing" style="display: block; white-space: pre"> </span>
<span class="diff-line-number-nothing" style="display: block; white-space: pre"> </span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/droonga/drndump/commit/c08c31a011e09e3c8c5b0855b5441d30829710d4#L0L158">158</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/droonga/drndump/commit/c08c31a011e09e3c8c5b0855b5441d30829710d4#L0L159">159</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/droonga/drndump/commit/c08c31a011e09e3c8c5b0855b5441d30829710d4#L0L160">160</a></span>
</pre>
</th>
<th class="diff-line-number" style="border: 1px solid #aaa">
<pre style="border: 0; font-family: Consolas, Menlo, "Liberation Mono", Courier, monospace; line-height: 1.2; margin: 0; padding: 0.5em; white-space: normal; width: auto"><span class="diff-line-number-hunk-header" style="display: block; white-space: pre"><a href="https://github.com/droonga/drndump/commit/c08c31a011e09e3c8c5b0855b5441d30829710d4#L0R144">...</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/droonga/drndump/commit/c08c31a011e09e3c8c5b0855b5441d30829710d4#L0R145">145</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/droonga/drndump/commit/c08c31a011e09e3c8c5b0855b5441d30829710d4#L0R146">146</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/droonga/drndump/commit/c08c31a011e09e3c8c5b0855b5441d30829710d4#L0R147">147</a></span>
<span class="diff-line-number-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre"><a href="https://github.com/droonga/drndump/commit/c08c31a011e09e3c8c5b0855b5441d30829710d4#L0R148">148</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/droonga/drndump/commit/c08c31a011e09e3c8c5b0855b5441d30829710d4#L0R149">149</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/droonga/drndump/commit/c08c31a011e09e3c8c5b0855b5441d30829710d4#L0R150">150</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/droonga/drndump/commit/c08c31a011e09e3c8c5b0855b5441d30829710d4#L0R151">151</a></span>
<span class="diff-line-number-hunk-header" style="display: block; white-space: pre"><a href="https://github.com/droonga/drndump/commit/c08c31a011e09e3c8c5b0855b5441d30829710d4#L0R152">...</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/droonga/drndump/commit/c08c31a011e09e3c8c5b0855b5441d30829710d4#L0R153">153</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/droonga/drndump/commit/c08c31a011e09e3c8c5b0855b5441d30829710d4#L0R154">154</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/droonga/drndump/commit/c08c31a011e09e3c8c5b0855b5441d30829710d4#L0R155">155</a></span>
<span class="diff-line-number-nothing" style="display: block; white-space: pre"> </span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/droonga/drndump/commit/c08c31a011e09e3c8c5b0855b5441d30829710d4#L0R156">156</a></span>
<span class="diff-line-number-nothing" style="display: block; white-space: pre"> </span>
<span class="diff-line-number-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre"><a href="https://github.com/droonga/drndump/commit/c08c31a011e09e3c8c5b0855b5441d30829710d4#L0R157">157</a></span>
<span class="diff-line-number-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre"><a href="https://github.com/droonga/drndump/commit/c08c31a011e09e3c8c5b0855b5441d30829710d4#L0R158">158</a></span>
<span class="diff-line-number-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre"><a href="https://github.com/droonga/drndump/commit/c08c31a011e09e3c8c5b0855b5441d30829710d4#L0R159">159</a></span>
<span class="diff-line-number-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre"><a href="https://github.com/droonga/drndump/commit/c08c31a011e09e3c8c5b0855b5441d30829710d4#L0R160">160</a></span>
<span class="diff-line-number-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre"><a href="https://github.com/droonga/drndump/commit/c08c31a011e09e3c8c5b0855b5441d30829710d4#L0R161">161</a></span>
<span class="diff-line-number-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre"><a href="https://github.com/droonga/drndump/commit/c08c31a011e09e3c8c5b0855b5441d30829710d4#L0R162">162</a></span>
<span class="diff-line-number-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre"><a href="https://github.com/droonga/drndump/commit/c08c31a011e09e3c8c5b0855b5441d30829710d4#L0R163">163</a></span>
<span class="diff-line-number-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre"><a href="https://github.com/droonga/drndump/commit/c08c31a011e09e3c8c5b0855b5441d30829710d4#L0R164">164</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/droonga/drndump/commit/c08c31a011e09e3c8c5b0855b5441d30829710d4#L0R165">165</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/droonga/drndump/commit/c08c31a011e09e3c8c5b0855b5441d30829710d4#L0R166">166</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/droonga/drndump/commit/c08c31a011e09e3c8c5b0855b5441d30829710d4#L0R167">167</a></span>
</pre>
</th>
<td class="diff-content" style="border: 1px solid #aaa">
<pre style="border: 0; font-family: Consolas, Menlo, "Liberation Mono", Courier, monospace; line-height: 1.2; margin: 0; padding: 0.5em; white-space: normal; width: auto"><span class="diff-hunk-header" style="background-color: #eaf2f5; color: #999999; display: block; white-space: pre">@@ -145,6 +145,7 @@ <span class="diff-context" style="background-color: #ffffaa; color: #000000">module Drndump</span></span>
<span class="diff-not-changed" style="display: block; white-space: pre"> def recent_throughput</span>
<span class="diff-not-changed" style="display: block; white-space: pre"> now = Time.now</span>
<span class="diff-not-changed" style="display: block; white-space: pre"> n_messages = @n_received_messages - @previous_n_received_messages</span>
<span class="diff-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre">+</span>
<span class="diff-not-changed" style="display: block; white-space: pre"> if now - @previous_measure_time < 1</span>
<span class="diff-not-changed" style="display: block; white-space: pre"> now = @previous_measure_time</span>
<span class="diff-not-changed" style="display: block; white-space: pre"> n_messages = @previous_n_received_messages</span>
<span class="diff-hunk-header" style="background-color: #eaf2f5; color: #999999; display: block; white-space: pre">@@ -152,9 +153,15 @@ <span class="diff-context" style="background-color: #ffffaa; color: #000000">module Drndump</span></span>
<span class="diff-not-changed" style="display: block; white-space: pre"> @previous_measure_time = now</span>
<span class="diff-not-changed" style="display: block; white-space: pre"> @previous_n_received_messages = n_messages.to_f</span>
<span class="diff-not-changed" style="display: block; white-space: pre"> end</span>
<span class="diff-deleted" style="background-color: #ffaaaa; color: #000000; display: block; white-space: pre">- elapsed_seconds = now - @measure_start_time</span>
<span class="diff-not-changed" style="display: block; white-space: pre"> </span>
<span class="diff-deleted" style="background-color: #ffaaaa; color: #000000; display: block; white-space: pre">- [n_messages / elapsed_seconds, MIN_REPORTED_THROUGHPUT].max</span>
<span class="diff-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre">+ if now == @measure_start_time</span>
<span class="diff-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre">+ actual_throughput = 0</span>
<span class="diff-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre">+ else</span>
<span class="diff-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre">+ elapsed_seconds = now - @measure_start_time</span>
<span class="diff-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre">+ actual_throughput = n_messages / elapsed_seconds</span>
<span class="diff-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre">+ end</span>
<span class="diff-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre">+</span>
<span class="diff-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre">+ [actual_throughput, MIN_REPORTED_THROUGHPUT].max</span>
<span class="diff-not-changed" style="display: block; white-space: pre"> end</span>
<span class="diff-not-changed" style="display: block; white-space: pre"> </span>
<span class="diff-not-changed" style="display: block; white-space: pre"> def n_remaining_messages</span>
</pre>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>