class Benchmark::Memory::Job::Task
Hold a labelled job for later measurement.
def call
-
(Measurement)- the memory usage measurement of the code.
def call result = while_measuring_memory_usage { action.call } Measurement.from_result(result) end
def initialize(label, action)
-
(ArgumentError)- if the action does not respond to `#call`.
Parameters:
-
action(#call) -- The code to be measured. -
label(#to_s) -- The label for the benchmark.
def initialize(label, action) unless action.respond_to?(:call) raise( ArgumentError, "Invalid action (#{@action.inspect} does not respond to call)" ) end @label = label @action = action end
def while_measuring_memory_usage(&block)
def while_measuring_memory_usage(&block) MemoryProfiler.report({}, &block) end