Proof of concept to use dtrace on rubymotion. Check the demo at You Tube.
gem install motion-dtrace
You also need to install gnu-grep since grep used on mac is no more compatible !
brew install grep
Edit the Rakefile of your RubyMotion project and add the following require line.
require 'rubygems'
require 'motion-dtrace'
Start simulator process:
rake
On another terminal, start dtrace:
rake dtrace
When you terminate the app, you get a trace similar to following:
CLASS#METHOD TOTAL TIME µsec
--------------------------------------------------------------------------------
CGPoint#y=: 3
String#nil? 3
Array#last 4
CGRect#origin 4
Evernote::Note#title 4
Hash#empty? 4
........
Class#all: 19867
UIImage#thumbnail 24226
DTWebArchive#thumbnail 24415
ClipItem#thumbnail 24451
__NSArrayM#each 24717
ClipperTableViewCell#item=: 25143
You may specify your own dtrace file via:
rake dtrace DTRACE=/Users/siuying/Documents/workspace/motion/motion-dtrace/dtrace/methods_duration.d
Currently this gem is just a hack to simplify command lines.
We shall investigate can we do real integration with project.