doc/BigBench.html in bigbench-0.0.2 vs doc/BigBench.html in bigbench-0.0.3
- old
+ new
@@ -52,10 +52,12 @@
<li>lib/bigbench/bot.rb
<li>lib/bigbench/configuration.rb
<li>lib/bigbench/executor.rb
<li>lib/bigbench/fragment.rb
<li>lib/bigbench/output.rb
+ <li>lib/bigbench/post_processor/statistics.rb
+ <li>lib/bigbench/post_processor.rb
<li>lib/bigbench/runner.rb
<li>lib/bigbench/store.rb
<li>lib/bigbench/tracker.rb
<li>lib/bigbench/version.rb
</ul>
@@ -86,12 +88,18 @@
<li><a href="#method-c-duration">::duration</a>
<li><a href="#method-c-load_test-21">::load_test!</a>
+ <li><a href="#method-c-post_process">::post_process</a>
+
+ <li><a href="#method-c-post_processors">::post_processors</a>
+
<li><a href="#method-c-run-21">::run!</a>
+ <li><a href="#method-c-run_post_processors-21">::run_post_processors!</a>
+
<li><a href="#method-c-write_local_trackings_to_file-21">::write_local_trackings_to_file!</a>
<li><a href="#method-c-write_store_trackings_to_file-21">::write_store_trackings_to_file!</a>
<li><a href="#method-c-write_trackings_to_store-21">::write_trackings_to_store!</a>
@@ -145,10 +153,22 @@
<li><a href="./BigBench/Fragment/Fragment.html">BigBench::Fragment::Fragment</a>
<li><a href="./BigBench/Output.html">BigBench::Output</a>
+ <li><a href="./BigBench/PostProcessor.html">BigBench::PostProcessor</a>
+
+ <li><a href="./BigBench/PostProcessor/Environment.html">BigBench::PostProcessor::Environment</a>
+
+ <li><a href="./BigBench/PostProcessor/InvalidProcessor.html">BigBench::PostProcessor::InvalidProcessor</a>
+
+ <li><a href="./BigBench/PostProcessor/Processor.html">BigBench::PostProcessor::Processor</a>
+
+ <li><a href="./BigBench/PostProcessor/Statistics.html">BigBench::PostProcessor::Statistics</a>
+
+ <li><a href="./BigBench/PostProcessor/Test.html">BigBench::PostProcessor::Test</a>
+
<li><a href="./BigBench/Runner.html">BigBench::Runner</a>
<li><a href="./BigBench/Runner/NoBenchmarksDefined.html">BigBench::Runner::NoBenchmarksDefined</a>
<li><a href="./BigBench/Store.html">BigBench::Store</a>
@@ -238,12 +258,11 @@
<div class="method-source-code" id="benchmark-source">
<pre><span class="ruby-comment"># File lib/bigbench/benchmark.rb, line 101</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">benchmark</span>(<span class="ruby-identifier">options</span>)
- <span class="ruby-keyword">return</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">block_given?</span>
- <span class="ruby-constant">Benchmark</span>.<span class="ruby-identifier">add</span>(<span class="ruby-identifier">options</span>, &<span class="ruby-constant">Proc</span>.<span class="ruby-identifier">new</span>)
+ <span class="ruby-constant">Benchmark</span>.<span class="ruby-identifier">add</span>(<span class="ruby-identifier">options</span>, &<span class="ruby-constant">Proc</span>.<span class="ruby-identifier">new</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">block_given?</span>
<span class="ruby-keyword">end</span></pre>
</div><!-- benchmark-source -->
</div>
@@ -267,11 +286,11 @@
<p>List all available benchmarks</p>
<div class="method-source-code" id="benchmarks-source">
- <pre><span class="ruby-comment"># File lib/bigbench/benchmark.rb, line 107</span>
+ <pre><span class="ruby-comment"># File lib/bigbench/benchmark.rb, line 106</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">benchmarks</span>
<span class="ruby-constant">Benchmark</span>.<span class="ruby-identifier">all</span>
<span class="ruby-keyword">end</span></pre>
</div><!-- benchmarks-source -->
@@ -405,11 +424,11 @@
one</p>
<div class="method-source-code" id="duration-source">
- <pre><span class="ruby-comment"># File lib/bigbench/benchmark.rb, line 112</span>
+ <pre><span class="ruby-comment"># File lib/bigbench/benchmark.rb, line 111</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">duration</span>
<span class="ruby-constant">Benchmark</span>.<span class="ruby-identifier">max_duration</span>
<span class="ruby-keyword">end</span></pre>
</div><!-- duration-source -->
@@ -460,10 +479,124 @@
</div><!-- load_test-21-method -->
+ <div id="method-c-post_process" class="method-detail ">
+
+ <div class="method-heading">
+ <span class="method-name">post_process</span><span
+ class="method-args">(processor = nil)</span>
+ <span class="method-click-advice">click to toggle source</span>
+ </div>
+
+
+ <div class="method-description">
+
+ <p>To setup a post processor simply do this:</p>
+
+<pre>post_process do
+ # Some code that is executed after the tests, like a database update, twitter post, email etc.
+end</pre>
+
+<p>Or use one of the predefined post processor or write one yourself:</p>
+
+<pre>post_process :statistics
+post_process BigBench::PostProcessor::Statistics
+post_process "statistics"</pre>
+
+<p>All the upper lines include the same post processor. Symbols and strings
+are camelized and constantized as the module name.</p>
+
+<h2 id="method-c-post_process-label-Available+Methods+in+Processors">Available Methods in Processors</h2>
+
+<p>Every post processor block or module supports the following methods and has
+full <a
+href="http://api.rubyonrails.org/classes/ActionView/Helpers.html">ActionView::Helper</a>
+support.</p>
+<dl class="rdoc-list label-list"><dt>each_tracking
+<dd>
+<p>A method that iterates through every collected tracking. It automatically
+returns a hash with a single tracking of the following form:</p>
+
+<pre class="ruby">{
+ :<span class="ruby-identifier">elapsed</span> =<span class="ruby-operator">></span> <span class="ruby-value">2.502132</span>,
+ :<span class="ruby-identifier">start</span> =<span class="ruby-operator">></span> <span class="ruby-value">1333986292.1755981</span>,
+ :<span class="ruby-identifier">stop</span> =<span class="ruby-operator">></span> <span class="ruby-value">1333986293.618884</span>,
+ :<span class="ruby-identifier">duration</span> =<span class="ruby-operator">></span> <span class="ruby-value">1443</span>,
+ :<span class="ruby-identifier">benchmark</span> =<span class="ruby-operator">></span> <span class="ruby-string">"index page"</span>,
+ :<span class="ruby-identifier">url</span> =<span class="ruby-operator">></span> <span class="ruby-string">"http://www.google.de/"</span>,
+ :<span class="ruby-identifier">path</span> =<span class="ruby-operator">></span> <span class="ruby-string">"/"</span>,
+ :<span class="ruby-identifier">method</span> =<span class="ruby-operator">></span> <span class="ruby-string">"get"</span>,
+ :<span class="ruby-identifier">status</span> =<span class="ruby-operator">></span> <span class="ruby-value">200</span>
+}
+</pre>
+
+<p>It can be used like this:</p>
+
+<pre class="ruby"><span class="ruby-identifier">post_process</span> <span class="ruby-keyword">do</span>
+
+ <span class="ruby-identifier">total_trackings</span>, <span class="ruby-identifier">total_errors</span> = <span class="ruby-value">0</span>, <span class="ruby-value">0</span>
+ <span class="ruby-identifier">each_tracking</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">tracking</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">total_trackings</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
+ <span class="ruby-identifier">total_errors</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">tracking</span>[:<span class="ruby-identifier">status</span>] <span class="ruby-operator">==</span> <span class="ruby-value">200</span>
+ <span class="ruby-keyword">end</span>
+
+ <span class="ruby-constant">Twitter</span>.<span class="ruby-identifier">post</span> <span class="ruby-node">"Just run BigBench with #{total_trackings} trackings and #{total_errors} errors."</span>
+
+<span class="ruby-keyword">end</span>
+</pre>
+</dd></dl>
+
+
+
+ <div class="method-source-code" id="post_process-source">
+ <pre><span class="ruby-comment"># File lib/bigbench/post_processor.rb, line 192</span>
+<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">post_process</span> <span class="ruby-identifier">processor</span> = <span class="ruby-keyword">nil</span>
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">PostProcessor</span><span class="ruby-operator">::</span><span class="ruby-constant">InvalidProcessor</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">processor</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">&&</span> <span class="ruby-operator">!</span><span class="ruby-identifier">block_given?</span>
+ <span class="ruby-identifier">block_given?</span> <span class="ruby-operator">?</span> <span class="ruby-constant">PostProcessor</span>.<span class="ruby-identifier">add</span>(&<span class="ruby-constant">Proc</span>.<span class="ruby-identifier">new</span>) <span class="ruby-operator">:</span> <span class="ruby-constant">PostProcessor</span>.<span class="ruby-identifier">add</span>(<span class="ruby-identifier">processor</span>)
+<span class="ruby-keyword">end</span></pre>
+ </div><!-- post_process-source -->
+
+ </div>
+
+
+
+
+ </div><!-- post_process-method -->
+
+
+ <div id="method-c-post_processors" class="method-detail ">
+
+ <div class="method-heading">
+ <span class="method-name">post_processors</span><span
+ class="method-args">()</span>
+ <span class="method-click-advice">click to toggle source</span>
+ </div>
+
+
+ <div class="method-description">
+
+ <p>List all initialized post processors</p>
+
+
+
+ <div class="method-source-code" id="post_processors-source">
+ <pre><span class="ruby-comment"># File lib/bigbench/post_processor.rb, line 198</span>
+<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">post_processors</span>
+ <span class="ruby-constant">PostProcessor</span>.<span class="ruby-identifier">all</span>
+<span class="ruby-keyword">end</span></pre>
+ </div><!-- post_processors-source -->
+
+ </div>
+
+
+
+
+ </div><!-- post_processors-method -->
+
+
<div id="method-c-run-21" class="method-detail ">
<div class="method-heading">
<span class="method-name">run!</span><span
class="method-args">()</span>
@@ -490,9 +623,39 @@
</div><!-- run-21-method -->
+
+
+ <div id="method-c-run_post_processors-21" class="method-detail ">
+
+ <div class="method-heading">
+ <span class="method-name">run_post_processors!</span><span
+ class="method-args">()</span>
+ <span class="method-click-advice">click to toggle source</span>
+ </div>
+
+
+ <div class="method-description">
+
+ <p>Runs all initialized post processors after the trackings have been written</p>
+
+
+
+ <div class="method-source-code" id="run_post_processors-21-source">
+ <pre><span class="ruby-comment"># File lib/bigbench/post_processor.rb, line 203</span>
+<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">run_post_processors!</span>
+ <span class="ruby-constant">PostProcessor</span>.<span class="ruby-identifier">run!</span>
+<span class="ruby-keyword">end</span></pre>
+ </div><!-- run_post_processors-21-source -->
+
+ </div>
+
+
+
+
+ </div><!-- run_post_processors-21-method -->
<div id="method-c-write_local_trackings_to_file-21" class="method-detail ">
<div class="method-heading">