overridden by each implementation
Methods
- C
- N
- O
- R
- T
Class Public methods
Instance Public methods
# File activesupport/lib/active_support/testing/performance/jruby.rb, line 37 37: def record 38: return unless @supported 39: 40: klasses = full_profile_options[:formats].map { |f| JRuby::Profiler.const_get("#{f.to_s.camelize}ProfilePrinter") }.compact 41: 42: klasses.each do |klass| 43: fname = output_filename(klass) 44: FileUtils.mkdir_p(File.dirname(fname)) 45: file = File.open(fname, 'wb') do |file| 46: klass.new(@data).printProfile(file) 47: end 48: end 49: end
# File activesupport/lib/active_support/testing/performance/ruby.rb, line 42 42: def record 43: return unless @supported 44: 45: klasses = full_profile_options[:formats].map { |f| RubyProf.const_get("#{f.to_s.camelize}Printer") }.compact 46: 47: klasses.each do |klass| 48: fname = output_filename(klass) 49: FileUtils.mkdir_p(File.dirname(fname)) 50: File.open(fname, 'wb') do |file| 51: klass.new(@data).print(file, full_profile_options.slice(:min_percent)) 52: end 53: end 54: end
# File activesupport/lib/active_support/testing/performance/rubinius.rb, line 39 39: def record 40: return unless @supported 41: 42: if(full_profile_options[:formats].include?(:flat)) 43: create_path_and_open_file(:flat) do |file| 44: @profiler.show(file) 45: end 46: end 47: 48: if(full_profile_options[:formats].include?(:graph)) 49: create_path_and_open_file(:graph) do |file| 50: @profiler.show(file) 51: end 52: end 53: end
# File activesupport/lib/active_support/testing/performance/rubinius.rb, line 27 27: def run 28: return unless @supported 29: 30: @profiler = Rubinius::Profiler::Instrumenter.new 31: 32: @total = time_with_block do 33: @profiler.profile(false) do 34: full_profile_options[:runs].to_i.times { run_test(@metric, :profile) } 35: end 36: end 37: end
# File activesupport/lib/active_support/testing/performance/ruby.rb, line 31 31: def run 32: return unless @supported 33: 34: RubyProf.measure_mode = @metric.measure_mode 35: RubyProf.start 36: RubyProf.pause 37: full_profile_options[:runs].to_i.times { run_test(@metric, :profile) } 38: @data = RubyProf.stop 39: @total = @data.threads.sum(0) { |thread| thread.methods.max.total_time } 40: end
# File activesupport/lib/active_support/testing/performance/jruby.rb, line 27 27: def run 28: return unless @supported 29: 30: @total = time_with_block do 31: @data = JRuby::Profiler.profile do 32: full_profile_options[:runs].to_i.times { run_test(@metric, :profile) } 33: end 34: end 35: end
Instance Protected methods
# File activesupport/lib/active_support/testing/performance/rubinius.rb, line 56 56: def create_path_and_open_file(printer_name) 57: fname = "#{output_filename}_#{printer_name}.txt" 58: FileUtils.mkdir_p(File.dirname(fname)) 59: File.open(fname, 'wb') do |file| 60: yield(file) 61: end 62: end
# File activesupport/lib/active_support/testing/performance/ruby.rb, line 57 57: def output_filename(printer_class) 58: suffix = 59: case printer_class.name.demodulize 60: when 'FlatPrinter'; 'flat.txt' 61: when 'FlatPrinterWithLineNumbers'; 'flat_line_numbers.txt' 62: when 'GraphPrinter'; 'graph.txt' 63: when 'GraphHtmlPrinter'; 'graph.html' 64: when 'GraphYamlPrinter'; 'graph.yml' 65: when 'CallTreePrinter'; 'tree.txt' 66: when 'CallStackPrinter'; 'stack.html' 67: when 'DotPrinter'; 'graph.dot' 68: else printer_class.name.sub(/Printer$/, '').underscore 69: end 70: 71: "#{super()}_#{suffix}" 72: end
# File activesupport/lib/active_support/testing/performance/jruby.rb, line 52 52: def output_filename(printer_class) 53: suffix = 54: case printer_class.name.demodulize 55: when 'FlatProfilePrinter'; 'flat.txt' 56: when 'GraphProfilePrinter'; 'graph.txt' 57: else printer_class.name.sub(/ProfilePrinter$/, '').underscore 58: end 59: 60: "#{super()}_#{suffix}" 61: end