From 600f727117126f80ddc2d109e69374c2fe4eb043 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Fri, 1 Nov 2013 14:34:56 +0100 Subject: [PATCH] [profiler] Replace templates list with hardcoded lists. --- lib/motion/project/template/ios.rb | 58 ++++++++++-------------------- lib/motion/project/template/osx.rb | 28 ++++++--------- 2 files changed, 30 insertions(+), 56 deletions(-) diff --git a/lib/motion/project/template/ios.rb b/lib/motion/project/template/ios.rb index af715a16..348c171a 100644 --- a/lib/motion/project/template/ios.rb +++ b/lib/motion/project/template/ios.rb @@ -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 diff --git a/lib/motion/project/template/osx.rb b/lib/motion/project/template/osx.rb index 2ae8ba14..74bb771f 100644 --- a/lib/motion/project/template/osx.rb +++ b/lib/motion/project/template/osx.rb @@ -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