I don't think this is usually an issue because (with the exception of apache 
using prefork) there are n't that many multi-process apps out there. Everything 
is multi-threaded.

Here is an example that will trace all libc method entries in a process and 
it's children. 

Execute with: ./follow.d -p PID or ./follow.d -c CMD

*** START: follow.d ****

#!/usr/sbin/dtrace -s

#pragma D option destructive
#pragma D option quiet
#pragma D option switchrate=10

proc:::start
/progenyof($target)/
{
        printf("New process %d created, a progeny of %d\n", pid, $target);
        stop();
        printf("Stopped %d to allow for tracing to be enabled\n", pid);
        system("./tracepid.d -p %d", pid);
}

pid$target:libc.so.1::entry {
        printf("%s:%s:%s:%s\n", probeprov, probemod, probefunc, probename);
}

syscall::rexit:entry
/pid == $target/
{
        exit(0);
}

*** END: follow.d ****

*** START: tracepid.d ****

!/usr/sbin/dtrace -s

#pragma D option destructive
#pragma D option quiet
#pragma D option switchrate=10

BEGIN
{
        printf("Resuming %d\n", $target);
}

pid$target:libc.so.1::entry {
        printf("%s:%s:%s:%s\n", probeprov, probemod, probefunc, probename);
}

syscall::rexit:entry
/pid == $target/
{
        exit(0);
}

*** END: tracepid.d ****

It would be nice if there was a way to dynamically enable the pid provider for 
an unknown pid but I haven't seen any way to do it yet. Without this ability 
there would be no way to aggregate userspace method completion times in a 
process and all it's dynamically created children.


--
This message posted from opensolaris.org
_______________________________________________
dtrace-discuss mailing list
[email protected]

Reply via email to