stella 0.5.4 → 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +14 -10
- data/Rakefile +22 -36
- data/lib/daemonize.rb +56 -0
- data/lib/stella/adapter/ab.rb +49 -39
- data/lib/stella/adapter/base.rb +17 -8
- data/lib/stella/adapter/httperf.rb +24 -18
- data/lib/stella/adapter/pcap_watcher.rb +1 -1
- data/lib/stella/adapter/siege.rb +15 -12
- data/lib/stella/cli/localtest.rb +2 -3
- data/lib/stella/cli/sysinfo.rb +0 -1
- data/lib/stella/cli.rb +10 -55
- data/lib/stella/command/base.rb +0 -62
- data/lib/stella/command/localtest.rb +35 -36
- data/lib/stella/data/domain.rb +18 -11
- data/lib/stella/data/http.rb +23 -16
- data/lib/stella/logger.rb +29 -19
- data/lib/stella/response.rb +5 -2
- data/lib/stella/storable.rb +138 -52
- data/lib/stella/support.rb +107 -8
- data/lib/stella/sysinfo.rb +26 -16
- data/lib/stella/test/definition.rb +1 -1
- data/lib/stella/test/run/summary.rb +23 -13
- data/lib/stella/test/stats.rb +114 -0
- data/lib/stella/text/resource.rb +1 -1
- data/lib/stella.rb +29 -4
- data/lib/utils/mathutil.rb +0 -76
- data/lib/utils/stats.rb +88 -0
- data/lib/win32/Console/ANSI.rb +305 -305
- data/lib/win32/Console.rb +970 -970
- data/support/ruby-pcap-takuma-patch.txt +13 -13
- data/support/text/en.yaml +11 -8
- data/support/text/nl.yaml +7 -1
- data/{spec/show-agents_spec.rb → tests/01-util_test.rb} +0 -0
- data/tests/02-stella-util_test.rb +42 -0
- data/tests/10-stella_test.rb +104 -0
- data/tests/11-stella-storable_test.rb +68 -0
- data/tests/60-stella-command_test.rb +248 -0
- data/tests/80-stella-cli_test.rb +45 -0
- data/tests/spec-helper.rb +31 -0
- data/vendor/{frylock/README.textile → drydock/LICENSE.txt} +2 -52
- data/vendor/drydock/README.textile +57 -0
- data/vendor/{frylock → drydock}/bin/example +14 -14
- data/vendor/{frylock/frylock.gemspec → drydock/drydock.gemspec} +1 -1
- data/vendor/{frylock/lib/frylock → drydock/lib/drydock}/exceptions.rb +1 -1
- data/vendor/{frylock/lib/frylock.rb → drydock/lib/drydock.rb} +8 -8
- data/vendor/{frylock → drydock}/test/command_test.rb +0 -0
- metadata +34 -61
- data/lib/stella/test/base.rb +0 -38
- data/lib/stella/test/summary.rb +0 -82
- data/vendor/hitimes-0.4.0/HISTORY +0 -28
- data/vendor/hitimes-0.4.0/LICENSE.txt +0 -19
- data/vendor/hitimes-0.4.0/README +0 -80
- data/vendor/hitimes-0.4.0/Rakefile +0 -63
- data/vendor/hitimes-0.4.0/examples/benchmarks.rb +0 -86
- data/vendor/hitimes-0.4.0/examples/stats.rb +0 -29
- data/vendor/hitimes-0.4.0/ext/extconf.rb +0 -15
- data/vendor/hitimes-0.4.0/ext/hitimes_ext.c +0 -21
- data/vendor/hitimes-0.4.0/ext/hitimes_instant_clock_gettime.c +0 -20
- data/vendor/hitimes-0.4.0/ext/hitimes_instant_osx.c +0 -16
- data/vendor/hitimes-0.4.0/ext/hitimes_instant_windows.c +0 -27
- data/vendor/hitimes-0.4.0/ext/hitimes_interval.c +0 -340
- data/vendor/hitimes-0.4.0/ext/hitimes_interval.h +0 -73
- data/vendor/hitimes-0.4.0/ext/hitimes_stats.c +0 -242
- data/vendor/hitimes-0.4.0/ext/hitimes_stats.h +0 -30
- data/vendor/hitimes-0.4.0/ext/rbconfig-mingw.rb +0 -178
- data/vendor/hitimes-0.4.0/ext/rbconfig.rb +0 -178
- data/vendor/hitimes-0.4.0/gemspec.rb +0 -54
- data/vendor/hitimes-0.4.0/lib/hitimes/mutexed_stats.rb +0 -23
- data/vendor/hitimes-0.4.0/lib/hitimes/paths.rb +0 -54
- data/vendor/hitimes-0.4.0/lib/hitimes/stats.rb +0 -29
- data/vendor/hitimes-0.4.0/lib/hitimes/timer.rb +0 -223
- data/vendor/hitimes-0.4.0/lib/hitimes/version.rb +0 -42
- data/vendor/hitimes-0.4.0/lib/hitimes.rb +0 -24
- data/vendor/hitimes-0.4.0/spec/interval_spec.rb +0 -115
- data/vendor/hitimes-0.4.0/spec/mutex_stats_spec.rb +0 -34
- data/vendor/hitimes-0.4.0/spec/paths_spec.rb +0 -14
- data/vendor/hitimes-0.4.0/spec/spec_helper.rb +0 -6
- data/vendor/hitimes-0.4.0/spec/stats_spec.rb +0 -72
- data/vendor/hitimes-0.4.0/spec/timer_spec.rb +0 -105
- data/vendor/hitimes-0.4.0/spec/version_spec.rb +0 -27
- data/vendor/hitimes-0.4.0/tasks/announce.rake +0 -39
- data/vendor/hitimes-0.4.0/tasks/config.rb +0 -107
- data/vendor/hitimes-0.4.0/tasks/distribution.rake +0 -53
- data/vendor/hitimes-0.4.0/tasks/documentation.rake +0 -33
- data/vendor/hitimes-0.4.0/tasks/extension.rake +0 -64
- data/vendor/hitimes-0.4.0/tasks/rspec.rake +0 -31
- data/vendor/hitimes-0.4.0/tasks/rubyforge.rake +0 -52
- data/vendor/hitimes-0.4.0/tasks/utils.rb +0 -80
@@ -0,0 +1,114 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
module Stella::Test
|
4
|
+
|
5
|
+
# Stella::Test::Stats
|
6
|
+
class Stats < Stella::Storable
|
7
|
+
|
8
|
+
field :elapsed_time_avg => Float
|
9
|
+
field :transaction_rate_avg => Float
|
10
|
+
field :vusers_avg => Float
|
11
|
+
field :response_time_avg => Float
|
12
|
+
|
13
|
+
field :elapsed_time_sdev => Float
|
14
|
+
field :transaction_rate_sdev => Float
|
15
|
+
field :vusers_sdev => Float
|
16
|
+
field :response_time_sdev => Float
|
17
|
+
|
18
|
+
|
19
|
+
field :transactions_total => Float
|
20
|
+
field :successful_total => Float
|
21
|
+
field :failed_total => Float
|
22
|
+
|
23
|
+
field :data_transferred_total => Float
|
24
|
+
field :headers_transferred_total => Float
|
25
|
+
|
26
|
+
|
27
|
+
field :elapsed_time_total => Float
|
28
|
+
field :availability => Float
|
29
|
+
field :throughput_avg => Float
|
30
|
+
field :throughput_sdev => Float
|
31
|
+
|
32
|
+
def availability
|
33
|
+
return 0 if @successful_total == 0
|
34
|
+
begin
|
35
|
+
(@transactions_total / @successful_total).to_f * 100
|
36
|
+
rescue => ex
|
37
|
+
0.0
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
attr_reader :runs
|
43
|
+
|
44
|
+
def initialize(msg="")
|
45
|
+
@message = msg
|
46
|
+
@runs = []
|
47
|
+
end
|
48
|
+
|
49
|
+
# Add a TestRun object to the list
|
50
|
+
def add_run(run)
|
51
|
+
raise "I got a #{run.class} but I wanted a Run::Summary" unless run.is_a?(Run::Summary)
|
52
|
+
@runs << run
|
53
|
+
calculate
|
54
|
+
end
|
55
|
+
|
56
|
+
private
|
57
|
+
def calculate
|
58
|
+
# We simply keep a running tally of these
|
59
|
+
@transactions_total = 0
|
60
|
+
@headers_transferred_total = 0
|
61
|
+
@data_transferred_total = 0
|
62
|
+
@elapsed_time_total = 0
|
63
|
+
@successful_total = 0
|
64
|
+
@failed_total = 0
|
65
|
+
|
66
|
+
# We keep a list of the values for averaging and std dev
|
67
|
+
elapsed_times = ::Stats.new
|
68
|
+
transaction_rates = ::Stats.new
|
69
|
+
vusers_list = ::Stats.new
|
70
|
+
response_times = ::Stats.new
|
71
|
+
response_time = ::Stats.new
|
72
|
+
transaction_rate = ::Stats.new
|
73
|
+
throughput = ::Stats.new
|
74
|
+
vusers = ::Stats.new
|
75
|
+
|
76
|
+
# Each run is the summary of a single run (i.e. run01/SUMMARY.csv)
|
77
|
+
runs.each do |run|
|
78
|
+
# These are totaled
|
79
|
+
@transactions_total += run.transactions || 0
|
80
|
+
@headers_transferred_total += run.headers_transferred || 0
|
81
|
+
@data_transferred_total += run.data_transferred || 0
|
82
|
+
@successful_total += run.successful || 0
|
83
|
+
@failed_total += run.failed || 0
|
84
|
+
@elapsed_time_total += run.elapsed_time || 0
|
85
|
+
|
86
|
+
# These are used for standard deviation
|
87
|
+
elapsed_times.sample(run.elapsed_time)
|
88
|
+
transaction_rates.sample(run.transaction_rate)
|
89
|
+
vusers_list.sample(run.vusers)
|
90
|
+
response_times.sample(run.response_time)
|
91
|
+
throughput.sample(run.throughput)
|
92
|
+
response_time.sample(run.response_time)
|
93
|
+
transaction_rate.sample(run.transaction_rate)
|
94
|
+
vusers.sample(run.vusers)
|
95
|
+
end
|
96
|
+
|
97
|
+
# Calculate Averages
|
98
|
+
@elapsed_time_avg = elapsed_times.mean
|
99
|
+
@throughput_avg = throughput.mean
|
100
|
+
@response_time_avg = response_time.mean
|
101
|
+
@transaction_rate_avg = transaction_rate.mean
|
102
|
+
@vusers_avg = vusers.mean
|
103
|
+
|
104
|
+
# Calculate Standard Deviations
|
105
|
+
@elapsed_time_sdev = elapsed_times.sd
|
106
|
+
@throughput_sdev= throughput.sd
|
107
|
+
@transaction_rate_sdev = transaction_rates.sd
|
108
|
+
@vusers_sdev = vusers_list.sd
|
109
|
+
@response_time_sdev = response_times.sd
|
110
|
+
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
end
|
data/lib/stella/text/resource.rb
CHANGED
@@ -21,7 +21,7 @@ module Stella
|
|
21
21
|
|
22
22
|
def load_resource
|
23
23
|
return @messages unless @messages.empty?
|
24
|
-
Stella::LOGGER.debug("LOADING #{path}")
|
24
|
+
#Stella::LOGGER.debug("LOADING #{path}")
|
25
25
|
raise UnsupportedLanguage unless File.exists?(path)
|
26
26
|
@messages = YAML.load_file(path)
|
27
27
|
end
|
data/lib/stella.rb
CHANGED
@@ -4,6 +4,10 @@ require 'date'
|
|
4
4
|
require 'time'
|
5
5
|
require 'tempfile'
|
6
6
|
require 'socket'
|
7
|
+
require 'ostruct'
|
8
|
+
require 'optparse'
|
9
|
+
require 'rubygems'
|
10
|
+
|
7
11
|
|
8
12
|
# Common utilities
|
9
13
|
require 'utils/domainutil'
|
@@ -11,6 +15,7 @@ require 'utils/httputil'
|
|
11
15
|
require 'utils/fileutil'
|
12
16
|
require 'utils/mathutil'
|
13
17
|
require 'utils/escape'
|
18
|
+
require 'utils/stats'
|
14
19
|
|
15
20
|
# Common dependencies
|
16
21
|
$: << File.join(STELLA_HOME, 'vendor', 'useragent', 'lib')
|
@@ -32,7 +37,7 @@ require 'stella/response'
|
|
32
37
|
require 'stella/sysinfo'
|
33
38
|
require 'stella/test/definition'
|
34
39
|
require 'stella/test/run/summary'
|
35
|
-
require 'stella/test/
|
40
|
+
require 'stella/test/stats'
|
36
41
|
|
37
42
|
# Commands
|
38
43
|
require 'stella/command/base'
|
@@ -56,14 +61,14 @@ module Stella
|
|
56
61
|
# including OS (unix), implementation (freebsd), and architecture (x64)
|
57
62
|
SYSINFO = Stella::SystemInfo.new unless defined? SYSINFO
|
58
63
|
# A global logger for info, error, and debug messages.
|
59
|
-
LOGGER = Stella::Logger.new(:debug=>
|
64
|
+
LOGGER = Stella::Logger.new(:debug=>false) unless defined? LOGGER
|
60
65
|
# A global resource for all interface text.
|
61
66
|
TEXT = Stella::Text.new('en') unless defined? TEXT
|
62
67
|
|
63
68
|
module VERSION #:nodoc:
|
64
69
|
MAJOR = 0.freeze unless defined? MAJOR
|
65
70
|
MINOR = 5.freeze unless defined? MINOR
|
66
|
-
TINY =
|
71
|
+
TINY = 5.freeze unless defined? TINY
|
67
72
|
def self.to_s
|
68
73
|
[MAJOR, MINOR, TINY].join('.')
|
69
74
|
end
|
@@ -71,6 +76,26 @@ module Stella
|
|
71
76
|
self.to_s.to_f
|
72
77
|
end
|
73
78
|
end
|
74
|
-
|
79
|
+
|
80
|
+
def self.debug=(enable=false)
|
81
|
+
Stella::LOGGER.debug_level = enable
|
82
|
+
end
|
83
|
+
|
84
|
+
def self.text(*args)
|
85
|
+
TEXT.msg(*args)
|
86
|
+
end
|
87
|
+
|
88
|
+
def self.sysinfo
|
89
|
+
SYSINFO
|
90
|
+
end
|
91
|
+
|
92
|
+
def self.info(*args)
|
93
|
+
LOGGER.info(*args)
|
94
|
+
end
|
95
|
+
|
96
|
+
def self.error(*args)
|
97
|
+
LOGGER.error(*args)
|
98
|
+
end
|
99
|
+
|
75
100
|
end
|
76
101
|
|
data/lib/utils/mathutil.rb
CHANGED
@@ -2,30 +2,6 @@
|
|
2
2
|
|
3
3
|
module MathUtil
|
4
4
|
|
5
|
-
def self.variance(population)
|
6
|
-
n = 0
|
7
|
-
mean = 0.0
|
8
|
-
s = 0.0
|
9
|
-
|
10
|
-
population.each { |x|
|
11
|
-
n = n + 1
|
12
|
-
delta = (x - mean).to_f
|
13
|
-
mean = (mean + (delta / n)).to_f
|
14
|
-
s = (s + delta * (x - mean)).to_f
|
15
|
-
}
|
16
|
-
|
17
|
-
s / n
|
18
|
-
rescue => ex
|
19
|
-
0.0
|
20
|
-
end
|
21
|
-
|
22
|
-
# calculate the standard deviation of a population
|
23
|
-
# accepts: an array, the population
|
24
|
-
# returns: the standard deviation
|
25
|
-
def self.standard_deviation(population)
|
26
|
-
Math.sqrt(variance(population))
|
27
|
-
end
|
28
|
-
|
29
5
|
# enforce_limit
|
30
6
|
#
|
31
7
|
# Enforce a minimum and maximum value
|
@@ -37,55 +13,3 @@ module MathUtil
|
|
37
13
|
|
38
14
|
end
|
39
15
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
module Enumerable
|
44
|
-
|
45
|
-
##
|
46
|
-
# Sum of all the elements of the Enumerable
|
47
|
-
|
48
|
-
def sum
|
49
|
-
return 0 if !self || self.empty?
|
50
|
-
self.inject(0) { |acc, i| acc.to_f + i.to_f }
|
51
|
-
end
|
52
|
-
|
53
|
-
##
|
54
|
-
# Average of all the elements of the Enumerable
|
55
|
-
#
|
56
|
-
# The Enumerable must respond to #length
|
57
|
-
|
58
|
-
def average
|
59
|
-
return 0 unless self
|
60
|
-
self.sum / self.length.to_f
|
61
|
-
rescue => ex
|
62
|
-
0.0
|
63
|
-
end
|
64
|
-
|
65
|
-
##
|
66
|
-
# Sample variance of all the elements of the Enumerable
|
67
|
-
#
|
68
|
-
# The Enumerable must respond to #length
|
69
|
-
|
70
|
-
def sample_variance
|
71
|
-
return 0 unless self
|
72
|
-
avg = self.average
|
73
|
-
sum = self.sum
|
74
|
-
(1 / self.length.to_f * sum)
|
75
|
-
rescue => ex
|
76
|
-
0.0
|
77
|
-
end
|
78
|
-
|
79
|
-
##
|
80
|
-
# Standard deviation of all the elements of the Enumerable
|
81
|
-
#
|
82
|
-
# The Enumerable must respond to #length
|
83
|
-
|
84
|
-
def standard_deviation
|
85
|
-
return 0 unless self
|
86
|
-
Math.sqrt(self.sample_variance)
|
87
|
-
rescue => ex
|
88
|
-
0.0
|
89
|
-
end
|
90
|
-
|
91
|
-
end
|
data/lib/utils/stats.rb
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
# Copyright (c) 2005 Zed A. Shaw
|
2
|
+
# You can redistribute it and/or modify it under the same terms as Ruby.
|
3
|
+
#
|
4
|
+
# Additional work donated by contributors. See http://mongrel.rubyforge.org/attributions.html
|
5
|
+
# for more information.
|
6
|
+
|
7
|
+
# A very simple little class for doing some basic fast statistics sampling.
|
8
|
+
# You feed it either samples of numeric data you want measured or you call
|
9
|
+
# Stats.tick to get it to add a time delta between the last time you called it.
|
10
|
+
# When you're done either call sum, sumsq, n, min, max, mean or sd to get
|
11
|
+
# the information. The other option is to just call dump and see everything.
|
12
|
+
#
|
13
|
+
# It does all of this very fast and doesn't take up any memory since the samples
|
14
|
+
# are not stored but instead all the values are calculated on the fly.
|
15
|
+
|
16
|
+
class Stats
|
17
|
+
attr_reader :sum, :sumsq, :n, :min, :max
|
18
|
+
|
19
|
+
def initialize(name=:unknown)
|
20
|
+
@name = name
|
21
|
+
reset
|
22
|
+
end
|
23
|
+
|
24
|
+
# Resets the internal counters so you can start sampling again.
|
25
|
+
def reset
|
26
|
+
@sum = 0.0
|
27
|
+
@sumsq = 0.0
|
28
|
+
@last_time = Time.new
|
29
|
+
@n = 0.0
|
30
|
+
@min = 0.0
|
31
|
+
@max = 0.0
|
32
|
+
end
|
33
|
+
|
34
|
+
# Adds a sampling to the calculations.
|
35
|
+
def sample(s)
|
36
|
+
@sum += s
|
37
|
+
@sumsq += s * s
|
38
|
+
if @n == 0
|
39
|
+
@min = @max = s
|
40
|
+
else
|
41
|
+
@min = s if @min > s
|
42
|
+
@max = s if @max < s
|
43
|
+
end
|
44
|
+
(@n+=1).to_f
|
45
|
+
end
|
46
|
+
|
47
|
+
# Dump this Stats object with an optional additional message.
|
48
|
+
def dump(msg = "", out=STDERR)
|
49
|
+
out.puts "#{msg}: #{self.to_s}"
|
50
|
+
end
|
51
|
+
|
52
|
+
# Returns a common display (used by dump)
|
53
|
+
def to_s
|
54
|
+
"[#{@name}]: SUM=%0.4f, SUMSQ=%0.4f, N=%0.4f, MEAN=%0.4f, SD=%0.4f, MIN=%0.4f, MAX=%0.4f" % [@sum, @sumsq, @n, mean, sd, @min, @max]
|
55
|
+
end
|
56
|
+
|
57
|
+
|
58
|
+
# Calculates and returns the mean for the data passed so far.
|
59
|
+
def mean
|
60
|
+
@sum / @n
|
61
|
+
end
|
62
|
+
|
63
|
+
# Calculates the standard deviation of the data so far.
|
64
|
+
def sd
|
65
|
+
# (sqrt( ((s).sumsq - ( (s).sum * (s).sum / (s).n)) / ((s).n-1) ))
|
66
|
+
begin
|
67
|
+
return Math.sqrt( (@sumsq - ( @sum * @sum / @n)) / (@n-1) ).to_f
|
68
|
+
rescue Errno::EDOM
|
69
|
+
return 0.0
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
|
74
|
+
# Adds a time delta between now and the last time you called this. This
|
75
|
+
# will give you the average time between two activities.
|
76
|
+
#
|
77
|
+
# An example is:
|
78
|
+
#
|
79
|
+
# t = Stats.new("do_stuff")
|
80
|
+
# 10000.times { do_stuff(); t.tick }
|
81
|
+
# t.dump("time")
|
82
|
+
#
|
83
|
+
def tick
|
84
|
+
now = Time.now
|
85
|
+
sample(now - @last_time)
|
86
|
+
@last_time = now
|
87
|
+
end
|
88
|
+
end
|