aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2008-06-16 00:08:39 -0700
committerJeremy Kemper <jeremy@bitsweat.net>2008-06-16 00:08:39 -0700
commit49d19515b70a13f62127895301bd2a2d681135b9 (patch)
tree0116331e9e26e8031f12938234e14f0288d231f6 /activesupport
parente8f78998b2af492159189d4f0aa6c3a301431ca8 (diff)
downloadrails-49d19515b70a13f62127895301bd2a2d681135b9.tar.gz
rails-49d19515b70a13f62127895301bd2a2d681135b9.tar.bz2
rails-49d19515b70a13f62127895301bd2a2d681135b9.zip
Extract environment. Hardcode some git info so I can start working with it now.
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/testing/performance.rb32
1 files changed, 24 insertions, 8 deletions
diff --git a/activesupport/lib/active_support/testing/performance.rb b/activesupport/lib/active_support/testing/performance.rb
index 89bebf5913..377150a0a6 100644
--- a/activesupport/lib/active_support/testing/performance.rb
+++ b/activesupport/lib/active_support/testing/performance.rb
@@ -102,19 +102,35 @@ module ActiveSupport
end
def record
+ avg = @metric.total / profile_options[:runs].to_i
+ data = [full_test_name, @metric.name, avg, Time.now.utc.xmlschema] * ','
with_output_file do |file|
- file.puts [full_test_name, @metric.name,
- @metric.total, profile_options[:runs].to_i,
- @metric.total / profile_options[:runs].to_i,
- Time.now.utc.xmlschema,
- Rails::VERSION::STRING,
- defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby',
- RUBY_VERSION, RUBY_PATCHLEVEL, RUBY_PLATFORM].join(',')
+ file.puts "#{data},#{environment}"
end
end
+ def environment
+ unless defined? @env
+ app = "#{$1}.#{$2}" if `git branch -v` =~ /^\* (\S+)\s+(\S+)/
+
+ rails = Rails::VERSION::STRING
+ if File.directory?('vendor/rails/.git')
+ Dir.chdir('vendor/rails') do
+ rails += "#{$1}.#{$2}" if `git branch -v` =~ /^\* (\S+)\s+(\S+)/
+ end
+ end
+
+ ruby = defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby'
+ ruby += "-#{RUBY_VERSION}.#{RUBY_PATCHLEVEL}"
+
+ @env = [app, rails, ruby, RUBY_PLATFORM] * ','
+ end
+
+ @env
+ end
+
protected
- HEADER = 'test,metric,measurement,runs,average,created_at,rails_version,ruby_engine,ruby_version,ruby_patchlevel,ruby_platform'
+ HEADER = 'test,metric,measurement,created_at,app,rails,ruby,platform'
def with_output_file
fname = "#{profile_options[:output]}/benchmarks.csv"