hansel 0.2.6 → 0.2.7
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/VERSION +1 -1
- data/hansel.gemspec +1 -1
- data/lib/hansel/formatting/formatting.rb +8 -13
- data/lib/hansel/hansel.rb +4 -6
- data/lib/hansel/httperf/httperf.rb +2 -2
- data/lib/hansel/job_queue/job_queue.rb +1 -4
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.7
|
data/hansel.gemspec
CHANGED
@@ -13,16 +13,12 @@ module HanselCore
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def octave_formatter
|
16
|
-
|
16
|
+
res = results
|
17
|
+
opts, num_conns = options, (res.first.num_conns rescue nil)
|
17
18
|
file_name = output_filename{ "-#{num_conns.to_s}" }
|
19
|
+
template = opts.template || File.join( [ File.dirname(__FILE__), '../../..', opts.template_path, 'octave.m.erb' ] )
|
18
20
|
File.open(file_name, "w+") do |file|
|
19
|
-
file.puts OctaveFormatter.new(
|
20
|
-
{
|
21
|
-
:output_file_name => file_name,
|
22
|
-
:template => options.template ||
|
23
|
-
File.join( [ File.dirname(__FILE__), '../../..', options.template_path, 'octave.m.erb' ] ),
|
24
|
-
}
|
25
|
-
).format
|
21
|
+
file.puts OctaveFormatter.new(res, { :output_file_name => file_name, :template => template }).format
|
26
22
|
end
|
27
23
|
end
|
28
24
|
|
@@ -38,11 +34,10 @@ module HanselCore
|
|
38
34
|
end
|
39
35
|
|
40
36
|
def output_filename
|
41
|
-
part
|
42
|
-
type = { :yaml => 'yml', :csv => 'csv', :octave => 'm' }[
|
43
|
-
server
|
44
|
-
port
|
45
|
-
[File.join([options.output_dir, ("#{server}:#{port}" + part)]), type].join('.')
|
37
|
+
opts, part = options, (block_given? ? yield : '')
|
38
|
+
type = { :yaml => 'yml', :csv => 'csv', :octave => 'm' }[opts.format.to_sym]
|
39
|
+
server, port = (res = results.first) && res.server, res.port
|
40
|
+
[File.join([opts.output_dir, ("#{server}:#{port}" + part)]), type].join('.')
|
46
41
|
end
|
47
42
|
end
|
48
43
|
end
|
data/lib/hansel/hansel.rb
CHANGED
@@ -36,10 +36,12 @@ module HanselCore
|
|
36
36
|
# Output the results based on the requested output format
|
37
37
|
#
|
38
38
|
def output
|
39
|
-
|
40
|
-
|
39
|
+
opts = options
|
40
|
+
if opts.format
|
41
|
+
FileUtils.mkdir_p opts.output_dir
|
41
42
|
formatted_output
|
42
43
|
end
|
44
|
+
@results.clear
|
43
45
|
end
|
44
46
|
|
45
47
|
def status text
|
@@ -50,18 +52,14 @@ module HanselCore
|
|
50
52
|
# Run httperf from low_rate to high_rate, stepping by rate_step
|
51
53
|
#
|
52
54
|
def run
|
53
|
-
status "starting run..."
|
54
55
|
while @jobs.length > 0 do
|
55
56
|
@current_job = @jobs.pop
|
56
57
|
(@current_job.low_rate.to_i..@current_job.high_rate.to_i).step(@current_job.rate_step.to_i) do |rate|
|
57
|
-
status "running httperf at rate: #{rate}"
|
58
58
|
@current_rate = rate
|
59
59
|
httperf
|
60
60
|
end
|
61
61
|
output
|
62
|
-
@results.clear
|
63
62
|
end
|
64
|
-
status "ending run..."
|
65
63
|
end
|
66
64
|
|
67
65
|
def run_server
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module HanselCore
|
2
2
|
module Httperf
|
3
3
|
def build_httperf_cmd
|
4
|
+
cookie = @current_job.cookie
|
4
5
|
httperf_cmd = [
|
5
6
|
"httperf --hog",
|
6
7
|
"--server=#{@current_job.server}",
|
@@ -8,7 +9,7 @@ module HanselCore
|
|
8
9
|
"--uri=#{@current_job.uri}",
|
9
10
|
"--num-conns=#{@current_job.num_conns}",
|
10
11
|
"--rate=#{@current_rate}",
|
11
|
-
|
12
|
+
cookie && "--add-header='Cookie: #{cookie}\\n'"
|
12
13
|
].compact.join ' '
|
13
14
|
end
|
14
15
|
|
@@ -29,7 +30,6 @@ module HanselCore
|
|
29
30
|
}))
|
30
31
|
HttperfResultParser.new(pipe).parse(httperf_result)
|
31
32
|
end
|
32
|
-
self
|
33
33
|
end
|
34
34
|
|
35
35
|
end
|
@@ -5,7 +5,6 @@ module HanselCore
|
|
5
5
|
end
|
6
6
|
|
7
7
|
def push_job job
|
8
|
-
job.port = 80 unless job.port
|
9
8
|
@jobs.push job
|
10
9
|
end
|
11
10
|
|
@@ -13,11 +12,9 @@ module HanselCore
|
|
13
12
|
@jobs.pop
|
14
13
|
end
|
15
14
|
|
16
|
-
#
|
17
|
-
# Load jobs from queue
|
18
|
-
#
|
19
15
|
def load_job_queue
|
20
16
|
(YAML.load_file File.join(config_path, 'jobs.yml')).map do |job|
|
17
|
+
job.merge!({:port => 80}) unless job[:port]
|
21
18
|
self.push_job(OpenStruct.new job)
|
22
19
|
end
|
23
20
|
self
|