Has anyone every called dtrace in a perl script? I don't care about 
instrumenting perl at all. What I want to do is make a script that calls a 
dtrace script, does a bunch of things, kills dtrace and returns.  Right now I'm 
trying to fork and call dtrace. However, when I try to send SIGINT to the child 
it doesn't kill dtrace... Any ideas? I think dtrace may not even be fully 
started before SIGINT is called, but I'm not sure how to coordinate the two.

Here's my code:


#!/usr/bin/perl

print "Welcome to the script\n";

my $pid = fork();

if(not defined $pid){

        #fork failed
        print 'Fork failed on resources :(\n';

}elsif ($pid==0) {

        #In child process

        print "Starting DTrace\n";
        exec("dtrace -s pageTrace.d > traceOut.txt");
        print "DTrace finished\n";

} else {

        #In parent process

        print "do work\n";

        #Stop the DTrace process
        kill('SIGINT',$pid);


}

#Done
print "Script finished\n";


Thanks!


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

Reply via email to