stella 0.3.2 → 0.5.1
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 +24 -84
- data/Rakefile +1 -6
- data/doc/classes/Crypto.html +248 -0
- data/doc/classes/Crypto/Key.html +308 -0
- data/doc/classes/Enumerable.html +309 -0
- data/doc/classes/FileUtil.html +310 -0
- data/doc/classes/HTTPUtil.html +530 -0
- data/doc/classes/MathUtil.html +210 -0
- data/doc/classes/Stella.html +238 -0
- data/doc/classes/Stella/Adapter.html +127 -0
- data/doc/classes/Stella/Adapter/ApacheBench.html +1076 -0
- data/doc/classes/Stella/Adapter/Base.html +432 -0
- data/doc/classes/Stella/Adapter/CommandNotReady.html +146 -0
- data/doc/classes/Stella/Adapter/Httperf.html +949 -0
- data/doc/classes/Stella/Adapter/Siege.html +1011 -0
- data/doc/classes/Stella/CLI.html +914 -0
- data/doc/classes/Stella/CLI/Base.html +186 -0
- data/doc/classes/Stella/CLI/Language.html +149 -0
- data/doc/classes/Stella/CLI/LocalTest.html +268 -0
- data/doc/classes/Stella/Command.html +111 -0
- data/doc/classes/Stella/Command/Base.html +335 -0
- data/doc/classes/Stella/Config.html +292 -0
- data/doc/classes/Stella/InvalidArgument.html +242 -0
- data/doc/classes/Stella/LocalTest.html +450 -0
- data/doc/classes/Stella/Logger.html +548 -0
- data/doc/classes/Stella/Response.html +846 -0
- data/doc/classes/Stella/Storable.html +928 -0
- data/doc/classes/Stella/Test.html +142 -0
- data/doc/classes/Stella/Test/DaySummary.html +249 -0
- data/doc/classes/Stella/Test/Definition.html +294 -0
- data/doc/classes/Stella/Test/Definition/Rampup.html +215 -0
- data/doc/classes/Stella/Test/RunSummary.html +315 -0
- data/doc/classes/Stella/Test/SummaryBase.html +286 -0
- data/doc/classes/Stella/Test/TestSummary.html +200 -0
- data/doc/classes/Stella/Text.html +581 -0
- data/doc/classes/Stella/Text/Resource.html +289 -0
- data/doc/classes/Stella/UnavailableAdapter.html +242 -0
- data/doc/classes/Stella/UnknownValue.html +242 -0
- data/doc/classes/Stella/UnsupportedLanguage.html +115 -0
- data/doc/classes/Stella/Util.html +348 -0
- data/doc/classes/TextGraph.html +460 -0
- data/doc/classes/TimerUtil.html +431 -0
- data/doc/created.rid +1 -0
- data/doc/files/LICENSE_txt.html +129 -0
- data/doc/files/README_txt.html +209 -0
- data/doc/files/lib/stella/adapter/ab_rb.html +101 -0
- data/doc/files/lib/stella/adapter/base_rb.html +101 -0
- data/doc/files/lib/stella/adapter/httperf_rb.html +101 -0
- data/doc/files/lib/stella/adapter/siege_rb.html +101 -0
- data/doc/files/lib/stella/cli/base_rb.html +101 -0
- data/doc/files/lib/stella/cli/language_rb.html +101 -0
- data/doc/files/lib/stella/cli/localtest_rb.html +101 -0
- data/doc/files/lib/stella/cli_rb.html +112 -0
- data/doc/files/lib/stella/command/base_rb.html +101 -0
- data/doc/files/lib/stella/command/localtest_rb.html +101 -0
- data/doc/files/lib/stella/logger_rb.html +101 -0
- data/doc/files/lib/stella/response_rb.html +101 -0
- data/doc/files/lib/stella/storable_rb.html +109 -0
- data/doc/files/lib/stella/support_rb.html +101 -0
- data/doc/files/lib/stella/test/daysummary_rb.html +101 -0
- data/doc/files/lib/stella/test/definition_rb.html +101 -0
- data/doc/files/lib/stella/test/runsummary_rb.html +101 -0
- data/doc/files/lib/stella/test/summarybase_rb.html +101 -0
- data/doc/files/lib/stella/test/testsummary_rb.html +108 -0
- data/doc/files/lib/stella/text/resource_rb.html +108 -0
- data/doc/files/lib/stella/text_rb.html +108 -0
- data/doc/files/lib/stella_rb.html +128 -0
- data/doc/files/lib/utils/crypto-key_rb.html +116 -0
- data/doc/files/lib/utils/fileutil_rb.html +108 -0
- data/doc/files/lib/utils/httputil_rb.html +110 -0
- data/doc/files/lib/utils/mathutil_rb.html +101 -0
- data/doc/files/lib/utils/textgraph_rb.html +138 -0
- data/doc/files/lib/utils/timerutil_rb.html +108 -0
- data/doc/fr_class_index.html +66 -0
- data/doc/fr_file_index.html +62 -0
- data/doc/fr_method_index.html +309 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/lib/stella.rb +5 -6
- data/lib/stella/adapter/ab.rb +4 -31
- data/lib/stella/adapter/base.rb +1 -15
- data/lib/stella/adapter/httperf.rb +4 -35
- data/lib/stella/adapter/siege.rb +29 -51
- data/lib/stella/cli.rb +22 -45
- data/lib/stella/cli/language.rb +0 -2
- data/lib/stella/cli/localtest.rb +0 -5
- data/lib/stella/command/base.rb +1 -1
- data/lib/stella/command/localtest.rb +68 -84
- data/lib/stella/test/daysummary.rb +93 -0
- data/lib/stella/test/definition.rb +5 -10
- data/lib/stella/test/{run/summary.rb → runsummary.rb} +6 -4
- data/lib/stella/test/{base.rb → summarybase.rb} +7 -3
- data/lib/stella/test/{summary.rb → testsummary.rb} +29 -27
- data/lib/utils/mathutil.rb +34 -36
- data/spec/base.rb +26 -0
- data/spec/shell_spec.rb +12 -0
- data/support/text/en.yaml +1 -7
- metadata +102 -8
- data/lib/stella/cli/agents.rb +0 -73
- data/lib/utils/escape.rb +0 -302
data/lib/stella/cli.rb
CHANGED
|
@@ -2,14 +2,13 @@
|
|
|
2
2
|
require 'optparse'
|
|
3
3
|
require 'ostruct'
|
|
4
4
|
|
|
5
|
+
# All command-line interface wrappers
|
|
5
6
|
require 'stella/cli/base'
|
|
7
|
+
require 'stella/cli/language'
|
|
8
|
+
require 'stella/cli/localtest'
|
|
6
9
|
|
|
7
10
|
module Stella
|
|
8
11
|
|
|
9
|
-
# Stella::Config
|
|
10
|
-
#
|
|
11
|
-
# This Config class manages the content of ENV['HOME]/.stella. The functionality
|
|
12
|
-
# is currently disabled so stella is stateless.
|
|
13
12
|
class Config < Storable
|
|
14
13
|
DEFAULT_HOME = File.join(ENV['HOME'], '.stella').freeze unless defined? DEFAULT_HOME
|
|
15
14
|
DEFAULT_DATA_HOME = File.join(Dir.getwd, 'stella').freeze unless defined? DEFAULT_DATA_HOME
|
|
@@ -43,36 +42,27 @@ module Stella
|
|
|
43
42
|
|
|
44
43
|
end
|
|
45
44
|
|
|
46
|
-
# Stella::CLI
|
|
47
|
-
#
|
|
48
|
-
# The is the front-end class for the command-line implementation. The stella script
|
|
49
|
-
# creates an instance of this class which is the glue between the command-line
|
|
50
|
-
# and the Stella command classes.
|
|
51
|
-
# Note: All Stella::CLI classes are autoloaded and they add themselves to @@commands.
|
|
52
|
-
class CLI
|
|
53
45
|
|
|
54
|
-
|
|
55
|
-
@@commands = {}
|
|
46
|
+
class CLI
|
|
56
47
|
|
|
57
48
|
attr_reader :options
|
|
58
49
|
attr_reader :logger
|
|
59
|
-
|
|
50
|
+
attr_accessor :commands
|
|
60
51
|
|
|
61
|
-
|
|
62
52
|
def initialize(arguments=[], stdin=nil)
|
|
63
53
|
@arguments = arguments
|
|
64
54
|
@stdin = stdin
|
|
65
55
|
|
|
56
|
+
@commands = {
|
|
57
|
+
'ab' => Stella::CLI::LocalTest,
|
|
58
|
+
'siege' => Stella::CLI::LocalTest,
|
|
59
|
+
'httperf' => Stella::CLI::LocalTest,
|
|
60
|
+
'lang' => Stella::CLI::Language
|
|
61
|
+
}
|
|
66
62
|
@config = Stella::Config.new
|
|
67
63
|
@options = OpenStruct.new
|
|
68
64
|
@options.verbose = 0
|
|
69
|
-
@options.data_path = @config.working_directory
|
|
70
65
|
@options.agents = []
|
|
71
|
-
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
def commands
|
|
75
|
-
@@commands
|
|
76
66
|
end
|
|
77
67
|
|
|
78
68
|
def run
|
|
@@ -86,13 +76,13 @@ module Stella
|
|
|
86
76
|
|
|
87
77
|
# Pull the requested command object out of the list
|
|
88
78
|
# and tell it what shortname that was used to call it.
|
|
89
|
-
command =
|
|
79
|
+
command = @commands[@command_name].new(@command_name)
|
|
90
80
|
|
|
91
81
|
# Give the command object access to the config and runtime options
|
|
92
82
|
#command.global_config = @config
|
|
93
83
|
command.stella_options = @options
|
|
94
84
|
command.arguments = @command_arguments
|
|
95
|
-
command.working_directory = @
|
|
85
|
+
command.working_directory = @config.working_directory
|
|
96
86
|
|
|
97
87
|
command.run
|
|
98
88
|
|
|
@@ -114,7 +104,7 @@ module Stella
|
|
|
114
104
|
|
|
115
105
|
@command_name = nil
|
|
116
106
|
@arguments.each do |arg|
|
|
117
|
-
if (
|
|
107
|
+
if (@commands.has_key? arg)
|
|
118
108
|
@command_name = arg
|
|
119
109
|
index = @arguments.index(@command_name)
|
|
120
110
|
@command_arguments = @arguments[index + 1..@arguments.size]
|
|
@@ -143,7 +133,7 @@ module Stella
|
|
|
143
133
|
|
|
144
134
|
opts = OptionParser.new
|
|
145
135
|
opts.banner = Stella::TEXT.msg(:option_help_usage)
|
|
146
|
-
opts.on Stella::TEXT.msg(:option_help_preamble,
|
|
136
|
+
opts.on Stella::TEXT.msg(:option_help_preamble, @commands.keys.join(', '))
|
|
147
137
|
|
|
148
138
|
opts.on(Stella::TEXT.msg(:option_help_options_title))
|
|
149
139
|
opts.on('-V', '--version', Stella::TEXT.msg(:option_help_version)) do
|
|
@@ -159,13 +149,9 @@ module Stella
|
|
|
159
149
|
opts.on('-q', '--quiet', Stella::TEXT.msg(:option_help_quiet)) do
|
|
160
150
|
@options.quiet = true
|
|
161
151
|
end
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
# so we'll redo this soon. It's also useful for comparing Ruby/JRuby/IronRuby
|
|
166
|
-
#opts.on('--overhead', String, Stella::TEXT.msg(:option_help_overhead)) do
|
|
167
|
-
# @options.showoverhead = true
|
|
168
|
-
#end
|
|
152
|
+
opts.on('--overhead', String, Stella::TEXT.msg(:option_help_overhead)) do
|
|
153
|
+
@options.showoverhead = true
|
|
154
|
+
end
|
|
169
155
|
|
|
170
156
|
opts.on('-O', '--stdout', Stella::TEXT.msg(:option_help_stdout)) do
|
|
171
157
|
@options.stdout = true
|
|
@@ -197,9 +183,10 @@ module Stella
|
|
|
197
183
|
@options.warmup = MathUtil.enforce_limit(((v) ? v : 0), 0.1, 1)
|
|
198
184
|
end
|
|
199
185
|
|
|
200
|
-
opts.on('-a', '--agent=
|
|
186
|
+
opts.on('-a', '--agent=S', String, Stella::TEXT.msg(:option_help_agent)) do |v|
|
|
187
|
+
raise "Agent is empty" if v.empty?
|
|
201
188
|
@options.agents ||= []
|
|
202
|
-
agent_ary = Stella::Util::expand_str(v
|
|
189
|
+
agent_ary = Stella::Util::expand_str(v)
|
|
203
190
|
@options.agents.push(agent_ary)
|
|
204
191
|
end
|
|
205
192
|
|
|
@@ -261,7 +248,7 @@ module Stella
|
|
|
261
248
|
# Stella::LOGGER.debug("ENV[#{n}]=#{v}")
|
|
262
249
|
#end
|
|
263
250
|
|
|
264
|
-
Stella::LOGGER.debug("Commands (#{@command_name}): #{
|
|
251
|
+
Stella::LOGGER.debug("Commands (#{@command_name}): #{@commands.keys.join(',')}")
|
|
265
252
|
|
|
266
253
|
#Stella::LOGGER.debug("Configs: ")
|
|
267
254
|
#@config.to_hash.each_pair do |n,v|
|
|
@@ -278,14 +265,4 @@ module Stella
|
|
|
278
265
|
Stella::LOGGER.debug("Command Arguments: #{@command_arguments.join(',')}" )
|
|
279
266
|
end
|
|
280
267
|
end
|
|
281
|
-
end
|
|
282
|
-
|
|
283
|
-
# Autoload CLI classes. These classes add themselves to the class variable @@commands.
|
|
284
|
-
begin
|
|
285
|
-
cli_classes = Dir.glob(File.join(STELLA_HOME, 'lib', 'stella', 'cli', "*.rb"))
|
|
286
|
-
cli_classes.each do |path|
|
|
287
|
-
require path
|
|
288
|
-
end
|
|
289
|
-
rescue LoadError => ex
|
|
290
|
-
Stella::LOGGER.info("Error loading #{path}: #{ex.message}")
|
|
291
268
|
end
|
data/lib/stella/cli/language.rb
CHANGED
data/lib/stella/cli/localtest.rb
CHANGED
data/lib/stella/command/base.rb
CHANGED
|
@@ -27,7 +27,6 @@ module Stella
|
|
|
27
27
|
attr_reader :paths
|
|
28
28
|
|
|
29
29
|
attr_accessor :working_directory
|
|
30
|
-
attr_reader :available_agents
|
|
31
30
|
|
|
32
31
|
def initialize(testdef=nil, adapter=nil)
|
|
33
32
|
@testdef = testdef if testdef
|
|
@@ -74,16 +73,18 @@ module Stella
|
|
|
74
73
|
|
|
75
74
|
test_path = _generate_test_path
|
|
76
75
|
|
|
76
|
+
|
|
77
77
|
prepare_test(test_path)
|
|
78
78
|
|
|
79
79
|
threshold = (@testdef.rampup) ? @testdef.rampup.ceiling : @adapter.vusers
|
|
80
80
|
|
|
81
|
+
|
|
81
82
|
runnum = "00"
|
|
82
83
|
while(@adapter.vusers <= threshold) do
|
|
83
84
|
|
|
84
85
|
# Make sure the load factor is set to 1. If there was a warmup,
|
|
85
86
|
# then this value will be less than 1.
|
|
86
|
-
testrun =
|
|
87
|
+
testrun = testrun_maker(1)
|
|
87
88
|
|
|
88
89
|
# We empty test_runpaths so we can keep track of the runpaths for each
|
|
89
90
|
# level of virtual users. This is useful during a rampup test so we can
|
|
@@ -116,7 +117,7 @@ module Stella
|
|
|
116
117
|
if @testdef.sleep && @testdef.sleep.to_f > 0 && @testdef.repetitions > 1
|
|
117
118
|
run_sleeper(@testdef.sleep)
|
|
118
119
|
end
|
|
119
|
-
Stella::LOGGER.info('')
|
|
120
|
+
Stella::LOGGER.info('') # We want the newline
|
|
120
121
|
end
|
|
121
122
|
|
|
122
123
|
# Rampup tests produce multiple summary files which include the batch
|
|
@@ -145,7 +146,7 @@ module Stella
|
|
|
145
146
|
|
|
146
147
|
|
|
147
148
|
# Non-rampup tests only need to run through the loop once.
|
|
148
|
-
break if (
|
|
149
|
+
break if (@adapter.vusers == threshold)
|
|
149
150
|
|
|
150
151
|
end
|
|
151
152
|
|
|
@@ -166,66 +167,14 @@ module Stella
|
|
|
166
167
|
|
|
167
168
|
private
|
|
168
169
|
|
|
169
|
-
#
|
|
170
|
-
#
|
|
171
|
-
# Execute the group of testruns associated to this test. This includes
|
|
172
|
-
# zero or one warmup and one or more testruns.
|
|
173
|
-
#
|
|
174
|
-
# INPUT:
|
|
175
|
-
# +test_path+ filesystem path to store all test data
|
|
176
|
-
#
|
|
177
|
-
def prepare_test(test_path)
|
|
178
|
-
|
|
179
|
-
Stella::LOGGER.info("Writing test data to: #{test_path}\n\n") unless @quiet
|
|
180
|
-
|
|
181
|
-
# Make sure the test storage directory is created along with the
|
|
182
|
-
# latest symlink
|
|
183
|
-
FileUtil.create_dir(test_path)
|
|
184
|
-
File.unlink(latest_test_symlink_path) if File.exists?(latest_test_symlink_path)
|
|
185
|
-
File.symlink(File.expand_path(test_path), latest_test_symlink_path)
|
|
186
|
-
|
|
187
|
-
# Write the test ID to the storage directory
|
|
188
|
-
FileUtil.write_file(test_path + "/ID.txt", @guid, true)
|
|
189
|
-
|
|
190
|
-
# And the test run message
|
|
191
|
-
FileUtil.write_file(test_path + "/MESSAGE.txt", @testdef.message, true) if @testdef.message
|
|
192
|
-
|
|
193
|
-
@adapter.user_agent = @agents unless @agents.empty?
|
|
194
|
-
|
|
195
|
-
# The warmup is identical to a testrun except for two things:
|
|
196
|
-
# - we don't make note of the runpath
|
|
197
|
-
# - there is a one second sleep after the run.
|
|
198
|
-
# Everything else is identical.
|
|
199
|
-
if @testdef.warmup
|
|
200
|
-
|
|
201
|
-
testrun = maker_of_testruns(@testdef.warmup)
|
|
202
|
-
|
|
203
|
-
# Generate the filesystem path to store the run data.
|
|
204
|
-
# NOTE: We don't keep the warmup path in @test_runpaths because we
|
|
205
|
-
# include it in the final calculation for the test.
|
|
206
|
-
runpath = File.join(test_path, "warmup")
|
|
207
|
-
|
|
208
|
-
# Run the warmpup round
|
|
209
|
-
testrun.call("Warmup", runpath)
|
|
210
|
-
|
|
211
|
-
run_sleeper(@testdef.sleep || 1)
|
|
212
|
-
|
|
213
|
-
Stella::LOGGER.info('', '') unless @quiet # We just need the newline
|
|
214
|
-
|
|
215
|
-
end
|
|
216
|
-
|
|
217
|
-
print_title unless @quiet
|
|
218
|
-
|
|
219
|
-
end
|
|
220
|
-
|
|
221
|
-
# maker_of_testruns
|
|
170
|
+
# testrun_maker
|
|
222
171
|
#
|
|
223
172
|
# Generator of test runs. Everything that happens during a test
|
|
224
173
|
# run is defined here. We use a Proc so we can toss the functionality
|
|
225
174
|
# around like something that's dirty and loves a good tossing.
|
|
226
175
|
# It's important that all output be on a single line without a
|
|
227
176
|
# line terminator. Otherwise great descruction could occur.
|
|
228
|
-
def
|
|
177
|
+
def testrun_maker(factor)
|
|
229
178
|
testrun = Proc.new do |name,runpath|
|
|
230
179
|
# Make sure the test run storage directory is created
|
|
231
180
|
FileUtil.create_dir(runpath)
|
|
@@ -234,7 +183,7 @@ module Stella
|
|
|
234
183
|
@adapter.working_directory = runpath
|
|
235
184
|
@adapter.before
|
|
236
185
|
|
|
237
|
-
Stella::LOGGER.info_printf("%
|
|
186
|
+
Stella::LOGGER.info_printf("%10s: %6d@%-5d", name, @adapter.requests, @adapter.vusers) unless @quiet
|
|
238
187
|
|
|
239
188
|
# Here we record the command arguments. This needs to be last because we modify
|
|
240
189
|
# some of the arguments above.
|
|
@@ -253,16 +202,65 @@ module Stella
|
|
|
253
202
|
|
|
254
203
|
save_summary(@adapter.summary_path(@format), stats)
|
|
255
204
|
|
|
256
|
-
|
|
205
|
+
|
|
257
206
|
unless @quiet
|
|
258
|
-
Stella::LOGGER.info_print(sprintf("%
|
|
259
|
-
Stella::LOGGER.info_print(sprintf("%
|
|
207
|
+
Stella::LOGGER.info_print(sprintf("%9.4fs %6.2f/s", stats.elapsed_time, stats.transaction_rate))
|
|
208
|
+
Stella::LOGGER.info_print(sprintf("%9.4fs (%3.2f%%) ", stats.response_time, stats.availability))
|
|
209
|
+
Stella::LOGGER.info_print(sprintf(" (ruby: %.4f with %.4f overhead)", run_timer.real, run_timer.overhead)) if @showoverhead
|
|
260
210
|
# NOTE: We don't print a line terminator here
|
|
261
211
|
end
|
|
262
212
|
|
|
263
213
|
end
|
|
264
214
|
end
|
|
265
215
|
|
|
216
|
+
|
|
217
|
+
# prepare_test
|
|
218
|
+
#
|
|
219
|
+
# Execute the group of testruns associated to this test. This includes
|
|
220
|
+
# zero or one warmup and one or more testruns.
|
|
221
|
+
#
|
|
222
|
+
# INPUT:
|
|
223
|
+
# +test_path+ filesystem path to store all test data
|
|
224
|
+
#
|
|
225
|
+
def prepare_test(test_path)
|
|
226
|
+
|
|
227
|
+
Stella::LOGGER.info("Writing test data to: #{test_path}\n\n") unless @quiet
|
|
228
|
+
|
|
229
|
+
# Make sure the test storage directory is created along with the
|
|
230
|
+
# latest symlink
|
|
231
|
+
FileUtil.create_dir(test_path)
|
|
232
|
+
File.unlink(latest_test_symlink_path) if File.exists?(latest_test_symlink_path)
|
|
233
|
+
File.symlink(File.expand_path(test_path), latest_test_symlink_path)
|
|
234
|
+
|
|
235
|
+
# Write the test ID to the storage directory
|
|
236
|
+
FileUtil.write_file(test_path + "/ID.txt", @guid, true)
|
|
237
|
+
|
|
238
|
+
# And the test run message
|
|
239
|
+
FileUtil.write_file(test_path + "/MESSAGE.txt", @testdef.message, true) if @testdef.message
|
|
240
|
+
|
|
241
|
+
# The warmup is identical to a testrun except for two things:
|
|
242
|
+
# - we don't make note of the runpath
|
|
243
|
+
# - there is a one second sleep after the run.
|
|
244
|
+
# Everything else is identical.
|
|
245
|
+
if @testdef.warmup
|
|
246
|
+
|
|
247
|
+
testrun = testrun_maker(@testdef.warmup)
|
|
248
|
+
|
|
249
|
+
# Generate the filesystem path to store the run data.
|
|
250
|
+
# NOTE: We don't keep the warmup path in @test_runpaths because we
|
|
251
|
+
# include it in the final calculation for the test.
|
|
252
|
+
runpath = File.join(test_path, "warmup")
|
|
253
|
+
|
|
254
|
+
# Run the warmpup round
|
|
255
|
+
testrun.call("Warmup", runpath)
|
|
256
|
+
|
|
257
|
+
run_sleeper(@testdef.sleep || 1)
|
|
258
|
+
|
|
259
|
+
Stella::LOGGER.info('', '') # We just need the newline
|
|
260
|
+
end
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
end
|
|
266
264
|
|
|
267
265
|
# print_summary
|
|
268
266
|
#
|
|
@@ -270,27 +268,13 @@ module Stella
|
|
|
270
268
|
# it's also called at the end of all the runs.
|
|
271
269
|
#
|
|
272
270
|
# INPUT:
|
|
273
|
-
# stats:: Any object that extends Stella::Test::
|
|
271
|
+
# stats:: Any object that extends Stella::Test::SummaryBase object
|
|
274
272
|
def print_summary(stats)
|
|
275
273
|
Stella::LOGGER.info(' ' << "-"*67) unless @quiet
|
|
276
274
|
|
|
277
|
-
Stella::LOGGER.
|
|
278
|
-
Stella::LOGGER.info_printf("%
|
|
279
|
-
Stella::LOGGER.
|
|
280
|
-
Stella::LOGGER.info_printf("%8s: %22s %9.2f/s %8.3fs %8.3fMB/s %10s %8.3fs", "Std Dev", '', stats.transaction_rate_sdev, stats.response_time_sdev, stats.throughput_sdev, '', stats.elapsed_time_sdev)
|
|
281
|
-
Stella::LOGGER.info('') # New line
|
|
282
|
-
Stella::LOGGER.info('') unless @quiet # Extra new line
|
|
283
|
-
end
|
|
284
|
-
|
|
285
|
-
# print_title
|
|
286
|
-
#
|
|
287
|
-
# Prints the column headers for the test run output. Field widths match those
|
|
288
|
-
# in print_summary and test_maker
|
|
289
|
-
def print_title
|
|
290
|
-
Stella::LOGGER.info(' ' << "-"*67) unless @quiet
|
|
291
|
-
|
|
292
|
-
Stella::LOGGER.info_printf("%8s %10s@%-5s %5s %11s", "", 'REQ', 'VU/s', 'AVAIL', 'REQ/s')
|
|
293
|
-
Stella::LOGGER.info_printf("%10s %12s %10s %9s", 'RTIME', 'DATA/s', 'DATA', 'TIME')
|
|
275
|
+
Stella::LOGGER.info(sprintf("%9s %13s %9.4fs %6.2f/s %8.4fs", "Std Dev:", '', stats.elapsed_time_sdev, stats.transaction_rate_sdev, stats.response_time_sdev))
|
|
276
|
+
Stella::LOGGER.info_printf("%9s %8d@%-5d%9.4fs %6.2f/s", "Total:", stats.transactions_total, stats.vusers_avg, stats.elapsed_time_total, stats.transaction_rate_avg)
|
|
277
|
+
Stella::LOGGER.info_printf("%9.4fs (%3.2f%%) ", stats.response_time_avg, stats.availability)
|
|
294
278
|
Stella::LOGGER.info('') # New line
|
|
295
279
|
Stella::LOGGER.info('') unless @quiet # Extra new line
|
|
296
280
|
end
|
|
@@ -301,7 +285,7 @@ module Stella
|
|
|
301
285
|
#
|
|
302
286
|
# INPUT:
|
|
303
287
|
# filepath:: the complete path for the file (string)
|
|
304
|
-
# stats:: Any object that extends Stella::Test::
|
|
288
|
+
# stats:: Any object that extends Stella::Test::SummaryBase object
|
|
305
289
|
def save_summary(filepath, stats)
|
|
306
290
|
FileUtil.write_file(filepath, stats.dump(@format, :with_titles), true)
|
|
307
291
|
end
|
|
@@ -309,12 +293,12 @@ module Stella
|
|
|
309
293
|
# Load SUMMARY file for each run and create a summary with
|
|
310
294
|
# totals, averages, and standard deviations.
|
|
311
295
|
def process_test_stats(paths)
|
|
312
|
-
test_stats = Stella::Test::
|
|
296
|
+
test_stats = Stella::Test::TestSummary.new(@message)
|
|
313
297
|
all_stats_obj = []
|
|
314
298
|
paths.each do |path|
|
|
315
299
|
file_contents = FileUtil.read_file_to_array("#{path}/SUMMARY.#{@format}")
|
|
316
|
-
stats = Stella::Test::
|
|
317
|
-
stats_obj = Stella::Test::
|
|
300
|
+
stats = Stella::Test::RunSummary.undump(@format, file_contents)
|
|
301
|
+
stats_obj = Stella::Test::RunSummary.from_hash(stats)
|
|
318
302
|
test_stats.add_run(stats_obj)
|
|
319
303
|
end
|
|
320
304
|
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
module Stella::Test
|
|
4
|
+
|
|
5
|
+
class DaySummary < Stella::Storable
|
|
6
|
+
include SummaryBase
|
|
7
|
+
|
|
8
|
+
attr_accessor :testsummaries
|
|
9
|
+
|
|
10
|
+
def initialize
|
|
11
|
+
@testsummary = []
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def field_names
|
|
15
|
+
names = super
|
|
16
|
+
names << :testsummaries
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def initialize(msg="")
|
|
21
|
+
@message = msg
|
|
22
|
+
@testsummaries = []
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Add a TestRun object to the list
|
|
26
|
+
def add_testsummary(testsummary)
|
|
27
|
+
raise "I got a #{run.class} but I wanted a TestSummary" unless testsummary.is_a?(TestSummary)
|
|
28
|
+
@testsummaries << testsummary
|
|
29
|
+
calculate
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
private
|
|
33
|
+
def calculate
|
|
34
|
+
@transactions_total = 0
|
|
35
|
+
@headers_transferred_total = 0
|
|
36
|
+
@data_transferred_total = 0
|
|
37
|
+
|
|
38
|
+
@elapsed_time_avg = 0
|
|
39
|
+
@response_time_avg = 0
|
|
40
|
+
@transaction_rate_avg = 0
|
|
41
|
+
@vusers_avg = 0
|
|
42
|
+
|
|
43
|
+
@successful_total = 0
|
|
44
|
+
@failed_total = 0
|
|
45
|
+
|
|
46
|
+
elapsed_times = []
|
|
47
|
+
transaction_rates = []
|
|
48
|
+
vusers_list = []
|
|
49
|
+
response_times = []
|
|
50
|
+
@elapsed_time_total = 0
|
|
51
|
+
response_time = 0
|
|
52
|
+
transaction_rate = 0
|
|
53
|
+
vusers = 0
|
|
54
|
+
|
|
55
|
+
testsummaries.each do |testsummary|
|
|
56
|
+
# These are totaled
|
|
57
|
+
@transactions_total += testsummary.transactions_total
|
|
58
|
+
@headers_transferred_total += testsummary.headers_transferred_total
|
|
59
|
+
@data_transferred_total += testsummary.data_transferred_total
|
|
60
|
+
@successful_total += testsummary.successful_total
|
|
61
|
+
@failed_total += testsummary.failed_total
|
|
62
|
+
|
|
63
|
+
@elapsed_time_total += testsummary.elapsed_time_total
|
|
64
|
+
|
|
65
|
+
response_time += testsummary.response_time
|
|
66
|
+
|
|
67
|
+
transaction_rate += testsummary.transaction_rate
|
|
68
|
+
vusers += testsummary.vusers
|
|
69
|
+
|
|
70
|
+
# These are used for standard deviation
|
|
71
|
+
elapsed_times << testsummary.elapsed_time_avg
|
|
72
|
+
transaction_rates << testsummary.transaction_rate_avg
|
|
73
|
+
vusers_list << testsummary.vusers_avg
|
|
74
|
+
response_times << testsummary.response_time_avg
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Calculate Averages
|
|
78
|
+
@elapsed_time_avg = @elapsed_time_total / testsummary.size
|
|
79
|
+
@transaction_rate_avg = transaction_rate / testsummary.size
|
|
80
|
+
@vusers_avg = (vusers / testsummary.size)
|
|
81
|
+
@response_time_avg = response_time / testsummary.size
|
|
82
|
+
|
|
83
|
+
# Calculate Standard Deviations
|
|
84
|
+
@elapsed_time_sdev = MathUtil.standard_deviation(elapsed_times)
|
|
85
|
+
@transaction_rate_sdev = MathUtil.standard_deviation(transaction_rates)
|
|
86
|
+
@vusers_sdev = MathUtil.standard_deviation(vusers_list)
|
|
87
|
+
@response_time_sdev = MathUtil.standard_deviation(response_times)
|
|
88
|
+
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
end
|