hansel 0.2.15 → 0.2.16

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -8,7 +8,7 @@ rescue LoadError
8
8
  end
9
9
 
10
10
  $LOAD_PATH.unshift 'lib'
11
- # require 'hansel/tasks'
11
+ load 'tasks/octave.rake'
12
12
 
13
13
  RSpec::Core::RakeTask.new do |t|
14
14
  t.rspec_opts = [ "--color" ]
@@ -5,8 +5,10 @@ module HanselCore
5
5
  # Output to csv format
6
6
  #
7
7
  class CsvFormatter
8
- COLUMNS = %w(server port num_conns rate replies connection_rate request_rate reply_time net_io
9
- errors status reply_rate_min reply_rate_avg reply_rate_max reply_rate_stddev)
8
+ COLUMNS = %w( rate replies connection_rate
9
+ request_rate reply_time net_io errors status
10
+ reply_rate_min reply_rate_avg reply_rate_max
11
+ reply_rate_stddev server port num_conns )
10
12
 
11
13
  def self.line text
12
14
  @csv << text
@@ -19,7 +21,7 @@ module HanselCore
19
21
 
20
22
  def self.format results
21
23
  @csv = ""
22
- line CSV.generate_line(COLUMNS)
24
+ line '# ' + CSV.generate_line(COLUMNS)
23
25
  results.each { |data| format_line data } unless results.empty?
24
26
  @csv
25
27
  end
@@ -16,7 +16,13 @@ module HanselCore
16
16
  res = results
17
17
  opts, num_conns = options, (res.first.num_conns rescue nil)
18
18
  file_name = output_filename{ "#{num_conns.to_s}" }
19
- template = opts.template || File.join( [ File.dirname(__FILE__), '../../..', opts.template_path, 'octave.m.erb' ] )
19
+
20
+ template_name = (opts.template && opts.template + '.m.erb') || 'octave.m.erb'
21
+ template = File.join( [ File.dirname(__FILE__),
22
+ '../../..',
23
+ opts.template_path,
24
+ template_name ] )
25
+
20
26
  description = @current_job && @current_job.description
21
27
  File.open(file_name, "w+") do |file|
22
28
  file.puts OctaveFormatter.new(res,
@@ -15,5 +15,10 @@ module HanselCore
15
15
  @uri = opt[:uri]
16
16
  @num_conns = opt[:num_conns]
17
17
  end
18
+
19
+ def post_deserialize
20
+ puts "** I'm awake!"
21
+ end
22
+
18
23
  end
19
24
  end
@@ -1,3 +1,3 @@
1
1
  module HanselCore
2
- Version = VERSION = '0.2.15'
2
+ Version = VERSION = '0.2.16'
3
3
  end
@@ -0,0 +1,37 @@
1
+ require 'ostruct'
2
+ require 'hansel/formatting/octave_formatter.rb'
3
+
4
+ namespace :hansel do
5
+ namespace :octave do
6
+ # rake hansel:octave:plot[input_file,output_dir]
7
+ desc "Generate octave multiplots for an input yaml file"
8
+ task :plot, :input_file, :output_dir do |t, args|
9
+ desc "Generate octave plot for a file"
10
+ data = YAML.load_file( args.input_file ).collect{ |o| OpenStruct.new o.ivars }
11
+ template = File.join( [ File.dirname(__FILE__),
12
+ '../../templates',
13
+ 'multiplot.m.erb' ] )
14
+ first = data.first
15
+ output_dir = args.output_dir
16
+ output_name = args.input_file.split('/').last.gsub( '.', '-') + '.m'
17
+ output_file = File.join([ output_dir, output_name ])
18
+ File.open( output_file, 'w+' ) do |output|
19
+ output.puts HanselCore::OctaveFormatter.new(data,
20
+ { :output_file_name => output_name,
21
+ :template => template,
22
+ :description => first.description,
23
+ :png_file_name => [ first.server,
24
+ first.description,
25
+ first.num_conns.to_s
26
+ ].compact.join('-')
27
+ }).format
28
+ end
29
+ end
30
+
31
+ # rake hansel:octave:run[input_dir]
32
+ desc "Run octave on all *.m files in the specified directory"
33
+ task :run, :input_dir do |t, args|
34
+ %x[ cd #{args.input_dir} && octave *.m ]
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,35 @@
1
+ rate = [<%= @data.map(&:rate).join(', ') %>];
2
+ request_rate = [<%= @data.map(&:request_rate).join(', ') %>];
3
+ connection_rate = [<%= @data.map(&:connection_rate).join(', ') %>];
4
+ reply_rate_avg = [<%= @data.map(&:reply_rate_avg).join(', ') %>];
5
+ reply_rate_max = [<%= @data.map(&:reply_rate_max).join(', ') %>];
6
+ reply_time = [<%= @data.map(&:reply_time).join(', ') %>];
7
+ reply_rate_stddev = [<%= @data.map(&:reply_rate_stddev).join(', ') %>];
8
+ errors = [<%= @data.map(&:errors).join(', ') %>];
9
+
10
+ <% pages = [
11
+ [
12
+ { :ylabel => 'Request Rate', :yvar => 'request_rate' },
13
+ { :ylabel => 'Connection Rate', :yvar => 'connection_rate' },
14
+ { :ylabel => 'Reply time', :yvar => 'reply_time' },
15
+ ],
16
+ [
17
+ { :ylabel => 'Avg. reply rate', :yvar => 'reply_rate_avg' },
18
+ { :ylabel => 'Max. reply rate', :yvar => 'reply_rate_max' },
19
+ { :ylabel => 'Reply rate StdDev', :yvar => 'reply_rate_stddev' },
20
+ { :ylabel => 'Errors', :yvar => 'errors' },
21
+ ]
22
+ ]
23
+ %>
24
+
25
+ <% pages.each_with_index do |page, page_num| %>
26
+ <% page.each_with_index do |plot, i| %>
27
+ title('<%= plot[:ylabel] %>')
28
+ subplot (2, 2, <%= i + 1 %>)
29
+ plot(rate, <%= plot[:yvar] %>, '-k*');
30
+ xlabel('Demanded Request Rate');
31
+ ylabel('<%= plot[:ylabel] %>');
32
+ grid on;
33
+ <% end %>
34
+ print('<%= "#{@png_output}-#{page_num + 1}" %>.png', '-dpng')
35
+ <% end %>
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: 9
4
+ hash: 55
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 15
10
- version: 0.2.15
9
+ - 16
10
+ version: 0.2.16
11
11
  platform: ruby
12
12
  authors:
13
13
  - Paul Mylchreest
@@ -15,7 +15,8 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-06-15 00:00:00 Z
18
+ date: 2011-07-05 00:00:00 -04:00
19
+ default_executable:
19
20
  dependencies: []
20
21
 
21
22
  description: " Hansel is a pure ruby driver for httperf for automated load and\n performance testing. It will load a job queue file, in a yaml format, run\n httperf with each job.\n"
@@ -44,12 +45,15 @@ files:
44
45
  - lib/hansel/job_queue/job_queue.rb
45
46
  - lib/hansel/version.rb
46
47
  - lib/hansel.rb
48
+ - lib/tasks/octave.rake
47
49
  - spec/arg_parser_spec.rb
48
50
  - spec/hansel_spec.rb
49
51
  - spec/httperf_result_parser_spec.rb
50
52
  - spec/jobs.yml
51
53
  - spec/spec_helper.rb
54
+ - templates/multiplot.m.erb
52
55
  - templates/octave.m.erb
56
+ has_rdoc: true
53
57
  homepage: http://github.com/xlymian/hansel
54
58
  licenses: []
55
59
 
@@ -79,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
79
83
  requirements: []
80
84
 
81
85
  rubyforge_project:
82
- rubygems_version: 1.7.2
86
+ rubygems_version: 1.6.2
83
87
  signing_key:
84
88
  specification_version: 3
85
89
  summary: Ruby driver for httperf - automated load and performance testing.