Sha256: 512e104975c93e4045d03b3213692558445e94da3c3337073345e1aed88a2510

Contents?: true

Size: 1.72 KB

Versions: 52

Compression:

Stored size: 1.72 KB

Contents

require 'java'
require 'erb'

require File.dirname(__FILE__) + "/jruby-prof.jar"

import org.jruby.prof.JRubyProf

require 'jruby-prof/abstract_printer'
require 'jruby-prof/simple_tree_printer'
require 'jruby-prof/flat_text_printer'
require 'jruby-prof/graph_text_printer'
require 'jruby-prof/graph_html_printer'
require 'jruby-prof/invocation_set'
require 'jruby-prof/method'
require 'jruby-prof/tree_html_printer'

require 'jruby-prof/profile_invocation'

class JRubyProf
  
  def self.start
    raise RuntimeError, "JRubyProf already running" if running?
    start_tracing
  end
  
  def self.stop
    stop_tracing
  end
  
  def self.running?
    self.is_running
  end
  
  def self.profile
    raise ArgumentError, "profile requires a block" unless block_given?
    start
    yield
    stop
  end
  
  def self.print_call_tree(result, filename)
    printer = SimpleTreePrinter.new(ThreadSet.new(result.values.to_a, JRubyProf.lastTracingDuration))
    printer.print_to_file(filename)
  end
  
  def self.print_tree_html(result, filename)
    printer = TreeHtmlPrinter.new(ThreadSet.new(result.values.to_a, JRubyProf.lastTracingDuration))
    printer.print_to_file(filename)
  end
  
  def self.print_flat_text(result, filename)
    printer = FlatTextPrinter.new(ThreadSet.new(result.values.to_a, JRubyProf.lastTracingDuration))
    printer.print_to_file(filename)
  end
  
  def self.print_graph_text(result, filename)
    printer = GraphTextPrinter.new(ThreadSet.new(result.values.to_a, JRubyProf.lastTracingDuration))
    printer.print_to_file(filename)
  end

  def self.print_graph_html(result, filename)
    printer = GraphHtmlPrinter.new(ThreadSet.new(result.values.to_a, JRubyProf.lastTracingDuration))
    printer.print_to_file(filename)
  end
end

Version data entries

52 entries across 52 versions & 4 rubygems

Version Path
redcar-0.9.1 plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof.rb
redcar-0.9.0 plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof.rb
redcar-0.8.1 plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof.rb
redcar-0.8 plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof.rb
redcar-0.7 plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof.rb
redcar-0.6.1 plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof.rb
redcar-0.6 plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof.rb
redcar-0.6.1dev plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof.rb
redcar-0.5.1 plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof.rb
redcar-0.5 plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof.rb
redcar-0.5.6dev plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof.rb
redcar-0.5.5dev plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof.rb
redcar-0.5.4dev plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof.rb
redcar-0.5.3dev plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof.rb
redcar-0.5.2dev plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof.rb
redcar-0.5.1dev plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof.rb
redcar-0.4.1 plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof.rb
redcar-0.4 plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof.rb
redcar-0.3.10.1dev plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof.rb
redcar-0.3.10.0dev plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof.rb