doc/rdoc/classes/RFuzz/Session.src/M000023.html in rfuzz-0.6 vs doc/rdoc/classes/RFuzz/Session.src/M000023.html in rfuzz-0.7

- old
+ new

@@ -8,27 +8,27 @@ <title>run (RFuzz::Session)</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" /> </head> <body class="standalone-code"> - <pre> <span class="ruby-comment cmt"># File lib/rfuzz/session.rb, line 59</span> -59: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">run</span>(<span class="ruby-identifier">count</span>, <span class="ruby-identifier">options</span>={}) -60: <span class="ruby-identifier">sample</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:sample</span>] <span class="ruby-operator">||</span> [<span class="ruby-identifier">:request</span>] -61: <span class="ruby-identifier">count</span>.<span class="ruby-identifier">times</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> -62: <span class="ruby-comment cmt"># setup for this latest sample run</span> -63: <span class="ruby-ivar">@runs</span> <span class="ruby-operator">&lt;&lt;</span> {} -64: <span class="ruby-ivar">@counts</span> <span class="ruby-operator">&lt;&lt;</span> {} -65: <span class="ruby-ivar">@tracking</span> <span class="ruby-operator">&lt;&lt;</span> {} -66: <span class="ruby-keyword kw">yield</span> <span class="ruby-ivar">@client</span>, <span class="ruby-ivar">@rand</span> -67: -68: <span class="ruby-comment cmt"># record the request stats then reset them</span> -69: <span class="ruby-identifier">sample</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span> <span class="ruby-identifier">cur_run</span>[<span class="ruby-identifier">s</span>] = <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">notifier</span>.<span class="ruby-identifier">stats</span>[<span class="ruby-identifier">s</span>].<span class="ruby-identifier">clone</span> } -70: <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">notifier</span>.<span class="ruby-identifier">reset</span> -71: <span class="ruby-keyword kw">end</span> -72: -73: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:save_as</span>] -74: <span class="ruby-identifier">write_runs</span>(<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:save_as</span>][<span class="ruby-value">0</span>]) -75: <span class="ruby-identifier">write_counts</span>(<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:save_as</span>][<span class="ruby-value">1</span>]) -76: <span class="ruby-keyword kw">end</span> -77: <span class="ruby-keyword kw">end</span></pre> + <pre> <span class="ruby-comment cmt"># File lib/rfuzz/session.rb, line 61</span> +61: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">run</span>(<span class="ruby-identifier">count</span>=<span class="ruby-value">1</span>, <span class="ruby-identifier">options</span>={}) +62: <span class="ruby-identifier">sample</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:sample</span>] <span class="ruby-operator">||</span> [<span class="ruby-identifier">:request</span>] +63: <span class="ruby-identifier">count</span>.<span class="ruby-identifier">times</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> +64: <span class="ruby-comment cmt"># setup for this latest sample run</span> +65: <span class="ruby-ivar">@runs</span> <span class="ruby-operator">&lt;&lt;</span> {} +66: <span class="ruby-ivar">@counts</span> <span class="ruby-operator">&lt;&lt;</span> {} +67: <span class="ruby-ivar">@tracking</span> <span class="ruby-operator">&lt;&lt;</span> {} +68: <span class="ruby-keyword kw">yield</span> <span class="ruby-ivar">@client</span>, <span class="ruby-ivar">@rand</span> +69: +70: <span class="ruby-comment cmt"># record the request stats then reset them</span> +71: <span class="ruby-identifier">sample</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span> <span class="ruby-identifier">cur_run</span>[<span class="ruby-identifier">s</span>] = <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">notifier</span>.<span class="ruby-identifier">stats</span>[<span class="ruby-identifier">s</span>].<span class="ruby-identifier">clone</span> } +72: <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">notifier</span>.<span class="ruby-identifier">reset</span> +73: <span class="ruby-keyword kw">end</span> +74: +75: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:save_as</span>] +76: <span class="ruby-identifier">write_runs</span>(<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:save_as</span>][<span class="ruby-value">0</span>]) +77: <span class="ruby-identifier">write_counts</span>(<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:save_as</span>][<span class="ruby-value">1</span>]) +78: <span class="ruby-keyword kw">end</span> +79: <span class="ruby-keyword kw">end</span></pre> </body> </html> \ No newline at end of file