[profiler] Replace templates list with hardcoded lists.

This commit is contained in:
Eloy Durán
2013-11-01 14:34:56 +01:00
parent 40e9e8c2e1
commit 600f727117
2 changed files with 30 additions and 56 deletions

View File

@@ -179,6 +179,19 @@ task :static do
sh "/usr/bin/lipo -create #{libs.join(' ')} -output \"#{fat_lib}\""
end
IOS_SIM_INSTRUMENTS_TEMPLATES = [
'Allocations', 'Leaks', 'Activity Monitor',
'Zombies', 'Time Profiler', 'System Trace', 'Automation',
'File Activity', 'Core Data'
]
IOS_DEVICE_INSTRUMENTS_TEMPLATES = [
'Allocations', 'Leaks', 'Activity Monitor',
'Zombies', 'Time Profiler', 'System Trace', 'Automation',
'Energy Diagnostics', 'Network', 'System Usage', 'Core Animation',
'OpenGL ES Driver', 'OpenGL ES Analysis'
]
desc "Same as profile:simulator"
task :profile => ['profile:simulator']
@@ -196,26 +209,9 @@ namespace :profile do
namespace :simulator do
desc 'List all built-in iOS Simulator Instruments templates'
task :templates do
list = `/usr/bin/xcrun instruments -s 2>&1`.strip.split("\n").map do |line|
line.sub(/^\s+"/, '').sub(/",*$/, '')
end
instruments_path = File.expand_path('../Applications/Instruments.app/Contents', App.config.xcode_dir)
regexp = Regexp.new(Regexp.escape(File.join(instruments_path, 'Resources/templates')))
templates_for_all_platforms = list.grep(regexp)
# TODO figure out if there is a way to programatically determine these.
templates_for_ios_sim_platform = [
File.join(instruments_path, "PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate"),
File.join(App.config.xcode_dir, "Platforms/MacOSX.platform/Developer/Library/Instruments/PlugIns/CoreData/Core Data.tracetemplate"),
]
templates = templates_for_all_platforms + templates_for_ios_sim_platform
puts "Built-in templates:"
templates.each do |template|
puts "* #{File.basename(template, File.extname(template))}"
puts "Built-in iOS Simulator Instruments templates:"
IOS_SIM_INSTRUMENTS_TEMPLATES.each do |template|
puts "* #{template}"
end
end
end
@@ -240,25 +236,9 @@ namespace :profile do
namespace :device do
desc 'List all built-in iOS device Instruments templates'
task :templates do
list = `/usr/bin/xcrun instruments -s 2>&1`.strip.split("\n").map do |line|
line.sub(/^\s+"/, '').sub(/",*$/, '')
end
instruments_path = File.expand_path('../Applications/Instruments.app/Contents', App.config.xcode_dir)
regexp = Regexp.new(Regexp.escape(File.join(instruments_path, 'Resources/templates')))
templates_for_all_platforms = list.grep(regexp)
# TODO figure out if there is a way to programatically determine these.
templates_for_ios_sim_platform = [
File.join(instruments_path, "PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate"),
]
templates = templates_for_all_platforms + templates_for_ios_sim_platform
puts "Built-in templates:"
templates.each do |template|
puts "* #{File.basename(template, File.extname(template))}"
puts "Built-in iOS device Instruments templates:"
IOS_DEVICE_INSTRUMENTS_TEMPLATES.each do |template|
puts "* #{template}"
end
end
end

View File

@@ -95,6 +95,14 @@ task :static do
App.build('MacOSX', :static => true)
end
OSX_INSTRUMENTS_TEMPLATES = [
'Allocations', 'Leaks', 'Zombies',
'GC Monitor', 'Activity Monitor', 'Time Profiler', 'Multicore',
'Dispatch', 'System Trace', 'Event Profiler', 'Counters',
'File Activity', 'Core Data', 'UI Recorder', 'Sudden Termination',
'Cocoa Layout'
]
namespace :profile do
%w{ development release }.each do |mode|
desc "Run a #{mode} build through Instruments"
@@ -106,23 +114,9 @@ namespace :profile do
desc 'List all built-in OS X Instruments templates'
task :templates do
list = `/usr/bin/xcrun instruments -s 2>&1`.strip.split("\n").map do |line|
line.sub(/^\s+"/, '').sub(/",*$/, '')
end
instruments_path = File.expand_path('../Applications/Instruments.app/Contents', App.config.xcode_dir)
regexp = Regexp.new(Regexp.escape(File.join(instruments_path, 'Resources/templates')))
templates_for_all_platforms = list.grep(regexp)
regexp = Regexp.new(Regexp.escape(File.join(App.config.xcode_dir, 'Platforms/MacOSX.platform/Developer/Library/Instruments/PlugIns')))
templates_for_osx_platform = list.grep(regexp)
templates = templates_for_all_platforms + templates_for_osx_platform
puts "Built-in templates:"
templates.each do |template|
puts "* #{File.basename(template, File.extname(template))}"
puts "Built-in OS X Instruments templates:"
OSX_INSTRUMENTS_TEMPLATES.each do |template|
puts "* #{template}"
end
end
end