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
32 def self.exclude_threads
33   @exclude_threads ||= Array.new
34 end
exclude_threads=(value) click to toggle source

Specifies which threads ruby-prof should exclude from profiling

   # File lib/ruby-prof/compatibility.rb
37 def self.exclude_threads=(value)
38   @exclude_threads = value
39 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
14 def self.measure_mode
15   @measure_mode ||= RubyProf::WALL_TIME
16 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
27 def self.measure_mode=(value)
28   @measure_mode = value
29 end
pause() click to toggle source

Pauses profiling

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

Profiles a block

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

Resume profiling

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

Is a profile running?

   # File lib/ruby-prof/compatibility.rb
55 def self.running?
56   if defined?(@profile) and @profile
57     @profile.running?
58   else
59     false
60   end
61 end
start() click to toggle source

Starts profiling

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

Stops profiling

   # File lib/ruby-prof/compatibility.rb
70 def self.stop
71   ensure_running!
72   result = @profile.stop
73   @profile = nil
74   result
75 end