instrumentality 0.1.0 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 05ae3b363734c9eb4a9c6cbbbb3b2d2f7e4c3d87
4
- data.tar.gz: 8ac7c4c91afa271574d1e78e8a09b69eaf48badc
3
+ metadata.gz: 4bd92f799a2dc113dda402dfe40d94334be2324f
4
+ data.tar.gz: 350759f37a462eab9c6a155c90a689945f3764a0
5
5
  SHA512:
6
- metadata.gz: 4fb9e519ea950637947cc7e06ed3fd895966bd8d554f1016fb1cb7b1b1ea7cab5a3ebed8ad8c9abdbe8ec10b0329b1f4de6f5a1e4d811c5343b0c8eb6f618eb7
7
- data.tar.gz: 5432bc1923d7091db9920d82f8e8bfd6bcc50c55026ee7fe51b33e8a332ebde863c899eac44048e9645eed68d80e8b7aa1ea8c6f07f147f2367817e5c01a91c6
6
+ metadata.gz: 0df7535151887c65cf1f89412f8419801cc731d71d7f43844e40200f117f2300cf853d648059b67950e02a46b074b3055d87c6ff7a8abbb912c72332e2703fbb
7
+ data.tar.gz: 013656bdb62c8d9295a797f1455dfa5b12e4a3465fe0f2dffc6ab76c22763339c3401be35a288bfe048607084db708987d25761668915128b16ebfde4b4a22e0
@@ -0,0 +1,12 @@
1
+ version: 2.0
2
+ jobs:
3
+ build:
4
+ docker:
5
+ - image: ruenzuo/instrumentality-circle-ci:latest
6
+ environment:
7
+ - COVERAGE: "YES"
8
+ steps:
9
+ - checkout
10
+ - run: gem install bundler
11
+ - run: bundle
12
+ - run: (/usr/local/bin/Finder.app &) && bundle exec rake spec
@@ -0,0 +1,4 @@
1
+ FROM ruby:2.2-alpine
2
+ COPY Finder.app xcode-select xcodebuild /usr/local/bin/
3
+ RUN apk --update --no-cache add git make gcc libc-dev
4
+
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env sh
2
+
3
+ while true
4
+ do
5
+ sleep 5
6
+ done
File without changes
File without changes
@@ -0,0 +1,2 @@
1
+ service_name: 'circle-ci'
2
+ repo_token: '5Qb2yMzjmBmwxQ2sDr6Irn5jjHhYLST9d'
data/README.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Instrumentality
2
2
 
3
+ [![CircleCI](https://circleci.com/gh/Ruenzuo/instrumentality.svg?style=svg&circle-token=71523995bd17c73c1ce365df507d24cb0bc1e3c4)](https://circleci.com/gh/Ruenzuo/instrumentality)
4
+ [![Coverage Status](https://coveralls.io/repos/github/Ruenzuo/instrumentality/badge.svg?branch=master)](https://coveralls.io/github/Ruenzuo/instrumentality?branch=master)
5
+
3
6
  Command line interface to profiling tools for iOS development
4
7
 
5
8
  ## Installation
@@ -28,4 +28,7 @@ Gem::Specification.new do |spec|
28
28
  spec.add_development_dependency "bundler", "~> 1.15"
29
29
  spec.add_development_dependency "rake", "~> 10.0"
30
30
  spec.add_development_dependency "rspec", "~> 3.0"
31
+ spec.add_development_dependency "pry-byebug", "~> 3.4"
32
+ spec.add_development_dependency "simplecov", "~> 0.15"
33
+ spec.add_development_dependency "coveralls", "~> 0.7.0"
31
34
  end
@@ -3,10 +3,11 @@ require 'instrumentality/version'
3
3
 
4
4
  module Instrumentality
5
5
  class Command < CLAide::Command
6
- require 'instrumentality/command/benchmark'
7
- require 'instrumentality/command/file_activity'
6
+ require 'instrumentality/command/profile'
7
+ require 'instrumentality/command/profile/benchmark'
8
+ require 'instrumentality/command/profile/file_activity'
9
+ require 'instrumentality/command/profile/custom'
8
10
  require 'instrumentality/command/generate_header'
9
- require 'instrumentality/command/custom'
10
11
 
11
12
  self.abstract_command = true
12
13
  self.command = 'instr'
@@ -1,33 +1,15 @@
1
1
  require 'instrumentality/command'
2
- require 'instrumentality/finder'
3
- require 'instrumentality/profiler'
4
- require 'instrumentality/constants'
5
- require 'ostruct'
6
2
 
7
3
  module Instrumentality
8
- class Custom < Command
9
- def self.options
10
- [
11
- ['--workspace=path/to/name.xcworkspace', 'If not set, Instr will try to find one'],
12
- ['--project=path/to/name.xcodeproj', 'If not set and workspace search failed, Instr will try to find one'],
13
- ['--scheme=name', 'If not set, Instr will use the process name'],
14
- ['--server-port=port_number', 'If not set, Instr will use 8080'],
15
- ['--interactive', 'If set, Instr will not attempt to run an Xcode scheme, but instead attach DTrace directly'],
16
- ].concat(super)
17
- end
4
+ class Profile < Command
5
+ self.abstract_command = true
18
6
 
19
- self.arguments = [
20
- CLAide::Argument.new("process", true),
21
- CLAide::Argument.new("script", true),
22
- ]
7
+ self.summary = "Run instruments"
23
8
 
24
- self.summary = <<-DESC
25
- Runs a DTrace script against a specific iOS process.
26
- DESC
9
+ #-----#
27
10
 
28
11
  def initialize(argv)
29
12
  @process = argv.shift_argument
30
- @script = argv.shift_argument
31
13
  @workspace = argv.option('workspace') || Finder.find_workspace
32
14
  @project = argv.option('project')
33
15
  @project ||= Finder.find_project if @workspace.nil?
@@ -39,24 +21,29 @@ module Instrumentality
39
21
 
40
22
  def validate!
41
23
  super
24
+ end
42
25
 
26
+ def validate_shared_arguments!
43
27
  help! 'A process name is required' unless @process
44
- help! 'A valid script path is required' unless File.exist?(@script)
45
28
  return if @interactive
46
29
  help! 'Xcode workspace or project files not found' if @workspace.nil? && @project.nil?
47
30
  end
48
31
 
49
- def run
50
- config = OpenStruct.new({'script' => @script,
51
- 'process' => @process,
52
- 'workspace' => @workspace,
53
- 'project' => @project,
54
- 'scheme' => @scheme,
55
- 'server_port' => @server_port,
56
- 'interactive' => @interactive,
57
- 'experimental' => false})
58
- profiler = Profiler.new(config, @verbose)
59
- profiler.profile
32
+ def self.shared_arguments
33
+ [
34
+ CLAide::Argument.new("process", true),
35
+ ]
36
+ end
37
+
38
+ def self.shared_options
39
+ [
40
+ ['--workspace=path/to/name.xcworkspace', 'If not set, Instr will try to find one'],
41
+ ['--project=path/to/name.xcodeproj', 'If not set and workspace search failed, Instr will try to find one'],
42
+ ['--scheme=name', 'If not set, Instr will use the process name'],
43
+ ['--server-port=port_number', 'If not set, Instr will use 8080'],
44
+ ['--interactive', 'If set, Instr will not attempt to run an Xcode scheme, but instead attach DTrace directly'],
45
+ ]
60
46
  end
61
47
  end
62
48
  end
49
+
@@ -0,0 +1,47 @@
1
+ require 'instrumentality/command'
2
+ require 'instrumentality/finder'
3
+ require 'instrumentality/profiler'
4
+ require 'instrumentality/constants'
5
+ require 'ostruct'
6
+
7
+ module Instrumentality
8
+ class Profile < Command
9
+ class Benchmark < Profile
10
+ def self.options
11
+ shared_options.concat([
12
+ ['--experimental', "Don't use it if you don't know what it does"],
13
+ ]).concat(super)
14
+ end
15
+
16
+ self.arguments = shared_arguments.concat([
17
+ ])
18
+
19
+ self.summary = <<-DESC
20
+ Runs a benchmark against a specific iOS process. Requires static probes.
21
+ DESC
22
+
23
+ def initialize(argv)
24
+ @experimental = argv.flag?('experimental', false)
25
+ super
26
+ end
27
+
28
+ def validate!
29
+ super
30
+ validate_shared_arguments!
31
+ end
32
+
33
+ def run
34
+ config = OpenStruct.new({'script' => Constants::BENCHMARK_SCRIPT,
35
+ 'process' => @process,
36
+ 'workspace' => @workspace,
37
+ 'project' => @project,
38
+ 'scheme' => @scheme,
39
+ 'server_port' => @server_port,
40
+ 'interactive' => @interactive,
41
+ 'experimental' => @experimental})
42
+ profiler = Profiler.new(config, @verbose)
43
+ profiler.profile
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,47 @@
1
+ require 'instrumentality/command'
2
+ require 'instrumentality/finder'
3
+ require 'instrumentality/profiler'
4
+ require 'instrumentality/constants'
5
+ require 'ostruct'
6
+
7
+ module Instrumentality
8
+ class Profile < Command
9
+ class Custom < Profile
10
+ def self.options
11
+ shared_options.concat([
12
+ ]).concat(super)
13
+ end
14
+
15
+ self.arguments = shared_arguments.concat([
16
+ CLAide::Argument.new("script", true),
17
+ ])
18
+
19
+ self.summary = <<-DESC
20
+ Runs a DTrace script against a specific iOS process.
21
+ DESC
22
+
23
+ def initialize(argv)
24
+ super
25
+ @script = argv.shift_argument
26
+ end
27
+
28
+ def validate!
29
+ super
30
+ validate_shared_arguments!
31
+ end
32
+
33
+ def run
34
+ config = OpenStruct.new({'script' => @script,
35
+ 'process' => @process,
36
+ 'workspace' => @workspace,
37
+ 'project' => @project,
38
+ 'scheme' => @scheme,
39
+ 'server_port' => @server_port,
40
+ 'interactive' => @interactive,
41
+ 'experimental' => false})
42
+ profiler = Profiler.new(config, @verbose)
43
+ profiler.profile
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,47 @@
1
+ require 'instrumentality/command'
2
+ require 'instrumentality/finder'
3
+ require 'instrumentality/profiler'
4
+ require 'instrumentality/constants'
5
+ require 'ostruct'
6
+
7
+ module Instrumentality
8
+ class Profile < Command
9
+ class FileActivity < Profile
10
+ def self.options
11
+ shared_options.concat([
12
+ ['--experimental', "Don't use it if you don't know what it does"],
13
+ ]).concat(super)
14
+ end
15
+
16
+ self.arguments = shared_arguments.concat([
17
+ ])
18
+
19
+ self.summary = <<-DESC
20
+ Prints files read or write by a specific iOS process.
21
+ DESC
22
+
23
+ def initialize(argv)
24
+ @experimental = argv.flag?('experimental', false)
25
+ super
26
+ end
27
+
28
+ def validate!
29
+ super
30
+ validate_shared_arguments!
31
+ end
32
+
33
+ def run
34
+ config = OpenStruct.new({'script' => Constants::FILE_ACTIVITY_SCRIPT,
35
+ 'process' => @process,
36
+ 'workspace' => @workspace,
37
+ 'project' => @project,
38
+ 'scheme' => @scheme,
39
+ 'server_port' => @server_port,
40
+ 'interactive' => @interactive,
41
+ 'experimental' => @experimental})
42
+ profiler = Profiler.new(config, @verbose)
43
+ profiler.profile
44
+ end
45
+ end
46
+ end
47
+ end
@@ -1,4 +1,4 @@
1
- require 'instrumentality/constants'
1
+ require 'instrumentality/logger'
2
2
  require 'claide'
3
3
  require 'colorize'
4
4
  require 'timeout'
@@ -8,7 +8,7 @@ module Instrumentality
8
8
  class ExecutorError < StandardError; include CLAide::InformativeError; end
9
9
 
10
10
  def self.execute(cmd, verbose = false)
11
- puts "#{Constants::OUTPUT_PREFIX} Executing command: #{cmd}"
11
+ Logger.log("Executing command: #{cmd}")
12
12
  if verbose
13
13
  system(cmd)
14
14
  else
@@ -19,21 +19,25 @@ module Instrumentality
19
19
  end
20
20
 
21
21
  def self.execute_async(cmd)
22
- spawn("#{cmd}").tap do |pid|
23
- puts "#{Constants::OUTPUT_PREFIX} Spawned process (PID: #{pid}) from command: #{cmd}"
22
+ Process.spawn("#{cmd}").tap do |pid|
23
+ Logger.log("Spawned process (PID: #{pid}) from command: #{cmd}")
24
24
  end
25
25
  end
26
26
 
27
27
  def self.timeout(process, seconds = Constants::TIMEOUT)
28
28
  pid = ""
29
- Timeout.timeout(seconds) do
30
- loop do
31
- pid = `ps aux | grep #{process}.app | grep -v grep | awk '{print $2}'`.strip
32
- break if pid != ""
29
+ begin
30
+ Timeout.timeout(seconds) do
31
+ loop do
32
+ pid = `ps aux | grep #{process}.app | grep -v grep | awk '{print $2}'`.strip
33
+ break if pid != ""
34
+ end
33
35
  end
36
+ rescue Timeout::Error
37
+ raise ExecutorError, "Timeout while trying to find #{process} process".red
34
38
  end
35
39
  pid.tap do |pid|
36
- puts "#{Constants::OUTPUT_PREFIX} Found process #{process} with PID: #{pid}"
40
+ Logger.log("Found process #{process} with PID: #{pid}")
37
41
  end
38
42
  end
39
43
  end
@@ -1,11 +1,11 @@
1
1
  module Instrumentality
2
2
  class Finder
3
3
  def self.find_workspace
4
- find('*.xcworkspace', 1).first
4
+ find('*.xcworkspace', 2).first
5
5
  end
6
6
 
7
7
  def self.find_project
8
- find('*.xcodeproj', 1).first
8
+ find('*.xcodeproj', 2).first
9
9
  end
10
10
 
11
11
  def self.find_xctestrun(location)
@@ -1,19 +1,24 @@
1
1
  require 'instrumentality/executor'
2
2
  require 'instrumentality/finder'
3
3
  require 'instrumentality/constants'
4
+ require 'claide'
5
+ require 'colorize'
4
6
 
5
7
  module Instrumentality
6
8
  class HeaderGenerator
9
+ class HeaderGeneratorError < StandardError; include CLAide::InformativeError; end
7
10
  attr_reader :instrument, :verbose
8
11
 
9
- def initialize(instrument, verbose)
12
+ def initialize(instrument, verbose = false)
10
13
  @instrument = instrument
11
14
  @verbose = verbose
12
15
  end
13
16
 
14
17
  def generate
18
+ path_for_header = Finder.path_for_header("#{instrument}.d")
19
+ raise HeaderGeneratorError, "Couldn't find header for #{instrument} instrument".red unless File.exist?(path_for_header)
15
20
  dtrace_cmd = %w[dtrace]
16
- dtrace_cmd += %W[-h -s #{Finder.path_for_header(Constants::BENCHMARK_SCRIPT)}]
21
+ dtrace_cmd += %W[-h -s #{path_for_header}]
17
22
  cmd = dtrace_cmd.join(' ')
18
23
  Executor.execute(cmd, verbose)
19
24
  end
@@ -0,0 +1,9 @@
1
+ require 'instrumentality/constants'
2
+
3
+ module Instrumentality
4
+ class Logger
5
+ def self.log(message)
6
+ puts "#{Constants::OUTPUT_PREFIX} #{message}"
7
+ end
8
+ end
9
+ end
@@ -2,8 +2,10 @@ require 'instrumentality/executor'
2
2
  require 'instrumentality/finder'
3
3
  require 'instrumentality/constants'
4
4
  require 'instrumentality/simctl'
5
+ require 'instrumentality/logger'
5
6
  require 'net/http'
6
7
  require 'uri'
8
+ require 'tmpdir'
7
9
 
8
10
  module Instrumentality
9
11
  class Profiler
@@ -11,7 +13,7 @@ module Instrumentality
11
13
  class ProfilerError < StandardError; include CLAide::InformativeError; end
12
14
  attr_reader :config, :script_path, :verbose, :xcodebuild_pid, :app_pid, :dtrace_pid
13
15
 
14
- def initialize(config, verbose)
16
+ def initialize(config, verbose = false)
15
17
  @config = config
16
18
  @verbose = verbose
17
19
  script = config.script.dup
@@ -25,8 +27,8 @@ module Instrumentality
25
27
  current_directory = Dir.pwd
26
28
  Dir.mktmpdir do |tmpdir|
27
29
  compile(current_directory, tmpdir)
28
- Simctl.execute_with_simulator_ready(Constants::DEFAULT_RUNTIME, Constants::DEFAULT_DEVICE) do |device|
29
- run_tests(tmpdir, device)
30
+ Simctl.execute_with_simulator_ready(Constants::DEFAULT_RUNTIME, Constants::DEFAULT_DEVICE) do |device_udid|
31
+ run_tests(tmpdir, device_udid)
30
32
  find_app_pid
31
33
  notify_server
32
34
  attach_dtrace(tmpdir)
@@ -59,11 +61,11 @@ module Instrumentality
59
61
  Executor.execute(cmd, verbose)
60
62
  end
61
63
 
62
- def run_tests(temporary_directory, device)
64
+ def run_tests(temporary_directory, device_udid)
63
65
  xctestrun = Finder.find_xctestrun(temporary_directory)
64
66
  xcodebuild_cmd = %w[xcodebuild]
65
67
  xcodebuild_cmd += %W[-xctestrun #{xctestrun}]
66
- xcodebuild_cmd += %W[-destination 'platform=iOS Simulator,id=#{device.udid}']
68
+ xcodebuild_cmd += %W[-destination 'platform=iOS Simulator,id=#{device_udid}']
67
69
  xcodebuild_cmd += %w[test-without-building]
68
70
  cmd = xcodebuild_cmd.join(' ')
69
71
  @xcodebuild_pid = Executor.execute_async(cmd)
@@ -116,7 +118,7 @@ module Instrumentality
116
118
  cmd = touch_cmd.join(' ')
117
119
  Executor.execute(cmd, verbose)
118
120
  stream = IO.new(IO.sysopen(output_file))
119
- puts "#{Constants::OUTPUT_PREFIX} Started interactive session. #{"Press CTRL+C to finish.".blue}"
121
+ Logger.log("Started interactive session. #{"Press CTRL+C to finish.".blue}")
120
122
  begin
121
123
  loop do
122
124
  output = stream.gets
@@ -10,7 +10,7 @@ module Instrumentality
10
10
  d.state == :booted && d.ready?
11
11
  end
12
12
  begin
13
- yield device
13
+ yield device.udid
14
14
  rescue StandardError => error
15
15
  throw error
16
16
  ensure
@@ -1,3 +1,3 @@
1
1
  module Instrumentality
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,99 +1,141 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: instrumentality
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Renzo Crisóstomo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-11 00:00:00.000000000 Z
11
+ date: 2018-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: claide
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: 1.0.2
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: 1.0.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: colorize
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
33
  version: 0.8.1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.8.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: simctl
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ~>
46
46
  - !ruby/object:Gem::Version
47
47
  version: 1.6.2
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ~>
53
53
  - !ruby/object:Gem::Version
54
54
  version: 1.6.2
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ~>
60
60
  - !ruby/object:Gem::Version
61
61
  version: '1.15'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ~>
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.15'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ~>
74
74
  - !ruby/object:Gem::Version
75
75
  version: '10.0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ~>
81
81
  - !ruby/object:Gem::Version
82
82
  version: '10.0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rspec
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ~>
88
88
  - !ruby/object:Gem::Version
89
89
  version: '3.0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ~>
95
95
  - !ruby/object:Gem::Version
96
96
  version: '3.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: pry-byebug
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ~>
102
+ - !ruby/object:Gem::Version
103
+ version: '3.4'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ~>
109
+ - !ruby/object:Gem::Version
110
+ version: '3.4'
111
+ - !ruby/object:Gem::Dependency
112
+ name: simplecov
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ~>
116
+ - !ruby/object:Gem::Version
117
+ version: '0.15'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ~>
123
+ - !ruby/object:Gem::Version
124
+ version: '0.15'
125
+ - !ruby/object:Gem::Dependency
126
+ name: coveralls
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ~>
130
+ - !ruby/object:Gem::Version
131
+ version: 0.7.0
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ~>
137
+ - !ruby/object:Gem::Version
138
+ version: 0.7.0
97
139
  description: Command line interface to profiling tools for iOS development
98
140
  email:
99
141
  - renzo.crisostomo@here.com
@@ -103,9 +145,14 @@ executables:
103
145
  extensions: []
104
146
  extra_rdoc_files: []
105
147
  files:
106
- - ".gitignore"
107
- - ".rspec"
108
- - ".travis.yml"
148
+ - .circleci/config.yml
149
+ - .circleci/images/Dockerfile
150
+ - .circleci/images/Finder.app
151
+ - .circleci/images/xcode-select
152
+ - .circleci/images/xcodebuild
153
+ - .coveralls.yml
154
+ - .gitignore
155
+ - .rspec
109
156
  - Gemfile
110
157
  - LICENSE.txt
111
158
  - README.md
@@ -115,15 +162,17 @@ files:
115
162
  - instrumentality.gemspec
116
163
  - lib/instrumentality.rb
117
164
  - lib/instrumentality/command.rb
118
- - lib/instrumentality/command/benchmark.rb
119
- - lib/instrumentality/command/custom.rb
120
- - lib/instrumentality/command/file_activity.rb
121
165
  - lib/instrumentality/command/generate_header.rb
166
+ - lib/instrumentality/command/profile.rb
167
+ - lib/instrumentality/command/profile/benchmark.rb
168
+ - lib/instrumentality/command/profile/custom.rb
169
+ - lib/instrumentality/command/profile/file_activity.rb
122
170
  - lib/instrumentality/constants.rb
123
171
  - lib/instrumentality/executor.rb
124
172
  - lib/instrumentality/finder.rb
125
173
  - lib/instrumentality/header_generator.rb
126
174
  - lib/instrumentality/headers/benchmark.d
175
+ - lib/instrumentality/logger.rb
127
176
  - lib/instrumentality/profiler.rb
128
177
  - lib/instrumentality/scripts/benchmark.d
129
178
  - lib/instrumentality/scripts/experimental_file_activity.d
@@ -140,19 +189,18 @@ require_paths:
140
189
  - lib
141
190
  required_ruby_version: !ruby/object:Gem::Requirement
142
191
  requirements:
143
- - - ">="
192
+ - - '>='
144
193
  - !ruby/object:Gem::Version
145
194
  version: '0'
146
195
  required_rubygems_version: !ruby/object:Gem::Requirement
147
196
  requirements:
148
- - - ">="
197
+ - - '>='
149
198
  - !ruby/object:Gem::Version
150
199
  version: '0'
151
200
  requirements: []
152
201
  rubyforge_project:
153
- rubygems_version: 2.4.5.2
202
+ rubygems_version: 2.0.14.1
154
203
  signing_key:
155
204
  specification_version: 4
156
205
  summary: Command line interface to profiling tools for iOS development
157
206
  test_files: []
158
- has_rdoc:
@@ -1,5 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.2.7
5
- before_install: gem install bundler -v 1.15.4
@@ -1,61 +0,0 @@
1
- require 'instrumentality/command'
2
- require 'instrumentality/finder'
3
- require 'instrumentality/profiler'
4
- require 'instrumentality/constants'
5
- require 'ostruct'
6
-
7
- module Instrumentality
8
- class Benchmark < Command
9
- def self.options
10
- [
11
- ['--workspace=path/to/name.xcworkspace', 'If not set, Instr will try to find one'],
12
- ['--project=path/to/name.xcodeproj', 'If not set and workspace search failed, Instr will try to find one'],
13
- ['--scheme=name', 'If not set, Instr will use the process name'],
14
- ['--server-port=port_number', 'If not set, Instr will use 8080'],
15
- ['--interactive', 'If set, Instr will not attempt to run an Xcode scheme, but instead attach DTrace directly'],
16
- ['--experimental', "Don't use it if you don't know what it does"],
17
- ].concat(super)
18
- end
19
-
20
- self.arguments = [
21
- CLAide::Argument.new("process", true),
22
- ]
23
-
24
- self.summary = <<-DESC
25
- Runs a benchmark against a specific iOS process. Requires static probes.
26
- DESC
27
-
28
- def initialize(argv)
29
- @process = argv.shift_argument
30
- @workspace = argv.option('workspace') || Finder.find_workspace
31
- @project = argv.option('project')
32
- @project ||= Finder.find_project if @workspace.nil?
33
- @scheme = argv.option('scheme') || @process
34
- @server_port = argv.option('server-port') || Constants::DEFAULT_SERVER_PORT
35
- @interactive = argv.flag?('interactive', false)
36
- @experimental = argv.flag?('experimental', false)
37
- super
38
- end
39
-
40
- def validate!
41
- super
42
-
43
- help! 'A process name is required' unless @process
44
- return if @interactive
45
- help! 'Xcode workspace or project files not found' if @workspace.nil? && @project.nil?
46
- end
47
-
48
- def run
49
- config = OpenStruct.new({'script' => Constants::BENCHMARK_SCRIPT,
50
- 'process' => @process,
51
- 'workspace' => @workspace,
52
- 'project' => @project,
53
- 'scheme' => @scheme,
54
- 'server_port' => @server_port,
55
- 'interactive' => @interactive,
56
- 'experimental' => @experimental})
57
- profiler = Profiler.new(config, @verbose)
58
- profiler.profile
59
- end
60
- end
61
- end
@@ -1,61 +0,0 @@
1
- require 'instrumentality/command'
2
- require 'instrumentality/finder'
3
- require 'instrumentality/profiler'
4
- require 'instrumentality/constants'
5
- require 'ostruct'
6
-
7
- module Instrumentality
8
- class FileActivity < Command
9
- def self.options
10
- [
11
- ['--workspace=path/to/name.xcworkspace', 'If not set, Instr will try to find one'],
12
- ['--project=path/to/name.xcodeproj', 'If not set and workspace search failed, Instr will try to find one'],
13
- ['--scheme=name', 'If not set, Instr will use the process name'],
14
- ['--server-port=port_number', 'If not set, Instr will use 8080'],
15
- ['--interactive', 'If set, Instr will not attempt to run an Xcode scheme, but instead attach DTrace directly'],
16
- ['--experimental', "Don't use it if you don't know what it does"],
17
- ].concat(super)
18
- end
19
-
20
- self.arguments = [
21
- CLAide::Argument.new("process", true),
22
- ]
23
-
24
- self.summary = <<-DESC
25
- Prints files read or write by a specific iOS process.
26
- DESC
27
-
28
- def initialize(argv)
29
- @process = argv.shift_argument
30
- @workspace = argv.option('workspace') || Finder.find_workspace
31
- @project = argv.option('project')
32
- @project ||= Finder.find_project if @workspace.nil?
33
- @scheme = argv.option('scheme') || @process
34
- @server_port = argv.option('server-port') || Constants::DEFAULT_SERVER_PORT
35
- @interactive = argv.flag?('interactive', false)
36
- @experimental = argv.flag?('experimental', false)
37
- super
38
- end
39
-
40
- def validate!
41
- super
42
-
43
- help! 'A process name is required' unless @process
44
- return if @interactive
45
- help! 'Xcode workspace or project files not found' if @workspace.nil? && @project.nil?
46
- end
47
-
48
- def run
49
- config = OpenStruct.new({'script' => Constants::FILE_ACTIVITY_SCRIPT,
50
- 'process' => @process,
51
- 'workspace' => @workspace,
52
- 'project' => @project,
53
- 'scheme' => @scheme,
54
- 'server_port' => @server_port,
55
- 'interactive' => @interactive,
56
- 'experimental' => @experimental})
57
- profiler = Profiler.new(config, @verbose)
58
- profiler.profile
59
- end
60
- end
61
- end