hansel 0.2.9 → 0.2.10
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.markdown +15 -12
- data/lib/hansel/formatting/formatting.rb +13 -5
- data/lib/hansel/formatting/octave_formatter.rb +6 -5
- data/lib/hansel/version.rb +1 -1
- data/spec/hansel_spec.rb +2 -2
- data/templates/octave.m.erb +1 -1
- metadata +4 -4
data/README.markdown
CHANGED
@@ -12,9 +12,10 @@ Installing Httperf and Hansel
|
|
12
12
|
For Linux (Ubuntu):
|
13
13
|
|
14
14
|
apt-get update && apt-get -y install rubygems httperf ruby1.8-dev libcurl4-gnutls-dev
|
15
|
-
gem install rubygems-update
|
15
|
+
gem install rubygems-update -v 1.3.0
|
16
16
|
export PATH=$PATH:/var/lib/gems/1.8/bin
|
17
17
|
update_rubygems
|
18
|
+
gem update --system
|
18
19
|
gem install hansel
|
19
20
|
|
20
21
|
On MacOS X using homebrew:
|
@@ -43,6 +44,7 @@ Create a job queue file in ~/.hansel/jobs.yml:
|
|
43
44
|
:low_rate: 10
|
44
45
|
:high_rate: 50
|
45
46
|
:rate_step: 10
|
47
|
+
:description: example
|
46
48
|
|
47
49
|
- :server: www.apple.com
|
48
50
|
:uri: /
|
@@ -50,6 +52,7 @@ Create a job queue file in ~/.hansel/jobs.yml:
|
|
50
52
|
:low_rate: 10
|
51
53
|
:high_rate: 50
|
52
54
|
:rate_step: 10
|
55
|
+
:description: apple
|
53
56
|
|
54
57
|
and run Hansel
|
55
58
|
|
@@ -59,14 +62,14 @@ By default, the output is written into the ~/hansel_output directory. When the o
|
|
59
62
|
specified, it uses the default template octave.m.erb in the project templates. Here is a sample
|
60
63
|
output from the previous job:
|
61
64
|
|
62
|
-
rate = [
|
63
|
-
request_rate = [
|
64
|
-
connection_rate = [
|
65
|
-
reply_rate_avg = [0.0, 0.0, 0.0, 0.0];
|
66
|
-
reply_rate_max = [0.0, 0.0, 0.0, 0.0];
|
67
|
-
reply_time = [
|
68
|
-
reply_rate_stddev = [0.0, 0.0, 0.0, 0.0];
|
69
|
-
errors = [0, 0, 0, 0];
|
65
|
+
rate = [10, 20, 30, 40, 50];
|
66
|
+
request_rate = [8.8, 17.6, 18.9, 24.6, 19.3];
|
67
|
+
connection_rate = [8.8, 17.6, 18.9, 24.6, 19.3];
|
68
|
+
reply_rate_avg = [0.0, 0.0, 0.0, 0.0, 0.0];
|
69
|
+
reply_rate_max = [0.0, 0.0, 0.0, 0.0, 0.0];
|
70
|
+
reply_time = [62.7, 56.0, 55.8, 45.3, 118.0];
|
71
|
+
reply_rate_stddev = [0.0, 0.0, 0.0, 0.0, 0.0];
|
72
|
+
errors = [0, 0, 0, 0, 0];
|
70
73
|
|
71
74
|
plot(rate, request_rate, '-k*');
|
72
75
|
hold on;
|
@@ -84,11 +87,11 @@ output from the previous job:
|
|
84
87
|
|
85
88
|
grid on;
|
86
89
|
|
87
|
-
axis([0
|
88
|
-
title('Hansel report for www.
|
90
|
+
axis([0 50 0 50]);
|
91
|
+
title('Hansel report for www.apple.com:80/ (10 connections per run)')
|
89
92
|
xlabel('Demanded Request Rate');
|
90
93
|
legend('Request Rate', 'Connection Rate', 'Avg. reply rate', 'Max. reply rate', 'Reply rate StdDev', 'Reply time', 'Errors');
|
91
|
-
print('
|
94
|
+
print('www.apple.com-80-osx-10.png', '-dpng')
|
92
95
|
|
93
96
|
Run octave on it will produce graph as a png file.
|
94
97
|
|
@@ -15,13 +15,20 @@ module HanselCore
|
|
15
15
|
def octave_formatter
|
16
16
|
res = results
|
17
17
|
opts, num_conns = options, (res.first.num_conns rescue nil)
|
18
|
-
file_name = output_filename{ "
|
18
|
+
file_name = output_filename{ "#{num_conns.to_s}" }
|
19
19
|
template = opts.template || File.join( [ File.dirname(__FILE__), '../../..', opts.template_path, 'octave.m.erb' ] )
|
20
|
+
description = @current_job && @current_job.description
|
20
21
|
File.open(file_name, "w+") do |file|
|
21
22
|
file.puts OctaveFormatter.new(res,
|
22
23
|
{ :output_file_name => file_name,
|
23
24
|
:template => template,
|
24
|
-
:
|
25
|
+
:description => @description,
|
26
|
+
:png_file_name => [[ @server, @port,
|
27
|
+
description,
|
28
|
+
num_conns.to_s
|
29
|
+
].compact.join('-'),
|
30
|
+
'png'
|
31
|
+
].join('.')
|
25
32
|
}).format
|
26
33
|
end
|
27
34
|
end
|
@@ -38,10 +45,11 @@ module HanselCore
|
|
38
45
|
end
|
39
46
|
|
40
47
|
def output_filename
|
41
|
-
|
42
|
-
type = { :yaml => 'yml', :csv => 'csv', :octave => 'm' }[
|
48
|
+
part = [ @current_job && @current_job.description, ( yield if block_given? ) ].compact
|
49
|
+
type = { :yaml => 'yml', :csv => 'csv', :octave => 'm' }[options.format.to_sym]
|
43
50
|
@server, @port = (res = results.first) && res.server, res.port
|
44
|
-
[
|
51
|
+
fname = [@server, @port, (part unless part.empty?)].compact.join('-')
|
52
|
+
[ File.join( [options.output_dir, fname] ), type ].join('.')
|
45
53
|
end
|
46
54
|
end
|
47
55
|
end
|
@@ -6,11 +6,12 @@ module HanselCore
|
|
6
6
|
#
|
7
7
|
class OctaveFormatter
|
8
8
|
def initialize(data, options = {})
|
9
|
-
@data
|
10
|
-
@template
|
11
|
-
@rates
|
12
|
-
@max_rate
|
13
|
-
@png_output
|
9
|
+
@data = data
|
10
|
+
@template = options[:template]
|
11
|
+
@rates = @data.map &:rate
|
12
|
+
@max_rate = @rates.max
|
13
|
+
@png_output = options[:png_file_name]
|
14
|
+
@description = options[:description]
|
14
15
|
end
|
15
16
|
|
16
17
|
# For each value of rate, collate the values in each variable in @vars
|
data/lib/hansel/version.rb
CHANGED
data/spec/hansel_spec.rb
CHANGED
@@ -82,7 +82,7 @@ describe HanselCore, "in general" do
|
|
82
82
|
|
83
83
|
describe "calling output" do
|
84
84
|
before :each do
|
85
|
-
@default_name = File.join [ @hansel.options.output_dir, 'localhost
|
85
|
+
@default_name = File.join [ @hansel.options.output_dir, 'localhost-80.yml' ]
|
86
86
|
FileUtils.rm @default_name if File.exists? @default_name
|
87
87
|
@hansel.output
|
88
88
|
end
|
@@ -93,7 +93,7 @@ describe HanselCore, "in general" do
|
|
93
93
|
|
94
94
|
describe "should put the output into a file in the specified format" do
|
95
95
|
it "should be in a file with the default file name" do
|
96
|
-
@
|
96
|
+
@hansel.output_filename.should == @default_name
|
97
97
|
File.exists?( @default_name ).should be_true
|
98
98
|
end
|
99
99
|
end
|
data/templates/octave.m.erb
CHANGED
@@ -24,7 +24,7 @@ plot(rate, errors, '-r*');
|
|
24
24
|
grid on;
|
25
25
|
|
26
26
|
axis([0 <%= @max_rate %> 0 <%= @max_rate %>]);
|
27
|
-
title('Hansel report for <%= "#{@data.first.server}:#{@data.first.port}#{@data.first.uri} (#{@data.first.num_conns}" %> connections per run)')
|
27
|
+
title('Hansel report for <%= "#{@data.first.server}:#{@data.first.port}#{@data.first.uri} #{@description} (#{@data.first.num_conns}" %> connections per run)')
|
28
28
|
xlabel('Demanded Request Rate');
|
29
29
|
legend('Request Rate', 'Connection Rate', 'Avg. reply rate', 'Max. reply rate', 'Reply rate StdDev', 'Reply time', 'Errors');
|
30
30
|
print('<%= @png_output %>', '-dpng')
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hansel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 3
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 10
|
10
|
+
version: 0.2.10
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Paul Mylchreest
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-06-
|
18
|
+
date: 2011-06-14 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|