[macruby-changes] [4218] MacRuby/trunk/perf/run.rb
source_changes at macosforge.org
source_changes at macosforge.org
Thu Jun 10 19:37:43 PDT 2010
Revision: 4218
http://trac.macosforge.org/projects/ruby/changeset/4218
Author: martinlagardette at apple.com
Date: 2010-06-10 19:37:41 -0700 (Thu, 10 Jun 2010)
Log Message:
-----------
Add an argument to perf/run to display total running time
Modified Paths:
--------------
MacRuby/trunk/perf/run.rb
Modified: MacRuby/trunk/perf/run.rb
===================================================================
--- MacRuby/trunk/perf/run.rb 2010-06-11 02:31:10 UTC (rev 4217)
+++ MacRuby/trunk/perf/run.rb 2010-06-11 02:37:41 UTC (rev 4218)
@@ -1,7 +1,7 @@
#!/usr/bin/ruby
def usage
- puts "ruby #{$0} [--rubies=...] [--iterations=n] [perf_suite, [perf_suite...]]"
+ puts "ruby #{$0} [--rubies=...] [--iterations=n] [--displayTotal] [perf_suite, [perf_suite...]]"
exit 0
end
@@ -11,6 +11,7 @@
perf_files = []
rubies = []
n_iterations = 3
+totals = nil
ARGV.each do |arg|
if arg.match(/--help/)
usage
@@ -22,6 +23,8 @@
$stderr.puts "n_iterations must be greater than zero"
exit 1
end
+ elsif arg == '-t' or arg == '--displayTotal'
+ totals = {}
else
name, suite = arg.split(':', 2)
perf_files << [File.join(cwd, "perf_#{name}.rb"), suite]
@@ -56,6 +59,10 @@
best = times.split(/,/).min
results[title] ||= []
results[title] << {:ruby => ruby, :best => best}
+ if totals
+ totals[ruby] = 0.0 if totals[ruby].nil?
+ totals[ruby] += best.to_f unless best == 'ERROR'
+ end
end
end
prefix = File.basename(file).scan(/perf_(\w+)\.rb/)[0][0]
@@ -80,3 +87,10 @@
puts ''
end
end
+
+if totals
+ puts '-' * header_string.length
+ footer_string = 'Total'.ljust(20)
+ rubies.each { |x| footer_string += totals[x].to_s.ljust(20) }
+ puts footer_string
+end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100610/eb016932/attachment.html>
More information about the macruby-changes
mailing list