Skip to content

Commit

Permalink
check if RubyProf's WALL_TIME and PROCESS_TIME are available before u…
Browse files Browse the repository at this point in the history
…sing them (similarly to other constants)
  • Loading branch information
goncalossilva committed Mar 24, 2011
1 parent 9887f23 commit 23be2c6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions activesupport/lib/active_support/testing/performance.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -305,15 +305,15 @@ def format(measurement)
end end


class ProcessTime < Time class ProcessTime < Time
Mode = RubyProf::PROCESS_TIME Mode = RubyProf::PROCESS_TIME if RubyProf.const_defined?(:PROCESS_TIME)


def measure def measure
RubyProf.measure_process_time RubyProf.measure_process_time
end end
end end


class WallTime < Time class WallTime < Time
Mode = RubyProf::WALL_TIME Mode = RubyProf::WALL_TIME if RubyProf.const_defined?(:WALL_TIME)


def measure def measure
RubyProf.measure_wall_time RubyProf.measure_wall_time
Expand Down

0 comments on commit 23be2c6

Please sign in to comment.