Class: Xcprofiler::Profiler

Inherits:
Object
  • Object
show all
Defined in:
lib/xcprofiler/profiler.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(derived_data) ⇒ Profiler

Returns a new instance of Profiler.



19
20
21
# File 'lib/xcprofiler/profiler.rb', line 19

def initialize(derived_data)
  @derived_data = derived_data
end

Instance Attribute Details

#derived_dataObject (readonly)

Returns the value of attribute derived_data.



7
8
9
# File 'lib/xcprofiler/profiler.rb', line 7

def derived_data
  @derived_data
end

#reporters=(value) ⇒ Object

Sets the attribute reporters

Parameters:

  • value

    the value to set the attribute reporters to.



6
7
8
# File 'lib/xcprofiler/profiler.rb', line 6

def reporters=(value)
  @reporters = value
end

Class Method Details

.by_path(activity_log_path) ⇒ Object



9
10
11
12
# File 'lib/xcprofiler/profiler.rb', line 9

def self.by_path(activity_log_path)
  derived_data = DerivedData.new(activity_log_path)
  Profiler.new(derived_data)
end

.by_product_name(product_name, default_derived_data_root = nil) ⇒ Object



14
15
16
17
# File 'lib/xcprofiler/profiler.rb', line 14

def self.by_product_name(product_name, default_derived_data_root = nil)
  derived_data = DerivedData.by_product_name(product_name, default_derived_data_root)
  Profiler.new(derived_data)
end

Instance Method Details

#report!Object



23
24
25
26
27
28
29
30
31
32
# File 'lib/xcprofiler/profiler.rb', line 23

def report!
  unless derived_data.flag_enabled?
    raise BuildFlagIsNotEnabled, "'-Xfrontend -debug-time-function-bodies' flag is not enabled"
  end

  reporters.each do |reporter|
    filtered = reporter.filter_executions(derived_data.executions)
    reporter.report!(filtered)
  end
end