Class: Instrumentality::Profiler
- Inherits:
-
Object
- Object
- Instrumentality::Profiler
- Defined in:
- lib/instrumentality/profiler.rb
Defined Under Namespace
Classes: ProfilerError, ProfilerInterruptError
Instance Attribute Summary collapse
-
#app_pid ⇒ Object
readonly
Returns the value of attribute app_pid.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#dtrace_pid ⇒ Object
readonly
Returns the value of attribute dtrace_pid.
-
#script_path ⇒ Object
readonly
Returns the value of attribute script_path.
-
#verbose ⇒ Object
readonly
Returns the value of attribute verbose.
-
#xcodebuild_pid ⇒ Object
readonly
Returns the value of attribute xcodebuild_pid.
Instance Method Summary collapse
-
#initialize(config, verbose = false) ⇒ Profiler
constructor
A new instance of Profiler.
- #profile ⇒ Object
Constructor Details
#initialize(config, verbose = false) ⇒ Profiler
Returns a new instance of Profiler.
16 17 18 19 20 21 22 23 |
# File 'lib/instrumentality/profiler.rb', line 16 def initialize(config, verbose = false) @config = config @verbose = verbose script = config.script.dup script.prepend(Constants::EXPERIMENTAL) if @config.experimental @script_path = Finder.path_for_script(script) raise ProfilerError, "This intrument doesn't support --experimental flag".red unless File.exist?(script_path) end |
Instance Attribute Details
#app_pid ⇒ Object (readonly)
Returns the value of attribute app_pid.
14 15 16 |
# File 'lib/instrumentality/profiler.rb', line 14 def app_pid @app_pid end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
14 15 16 |
# File 'lib/instrumentality/profiler.rb', line 14 def config @config end |
#dtrace_pid ⇒ Object (readonly)
Returns the value of attribute dtrace_pid.
14 15 16 |
# File 'lib/instrumentality/profiler.rb', line 14 def dtrace_pid @dtrace_pid end |
#script_path ⇒ Object (readonly)
Returns the value of attribute script_path.
14 15 16 |
# File 'lib/instrumentality/profiler.rb', line 14 def script_path @script_path end |
#verbose ⇒ Object (readonly)
Returns the value of attribute verbose.
14 15 16 |
# File 'lib/instrumentality/profiler.rb', line 14 def verbose @verbose end |
#xcodebuild_pid ⇒ Object (readonly)
Returns the value of attribute xcodebuild_pid.
14 15 16 |
# File 'lib/instrumentality/profiler.rb', line 14 def xcodebuild_pid @xcodebuild_pid end |
Instance Method Details
#profile ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/instrumentality/profiler.rb', line 25 def profile return interactive if @config.interactive current_directory = Dir.pwd Dir.mktmpdir do |tmpdir| compile(current_directory, tmpdir) Simctl.execute_with_simulator_ready(Constants::DEFAULT_RUNTIME, Constants::DEFAULT_DEVICE) do |device_udid| run_tests(tmpdir, device_udid) find_app_pid notify_server attach_dtrace(tmpdir) wait end process_dtrace_output(current_directory, tmpdir) end end |