Skip to content

Commit

Permalink
More tweaks to automate ironruby.info
Browse files Browse the repository at this point in the history
  • Loading branch information
unknown committed Jan 24, 2010
1 parent 2a37ecc commit 3bcf15c
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 38 deletions.
13 changes: 10 additions & 3 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ A script for capturing interesting statistics about IronRuby

Pre-requisites
--------------
1. git clone git://github.com/ironruby/ironruby.git
2. Set up IronRuby for building: http://wiki.github.com/ironruby/ironruby
1. Ruby (MRI)
2. An IronRuby repository

git clone git://github.com/ironruby/ironruby.git

Configuration
-------------
Expand All @@ -17,12 +19,17 @@ your REPO value:

REPO = 'c:/dev/ironruby'

Also, update "MRI_BIN" with the path to your ruby.exe:

MRI_BIN = 'c:\ruby\bin'

Example
-------

> ruby stats.rb --all
Runs all reports, and writes results to a .dat file.
Runs all reports, writes results to a .dat file, generates a HTML file, and
attemps to upload both the html file and the dat file to ironruby.info.
"ruby stats.rb --reporter=data --all" will do the same thing.

> ruby stats.rb --reporter=text --all
Expand Down
7 changes: 3 additions & 4 deletions app.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
File.open('data/pid1', 'w'){ |f| f.print Process.pid }
File.open(File.dirname(__FILE__) + '/data/pid1', 'w'){ |f| f.print Process.pid }

require 'rubygems'
require 'sinatra'

require 'mymath'

require 'haml'
require 'ext'
require 'active_support'

helpers do
Expand Down
8 changes: 7 additions & 1 deletion config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,10 @@
# The path on disk to where an IronRuby repository is
#

REPO = "C:/dev/vsl1s"
REPO = "C:/dev/vsl1s_irstats"

#
# Set path to MRI (ruby.exe)
#

MRI_BIN = "#{REPO}/Merlin/External.LCA_RESTRICTED/Languages/Ruby/ruby-1.8.6p368/bin"
8 changes: 7 additions & 1 deletion mymath.rb → ext.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
class String
def to_dos
self.gsub('/', '\\')
end
end

class Float
def round_to(x)
(self * 10**x).round.to_f / 10**x
Expand All @@ -10,4 +16,4 @@ def ceil_to(x)
def floor_to(x)
(self * 10**x).floor.to_f / 10**x
end
end
end
2 changes: 1 addition & 1 deletion getpid.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
File.open('data/pid', 'w'){ |f| f.print Process.pid }
File.open(File.dirname(__FILE__) + '/data/pid', 'w'){ |f| f.print Process.pid }
a = 0
a += 1 while true
7 changes: 5 additions & 2 deletions stats.bat
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
call C:\dev\vsl1s\Merlin\Main\Scripts\Bat\Dev.bat
cd %MERLIN_ROOT%
set REPO=c:\dev\vsl1s_irstats
call %REPO%\Merlin\Main\Scripts\Bat\Dev.bat
pushd %MERLIN_ROOT%
tf get
tf unshelve rubytags-2010-01-22;jimmysch /noprompt
set GEM_HOME=%GEM_PATH%
set RUBY=%MERLIN_ROOT%\..\External.LCA_RESTRICTED\Languages\Ruby\ruby-1.8.6p368\bin\ruby.exe
%RUBY% %~dp0stats.rb --clean
%RUBY% %~dp0stats.rb --all
popd
48 changes: 22 additions & 26 deletions stats.rb
Original file line number Diff line number Diff line change
@@ -1,37 +1,33 @@
$: << File.expand_path(File.dirname(__FILE__))

load 'config.rb'

require 'rubygems'
require 'mymath'
require 'ext'
require 'benchmark'
require 'win32ole'
require 'net/http'
require 'uri'
#require 'net/scp'

class String
def to_dos
self.gsub('/', '\\')
end
end

RB = "#{REPO}/Merlin/Main/Languages/Ruby"
BIN = "#{REPO}/Merlin/Main/Bin/Release"
MRI_BIN = "#{REPO}/Merlin/External.LCA_RESTRICTED/Languages/Ruby/ruby-1.8.6p368/bin"
ENV['PATH'] = [MRI_BIN.to_dos, BIN.to_dos, ENV['PATH']].join(';')
CD = File.expand_path(File.dirname(__FILE__))
DATA = "#{CD}/data"
require 'fileutils'
FileUtils.mkdir DATA unless File.exist? DATA
INTERPRET = "-X:CompilationThreshold 1000000000"
IR = "#{BIN}/ir.exe"
MRI = "#{MRI_BIN}/ruby.exe"
MSPEC = "mspec.bat run -fs"
MSPEC_OPTIONS = {:ironruby => "-Gcritical -Gunstable -Gruby", :ruby => '-Gruby'}
DATA = "#{CD}/data"
require 'fileutils'
FileUtils.mkdir DATA unless File.exist? DATA

#
# Helpers
#

module Helpers
require 'net/http'
require 'uri'

def fetch(uri_str, limit = 10)
raise ArgumentError, 'HTTP redirect too deep' if limit == 0

Expand Down Expand Up @@ -159,6 +155,7 @@ def throughput
def mspec(type = nil, impl = nil)
type ||= :core
impl ||= :ironruby
impl_bin = impl == :ironruby ? IR : MRI

print "Running mspec:#{type} with #{impl} ... "

Expand All @@ -170,7 +167,7 @@ def mspec(type = nil, impl = nil)
old = FileUtils.pwd
begin
FileUtils.cd RB
system "#{MSPEC} #{MSPEC_OPTIONS[impl]} --target #{impl} #{type} 1> #{log.to_dos} 2>&1"
system "#{MSPEC} #{MSPEC_OPTIONS[impl]} -B#{ "#{CD}/stats.config".to_dos } --target=#{impl_bin.to_dos} #{type} 1> #{log.to_dos} 2>&1"
ensure
FileUtils.cd old
end
Expand Down Expand Up @@ -299,20 +296,10 @@ def report_mspec_library
_mspec(:library)
end

# serialize @data into a timestamped file in data/, and send (scp)
# that file up to the stats website. Looks for the ssh password in
# the pswd file
def final
date = Time.now.strftime("%Y%m%d%H%M%S")
filename = "#{DATA}/data-#{date}.dat"
print "Writing #{filename} ... "
File.open(filename, "wb") do |f|
Marshal.dump(@data, f)
end
puts "done"

_save_dat(date)
_upload_html(*_save_html(date))
# _scp_data(filename)
end

private
Expand All @@ -323,6 +310,15 @@ def _mspec(scope)
{:ironruby => ir, :ruby => ru, :delta => delta}
end

def _save_dat(date)
filename = "#{DATA}/data-#{date}.dat"
print "Writing #{filename} ... "
File.open(filename, "wb") do |f|
Marshal.dump(@data, f)
end
puts "done"
end

def _save_html(date)
print "Generating http://ironruby.info homepage "
_kill 'pid1'
Expand Down

0 comments on commit 3bcf15c

Please sign in to comment.