Sha256: e7ba9bd8b690632018ac16e243b4bffc55caf4346120d2e456cc6c3797aa662a

Contents?: true

Size: 499 Bytes

Versions: 1

Compression:

Stored size: 499 Bytes

Contents

desc "Run dtrace on Simulator process"
task :dtrace do
  trace_file = ENV['DTRACE'] || File.expand_path(File.join(File.dirname(__FILE__), "/../dtrace/time.d"))  
  trace_pid  = `ps ax | grep -P 'iPhone Simulator/[0-9\.]+/Applications/[^/]+/[^/]+\.app' | awk '{print $1}'`
  command    = "sudo dtrace -qs #{trace_file} -p #{trace_pid}"
  puts "#{command}"
  pid = fork { exec command }

  Signal.trap("HUP") do
    Process.kill("HUP", pid)
    Process.wait(pid)
    exit
  end
  Process.wait(pid)
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
motion-dtrace-0.1.1 lib/motion-dtrace.rb