perfer 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,9 @@
1
+ if defined? Perfer
2
+ raise LoadError, "Perfer is already loaded in " \
3
+ "#{$LOADED_FEATURES.find { |f| f.end_with? 'lib/perfer.rb' }}. " \
4
+ "Current file is #{__FILE__}."
5
+ end
6
+
1
7
  require 'yaml'
2
8
  require 'path'
3
9
  require 'optparse'
@@ -79,7 +79,6 @@ EOS
79
79
  files.each do |file|
80
80
  require file.path
81
81
  end
82
- Perfer.sessions.each(&:run)
83
82
  end
84
83
 
85
84
  def results
@@ -2,15 +2,9 @@ module Perfer
2
2
  class ResultsFormatter
3
3
  include Formatter
4
4
 
5
- # maximal job length is computed from +jobs+ if given,
6
- # or deduced from given results
7
- def initialize(results, jobs = nil)
5
+ def initialize(results)
8
6
  @results = Array(results)
9
- @max_job_length = if jobs
10
- max_length_of(jobs, &:title)
11
- else
12
- max_length_of(@results) { |r| r[:job] }
13
- end
7
+ @max_job_length = max_length_of(@results) { |r| r[:job] }
14
8
  end
15
9
 
16
10
  def job_title(result)
@@ -10,10 +10,17 @@ module Perfer
10
10
  return puts "No results available." unless @session.results
11
11
  session_name = @session.results.first[:session]
12
12
  puts session_name
13
+ last_bench_file_checksum = @session.results.first[:bench_file_checksum]
13
14
  @session.results.chunk { |r|
14
15
  r[:run_time]
15
16
  }.each { |run_time, results|
16
- puts "Ran at #{format_time run_time} with #{results.first[:ruby]}"
17
+ result = results.first
18
+ if last_bench_file_checksum != result[:bench_file_checksum]
19
+ puts "-- The benchmark script changed --"
20
+ puts
21
+ last_bench_file_checksum = result[:bench_file_checksum]
22
+ end
23
+ puts "Ran at #{format_time run_time} with #{result[:ruby]}"
17
24
  ResultsFormatter.new(results).report(options)
18
25
  puts
19
26
  }
@@ -8,7 +8,7 @@ module Perfer
8
8
  @store = Store.for_session(self)
9
9
  @results = nil # not an Array, so it errors out if we forgot to load
10
10
 
11
- setup_for_run(&block) if block_given?
11
+ run(&block) if block_given?
12
12
 
13
13
  Perfer.sessions << self
14
14
  end
@@ -30,8 +30,6 @@ module Perfer
30
30
  add_git_metadata
31
31
  add_bench_file_checksum
32
32
  @metadata.freeze
33
-
34
- yield DSL.new(self)
35
33
  end
36
34
 
37
35
  def add_config_metadata
@@ -61,16 +59,17 @@ module Perfer
61
59
 
62
60
  def add_result(result)
63
61
  @results_to_save << result
64
- ResultsFormatter.new(result, @jobs).report
62
+ ResultsFormatter.new(result).report
65
63
  end
66
64
 
67
- def run
65
+ def run(&block)
66
+ setup_for_run
68
67
  puts "Session #{@name} with #{@metadata[:ruby]}"
69
68
  print "Taking #{Perfer.configuration.measurements} measurements of"
70
69
  puts " at least #{Perfer.configuration.minimal_time}s"
71
- @jobs.each { |job|
72
- job.run
73
- }
70
+
71
+ block.call DSL.new(self)
72
+
74
73
  @results_to_save.each { |result|
75
74
  @store.append(result)
76
75
  }
@@ -97,7 +96,8 @@ module Perfer
97
96
  def add_job(job_type, title, *args, &block)
98
97
  check_benchmark_type(job_type)
99
98
  check_unique_job_title(title)
100
- @jobs << job_type.new(self, title, *args, &block)
99
+ @jobs << job = job_type.new(self, title, *args, &block)
100
+ job.run
101
101
  @next_job_metadata = nil
102
102
  end
103
103
 
@@ -10,5 +10,5 @@ Gem::Specification.new do |s|
10
10
  s.add_dependency 'ffi', '~> 1.0.11'
11
11
  s.add_dependency 'backports', '~> 2.6.3'
12
12
  s.add_dependency 'hitimes', '~> 1.1.1'
13
- s.version = '0.2.0'
13
+ s.version = '0.2.1'
14
14
  end
metadata CHANGED
@@ -1,157 +1,134 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: perfer
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.2.0
4
+ version: 0.2.1
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - eregon
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-14 00:00:00.000000000 Z
12
+ date: 2012-10-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: path
16
- version_requirements: !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
17
18
  requirements:
18
19
  - - ~>
19
20
  - !ruby/object:Gem::Version
20
21
  version: 1.3.1
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
21
25
  none: false
22
- requirement: !ruby/object:Gem::Requirement
23
26
  requirements:
24
27
  - - ~>
25
28
  - !ruby/object:Gem::Version
26
29
  version: 1.3.1
27
- none: false
28
- prerelease: false
29
- type: :runtime
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: ffi
32
- version_requirements: !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
33
34
  requirements:
34
35
  - - ~>
35
36
  - !ruby/object:Gem::Version
36
37
  version: 1.0.11
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
37
41
  none: false
38
- requirement: !ruby/object:Gem::Requirement
39
42
  requirements:
40
43
  - - ~>
41
44
  - !ruby/object:Gem::Version
42
45
  version: 1.0.11
43
- none: false
44
- prerelease: false
45
- type: :runtime
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: backports
48
- version_requirements: !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
49
50
  requirements:
50
51
  - - ~>
51
52
  - !ruby/object:Gem::Version
52
53
  version: 2.6.3
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
53
57
  none: false
54
- requirement: !ruby/object:Gem::Requirement
55
58
  requirements:
56
59
  - - ~>
57
60
  - !ruby/object:Gem::Version
58
61
  version: 2.6.3
59
- none: false
60
- prerelease: false
61
- type: :runtime
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: hitimes
64
- version_requirements: !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
65
66
  requirements:
66
67
  - - ~>
67
68
  - !ruby/object:Gem::Version
68
69
  version: 1.1.1
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
69
73
  none: false
70
- requirement: !ruby/object:Gem::Requirement
71
74
  requirements:
72
75
  - - ~>
73
76
  - !ruby/object:Gem::Version
74
77
  version: 1.1.1
75
- none: false
76
- prerelease: false
77
- type: :runtime
78
- description:
78
+ description:
79
79
  email: eregontp@gmail.com
80
80
  executables:
81
81
  - perfer
82
82
  extensions: []
83
83
  extra_rdoc_files: []
84
84
  files:
85
- - !binary |-
86
- YmluL3BlcmZlcg==
87
- - !binary |-
88
- bGliL3BlcmZlci5yYg==
89
- - !binary |-
90
- bGliL3BlcmZlci9jbGkucmI=
91
- - !binary |-
92
- bGliL3BlcmZlci9jb25maWd1cmF0aW9uLnJi
93
- - !binary |-
94
- bGliL3BlcmZlci9lcnJvcnMucmI=
95
- - !binary |-
96
- bGliL3BlcmZlci9mb3JtYXR0ZXIucmI=
97
- - !binary |-
98
- bGliL3BlcmZlci9naXQucmI=
99
- - !binary |-
100
- bGliL3BlcmZlci9qb2IucmI=
101
- - !binary |-
102
- bGliL3BlcmZlci9wbGF0Zm9ybS5yYg==
103
- - !binary |-
104
- bGliL3BlcmZlci9yZXN1bHQucmI=
105
- - !binary |-
106
- bGliL3BlcmZlci9zZXNzaW9uLnJi
107
- - !binary |-
108
- bGliL3BlcmZlci9zdGF0aXN0aWNzLnJi
109
- - !binary |-
110
- bGliL3BlcmZlci9zdG9yZS5yYg==
111
- - !binary |-
112
- bGliL3BlcmZlci9mb3JtYXR0ZXIvbWVhc3VyZW1lbnRzX2Zvcm1hdHRlci5y
113
- Yg==
114
- - !binary |-
115
- bGliL3BlcmZlci9mb3JtYXR0ZXIvcmVzdWx0c19mb3JtYXR0ZXIucmI=
116
- - !binary |-
117
- bGliL3BlcmZlci9mb3JtYXR0ZXIvc2Vzc2lvbl9mb3JtYXR0ZXIucmI=
118
- - !binary |-
119
- bGliL3BlcmZlci9ncmFwaGVyL3JfZ3JhcGhlci5yYg==
120
- - !binary |-
121
- bGliL3BlcmZlci9qb2IvaW5wdXRfc2l6ZV9qb2IucmI=
122
- - !binary |-
123
- bGliL3BlcmZlci9qb2IvaXRlcmF0aW9uX2pvYi5yYg==
124
- - !binary |-
125
- bGliL3BlcmZlci9wbGF0Zm9ybS9wb3NpeC5yYg==
126
- - !binary |-
127
- bGliL3BlcmZlci9wbGF0Zm9ybS93aW5kb3dzLnJi
85
+ - bin/perfer
86
+ - lib/perfer/cli.rb
87
+ - lib/perfer/configuration.rb
88
+ - lib/perfer/errors.rb
89
+ - lib/perfer/formatter/measurements_formatter.rb
90
+ - lib/perfer/formatter/results_formatter.rb
91
+ - lib/perfer/formatter/session_formatter.rb
92
+ - lib/perfer/formatter.rb
93
+ - lib/perfer/git.rb
94
+ - lib/perfer/grapher/r_grapher.rb
95
+ - lib/perfer/job/input_size_job.rb
96
+ - lib/perfer/job/iteration_job.rb
97
+ - lib/perfer/job.rb
98
+ - lib/perfer/platform/posix.rb
99
+ - lib/perfer/platform/windows.rb
100
+ - lib/perfer/platform.rb
101
+ - lib/perfer/result.rb
102
+ - lib/perfer/session.rb
103
+ - lib/perfer/statistics.rb
104
+ - lib/perfer/store.rb
105
+ - lib/perfer.rb
128
106
  - README.md
129
107
  - LICENSE
130
108
  - perfer.gemspec
131
109
  homepage: https://github.com/jruby/perfer
132
110
  licenses: []
133
- post_install_message:
111
+ post_install_message:
134
112
  rdoc_options: []
135
113
  require_paths:
136
114
  - lib
137
115
  required_ruby_version: !ruby/object:Gem::Requirement
116
+ none: false
138
117
  requirements:
139
118
  - - ! '>='
140
119
  - !ruby/object:Gem::Version
141
- version: !binary |-
142
- MA==
143
- none: false
120
+ version: '0'
144
121
  required_rubygems_version: !ruby/object:Gem::Requirement
122
+ none: false
145
123
  requirements:
146
124
  - - ! '>='
147
125
  - !ruby/object:Gem::Version
148
- version: !binary |-
149
- MA==
150
- none: false
126
+ version: '0'
151
127
  requirements: []
152
- rubyforge_project:
153
- rubygems_version: 1.8.24
154
- signing_key:
128
+ rubyforge_project:
129
+ rubygems_version: 1.8.23
130
+ signing_key:
155
131
  specification_version: 3
156
132
  summary: A benchmark tool for all rubies!
157
133
  test_files: []
134
+ has_rdoc: