module RubyProf

These methods are deprecated and are available for backwards compatability.

Constants

VERSION

Public Class Methods

exclude_threads() click to toggle source

Returns the threads that ruby-prof should exclude from profiling

# File lib/ruby-prof/compatibility.rb, line 32
def self.exclude_threads
  @exclude_threads ||= Array.new
end
exclude_threads=(value) click to toggle source

Specifies which threads ruby-prof should exclude from profiling

# File lib/ruby-prof/compatibility.rb, line 37
def self.exclude_threads=(value)
  @exclude_threads = value
end
measure_mode → measure_mode click to toggle source

Returns what ruby-prof is measuring. Valid values include:

  • RubyProf::WALL_TIME

  • RubyProf::PROCESS_TIME

  • RubyProf::ALLOCATIONS

  • RubyProf::MEMORY

# File lib/ruby-prof/compatibility.rb, line 14
def self.measure_mode
  @measure_mode ||= RubyProf::WALL_TIME
end
measure_mode=value → void click to toggle source

Specifies what ruby-prof should measure. Valid values include:

  • RubyProf::WALL_TIME - Wall time measures the real-world time elapsed between any two moments. If there are other processes concurrently running on the system that use significant CPU or disk time during a profiling run then the reported results will be larger than expected. On Windows, wall time is measured using GetTickCount(), on MacOS by mach_absolute_time, on Linux by clock_gettime and otherwise by gettimeofday.

  • RubyProf::PROCESS_TIME - Process time measures the time used by a process between any two moments. It is unaffected by other processes concurrently running on the system. Remember with process time that calls to methods like sleep will not be included in profiling results. On Windows, process time is measured using GetProcessTimes and on other platforms by clock_gettime.

  • RubyProf::ALLOCATIONS - Object allocations measures show how many objects each method in a program allocates. Measurements are done via Ruby's GC.stat api.

  • RubyProf::MEMORY - Memory measures how much memory each method in a program uses. Measurements are done via Ruby's TracePoint api.

# File lib/ruby-prof/compatibility.rb, line 27
def self.measure_mode=(value)
  @measure_mode = value
end
pause() click to toggle source

Pauses profiling

# File lib/ruby-prof/compatibility.rb, line 49
def self.pause
  ensure_running!
  @profile.pause
end
profile(options = {}, &block) click to toggle source

Profiles a block

# File lib/ruby-prof/compatibility.rb, line 78
def self.profile(options = {}, &block)
  ensure_not_running!
  options = {:measure_mode => measure_mode, :exclude_threads => exclude_threads }.merge!(options)
  Profile.profile(options, &block)
end
resume() click to toggle source

Resume profiling

# File lib/ruby-prof/compatibility.rb, line 64
def self.resume
  ensure_running!
  @profile.resume
end
running?() click to toggle source

Is a profile running?

# File lib/ruby-prof/compatibility.rb, line 55
def self.running?
  if defined?(@profile) and @profile
    @profile.running?
  else
    false
  end
end
start() click to toggle source

Starts profiling

# File lib/ruby-prof/compatibility.rb, line 42
def self.start
  ensure_not_running!
  @profile = Profile.new(:measure_mode => measure_mode, :exclude_threads => exclude_threads)
  @profile.start
end
stop() click to toggle source

Stops profiling

# File lib/ruby-prof/compatibility.rb, line 70
def self.stop
  ensure_running!
  result = @profile.stop
  @profile = nil
  result
end