Here's my complete Mac solution. It misses the dynamic linking phase, I'm afraid, which is not something that 'dtrace -c ...' was doing. It does allow apps to run in their native environment, though, as opposed to as root.

I can launch it like this, for example, to stop once my USDT probe is fired in the Firefox main().

./d firefox-bin startup.d stop-main.d

or to figure out the time spent by Firefox on the CPU during the first 10s of startup:

./d firefox-bin cpu.d stop-10s.d

d:

#!/bin/bash

progname=$1
shift

scripts="-s sigcont.d"

for i in $*; do scripts="$scripts -s $i"; done

opts="-Zqw -x dynvarsize=64m -x evaltime=exec"

dtrace='

inline string progname="'$progname'";
inline string scripts="'$scripts'";
inline string opts="'$opts'";

proc:::exec-success
/execname == progname/
{
  stop();
  printf("dtrace %s -p %d %s\n", opts, pid, scripts);
  system("dtrace %s -p %d %s\n", opts, pid, scripts);
  exit(0);
}
'

sync && purge && dtrace $opts -n "$dtrace"
---

sigcont.d:

BEGIN
{
  printf("kill -CONT %d\n", $target);
  system("kill -CONT %d\n", $target);
}
---

All the scripts are up on Github [1] and I love building these chains of "lego blocks" in different permutations.

[1] http://github.com/wagerlabs/firefox-startup/tree/master

---
fastest mac firefox!
http://wagerlabs.com




_______________________________________________
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org

Reply via email to