check if RubyProf's WALL_TIME and PROCESS_TIME are available before using them (similarly to other constants)

This commit is contained in:
Gonçalo Silva
2011-03-24 23:38:17 +00:00
parent 9887f23887
commit 23be2c6134

View File

@@ -305,7 +305,7 @@ begin
end
class ProcessTime < Time
Mode = RubyProf::PROCESS_TIME
Mode = RubyProf::PROCESS_TIME if RubyProf.const_defined?(:PROCESS_TIME)
def measure
RubyProf.measure_process_time
@@ -313,7 +313,7 @@ begin
end
class WallTime < Time
Mode = RubyProf::WALL_TIME
Mode = RubyProf::WALL_TIME if RubyProf.const_defined?(:WALL_TIME)
def measure
RubyProf.measure_wall_time