stella 0.5.1 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.txt +84 -24
- data/Rakefile +6 -1
- data/lib/stella.rb +5 -4
- data/lib/stella/adapter/ab.rb +31 -4
- data/lib/stella/adapter/base.rb +15 -1
- data/lib/stella/adapter/httperf.rb +35 -4
- data/lib/stella/adapter/siege.rb +51 -29
- data/lib/stella/cli.rb +45 -22
- data/lib/stella/cli/agents.rb +73 -0
- data/lib/stella/cli/language.rb +2 -0
- data/lib/stella/cli/localtest.rb +5 -0
- data/lib/stella/command/base.rb +1 -1
- data/lib/stella/command/localtest.rb +84 -68
- data/lib/stella/test/{summarybase.rb → base.rb} +3 -7
- data/lib/stella/test/definition.rb +10 -5
- data/lib/stella/test/{runsummary.rb → run/summary.rb} +4 -6
- data/lib/stella/test/{testsummary.rb → summary.rb} +27 -29
- data/lib/utils/escape.rb +302 -0
- data/lib/utils/mathutil.rb +36 -34
- data/support/text/en.yaml +7 -1
- metadata +8 -102
- data/doc/classes/Crypto.html +0 -248
- data/doc/classes/Crypto/Key.html +0 -308
- data/doc/classes/Enumerable.html +0 -309
- data/doc/classes/FileUtil.html +0 -310
- data/doc/classes/HTTPUtil.html +0 -530
- data/doc/classes/MathUtil.html +0 -210
- data/doc/classes/Stella.html +0 -238
- data/doc/classes/Stella/Adapter.html +0 -127
- data/doc/classes/Stella/Adapter/ApacheBench.html +0 -1076
- data/doc/classes/Stella/Adapter/Base.html +0 -432
- data/doc/classes/Stella/Adapter/CommandNotReady.html +0 -146
- data/doc/classes/Stella/Adapter/Httperf.html +0 -949
- data/doc/classes/Stella/Adapter/Siege.html +0 -1011
- data/doc/classes/Stella/CLI.html +0 -914
- data/doc/classes/Stella/CLI/Base.html +0 -186
- data/doc/classes/Stella/CLI/Language.html +0 -149
- data/doc/classes/Stella/CLI/LocalTest.html +0 -268
- data/doc/classes/Stella/Command.html +0 -111
- data/doc/classes/Stella/Command/Base.html +0 -335
- data/doc/classes/Stella/Config.html +0 -292
- data/doc/classes/Stella/InvalidArgument.html +0 -242
- data/doc/classes/Stella/LocalTest.html +0 -450
- data/doc/classes/Stella/Logger.html +0 -548
- data/doc/classes/Stella/Response.html +0 -846
- data/doc/classes/Stella/Storable.html +0 -928
- data/doc/classes/Stella/Test.html +0 -142
- data/doc/classes/Stella/Test/DaySummary.html +0 -249
- data/doc/classes/Stella/Test/Definition.html +0 -294
- data/doc/classes/Stella/Test/Definition/Rampup.html +0 -215
- data/doc/classes/Stella/Test/RunSummary.html +0 -315
- data/doc/classes/Stella/Test/SummaryBase.html +0 -286
- data/doc/classes/Stella/Test/TestSummary.html +0 -200
- data/doc/classes/Stella/Text.html +0 -581
- data/doc/classes/Stella/Text/Resource.html +0 -289
- data/doc/classes/Stella/UnavailableAdapter.html +0 -242
- data/doc/classes/Stella/UnknownValue.html +0 -242
- data/doc/classes/Stella/UnsupportedLanguage.html +0 -115
- data/doc/classes/Stella/Util.html +0 -348
- data/doc/classes/TextGraph.html +0 -460
- data/doc/classes/TimerUtil.html +0 -431
- data/doc/created.rid +0 -1
- data/doc/files/LICENSE_txt.html +0 -129
- data/doc/files/README_txt.html +0 -209
- data/doc/files/lib/stella/adapter/ab_rb.html +0 -101
- data/doc/files/lib/stella/adapter/base_rb.html +0 -101
- data/doc/files/lib/stella/adapter/httperf_rb.html +0 -101
- data/doc/files/lib/stella/adapter/siege_rb.html +0 -101
- data/doc/files/lib/stella/cli/base_rb.html +0 -101
- data/doc/files/lib/stella/cli/language_rb.html +0 -101
- data/doc/files/lib/stella/cli/localtest_rb.html +0 -101
- data/doc/files/lib/stella/cli_rb.html +0 -112
- data/doc/files/lib/stella/command/base_rb.html +0 -101
- data/doc/files/lib/stella/command/localtest_rb.html +0 -101
- data/doc/files/lib/stella/logger_rb.html +0 -101
- data/doc/files/lib/stella/response_rb.html +0 -101
- data/doc/files/lib/stella/storable_rb.html +0 -109
- data/doc/files/lib/stella/support_rb.html +0 -101
- data/doc/files/lib/stella/test/daysummary_rb.html +0 -101
- data/doc/files/lib/stella/test/definition_rb.html +0 -101
- data/doc/files/lib/stella/test/runsummary_rb.html +0 -101
- data/doc/files/lib/stella/test/summarybase_rb.html +0 -101
- data/doc/files/lib/stella/test/testsummary_rb.html +0 -108
- data/doc/files/lib/stella/text/resource_rb.html +0 -108
- data/doc/files/lib/stella/text_rb.html +0 -108
- data/doc/files/lib/stella_rb.html +0 -128
- data/doc/files/lib/utils/crypto-key_rb.html +0 -116
- data/doc/files/lib/utils/fileutil_rb.html +0 -108
- data/doc/files/lib/utils/httputil_rb.html +0 -110
- data/doc/files/lib/utils/mathutil_rb.html +0 -101
- data/doc/files/lib/utils/textgraph_rb.html +0 -138
- data/doc/files/lib/utils/timerutil_rb.html +0 -108
- data/doc/fr_class_index.html +0 -66
- data/doc/fr_file_index.html +0 -62
- data/doc/fr_method_index.html +0 -309
- data/doc/index.html +0 -24
- data/doc/rdoc-style.css +0 -208
- data/lib/stella/test/daysummary.rb +0 -93
- data/spec/base.rb +0 -26
- data/spec/shell_spec.rb +0 -12
|
@@ -1,1076 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<!DOCTYPE html
|
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
-
|
|
6
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
7
|
-
<head>
|
|
8
|
-
<title>Class: Stella::Adapter::ApacheBench</title>
|
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
10
|
-
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
|
11
|
-
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
|
12
|
-
<script type="text/javascript">
|
|
13
|
-
// <![CDATA[
|
|
14
|
-
|
|
15
|
-
function popupCode( url ) {
|
|
16
|
-
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function toggleCode( id ) {
|
|
20
|
-
if ( document.getElementById )
|
|
21
|
-
elem = document.getElementById( id );
|
|
22
|
-
else if ( document.all )
|
|
23
|
-
elem = eval( "document.all." + id );
|
|
24
|
-
else
|
|
25
|
-
return false;
|
|
26
|
-
|
|
27
|
-
elemStyle = elem.style;
|
|
28
|
-
|
|
29
|
-
if ( elemStyle.display != "block" ) {
|
|
30
|
-
elemStyle.display = "block"
|
|
31
|
-
} else {
|
|
32
|
-
elemStyle.display = "none"
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// Make codeblocks hidden by default
|
|
39
|
-
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
|
40
|
-
|
|
41
|
-
// ]]>
|
|
42
|
-
</script>
|
|
43
|
-
|
|
44
|
-
</head>
|
|
45
|
-
<body>
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
<div id="classHeader">
|
|
50
|
-
<table class="header-table">
|
|
51
|
-
<tr class="top-aligned-row">
|
|
52
|
-
<td><strong>Class</strong></td>
|
|
53
|
-
<td class="class-name-in-header">Stella::Adapter::ApacheBench</td>
|
|
54
|
-
</tr>
|
|
55
|
-
<tr class="top-aligned-row">
|
|
56
|
-
<td><strong>In:</strong></td>
|
|
57
|
-
<td>
|
|
58
|
-
<a href="../../../files/lib/stella/adapter/ab_rb.html">
|
|
59
|
-
lib/stella/adapter/ab.rb
|
|
60
|
-
</a>
|
|
61
|
-
<br />
|
|
62
|
-
</td>
|
|
63
|
-
</tr>
|
|
64
|
-
|
|
65
|
-
<tr class="top-aligned-row">
|
|
66
|
-
<td><strong>Parent:</strong></td>
|
|
67
|
-
<td>
|
|
68
|
-
<a href="Base.html">
|
|
69
|
-
Stella::Adapter::Base
|
|
70
|
-
</a>
|
|
71
|
-
</td>
|
|
72
|
-
</tr>
|
|
73
|
-
</table>
|
|
74
|
-
</div>
|
|
75
|
-
<!-- banner header -->
|
|
76
|
-
|
|
77
|
-
<div id="bodyContent">
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
<div id="contextContent">
|
|
82
|
-
|
|
83
|
-
<div id="description">
|
|
84
|
-
<p>
|
|
85
|
-
Usage: ab [options] [http[s]://]hostname[:port]/path Options are:
|
|
86
|
-
</p>
|
|
87
|
-
<pre>
|
|
88
|
-
-n requests Number of requests to perform
|
|
89
|
-
-c concurrency Number of multiple requests to make
|
|
90
|
-
-t timelimit Seconds to max. wait for responses
|
|
91
|
-
-b windowsize Size of TCP send/receive buffer, in bytes
|
|
92
|
-
-p postfile File containing data to POST. Remember also to set -T
|
|
93
|
-
-T content-type Content-type header for POSTing, eg.
|
|
94
|
-
'application/x-www-form-urlencoded'
|
|
95
|
-
Default is 'text/plain'
|
|
96
|
-
-v verbosity How much troubleshooting info to print
|
|
97
|
-
-w Print out results in HTML tables
|
|
98
|
-
-i Use HEAD instead of GET
|
|
99
|
-
-x attributes String to insert as table attributes
|
|
100
|
-
-y attributes String to insert as tr attributes
|
|
101
|
-
-z attributes String to insert as td or th attributes
|
|
102
|
-
-C attribute Add cookie, eg. 'Apache=1234. (repeatable)
|
|
103
|
-
-H attribute Add Arbitrary header line, eg. 'Accept-Encoding: gzip'
|
|
104
|
-
Inserted after all normal header lines. (repeatable)
|
|
105
|
-
-A attribute Add Basic WWW Authentication, the attributes
|
|
106
|
-
are a colon separated username and password.
|
|
107
|
-
-P attribute Add Basic Proxy Authentication, the attributes
|
|
108
|
-
are a colon separated username and password.
|
|
109
|
-
-X proxy:port Proxyserver and port number to use
|
|
110
|
-
-V Print version number and exit
|
|
111
|
-
-k Use HTTP KeepAlive feature
|
|
112
|
-
-d Do not show percentiles served table.
|
|
113
|
-
-S Do not show confidence estimators and warnings.
|
|
114
|
-
-g filename Output collected data to gnuplot format file.
|
|
115
|
-
-e filename Output CSV file with percentages served
|
|
116
|
-
-r Don't exit on socket receive errors.
|
|
117
|
-
-h Display usage information (this message)
|
|
118
|
-
-Z ciphersuite Specify SSL/TLS cipher suite (See openssl ciphers)
|
|
119
|
-
-f protocol Specify SSL/TLS protocol (SSL2, SSL3, TLS1, or ALL)
|
|
120
|
-
</pre>
|
|
121
|
-
|
|
122
|
-
</div>
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
</div>
|
|
126
|
-
|
|
127
|
-
<div id="method-list">
|
|
128
|
-
<h3 class="section-bar">Methods</h3>
|
|
129
|
-
|
|
130
|
-
<div class="name-list">
|
|
131
|
-
<a href="#M000068">after</a>
|
|
132
|
-
<a href="#M000063">before</a>
|
|
133
|
-
<a href="#M000074">c</a>
|
|
134
|
-
<a href="#M000064">command</a>
|
|
135
|
-
<a href="#M000076">hosts</a>
|
|
136
|
-
<a href="#M000065">loadtest?</a>
|
|
137
|
-
<a href="#M000075">n</a>
|
|
138
|
-
<a href="#M000061">new</a>
|
|
139
|
-
<a href="#M000077">paths</a>
|
|
140
|
-
<a href="#M000067">process_options</a>
|
|
141
|
-
<a href="#M000066">ready?</a>
|
|
142
|
-
<a href="#M000071">requests</a>
|
|
143
|
-
<a href="#M000072">requests=</a>
|
|
144
|
-
<a href="#M000079">stats</a>
|
|
145
|
-
<a href="#M000078">stats_file</a>
|
|
146
|
-
<a href="#M000062">version</a>
|
|
147
|
-
<a href="#M000073">vuser_requests</a>
|
|
148
|
-
<a href="#M000069">vusers</a>
|
|
149
|
-
<a href="#M000070">vusers=</a>
|
|
150
|
-
</div>
|
|
151
|
-
</div>
|
|
152
|
-
|
|
153
|
-
</div>
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
<!-- if includes -->
|
|
157
|
-
|
|
158
|
-
<div id="section">
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
<div id="constants-list">
|
|
162
|
-
<h3 class="section-bar">Constants</h3>
|
|
163
|
-
|
|
164
|
-
<div class="name-list">
|
|
165
|
-
<table summary="Constants">
|
|
166
|
-
<tr class="top-aligned-row context-row">
|
|
167
|
-
<td class="context-item-name">V</td>
|
|
168
|
-
<td>=</td>
|
|
169
|
-
<td class="context-item-value">true end</td>
|
|
170
|
-
</tr>
|
|
171
|
-
<tr class="top-aligned-row context-row">
|
|
172
|
-
<td class="context-item-name">S</td>
|
|
173
|
-
<td>=</td>
|
|
174
|
-
<td class="context-item-value">true end</td>
|
|
175
|
-
</tr>
|
|
176
|
-
<tr class="top-aligned-row context-row">
|
|
177
|
-
<td class="context-item-name">P</td>
|
|
178
|
-
<td>=</td>
|
|
179
|
-
<td class="context-item-value">v end</td>
|
|
180
|
-
</tr>
|
|
181
|
-
<tr class="top-aligned-row context-row">
|
|
182
|
-
<td class="context-item-name">Z</td>
|
|
183
|
-
<td>=</td>
|
|
184
|
-
<td class="context-item-value">v end</td>
|
|
185
|
-
</tr>
|
|
186
|
-
</table>
|
|
187
|
-
</div>
|
|
188
|
-
</div>
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
<div id="attribute-list">
|
|
193
|
-
<h3 class="section-bar">Attributes</h3>
|
|
194
|
-
|
|
195
|
-
<div class="name-list">
|
|
196
|
-
<table>
|
|
197
|
-
<tr class="top-aligned-row context-row">
|
|
198
|
-
<td class="context-item-name">A</td>
|
|
199
|
-
<td class="context-item-value"> [RW] </td>
|
|
200
|
-
<td class="context-item-desc"></td>
|
|
201
|
-
</tr>
|
|
202
|
-
<tr class="top-aligned-row context-row">
|
|
203
|
-
<td class="context-item-name">C</td>
|
|
204
|
-
<td class="context-item-value"> [RW] </td>
|
|
205
|
-
<td class="context-item-desc"></td>
|
|
206
|
-
</tr>
|
|
207
|
-
<tr class="top-aligned-row context-row">
|
|
208
|
-
<td class="context-item-name">H</td>
|
|
209
|
-
<td class="context-item-value"> [RW] </td>
|
|
210
|
-
<td class="context-item-desc"></td>
|
|
211
|
-
</tr>
|
|
212
|
-
<tr class="top-aligned-row context-row">
|
|
213
|
-
<td class="context-item-name">P</td>
|
|
214
|
-
<td class="context-item-value"> [RW] </td>
|
|
215
|
-
<td class="context-item-desc"></td>
|
|
216
|
-
</tr>
|
|
217
|
-
<tr class="top-aligned-row context-row">
|
|
218
|
-
<td class="context-item-name">S</td>
|
|
219
|
-
<td class="context-item-value"> [RW] </td>
|
|
220
|
-
<td class="context-item-desc"></td>
|
|
221
|
-
</tr>
|
|
222
|
-
<tr class="top-aligned-row context-row">
|
|
223
|
-
<td class="context-item-name">T</td>
|
|
224
|
-
<td class="context-item-value"> [RW] </td>
|
|
225
|
-
<td class="context-item-desc"></td>
|
|
226
|
-
</tr>
|
|
227
|
-
<tr class="top-aligned-row context-row">
|
|
228
|
-
<td class="context-item-name">V</td>
|
|
229
|
-
<td class="context-item-value"> [RW] </td>
|
|
230
|
-
<td class="context-item-desc"></td>
|
|
231
|
-
</tr>
|
|
232
|
-
<tr class="top-aligned-row context-row">
|
|
233
|
-
<td class="context-item-name">X</td>
|
|
234
|
-
<td class="context-item-value"> [RW] </td>
|
|
235
|
-
<td class="context-item-desc"></td>
|
|
236
|
-
</tr>
|
|
237
|
-
<tr class="top-aligned-row context-row">
|
|
238
|
-
<td class="context-item-name">Z</td>
|
|
239
|
-
<td class="context-item-value"> [RW] </td>
|
|
240
|
-
<td class="context-item-desc"></td>
|
|
241
|
-
</tr>
|
|
242
|
-
<tr class="top-aligned-row context-row">
|
|
243
|
-
<td class="context-item-name">b</td>
|
|
244
|
-
<td class="context-item-value"> [RW] </td>
|
|
245
|
-
<td class="context-item-desc"></td>
|
|
246
|
-
</tr>
|
|
247
|
-
<tr class="top-aligned-row context-row">
|
|
248
|
-
<td class="context-item-name">c</td>
|
|
249
|
-
<td class="context-item-value"> [RW] </td>
|
|
250
|
-
<td class="context-item-desc"></td>
|
|
251
|
-
</tr>
|
|
252
|
-
<tr class="top-aligned-row context-row">
|
|
253
|
-
<td class="context-item-name">d</td>
|
|
254
|
-
<td class="context-item-value"> [RW] </td>
|
|
255
|
-
<td class="context-item-desc"></td>
|
|
256
|
-
</tr>
|
|
257
|
-
<tr class="top-aligned-row context-row">
|
|
258
|
-
<td class="context-item-name">e</td>
|
|
259
|
-
<td class="context-item-value"> [RW] </td>
|
|
260
|
-
<td class="context-item-desc"></td>
|
|
261
|
-
</tr>
|
|
262
|
-
<tr class="top-aligned-row context-row">
|
|
263
|
-
<td class="context-item-name">f</td>
|
|
264
|
-
<td class="context-item-value"> [RW] </td>
|
|
265
|
-
<td class="context-item-desc"></td>
|
|
266
|
-
</tr>
|
|
267
|
-
<tr class="top-aligned-row context-row">
|
|
268
|
-
<td class="context-item-name">g</td>
|
|
269
|
-
<td class="context-item-value"> [RW] </td>
|
|
270
|
-
<td class="context-item-desc"></td>
|
|
271
|
-
</tr>
|
|
272
|
-
<tr class="top-aligned-row context-row">
|
|
273
|
-
<td class="context-item-name">h</td>
|
|
274
|
-
<td class="context-item-value"> [RW] </td>
|
|
275
|
-
<td class="context-item-desc"></td>
|
|
276
|
-
</tr>
|
|
277
|
-
<tr class="top-aligned-row context-row">
|
|
278
|
-
<td class="context-item-name">i</td>
|
|
279
|
-
<td class="context-item-value"> [RW] </td>
|
|
280
|
-
<td class="context-item-desc"></td>
|
|
281
|
-
</tr>
|
|
282
|
-
<tr class="top-aligned-row context-row">
|
|
283
|
-
<td class="context-item-name">k</td>
|
|
284
|
-
<td class="context-item-value"> [RW] </td>
|
|
285
|
-
<td class="context-item-desc"></td>
|
|
286
|
-
</tr>
|
|
287
|
-
<tr class="top-aligned-row context-row">
|
|
288
|
-
<td class="context-item-name">n</td>
|
|
289
|
-
<td class="context-item-value"> [RW] </td>
|
|
290
|
-
<td class="context-item-desc"></td>
|
|
291
|
-
</tr>
|
|
292
|
-
<tr class="top-aligned-row context-row">
|
|
293
|
-
<td class="context-item-name">p</td>
|
|
294
|
-
<td class="context-item-value"> [RW] </td>
|
|
295
|
-
<td class="context-item-desc"></td>
|
|
296
|
-
</tr>
|
|
297
|
-
<tr class="top-aligned-row context-row">
|
|
298
|
-
<td class="context-item-name">r</td>
|
|
299
|
-
<td class="context-item-value"> [RW] </td>
|
|
300
|
-
<td class="context-item-desc"></td>
|
|
301
|
-
</tr>
|
|
302
|
-
<tr class="top-aligned-row context-row">
|
|
303
|
-
<td class="context-item-name">t</td>
|
|
304
|
-
<td class="context-item-value"> [RW] </td>
|
|
305
|
-
<td class="context-item-desc"></td>
|
|
306
|
-
</tr>
|
|
307
|
-
<tr class="top-aligned-row context-row">
|
|
308
|
-
<td class="context-item-name">v</td>
|
|
309
|
-
<td class="context-item-value"> [RW] </td>
|
|
310
|
-
<td class="context-item-desc"></td>
|
|
311
|
-
</tr>
|
|
312
|
-
<tr class="top-aligned-row context-row">
|
|
313
|
-
<td class="context-item-name">w</td>
|
|
314
|
-
<td class="context-item-value"> [RW] </td>
|
|
315
|
-
<td class="context-item-desc"></td>
|
|
316
|
-
</tr>
|
|
317
|
-
<tr class="top-aligned-row context-row">
|
|
318
|
-
<td class="context-item-name">x</td>
|
|
319
|
-
<td class="context-item-value"> [RW] </td>
|
|
320
|
-
<td class="context-item-desc"></td>
|
|
321
|
-
</tr>
|
|
322
|
-
<tr class="top-aligned-row context-row">
|
|
323
|
-
<td class="context-item-name">y</td>
|
|
324
|
-
<td class="context-item-value"> [RW] </td>
|
|
325
|
-
<td class="context-item-desc"></td>
|
|
326
|
-
</tr>
|
|
327
|
-
<tr class="top-aligned-row context-row">
|
|
328
|
-
<td class="context-item-name">z</td>
|
|
329
|
-
<td class="context-item-value"> [RW] </td>
|
|
330
|
-
<td class="context-item-desc"></td>
|
|
331
|
-
</tr>
|
|
332
|
-
</table>
|
|
333
|
-
</div>
|
|
334
|
-
</div>
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
<!-- if method_list -->
|
|
339
|
-
<div id="methods">
|
|
340
|
-
<h3 class="section-bar">Public Class methods</h3>
|
|
341
|
-
|
|
342
|
-
<div id="method-M000061" class="method-detail">
|
|
343
|
-
<a name="M000061"></a>
|
|
344
|
-
|
|
345
|
-
<div class="method-heading">
|
|
346
|
-
<a href="#M000061" class="method-signature">
|
|
347
|
-
<span class="method-name">new</span><span class="method-args">(options={}, arguments=[])</span>
|
|
348
|
-
</a>
|
|
349
|
-
</div>
|
|
350
|
-
|
|
351
|
-
<div class="method-description">
|
|
352
|
-
<p><a class="source-toggle" href="#"
|
|
353
|
-
onclick="toggleCode('M000061-source');return false;">[Source]</a></p>
|
|
354
|
-
<div class="method-source-code" id="M000061-source">
|
|
355
|
-
<pre>
|
|
356
|
-
<span class="ruby-comment cmt"># File lib/stella/adapter/ab.rb, line 47</span>
|
|
357
|
-
47: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">options</span>={}, <span class="ruby-identifier">arguments</span>=[])
|
|
358
|
-
48: <span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">options</span>, <span class="ruby-identifier">arguments</span>)
|
|
359
|
-
49: <span class="ruby-ivar">@private_variables</span> = [<span class="ruby-value str">'private_variables'</span>, <span class="ruby-value str">'name'</span>, <span class="ruby-value str">'arguments'</span>, <span class="ruby-value str">'load_factor'</span>, <span class="ruby-value str">'working_directory'</span>]
|
|
360
|
-
50: <span class="ruby-ivar">@c</span> = <span class="ruby-value">1</span>
|
|
361
|
-
51: <span class="ruby-ivar">@n</span> = <span class="ruby-value">1</span>
|
|
362
|
-
52: <span class="ruby-ivar">@name</span> = <span class="ruby-value str">'ab'</span>
|
|
363
|
-
53: <span class="ruby-ivar">@load_factor</span> = <span class="ruby-value">1</span>
|
|
364
|
-
54: <span class="ruby-keyword kw">end</span>
|
|
365
|
-
</pre>
|
|
366
|
-
</div>
|
|
367
|
-
</div>
|
|
368
|
-
</div>
|
|
369
|
-
|
|
370
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
|
371
|
-
|
|
372
|
-
<div id="method-M000068" class="method-detail">
|
|
373
|
-
<a name="M000068"></a>
|
|
374
|
-
|
|
375
|
-
<div class="method-heading">
|
|
376
|
-
<a href="#M000068" class="method-signature">
|
|
377
|
-
<span class="method-name">after</span><span class="method-args">()</span>
|
|
378
|
-
</a>
|
|
379
|
-
</div>
|
|
380
|
-
|
|
381
|
-
<div class="method-description">
|
|
382
|
-
<p><a class="source-toggle" href="#"
|
|
383
|
-
onclick="toggleCode('M000068-source');return false;">[Source]</a></p>
|
|
384
|
-
<div class="method-source-code" id="M000068-source">
|
|
385
|
-
<pre>
|
|
386
|
-
<span class="ruby-comment cmt"># File lib/stella/adapter/ab.rb, line 152</span>
|
|
387
|
-
152: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">after</span>
|
|
388
|
-
153: <span class="ruby-comment cmt"># We want to maintain copies of all test output, even when the user has </span>
|
|
389
|
-
154: <span class="ruby-comment cmt"># supplied other path names so we'll copy the files from the testrun directory</span>
|
|
390
|
-
155: <span class="ruby-comment cmt"># to the location specified by the user</span>
|
|
391
|
-
156: [[<span class="ruby-ivar">@options</span>.<span class="ruby-identifier">e</span>, <span class="ruby-value str">'csv'</span>], [<span class="ruby-ivar">@options</span>.<span class="ruby-identifier">g</span>, <span class="ruby-value str">'tsv'</span>]].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">tuple</span><span class="ruby-operator">|</span>
|
|
392
|
-
157: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-identifier">tuple</span>[<span class="ruby-value">0</span>])) <span class="ruby-operator">!=</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-ivar">@runpath</span>)
|
|
393
|
-
158: <span class="ruby-identifier">from</span> = <span class="ruby-identifier">tuple</span>[<span class="ruby-value">0</span>]
|
|
394
|
-
159: <span class="ruby-identifier">to</span> = <span class="ruby-ivar">@runpath</span> <span class="ruby-operator">+</span> <span class="ruby-node">"/ab-#{tuple[1]}.log"</span>
|
|
395
|
-
160: <span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">from</span>)
|
|
396
|
-
161: <span class="ruby-constant">File</span>.<span class="ruby-identifier">copy</span>(<span class="ruby-identifier">from</span>, <span class="ruby-identifier">to</span>)
|
|
397
|
-
162: <span class="ruby-keyword kw">end</span>
|
|
398
|
-
163: <span class="ruby-keyword kw">end</span>
|
|
399
|
-
164:
|
|
400
|
-
165: <span class="ruby-identifier">save_stats</span>
|
|
401
|
-
166: <span class="ruby-keyword kw">end</span>
|
|
402
|
-
</pre>
|
|
403
|
-
</div>
|
|
404
|
-
</div>
|
|
405
|
-
</div>
|
|
406
|
-
|
|
407
|
-
<div id="method-M000063" class="method-detail">
|
|
408
|
-
<a name="M000063"></a>
|
|
409
|
-
|
|
410
|
-
<div class="method-heading">
|
|
411
|
-
<a href="#M000063" class="method-signature">
|
|
412
|
-
<span class="method-name">before</span><span class="method-args">()</span>
|
|
413
|
-
</a>
|
|
414
|
-
</div>
|
|
415
|
-
|
|
416
|
-
<div class="method-description">
|
|
417
|
-
<p><a class="source-toggle" href="#"
|
|
418
|
-
onclick="toggleCode('M000063-source');return false;">[Source]</a></p>
|
|
419
|
-
<div class="method-source-code" id="M000063-source">
|
|
420
|
-
<pre>
|
|
421
|
-
<span class="ruby-comment cmt"># File lib/stella/adapter/ab.rb, line 67</span>
|
|
422
|
-
67: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">before</span>
|
|
423
|
-
68:
|
|
424
|
-
69: <span class="ruby-ivar">@e</span> = <span class="ruby-ivar">@working_directory</span> <span class="ruby-operator">+</span> <span class="ruby-value str">"/ab-percentiles.log"</span>
|
|
425
|
-
70: <span class="ruby-ivar">@e</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-ivar">@e</span>)
|
|
426
|
-
71:
|
|
427
|
-
72: <span class="ruby-ivar">@g</span> = <span class="ruby-ivar">@working_directory</span> <span class="ruby-operator">+</span> <span class="ruby-value str">"/ab-requests.log"</span>
|
|
428
|
-
73: <span class="ruby-ivar">@g</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-ivar">@g</span>)
|
|
429
|
-
74:
|
|
430
|
-
75: <span class="ruby-keyword kw">end</span>
|
|
431
|
-
</pre>
|
|
432
|
-
</div>
|
|
433
|
-
</div>
|
|
434
|
-
</div>
|
|
435
|
-
|
|
436
|
-
<div id="method-M000074" class="method-detail">
|
|
437
|
-
<a name="M000074"></a>
|
|
438
|
-
|
|
439
|
-
<div class="method-heading">
|
|
440
|
-
<a href="#M000074" class="method-signature">
|
|
441
|
-
<span class="method-name">c</span><span class="method-args">()</span>
|
|
442
|
-
</a>
|
|
443
|
-
</div>
|
|
444
|
-
|
|
445
|
-
<div class="method-description">
|
|
446
|
-
<p><a class="source-toggle" href="#"
|
|
447
|
-
onclick="toggleCode('M000074-source');return false;">[Source]</a></p>
|
|
448
|
-
<div class="method-source-code" id="M000074-source">
|
|
449
|
-
<pre>
|
|
450
|
-
<span class="ruby-comment cmt"># File lib/stella/adapter/ab.rb, line 200</span>
|
|
451
|
-
200: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">c</span>
|
|
452
|
-
201: (<span class="ruby-ivar">@c</span> <span class="ruby-operator">*</span> <span class="ruby-ivar">@load_factor</span>).<span class="ruby-identifier">to_i</span>
|
|
453
|
-
202: <span class="ruby-keyword kw">end</span>
|
|
454
|
-
</pre>
|
|
455
|
-
</div>
|
|
456
|
-
</div>
|
|
457
|
-
</div>
|
|
458
|
-
|
|
459
|
-
<div id="method-M000064" class="method-detail">
|
|
460
|
-
<a name="M000064"></a>
|
|
461
|
-
|
|
462
|
-
<div class="method-heading">
|
|
463
|
-
<a href="#M000064" class="method-signature">
|
|
464
|
-
<span class="method-name">command</span><span class="method-args">()</span>
|
|
465
|
-
</a>
|
|
466
|
-
</div>
|
|
467
|
-
|
|
468
|
-
<div class="method-description">
|
|
469
|
-
<p><a class="source-toggle" href="#"
|
|
470
|
-
onclick="toggleCode('M000064-source');return false;">[Source]</a></p>
|
|
471
|
-
<div class="method-source-code" id="M000064-source">
|
|
472
|
-
<pre>
|
|
473
|
-
<span class="ruby-comment cmt"># File lib/stella/adapter/ab.rb, line 76</span>
|
|
474
|
-
76: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">command</span>
|
|
475
|
-
77: <span class="ruby-identifier">raise</span> <span class="ruby-constant">CommandNotReady</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">to_s</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">ready?</span>
|
|
476
|
-
78:
|
|
477
|
-
79: <span class="ruby-identifier">command</span> = <span class="ruby-node">"#{@name} "</span>
|
|
478
|
-
80:
|
|
479
|
-
81: <span class="ruby-identifier">instance_variables</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span><span class="ruby-operator">|</span>
|
|
480
|
-
82: <span class="ruby-identifier">canon</span> = <span class="ruby-identifier">name</span>.<span class="ruby-identifier">tr</span>(<span class="ruby-value str">'@'</span>, <span class="ruby-value str">''</span>) <span class="ruby-comment cmt"># instance_variables returns '@name'</span>
|
|
481
|
-
83: <span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@private_variables</span>.<span class="ruby-identifier">member?</span>(<span class="ruby-identifier">canon</span>)
|
|
482
|
-
84:
|
|
483
|
-
85: <span class="ruby-comment cmt"># It's important that we take the value from the getter method</span>
|
|
484
|
-
86: <span class="ruby-comment cmt"># because it applies the load factor. </span>
|
|
485
|
-
87: <span class="ruby-identifier">value</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">canon</span>)
|
|
486
|
-
88: <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">value</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Array</span>)
|
|
487
|
-
89: <span class="ruby-identifier">value</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">el</span><span class="ruby-operator">|</span> <span class="ruby-identifier">command</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"-#{cannon} '#{el}' "</span> }
|
|
488
|
-
90: <span class="ruby-keyword kw">else</span>
|
|
489
|
-
91: <span class="ruby-identifier">command</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"-#{canon} '#{value}' "</span>
|
|
490
|
-
92: <span class="ruby-keyword kw">end</span>
|
|
491
|
-
93:
|
|
492
|
-
94: <span class="ruby-keyword kw">end</span>
|
|
493
|
-
95:
|
|
494
|
-
96: <span class="ruby-identifier">command</span> <span class="ruby-operator"><<</span> (<span class="ruby-ivar">@arguments</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">uri</span><span class="ruby-operator">|</span> <span class="ruby-node">"'#{uri}'"</span> }).<span class="ruby-identifier">join</span>(<span class="ruby-value str">' '</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@arguments</span>.<span class="ruby-identifier">empty?</span>
|
|
495
|
-
97: <span class="ruby-identifier">command</span>
|
|
496
|
-
98: <span class="ruby-keyword kw">end</span>
|
|
497
|
-
</pre>
|
|
498
|
-
</div>
|
|
499
|
-
</div>
|
|
500
|
-
</div>
|
|
501
|
-
|
|
502
|
-
<div id="method-M000076" class="method-detail">
|
|
503
|
-
<a name="M000076"></a>
|
|
504
|
-
|
|
505
|
-
<div class="method-heading">
|
|
506
|
-
<a href="#M000076" class="method-signature">
|
|
507
|
-
<span class="method-name">hosts</span><span class="method-args">()</span>
|
|
508
|
-
</a>
|
|
509
|
-
</div>
|
|
510
|
-
|
|
511
|
-
<div class="method-description">
|
|
512
|
-
<p><a class="source-toggle" href="#"
|
|
513
|
-
onclick="toggleCode('M000076-source');return false;">[Source]</a></p>
|
|
514
|
-
<div class="method-source-code" id="M000076-source">
|
|
515
|
-
<pre>
|
|
516
|
-
<span class="ruby-comment cmt"># File lib/stella/adapter/ab.rb, line 207</span>
|
|
517
|
-
207: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">hosts</span>
|
|
518
|
-
208: <span class="ruby-identifier">hosts</span> = <span class="ruby-ivar">@arguments</span> <span class="ruby-operator">||</span> []
|
|
519
|
-
209: <span class="ruby-comment cmt">#hosts << get_hosts_from_file</span>
|
|
520
|
-
210: <span class="ruby-identifier">hosts</span> = <span class="ruby-identifier">hosts</span>.<span class="ruby-identifier">map</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">h</span><span class="ruby-operator">|</span> <span class="ruby-identifier">tmp</span> = <span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">h</span>.<span class="ruby-identifier">strip</span>); <span class="ruby-node">"#{tmp.host}:#{tmp.port}"</span> }
|
|
521
|
-
211: <span class="ruby-identifier">hosts</span>
|
|
522
|
-
212: <span class="ruby-keyword kw">end</span>
|
|
523
|
-
</pre>
|
|
524
|
-
</div>
|
|
525
|
-
</div>
|
|
526
|
-
</div>
|
|
527
|
-
|
|
528
|
-
<div id="method-M000065" class="method-detail">
|
|
529
|
-
<a name="M000065"></a>
|
|
530
|
-
|
|
531
|
-
<div class="method-heading">
|
|
532
|
-
<a href="#M000065" class="method-signature">
|
|
533
|
-
<span class="method-name">loadtest?</span><span class="method-args">()</span>
|
|
534
|
-
</a>
|
|
535
|
-
</div>
|
|
536
|
-
|
|
537
|
-
<div class="method-description">
|
|
538
|
-
<p>
|
|
539
|
-
loadtest
|
|
540
|
-
</p>
|
|
541
|
-
<p>
|
|
542
|
-
True or false: is the call to ab a load test? If it‘s a call to help
|
|
543
|
-
or <a href="ApacheBench.html#M000062">version</a> or to display the config
|
|
544
|
-
this with return false. It‘s no reason for someone to make this call
|
|
545
|
-
through <a href="../../Stella.html">Stella</a> but it‘s here for
|
|
546
|
-
goodness sake.
|
|
547
|
-
</p>
|
|
548
|
-
<p><a class="source-toggle" href="#"
|
|
549
|
-
onclick="toggleCode('M000065-source');return false;">[Source]</a></p>
|
|
550
|
-
<div class="method-source-code" id="M000065-source">
|
|
551
|
-
<pre>
|
|
552
|
-
<span class="ruby-comment cmt"># File lib/stella/adapter/ab.rb, line 104</span>
|
|
553
|
-
104: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">loadtest?</span>
|
|
554
|
-
105: <span class="ruby-operator">!</span><span class="ruby-ivar">@arguments</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-comment cmt"># The argument is a URI</span>
|
|
555
|
-
106: <span class="ruby-keyword kw">end</span>
|
|
556
|
-
</pre>
|
|
557
|
-
</div>
|
|
558
|
-
</div>
|
|
559
|
-
</div>
|
|
560
|
-
|
|
561
|
-
<div id="method-M000075" class="method-detail">
|
|
562
|
-
<a name="M000075"></a>
|
|
563
|
-
|
|
564
|
-
<div class="method-heading">
|
|
565
|
-
<a href="#M000075" class="method-signature">
|
|
566
|
-
<span class="method-name">n</span><span class="method-args">()</span>
|
|
567
|
-
</a>
|
|
568
|
-
</div>
|
|
569
|
-
|
|
570
|
-
<div class="method-description">
|
|
571
|
-
<p><a class="source-toggle" href="#"
|
|
572
|
-
onclick="toggleCode('M000075-source');return false;">[Source]</a></p>
|
|
573
|
-
<div class="method-source-code" id="M000075-source">
|
|
574
|
-
<pre>
|
|
575
|
-
<span class="ruby-comment cmt"># File lib/stella/adapter/ab.rb, line 203</span>
|
|
576
|
-
203: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">n</span>
|
|
577
|
-
204: (<span class="ruby-ivar">@n</span> <span class="ruby-operator">*</span> <span class="ruby-ivar">@load_factor</span>).<span class="ruby-identifier">to_i</span>
|
|
578
|
-
205: <span class="ruby-keyword kw">end</span>
|
|
579
|
-
</pre>
|
|
580
|
-
</div>
|
|
581
|
-
</div>
|
|
582
|
-
</div>
|
|
583
|
-
|
|
584
|
-
<div id="method-M000077" class="method-detail">
|
|
585
|
-
<a name="M000077"></a>
|
|
586
|
-
|
|
587
|
-
<div class="method-heading">
|
|
588
|
-
<a href="#M000077" class="method-signature">
|
|
589
|
-
<span class="method-name">paths</span><span class="method-args">()</span>
|
|
590
|
-
</a>
|
|
591
|
-
</div>
|
|
592
|
-
|
|
593
|
-
<div class="method-description">
|
|
594
|
-
<p><a class="source-toggle" href="#"
|
|
595
|
-
onclick="toggleCode('M000077-source');return false;">[Source]</a></p>
|
|
596
|
-
<div class="method-source-code" id="M000077-source">
|
|
597
|
-
<pre>
|
|
598
|
-
<span class="ruby-comment cmt"># File lib/stella/adapter/ab.rb, line 214</span>
|
|
599
|
-
214: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">paths</span>
|
|
600
|
-
215: <span class="ruby-identifier">paths</span> = <span class="ruby-ivar">@arguments</span> <span class="ruby-operator">||</span> []
|
|
601
|
-
216: <span class="ruby-comment cmt">#hosts << get_hosts_from_file</span>
|
|
602
|
-
217: <span class="ruby-identifier">paths</span> = <span class="ruby-identifier">paths</span>.<span class="ruby-identifier">map</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">h</span><span class="ruby-operator">|</span> <span class="ruby-identifier">tmp</span> = <span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">h</span>.<span class="ruby-identifier">strip</span>); <span class="ruby-node">"#{tmp.path}?#{tmp.query}"</span> }
|
|
603
|
-
218: <span class="ruby-identifier">paths</span>
|
|
604
|
-
219: <span class="ruby-keyword kw">end</span>
|
|
605
|
-
</pre>
|
|
606
|
-
</div>
|
|
607
|
-
</div>
|
|
608
|
-
</div>
|
|
609
|
-
|
|
610
|
-
<div id="method-M000067" class="method-detail">
|
|
611
|
-
<a name="M000067"></a>
|
|
612
|
-
|
|
613
|
-
<div class="method-heading">
|
|
614
|
-
<a href="#M000067" class="method-signature">
|
|
615
|
-
<span class="method-name">process_options</span><span class="method-args">(arguments)</span>
|
|
616
|
-
</a>
|
|
617
|
-
</div>
|
|
618
|
-
|
|
619
|
-
<div class="method-description">
|
|
620
|
-
<p><a class="source-toggle" href="#"
|
|
621
|
-
onclick="toggleCode('M000067-source');return false;">[Source]</a></p>
|
|
622
|
-
<div class="method-source-code" id="M000067-source">
|
|
623
|
-
<pre>
|
|
624
|
-
<span class="ruby-comment cmt"># File lib/stella/adapter/ab.rb, line 112</span>
|
|
625
|
-
112: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process_options</span>(<span class="ruby-identifier">arguments</span>)
|
|
626
|
-
113: <span class="ruby-identifier">options</span> = <span class="ruby-constant">OpenStruct</span>.<span class="ruby-identifier">new</span>
|
|
627
|
-
114: <span class="ruby-identifier">opts</span> = <span class="ruby-constant">OptionParser</span>.<span class="ruby-identifier">new</span>
|
|
628
|
-
115: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">'-v'</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">v</span> = <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">end</span>
|
|
629
|
-
116: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">'-w'</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">w</span> = <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">end</span> <span class="ruby-comment cmt"># TODO: Print a note that we don't parse the HTML results</span>
|
|
630
|
-
117: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">'-i'</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">i</span> = <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">end</span>
|
|
631
|
-
118: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">'-V'</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">options</span>.<span class="ruby-constant">V</span> = <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">end</span>
|
|
632
|
-
119: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">'-k'</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">k</span> = <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">end</span>
|
|
633
|
-
120: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">'-d'</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">d</span> = <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">end</span>
|
|
634
|
-
121: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">'-S'</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">options</span>.<span class="ruby-constant">S</span> = <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">end</span>
|
|
635
|
-
122: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">'-r'</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">r</span> = <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">end</span>
|
|
636
|
-
123: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">'-h'</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">h</span> = <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">end</span>
|
|
637
|
-
124: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">'-e S'</span>, <span class="ruby-constant">String</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">e</span> = <span class="ruby-identifier">v</span> <span class="ruby-keyword kw">end</span>
|
|
638
|
-
125: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">'-g S'</span>, <span class="ruby-constant">String</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">g</span> = <span class="ruby-identifier">v</span> <span class="ruby-keyword kw">end</span>
|
|
639
|
-
126: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">'-p S'</span>, <span class="ruby-constant">String</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">p</span> = <span class="ruby-identifier">v</span> <span class="ruby-keyword kw">end</span>
|
|
640
|
-
127: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">'-T S'</span>, <span class="ruby-constant">String</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">t</span> = <span class="ruby-identifier">v</span> <span class="ruby-keyword kw">end</span>
|
|
641
|
-
128: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">'-x S'</span>, <span class="ruby-constant">String</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">x</span> = <span class="ruby-identifier">v</span> <span class="ruby-keyword kw">end</span>
|
|
642
|
-
129: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">'-y S'</span>, <span class="ruby-constant">String</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">y</span> = <span class="ruby-identifier">v</span> <span class="ruby-keyword kw">end</span>
|
|
643
|
-
130: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">'-z S'</span>, <span class="ruby-constant">String</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">z</span> = <span class="ruby-identifier">v</span> <span class="ruby-keyword kw">end</span>
|
|
644
|
-
131: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">'-P S'</span>, <span class="ruby-constant">String</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">options</span>.<span class="ruby-constant">P</span> = <span class="ruby-identifier">v</span> <span class="ruby-keyword kw">end</span>
|
|
645
|
-
132: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">'-Z S'</span>, <span class="ruby-constant">String</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">options</span>.<span class="ruby-constant">Z</span> = <span class="ruby-identifier">v</span> <span class="ruby-keyword kw">end</span>
|
|
646
|
-
133: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">'-f S'</span>, <span class="ruby-constant">String</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">f</span> = <span class="ruby-identifier">v</span> <span class="ruby-keyword kw">end</span>
|
|
647
|
-
134: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">'-c N'</span>, <span class="ruby-constant">Integer</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">c</span> = <span class="ruby-identifier">v</span> <span class="ruby-keyword kw">end</span>
|
|
648
|
-
135: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">'-n N'</span>, <span class="ruby-constant">Integer</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">n</span> = <span class="ruby-identifier">v</span> <span class="ruby-keyword kw">end</span>
|
|
649
|
-
136: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">'-t N'</span>, <span class="ruby-constant">Integer</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">t</span> = <span class="ruby-identifier">v</span> <span class="ruby-keyword kw">end</span>
|
|
650
|
-
137: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">'-b N'</span>, <span class="ruby-constant">Integer</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">b</span> = <span class="ruby-identifier">v</span> <span class="ruby-keyword kw">end</span>
|
|
651
|
-
138: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">'-H S'</span>, <span class="ruby-constant">String</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">options</span>.<span class="ruby-constant">H</span> <span class="ruby-operator">||=</span> []; <span class="ruby-identifier">options</span>.<span class="ruby-constant">H</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">v</span>; <span class="ruby-keyword kw">end</span>
|
|
652
|
-
139: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">'-C S'</span>, <span class="ruby-constant">String</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">options</span>.<span class="ruby-constant">C</span> <span class="ruby-operator">||=</span> []; <span class="ruby-identifier">options</span>.<span class="ruby-constant">C</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">v</span>; <span class="ruby-keyword kw">end</span>
|
|
653
|
-
140:
|
|
654
|
-
141: <span class="ruby-comment cmt"># NOTE: parse! removes the options it finds in @arguments. It will leave</span>
|
|
655
|
-
142: <span class="ruby-comment cmt"># all unnamed arguments and throw a fit about unknown ones. </span>
|
|
656
|
-
143: <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">parse!</span>(<span class="ruby-identifier">arguments</span>)
|
|
657
|
-
144:
|
|
658
|
-
145: <span class="ruby-identifier">options</span>
|
|
659
|
-
146: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">OptionParser</span><span class="ruby-operator">::</span><span class="ruby-constant">InvalidOption</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">ex</span>
|
|
660
|
-
147: <span class="ruby-comment cmt"># We want to replace this text so we grab just the name of the argument</span>
|
|
661
|
-
148: <span class="ruby-identifier">badarg</span> = <span class="ruby-identifier">ex</span>.<span class="ruby-identifier">message</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-value str">'invalid option: '</span>, <span class="ruby-value str">''</span>)
|
|
662
|
-
149: <span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidArgument</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">badarg</span>)
|
|
663
|
-
150: <span class="ruby-keyword kw">end</span>
|
|
664
|
-
151:
|
|
665
|
-
152: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">after</span>
|
|
666
|
-
153: <span class="ruby-comment cmt"># We want to maintain copies of all test output, even when the user has </span>
|
|
667
|
-
154: <span class="ruby-comment cmt"># supplied other path names so we'll copy the files from the testrun directory</span>
|
|
668
|
-
155: <span class="ruby-comment cmt"># to the location specified by the user</span>
|
|
669
|
-
156: [[<span class="ruby-ivar">@options</span>.<span class="ruby-identifier">e</span>, <span class="ruby-value str">'csv'</span>], [<span class="ruby-ivar">@options</span>.<span class="ruby-identifier">g</span>, <span class="ruby-value str">'tsv'</span>]].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">tuple</span><span class="ruby-operator">|</span>
|
|
670
|
-
157: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-identifier">tuple</span>[<span class="ruby-value">0</span>])) <span class="ruby-operator">!=</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-ivar">@runpath</span>)
|
|
671
|
-
158: <span class="ruby-identifier">from</span> = <span class="ruby-identifier">tuple</span>[<span class="ruby-value">0</span>]
|
|
672
|
-
159: <span class="ruby-identifier">to</span> = <span class="ruby-ivar">@runpath</span> <span class="ruby-operator">+</span> <span class="ruby-node">"/ab-#{tuple[1]}.log"</span>
|
|
673
|
-
160: <span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">from</span>)
|
|
674
|
-
161: <span class="ruby-constant">File</span>.<span class="ruby-identifier">copy</span>(<span class="ruby-identifier">from</span>, <span class="ruby-identifier">to</span>)
|
|
675
|
-
162: <span class="ruby-keyword kw">end</span>
|
|
676
|
-
163: <span class="ruby-keyword kw">end</span>
|
|
677
|
-
164:
|
|
678
|
-
165: <span class="ruby-identifier">save_stats</span>
|
|
679
|
-
166: <span class="ruby-keyword kw">end</span>
|
|
680
|
-
167:
|
|
681
|
-
168:
|
|
682
|
-
169:
|
|
683
|
-
170:
|
|
684
|
-
171:
|
|
685
|
-
172: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">vusers</span>
|
|
686
|
-
173: <span class="ruby-identifier">c</span> <span class="ruby-operator">||</span> <span class="ruby-value">0</span>
|
|
687
|
-
174: <span class="ruby-keyword kw">end</span>
|
|
688
|
-
175: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">vusers=</span>(<span class="ruby-identifier">v</span>)
|
|
689
|
-
176: <span class="ruby-identifier">ratio</span> = <span class="ruby-identifier">vuser_requests</span>
|
|
690
|
-
177: <span class="ruby-ivar">@c</span> = <span class="ruby-identifier">v</span>
|
|
691
|
-
178: <span class="ruby-ivar">@n</span> = <span class="ruby-identifier">ratio</span> <span class="ruby-operator">*</span> <span class="ruby-ivar">@c</span>
|
|
692
|
-
179: <span class="ruby-keyword kw">end</span>
|
|
693
|
-
180: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">requests</span>
|
|
694
|
-
181: <span class="ruby-identifier">n</span> <span class="ruby-operator">||</span> <span class="ruby-value">0</span>
|
|
695
|
-
182: <span class="ruby-keyword kw">end</span>
|
|
696
|
-
183: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">requests=</span>(<span class="ruby-identifier">v</span>)
|
|
697
|
-
184: <span class="ruby-ivar">@n</span> = <span class="ruby-identifier">v</span>
|
|
698
|
-
185: <span class="ruby-keyword kw">end</span>
|
|
699
|
-
186: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">vuser_requests</span>
|
|
700
|
-
187: <span class="ruby-identifier">ratio</span> = <span class="ruby-value">1</span>
|
|
701
|
-
188: <span class="ruby-comment cmt"># The request ratio tells us how many requests will be</span>
|
|
702
|
-
189: <span class="ruby-comment cmt"># generated per vuser. It helps us later when we need to</span>
|
|
703
|
-
190: <span class="ruby-comment cmt"># warmp up and ramp up.</span>
|
|
704
|
-
191: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@n</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span> <span class="ruby-operator">&&</span> <span class="ruby-ivar">@c</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
|
|
705
|
-
192: <span class="ruby-identifier">ratio</span> = (<span class="ruby-ivar">@n</span>.<span class="ruby-identifier">to_f</span> <span class="ruby-operator">/</span> <span class="ruby-ivar">@c</span>.<span class="ruby-identifier">to_f</span>).<span class="ruby-identifier">to_f</span>
|
|
706
|
-
193: <span class="ruby-comment cmt"># If concurrency isn't set, we'll assume the total number of requests</span>
|
|
707
|
-
194: <span class="ruby-comment cmt"># is intended to be per request</span>
|
|
708
|
-
195: <span class="ruby-keyword kw">elsif</span> <span class="ruby-ivar">@n</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
|
|
709
|
-
196: <span class="ruby-identifier">ratio</span> = <span class="ruby-ivar">@n</span>
|
|
710
|
-
197: <span class="ruby-keyword kw">end</span>
|
|
711
|
-
198: <span class="ruby-identifier">ratio</span>
|
|
712
|
-
199: <span class="ruby-keyword kw">end</span>
|
|
713
|
-
200: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">c</span>
|
|
714
|
-
201: (<span class="ruby-ivar">@c</span> <span class="ruby-operator">*</span> <span class="ruby-ivar">@load_factor</span>).<span class="ruby-identifier">to_i</span>
|
|
715
|
-
202: <span class="ruby-keyword kw">end</span>
|
|
716
|
-
203: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">n</span>
|
|
717
|
-
204: (<span class="ruby-ivar">@n</span> <span class="ruby-operator">*</span> <span class="ruby-ivar">@load_factor</span>).<span class="ruby-identifier">to_i</span>
|
|
718
|
-
205: <span class="ruby-keyword kw">end</span>
|
|
719
|
-
206:
|
|
720
|
-
207: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">hosts</span>
|
|
721
|
-
208: <span class="ruby-identifier">hosts</span> = <span class="ruby-ivar">@arguments</span> <span class="ruby-operator">||</span> []
|
|
722
|
-
209: <span class="ruby-comment cmt">#hosts << get_hosts_from_file</span>
|
|
723
|
-
210: <span class="ruby-identifier">hosts</span> = <span class="ruby-identifier">hosts</span>.<span class="ruby-identifier">map</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">h</span><span class="ruby-operator">|</span> <span class="ruby-identifier">tmp</span> = <span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">h</span>.<span class="ruby-identifier">strip</span>); <span class="ruby-node">"#{tmp.host}:#{tmp.port}"</span> }
|
|
724
|
-
211: <span class="ruby-identifier">hosts</span>
|
|
725
|
-
212: <span class="ruby-keyword kw">end</span>
|
|
726
|
-
213:
|
|
727
|
-
214: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">paths</span>
|
|
728
|
-
215: <span class="ruby-identifier">paths</span> = <span class="ruby-ivar">@arguments</span> <span class="ruby-operator">||</span> []
|
|
729
|
-
216: <span class="ruby-comment cmt">#hosts << get_hosts_from_file</span>
|
|
730
|
-
217: <span class="ruby-identifier">paths</span> = <span class="ruby-identifier">paths</span>.<span class="ruby-identifier">map</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">h</span><span class="ruby-operator">|</span> <span class="ruby-identifier">tmp</span> = <span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">h</span>.<span class="ruby-identifier">strip</span>); <span class="ruby-node">"#{tmp.path}?#{tmp.query}"</span> }
|
|
731
|
-
218: <span class="ruby-identifier">paths</span>
|
|
732
|
-
219: <span class="ruby-keyword kw">end</span>
|
|
733
|
-
220:
|
|
734
|
-
221:
|
|
735
|
-
222:
|
|
736
|
-
223: <span class="ruby-comment cmt"># Apache bench writes the summary to STDOUT</span>
|
|
737
|
-
224: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stats_file</span>
|
|
738
|
-
225: <span class="ruby-constant">File</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">stdout_path</span>)
|
|
739
|
-
226: <span class="ruby-keyword kw">end</span>
|
|
740
|
-
227:
|
|
741
|
-
228: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stats</span>
|
|
742
|
-
229: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">stats_file</span>
|
|
743
|
-
230: <span class="ruby-identifier">raw</span> = {}
|
|
744
|
-
231: <span class="ruby-identifier">stats_file</span>.<span class="ruby-identifier">each_line</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">l</span><span class="ruby-operator">|</span>
|
|
745
|
-
232: <span class="ruby-identifier">l</span>.<span class="ruby-identifier">chomp!</span>
|
|
746
|
-
233: <span class="ruby-identifier">nvpair</span> = <span class="ruby-identifier">l</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">':'</span>)
|
|
747
|
-
234: <span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">nvpair</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">nvpair</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">2</span>
|
|
748
|
-
235: <span class="ruby-identifier">n</span> = <span class="ruby-identifier">nvpair</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">tr</span>(<span class="ruby-value str">' '</span>, <span class="ruby-value str">'_'</span>).<span class="ruby-identifier">downcase</span>[<span class="ruby-regexp re">/\w+/</span>]
|
|
749
|
-
236: <span class="ruby-identifier">v</span> = <span class="ruby-identifier">nvpair</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">strip</span>[<span class="ruby-regexp re">/[\.\d]+/</span>]
|
|
750
|
-
237:
|
|
751
|
-
238: <span class="ruby-comment cmt"># Apache Bench outputs two fields with the name "Time per request".</span>
|
|
752
|
-
239: <span class="ruby-comment cmt"># We want only the first one so we don't overwrite values.</span>
|
|
753
|
-
240: <span class="ruby-identifier">raw</span>[<span class="ruby-identifier">n</span>.<span class="ruby-identifier">to_sym</span>] = <span class="ruby-identifier">v</span>.<span class="ruby-identifier">to_f</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">raw</span>.<span class="ruby-identifier">has_key?</span> <span class="ruby-identifier">n</span>.<span class="ruby-identifier">to_sym</span>
|
|
754
|
-
241: }
|
|
755
|
-
242:
|
|
756
|
-
243: <span class="ruby-identifier">stats</span> = <span class="ruby-constant">Stella</span><span class="ruby-operator">::</span><span class="ruby-constant">Test</span><span class="ruby-operator">::</span><span class="ruby-constant">RunSummary</span>.<span class="ruby-identifier">new</span>
|
|
757
|
-
244:
|
|
758
|
-
245: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">raw</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">||</span> <span class="ruby-operator">!</span><span class="ruby-identifier">raw</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">:time_taken_for_tests</span>)
|
|
759
|
-
246:
|
|
760
|
-
247: <span class="ruby-identifier">stats</span>.<span class="ruby-identifier">elapsed_time</span> = <span class="ruby-identifier">raw</span>[<span class="ruby-identifier">:time_taken_for_tests</span>]
|
|
761
|
-
248:
|
|
762
|
-
249: <span class="ruby-comment cmt"># We want this in MB, Apache Bench gives Bytes. </span>
|
|
763
|
-
250: <span class="ruby-identifier">stats</span>.<span class="ruby-identifier">data_transferred</span> = ((<span class="ruby-identifier">raw</span>[<span class="ruby-identifier">:html_transferred</span>] <span class="ruby-operator">||</span> <span class="ruby-value">0</span>) <span class="ruby-operator">/</span> <span class="ruby-value">1_048_576</span>)
|
|
764
|
-
251:
|
|
765
|
-
252: <span class="ruby-comment cmt"># total_transferred is header data + response data (html_transfered)</span>
|
|
766
|
-
253: <span class="ruby-identifier">stats</span>.<span class="ruby-identifier">headers_transferred</span> = ((<span class="ruby-identifier">raw</span>[<span class="ruby-identifier">:total_transferred</span>] <span class="ruby-operator">||</span> <span class="ruby-value">0</span>) <span class="ruby-operator">/</span> <span class="ruby-value">1_048_576</span>) <span class="ruby-operator">-</span> <span class="ruby-identifier">stats</span>.<span class="ruby-identifier">data_transferred</span>
|
|
767
|
-
254:
|
|
768
|
-
255: <span class="ruby-comment cmt"># Apache Bench returns ms</span>
|
|
769
|
-
256: <span class="ruby-identifier">stats</span>.<span class="ruby-identifier">response_time</span> = (<span class="ruby-identifier">raw</span>[<span class="ruby-identifier">:time_per_request</span>] <span class="ruby-operator">||</span> <span class="ruby-value">0</span>) <span class="ruby-operator">/</span> <span class="ruby-value">1000</span>
|
|
770
|
-
257: <span class="ruby-identifier">stats</span>.<span class="ruby-identifier">transaction_rate</span> = <span class="ruby-identifier">raw</span>[<span class="ruby-identifier">:requests_per_second</span>]
|
|
771
|
-
258:
|
|
772
|
-
259: <span class="ruby-identifier">stats</span>.<span class="ruby-identifier">vusers</span> = <span class="ruby-identifier">raw</span>[<span class="ruby-identifier">:concurrency_level</span>].<span class="ruby-identifier">to_i</span>
|
|
773
|
-
260: <span class="ruby-identifier">stats</span>.<span class="ruby-identifier">successful</span> = <span class="ruby-identifier">raw</span>[<span class="ruby-identifier">:complete_requests</span>].<span class="ruby-identifier">to_i</span>
|
|
774
|
-
261: <span class="ruby-identifier">stats</span>.<span class="ruby-identifier">failed</span> = <span class="ruby-identifier">raw</span>[<span class="ruby-identifier">:failed_requests</span>].<span class="ruby-identifier">to_i</span>
|
|
775
|
-
262:
|
|
776
|
-
263: <span class="ruby-identifier">stats</span>.<span class="ruby-identifier">transactions</span> = <span class="ruby-identifier">stats</span>.<span class="ruby-identifier">successful</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">stats</span>.<span class="ruby-identifier">failed</span>
|
|
777
|
-
264:
|
|
778
|
-
265: <span class="ruby-comment cmt">#stats.raw = raw if @global_options.debug</span>
|
|
779
|
-
266: <span class="ruby-keyword kw">end</span>
|
|
780
|
-
267:
|
|
781
|
-
268: <span class="ruby-identifier">stats</span>
|
|
782
|
-
269: <span class="ruby-keyword kw">end</span>
|
|
783
|
-
270:
|
|
784
|
-
271:
|
|
785
|
-
272:
|
|
786
|
-
273: <span class="ruby-keyword kw">end</span>
|
|
787
|
-
274:
|
|
788
|
-
275: <span class="ruby-keyword kw">end</span>
|
|
789
|
-
276: <span class="ruby-keyword kw">end</span>
|
|
790
|
-
|
|
791
|
-
</pre>
|
|
792
|
-
</div>
|
|
793
|
-
</div>
|
|
794
|
-
</div>
|
|
795
|
-
|
|
796
|
-
<div id="method-M000066" class="method-detail">
|
|
797
|
-
<a name="M000066"></a>
|
|
798
|
-
|
|
799
|
-
<div class="method-heading">
|
|
800
|
-
<a href="#M000066" class="method-signature">
|
|
801
|
-
<span class="method-name">ready?</span><span class="method-args">()</span>
|
|
802
|
-
</a>
|
|
803
|
-
</div>
|
|
804
|
-
|
|
805
|
-
<div class="method-description">
|
|
806
|
-
<p><a class="source-toggle" href="#"
|
|
807
|
-
onclick="toggleCode('M000066-source');return false;">[Source]</a></p>
|
|
808
|
-
<div class="method-source-code" id="M000066-source">
|
|
809
|
-
<pre>
|
|
810
|
-
<span class="ruby-comment cmt"># File lib/stella/adapter/ab.rb, line 107</span>
|
|
811
|
-
107: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">ready?</span>
|
|
812
|
-
108: (<span class="ruby-operator">!</span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">loadtest?</span>) <span class="ruby-operator">||</span> (<span class="ruby-ivar">@name</span> <span class="ruby-operator">&&</span> <span class="ruby-operator">!</span><span class="ruby-identifier">instance_variables</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">&&</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@arguments</span>.<span class="ruby-identifier">empty?</span>)
|
|
813
|
-
109: <span class="ruby-keyword kw">end</span>
|
|
814
|
-
</pre>
|
|
815
|
-
</div>
|
|
816
|
-
</div>
|
|
817
|
-
</div>
|
|
818
|
-
|
|
819
|
-
<div id="method-M000071" class="method-detail">
|
|
820
|
-
<a name="M000071"></a>
|
|
821
|
-
|
|
822
|
-
<div class="method-heading">
|
|
823
|
-
<a href="#M000071" class="method-signature">
|
|
824
|
-
<span class="method-name">requests</span><span class="method-args">()</span>
|
|
825
|
-
</a>
|
|
826
|
-
</div>
|
|
827
|
-
|
|
828
|
-
<div class="method-description">
|
|
829
|
-
<p><a class="source-toggle" href="#"
|
|
830
|
-
onclick="toggleCode('M000071-source');return false;">[Source]</a></p>
|
|
831
|
-
<div class="method-source-code" id="M000071-source">
|
|
832
|
-
<pre>
|
|
833
|
-
<span class="ruby-comment cmt"># File lib/stella/adapter/ab.rb, line 180</span>
|
|
834
|
-
180: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">requests</span>
|
|
835
|
-
181: <span class="ruby-identifier">n</span> <span class="ruby-operator">||</span> <span class="ruby-value">0</span>
|
|
836
|
-
182: <span class="ruby-keyword kw">end</span>
|
|
837
|
-
</pre>
|
|
838
|
-
</div>
|
|
839
|
-
</div>
|
|
840
|
-
</div>
|
|
841
|
-
|
|
842
|
-
<div id="method-M000072" class="method-detail">
|
|
843
|
-
<a name="M000072"></a>
|
|
844
|
-
|
|
845
|
-
<div class="method-heading">
|
|
846
|
-
<a href="#M000072" class="method-signature">
|
|
847
|
-
<span class="method-name">requests=</span><span class="method-args">(v)</span>
|
|
848
|
-
</a>
|
|
849
|
-
</div>
|
|
850
|
-
|
|
851
|
-
<div class="method-description">
|
|
852
|
-
<p><a class="source-toggle" href="#"
|
|
853
|
-
onclick="toggleCode('M000072-source');return false;">[Source]</a></p>
|
|
854
|
-
<div class="method-source-code" id="M000072-source">
|
|
855
|
-
<pre>
|
|
856
|
-
<span class="ruby-comment cmt"># File lib/stella/adapter/ab.rb, line 183</span>
|
|
857
|
-
183: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">requests=</span>(<span class="ruby-identifier">v</span>)
|
|
858
|
-
184: <span class="ruby-ivar">@n</span> = <span class="ruby-identifier">v</span>
|
|
859
|
-
185: <span class="ruby-keyword kw">end</span>
|
|
860
|
-
</pre>
|
|
861
|
-
</div>
|
|
862
|
-
</div>
|
|
863
|
-
</div>
|
|
864
|
-
|
|
865
|
-
<div id="method-M000079" class="method-detail">
|
|
866
|
-
<a name="M000079"></a>
|
|
867
|
-
|
|
868
|
-
<div class="method-heading">
|
|
869
|
-
<a href="#M000079" class="method-signature">
|
|
870
|
-
<span class="method-name">stats</span><span class="method-args">()</span>
|
|
871
|
-
</a>
|
|
872
|
-
</div>
|
|
873
|
-
|
|
874
|
-
<div class="method-description">
|
|
875
|
-
<p><a class="source-toggle" href="#"
|
|
876
|
-
onclick="toggleCode('M000079-source');return false;">[Source]</a></p>
|
|
877
|
-
<div class="method-source-code" id="M000079-source">
|
|
878
|
-
<pre>
|
|
879
|
-
<span class="ruby-comment cmt"># File lib/stella/adapter/ab.rb, line 228</span>
|
|
880
|
-
228: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stats</span>
|
|
881
|
-
229: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">stats_file</span>
|
|
882
|
-
230: <span class="ruby-identifier">raw</span> = {}
|
|
883
|
-
231: <span class="ruby-identifier">stats_file</span>.<span class="ruby-identifier">each_line</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">l</span><span class="ruby-operator">|</span>
|
|
884
|
-
232: <span class="ruby-identifier">l</span>.<span class="ruby-identifier">chomp!</span>
|
|
885
|
-
233: <span class="ruby-identifier">nvpair</span> = <span class="ruby-identifier">l</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">':'</span>)
|
|
886
|
-
234: <span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">nvpair</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">nvpair</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">2</span>
|
|
887
|
-
235: <span class="ruby-identifier">n</span> = <span class="ruby-identifier">nvpair</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">tr</span>(<span class="ruby-value str">' '</span>, <span class="ruby-value str">'_'</span>).<span class="ruby-identifier">downcase</span>[<span class="ruby-regexp re">/\w+/</span>]
|
|
888
|
-
236: <span class="ruby-identifier">v</span> = <span class="ruby-identifier">nvpair</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">strip</span>[<span class="ruby-regexp re">/[\.\d]+/</span>]
|
|
889
|
-
237:
|
|
890
|
-
238: <span class="ruby-comment cmt"># Apache Bench outputs two fields with the name "Time per request".</span>
|
|
891
|
-
239: <span class="ruby-comment cmt"># We want only the first one so we don't overwrite values.</span>
|
|
892
|
-
240: <span class="ruby-identifier">raw</span>[<span class="ruby-identifier">n</span>.<span class="ruby-identifier">to_sym</span>] = <span class="ruby-identifier">v</span>.<span class="ruby-identifier">to_f</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">raw</span>.<span class="ruby-identifier">has_key?</span> <span class="ruby-identifier">n</span>.<span class="ruby-identifier">to_sym</span>
|
|
893
|
-
241: }
|
|
894
|
-
242:
|
|
895
|
-
243: <span class="ruby-identifier">stats</span> = <span class="ruby-constant">Stella</span><span class="ruby-operator">::</span><span class="ruby-constant">Test</span><span class="ruby-operator">::</span><span class="ruby-constant">RunSummary</span>.<span class="ruby-identifier">new</span>
|
|
896
|
-
244:
|
|
897
|
-
245: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">raw</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">||</span> <span class="ruby-operator">!</span><span class="ruby-identifier">raw</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">:time_taken_for_tests</span>)
|
|
898
|
-
246:
|
|
899
|
-
247: <span class="ruby-identifier">stats</span>.<span class="ruby-identifier">elapsed_time</span> = <span class="ruby-identifier">raw</span>[<span class="ruby-identifier">:time_taken_for_tests</span>]
|
|
900
|
-
248:
|
|
901
|
-
249: <span class="ruby-comment cmt"># We want this in MB, Apache Bench gives Bytes. </span>
|
|
902
|
-
250: <span class="ruby-identifier">stats</span>.<span class="ruby-identifier">data_transferred</span> = ((<span class="ruby-identifier">raw</span>[<span class="ruby-identifier">:html_transferred</span>] <span class="ruby-operator">||</span> <span class="ruby-value">0</span>) <span class="ruby-operator">/</span> <span class="ruby-value">1_048_576</span>)
|
|
903
|
-
251:
|
|
904
|
-
252: <span class="ruby-comment cmt"># total_transferred is header data + response data (html_transfered)</span>
|
|
905
|
-
253: <span class="ruby-identifier">stats</span>.<span class="ruby-identifier">headers_transferred</span> = ((<span class="ruby-identifier">raw</span>[<span class="ruby-identifier">:total_transferred</span>] <span class="ruby-operator">||</span> <span class="ruby-value">0</span>) <span class="ruby-operator">/</span> <span class="ruby-value">1_048_576</span>) <span class="ruby-operator">-</span> <span class="ruby-identifier">stats</span>.<span class="ruby-identifier">data_transferred</span>
|
|
906
|
-
254:
|
|
907
|
-
255: <span class="ruby-comment cmt"># Apache Bench returns ms</span>
|
|
908
|
-
256: <span class="ruby-identifier">stats</span>.<span class="ruby-identifier">response_time</span> = (<span class="ruby-identifier">raw</span>[<span class="ruby-identifier">:time_per_request</span>] <span class="ruby-operator">||</span> <span class="ruby-value">0</span>) <span class="ruby-operator">/</span> <span class="ruby-value">1000</span>
|
|
909
|
-
257: <span class="ruby-identifier">stats</span>.<span class="ruby-identifier">transaction_rate</span> = <span class="ruby-identifier">raw</span>[<span class="ruby-identifier">:requests_per_second</span>]
|
|
910
|
-
258:
|
|
911
|
-
259: <span class="ruby-identifier">stats</span>.<span class="ruby-identifier">vusers</span> = <span class="ruby-identifier">raw</span>[<span class="ruby-identifier">:concurrency_level</span>].<span class="ruby-identifier">to_i</span>
|
|
912
|
-
260: <span class="ruby-identifier">stats</span>.<span class="ruby-identifier">successful</span> = <span class="ruby-identifier">raw</span>[<span class="ruby-identifier">:complete_requests</span>].<span class="ruby-identifier">to_i</span>
|
|
913
|
-
261: <span class="ruby-identifier">stats</span>.<span class="ruby-identifier">failed</span> = <span class="ruby-identifier">raw</span>[<span class="ruby-identifier">:failed_requests</span>].<span class="ruby-identifier">to_i</span>
|
|
914
|
-
262:
|
|
915
|
-
263: <span class="ruby-identifier">stats</span>.<span class="ruby-identifier">transactions</span> = <span class="ruby-identifier">stats</span>.<span class="ruby-identifier">successful</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">stats</span>.<span class="ruby-identifier">failed</span>
|
|
916
|
-
264:
|
|
917
|
-
265: <span class="ruby-comment cmt">#stats.raw = raw if @global_options.debug</span>
|
|
918
|
-
266: <span class="ruby-keyword kw">end</span>
|
|
919
|
-
267:
|
|
920
|
-
268: <span class="ruby-identifier">stats</span>
|
|
921
|
-
269: <span class="ruby-keyword kw">end</span>
|
|
922
|
-
</pre>
|
|
923
|
-
</div>
|
|
924
|
-
</div>
|
|
925
|
-
</div>
|
|
926
|
-
|
|
927
|
-
<div id="method-M000078" class="method-detail">
|
|
928
|
-
<a name="M000078"></a>
|
|
929
|
-
|
|
930
|
-
<div class="method-heading">
|
|
931
|
-
<a href="#M000078" class="method-signature">
|
|
932
|
-
<span class="method-name">stats_file</span><span class="method-args">()</span>
|
|
933
|
-
</a>
|
|
934
|
-
</div>
|
|
935
|
-
|
|
936
|
-
<div class="method-description">
|
|
937
|
-
<p>
|
|
938
|
-
Apache bench writes the summary to STDOUT
|
|
939
|
-
</p>
|
|
940
|
-
<p><a class="source-toggle" href="#"
|
|
941
|
-
onclick="toggleCode('M000078-source');return false;">[Source]</a></p>
|
|
942
|
-
<div class="method-source-code" id="M000078-source">
|
|
943
|
-
<pre>
|
|
944
|
-
<span class="ruby-comment cmt"># File lib/stella/adapter/ab.rb, line 224</span>
|
|
945
|
-
224: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stats_file</span>
|
|
946
|
-
225: <span class="ruby-constant">File</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">stdout_path</span>)
|
|
947
|
-
226: <span class="ruby-keyword kw">end</span>
|
|
948
|
-
</pre>
|
|
949
|
-
</div>
|
|
950
|
-
</div>
|
|
951
|
-
</div>
|
|
952
|
-
|
|
953
|
-
<div id="method-M000062" class="method-detail">
|
|
954
|
-
<a name="M000062"></a>
|
|
955
|
-
|
|
956
|
-
<div class="method-heading">
|
|
957
|
-
<a href="#M000062" class="method-signature">
|
|
958
|
-
<span class="method-name">version</span><span class="method-args">()</span>
|
|
959
|
-
</a>
|
|
960
|
-
</div>
|
|
961
|
-
|
|
962
|
-
<div class="method-description">
|
|
963
|
-
<p><a class="source-toggle" href="#"
|
|
964
|
-
onclick="toggleCode('M000062-source');return false;">[Source]</a></p>
|
|
965
|
-
<div class="method-source-code" id="M000062-source">
|
|
966
|
-
<pre>
|
|
967
|
-
<span class="ruby-comment cmt"># File lib/stella/adapter/ab.rb, line 57</span>
|
|
968
|
-
57: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">version</span>
|
|
969
|
-
58: <span class="ruby-identifier">vsn</span> = <span class="ruby-value">0</span>
|
|
970
|
-
59: <span class="ruby-identifier">text</span> = <span class="ruby-value str">""</span>
|
|
971
|
-
60: <span class="ruby-constant">Open3</span>.<span class="ruby-identifier">popen3</span>(<span class="ruby-node">"#{@name} -V"</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">stdin</span>, <span class="ruby-identifier">stdout</span>, <span class="ruby-identifier">stderr</span><span class="ruby-operator">|</span>
|
|
972
|
-
61: <span class="ruby-identifier">text</span> = <span class="ruby-identifier">stdout</span>.<span class="ruby-identifier">readlines</span>.<span class="ruby-identifier">join</span>
|
|
973
|
-
62: <span class="ruby-identifier">text</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/Version (\d+?\.\d+)/</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">vsn</span> = <span class="ruby-identifier">v</span>[<span class="ruby-value">0</span>] }
|
|
974
|
-
63: <span class="ruby-keyword kw">end</span>
|
|
975
|
-
64: <span class="ruby-identifier">vsn</span>
|
|
976
|
-
65: <span class="ruby-keyword kw">end</span>
|
|
977
|
-
</pre>
|
|
978
|
-
</div>
|
|
979
|
-
</div>
|
|
980
|
-
</div>
|
|
981
|
-
|
|
982
|
-
<div id="method-M000073" class="method-detail">
|
|
983
|
-
<a name="M000073"></a>
|
|
984
|
-
|
|
985
|
-
<div class="method-heading">
|
|
986
|
-
<a href="#M000073" class="method-signature">
|
|
987
|
-
<span class="method-name">vuser_requests</span><span class="method-args">()</span>
|
|
988
|
-
</a>
|
|
989
|
-
</div>
|
|
990
|
-
|
|
991
|
-
<div class="method-description">
|
|
992
|
-
<p><a class="source-toggle" href="#"
|
|
993
|
-
onclick="toggleCode('M000073-source');return false;">[Source]</a></p>
|
|
994
|
-
<div class="method-source-code" id="M000073-source">
|
|
995
|
-
<pre>
|
|
996
|
-
<span class="ruby-comment cmt"># File lib/stella/adapter/ab.rb, line 186</span>
|
|
997
|
-
186: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">vuser_requests</span>
|
|
998
|
-
187: <span class="ruby-identifier">ratio</span> = <span class="ruby-value">1</span>
|
|
999
|
-
188: <span class="ruby-comment cmt"># The request ratio tells us how many requests will be</span>
|
|
1000
|
-
189: <span class="ruby-comment cmt"># generated per vuser. It helps us later when we need to</span>
|
|
1001
|
-
190: <span class="ruby-comment cmt"># warmp up and ramp up.</span>
|
|
1002
|
-
191: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@n</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span> <span class="ruby-operator">&&</span> <span class="ruby-ivar">@c</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
|
|
1003
|
-
192: <span class="ruby-identifier">ratio</span> = (<span class="ruby-ivar">@n</span>.<span class="ruby-identifier">to_f</span> <span class="ruby-operator">/</span> <span class="ruby-ivar">@c</span>.<span class="ruby-identifier">to_f</span>).<span class="ruby-identifier">to_f</span>
|
|
1004
|
-
193: <span class="ruby-comment cmt"># If concurrency isn't set, we'll assume the total number of requests</span>
|
|
1005
|
-
194: <span class="ruby-comment cmt"># is intended to be per request</span>
|
|
1006
|
-
195: <span class="ruby-keyword kw">elsif</span> <span class="ruby-ivar">@n</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
|
|
1007
|
-
196: <span class="ruby-identifier">ratio</span> = <span class="ruby-ivar">@n</span>
|
|
1008
|
-
197: <span class="ruby-keyword kw">end</span>
|
|
1009
|
-
198: <span class="ruby-identifier">ratio</span>
|
|
1010
|
-
199: <span class="ruby-keyword kw">end</span>
|
|
1011
|
-
</pre>
|
|
1012
|
-
</div>
|
|
1013
|
-
</div>
|
|
1014
|
-
</div>
|
|
1015
|
-
|
|
1016
|
-
<div id="method-M000069" class="method-detail">
|
|
1017
|
-
<a name="M000069"></a>
|
|
1018
|
-
|
|
1019
|
-
<div class="method-heading">
|
|
1020
|
-
<a href="#M000069" class="method-signature">
|
|
1021
|
-
<span class="method-name">vusers</span><span class="method-args">()</span>
|
|
1022
|
-
</a>
|
|
1023
|
-
</div>
|
|
1024
|
-
|
|
1025
|
-
<div class="method-description">
|
|
1026
|
-
<p><a class="source-toggle" href="#"
|
|
1027
|
-
onclick="toggleCode('M000069-source');return false;">[Source]</a></p>
|
|
1028
|
-
<div class="method-source-code" id="M000069-source">
|
|
1029
|
-
<pre>
|
|
1030
|
-
<span class="ruby-comment cmt"># File lib/stella/adapter/ab.rb, line 172</span>
|
|
1031
|
-
172: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">vusers</span>
|
|
1032
|
-
173: <span class="ruby-identifier">c</span> <span class="ruby-operator">||</span> <span class="ruby-value">0</span>
|
|
1033
|
-
174: <span class="ruby-keyword kw">end</span>
|
|
1034
|
-
</pre>
|
|
1035
|
-
</div>
|
|
1036
|
-
</div>
|
|
1037
|
-
</div>
|
|
1038
|
-
|
|
1039
|
-
<div id="method-M000070" class="method-detail">
|
|
1040
|
-
<a name="M000070"></a>
|
|
1041
|
-
|
|
1042
|
-
<div class="method-heading">
|
|
1043
|
-
<a href="#M000070" class="method-signature">
|
|
1044
|
-
<span class="method-name">vusers=</span><span class="method-args">(v)</span>
|
|
1045
|
-
</a>
|
|
1046
|
-
</div>
|
|
1047
|
-
|
|
1048
|
-
<div class="method-description">
|
|
1049
|
-
<p><a class="source-toggle" href="#"
|
|
1050
|
-
onclick="toggleCode('M000070-source');return false;">[Source]</a></p>
|
|
1051
|
-
<div class="method-source-code" id="M000070-source">
|
|
1052
|
-
<pre>
|
|
1053
|
-
<span class="ruby-comment cmt"># File lib/stella/adapter/ab.rb, line 175</span>
|
|
1054
|
-
175: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">vusers=</span>(<span class="ruby-identifier">v</span>)
|
|
1055
|
-
176: <span class="ruby-identifier">ratio</span> = <span class="ruby-identifier">vuser_requests</span>
|
|
1056
|
-
177: <span class="ruby-ivar">@c</span> = <span class="ruby-identifier">v</span>
|
|
1057
|
-
178: <span class="ruby-ivar">@n</span> = <span class="ruby-identifier">ratio</span> <span class="ruby-operator">*</span> <span class="ruby-ivar">@c</span>
|
|
1058
|
-
179: <span class="ruby-keyword kw">end</span>
|
|
1059
|
-
</pre>
|
|
1060
|
-
</div>
|
|
1061
|
-
</div>
|
|
1062
|
-
</div>
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
</div>
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
</div>
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
<div id="validator-badges">
|
|
1072
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
|
1073
|
-
</div>
|
|
1074
|
-
|
|
1075
|
-
</body>
|
|
1076
|
-
</html>
|