diff --git a/kernel/delta/profiler.rb b/kernel/delta/profiler.rb
index b5e641a..bdd4507 100644
--- a/kernel/delta/profiler.rb
+++ b/kernel/delta/profiler.rb
@@ -20,6 +20,7 @@ module Rubinius
end
def initialize(options = {})
+ @options = { :sort => [:percent] }
set_options options
set_options :full_report => true if RUBY_CONFIG["rbx.profiler.full_report"]
set_options :graph => true if RUBY_CONFIG["rbx.profiler.graph"]
@@ -40,7 +41,6 @@ module Rubinius
#
# @todo Add options for GC allocation counts
def set_options(options)
- @options ||= { :sort => :percent }
@options.merge!(options)
end
@@ -119,7 +119,10 @@ module Rubinius
name ]
end
- data = data.sort_by {|row| -row[sort_order.first] }
+ columns = sort_order
+ data = data.sort_by do |row|
+ columns.map {|col| row[col] }
+ end.reverse
out.puts " % cumulative self self total"
out.puts " time seconds seconds calls ms/call ms/call name"
@@ -242,7 +245,7 @@ module Rubinius
def sort_order
# call to_i so if unrecognized symbol is passed, column will be percent
- Array(@options[:sort]).map { |header| HEADER_INDEX[header].to_i }
+ @options[:sort].map { |header| HEADER_INDEX[header].to_i }
end
end
diff --git a/kernel/loader.rb b/kernel/loader.rb
index 32bf474..5f0422d 100644
--- a/kernel/loader.rb
+++ b/kernel/loader.rb
@@ -169,7 +169,7 @@ begin
require 'profile'
when /^-P\w/
require 'profile'
- Profiler__.options :sort => arg[2..-1].to_sym
+ Profiler__.options :sort => arg[2..-1].split(/,/).map {|x| x.to_sym }
when '-gc'
stats = Rubinius::Stats::GC.new
at_exit { stats.show }