mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
profiling enabled under JRuby. Added documentation for workaround described in JRUBY-5650.
This commit is contained in:
parent
b8f9a45156
commit
677ce63d92
5 changed files with 9 additions and 20 deletions
|
@ -16,9 +16,7 @@ module ActiveSupport
|
|||
protected
|
||||
def run_gc
|
||||
ManagementFactory.memory_mx_bean.gc
|
||||
end
|
||||
|
||||
class Performer; end
|
||||
end
|
||||
|
||||
class Profiler < Performer
|
||||
def initialize(*args)
|
||||
|
@ -33,9 +31,6 @@ module ActiveSupport
|
|||
full_profile_options[:runs].to_i.times { run_test(@metric, :profile) }
|
||||
end
|
||||
|
||||
profile_printer = JRuby::Profiler::GraphProfilePrinter.new(@data)
|
||||
profile_printer.printProfile(STDOUT)
|
||||
|
||||
@total = @data.getDuration / 1000 / 1000 / 1000.0 # seconds
|
||||
end
|
||||
|
||||
|
|
|
@ -84,19 +84,19 @@ module ActiveSupport
|
|||
end
|
||||
end
|
||||
|
||||
class Memory < DigitalInformationUnit
|
||||
class Memory < DigitalInformationUnit
|
||||
def measure
|
||||
loopback.get("system.memory.counter.bytes").last
|
||||
end
|
||||
end
|
||||
|
||||
class Objects < Amount
|
||||
class Objects < Amount
|
||||
def measure
|
||||
loopback.get("system.memory.counter.objects").last
|
||||
end
|
||||
end
|
||||
|
||||
class GcRuns < Amount
|
||||
class GcRuns < Amount
|
||||
def measure
|
||||
loopback.get("system.gc.full.count").last + loopback.get("system.gc.young.count").last
|
||||
end
|
||||
|
|
|
@ -21,8 +21,6 @@ module ActiveSupport
|
|||
def run_gc
|
||||
GC.start
|
||||
end
|
||||
|
||||
class Performer; end
|
||||
|
||||
class Profiler < Performer
|
||||
def initialize(*args)
|
||||
|
@ -128,28 +126,28 @@ module ActiveSupport
|
|||
Mode = RubyProf::MEMORY if RubyProf.const_defined?(:MEMORY)
|
||||
|
||||
# overridden by each implementation
|
||||
def measure; 0; end
|
||||
def measure; end
|
||||
end
|
||||
|
||||
class Objects < Amount
|
||||
Mode = RubyProf::ALLOCATIONS if RubyProf.const_defined?(:ALLOCATIONS)
|
||||
|
||||
# overridden by each implementation
|
||||
def measure; 0; end
|
||||
def measure; end
|
||||
end
|
||||
|
||||
class GcRuns < Amount
|
||||
Mode = RubyProf::GC_RUNS if RubyProf.const_defined?(:GC_RUNS)
|
||||
|
||||
# overridden by each implementation
|
||||
def measure; 0; end
|
||||
def measure; end
|
||||
end
|
||||
|
||||
class GcTime < Time
|
||||
Mode = RubyProf::GC_TIME if RubyProf.const_defined?(:GC_TIME)
|
||||
|
||||
# overridden by each implementation
|
||||
def measure; 0; end
|
||||
def measure; end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -24,8 +24,6 @@ module ActiveSupport
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
class Amount < Base; end
|
||||
|
||||
class Objects < Amount
|
||||
# Ruby 1.8 + ruby-prof wrapper
|
||||
|
|
|
@ -223,7 +223,7 @@ h6. Profiling
|
|||
|_.Rubinius | yes | no | no | no | no | no | no | no |
|
||||
|_.JRuby | yes | no | no | no | no | no | no | no |
|
||||
|
||||
WARNING: Profiling under JRuby is currently unavailable because of a bug with rake and JRuby's +--profile.api+ option. You should resort exclusively to benchmarking.
|
||||
NOTE: To profile under JRuby you'll need to run +export JRUBY_OPTS="-Xlaunch.inproc=false --profile.api"+ *before* the performance tests.
|
||||
|
||||
h4. Understanding the Output
|
||||
|
||||
|
@ -309,8 +309,6 @@ h6. Output Availability
|
|||
|_.Rubinius | yes | yes | no |
|
||||
|_.JRuby | yes | yes | no |
|
||||
|
||||
WARNING: Again, profiling under JRuby is currently unavailable because of a bug with rake and JRuby's +--profile.api+ option.
|
||||
|
||||
h4. Tuning Test Runs
|
||||
|
||||
Test runs can be tuned by setting the +profile_options+ class variable on your test class.
|
||||
|
|
Loading…
Reference in a new issue