Class: Ree::BenchmarkMethodPlugin

Inherits:
Object
  • Object
show all
Defined in:
lib/ree/benchmark_method_plugin.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(method_name, is_class_method, target) ⇒ BenchmarkMethodPlugin

Returns a new instance of BenchmarkMethodPlugin.



8
9
10
11
12
# File 'lib/ree/benchmark_method_plugin.rb', line 8

def initialize(method_name, is_class_method, target)
  @method_name = method_name
  @is_class_method = is_class_method
  @target = target
end

Class Method Details

.active?Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/ree/benchmark_method_plugin.rb', line 4

def self.active?
  Ree.benchmark_mode?
end

Instance Method Details

#callObject



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/ree/benchmark_method_plugin.rb', line 14

def call
  return nil unless @method_name == :call && ree_fn?

  config = @target.instance_variable_get(:@__ree_benchmark_config)
  benchmark_name = build_benchmark_name

  if config
    build_entry_point_wrapper(benchmark_name, config)
  else
    build_collector_wrapper(benchmark_name)
  end
end