Skip to content

Commit

Permalink
* benchmark/driver.rb: add '--rawdata-output=[FILE] option to output
Browse files Browse the repository at this point in the history
  raw results into FILE.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45851 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
ko1 committed May 7, 2014
1 parent 11eb870 commit 1ddb9c5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Wed May 7 11:55:40 2014 Koichi Sasada <ko1@atdot.net>

* benchmark/driver.rb: add '--rawdata-output=[FILE] option to output
raw results into FILE.

Wed May 7 11:25:41 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>

* vm_eval.c (rb_f_local_variables): exclude variables hidden by
Expand Down
19 changes: 17 additions & 2 deletions benchmark/driver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def initialize execs, dir, opt = {}
@exclude = opt[:exclude] || nil
@verbose = opt[:quiet] ? false : (opt[:verbose] || false)
@output = opt[:output] ? open(opt[:output], 'w') : nil
@rawdata_output = opt[:rawdata_output] ? open(opt[:rawdata_output], 'w') : nil
@loop_wl1 = @loop_wl2 = nil
@ruby_arg = opt[:ruby_arg] || nil
@opt = opt
Expand Down Expand Up @@ -128,6 +129,15 @@ def show_results
message "Elapsed time: #{Time.now - @start_time} (sec)"
end

if @rawdata_output
h = {}
h[:cpuinfo] = File.read('/proc/cpuinfo') if File.exist?('/proc/cpuinfo')
h[:executables] = @execs
h[:results] = @results
pp h
# @rawdata_output.puts h.inspect
end

output '-----------------------------------------------------------'
output 'benchmark results:'

Expand Down Expand Up @@ -266,6 +276,7 @@ def measure executable, file
:dir => File.dirname(__FILE__),
:repeat => 1,
:output => "bmlog-#{Time.now.strftime('%Y%m%d-%H%M%S')}.#{$$}",
:raw_output => nil
}

parser = OptionParser.new{|o|
Expand Down Expand Up @@ -293,12 +304,16 @@ def measure executable, file
o.on('--ruby-arg [ARG]', "Optional argument for ruby"){|a|
opt[:ruby_arg] = a
}
o.on('-q', '--quiet', "Run without notify information except result table."){|q|
opt[:quiet] = q
o.on('--rawdata-output [FILE]', 'output rawdata'){|r|
opt[:rawdata_output] = r
}
o.on('-v', '--verbose'){|v|
opt[:verbose] = v
}
o.on('-q', '--quiet', "Run without notify information except result table."){|q|
opt[:quiet] = q
opt[:verbose] = false
}
}

parser.parse!(ARGV)
Expand Down

0 comments on commit 1ddb9c5

Please sign in to comment.