Re: DTrace probe problem
Re: DTrace probe problem
- Subject: Re: DTrace probe problem
- From: "Michael Ash" <email@hidden>
- Date: Fri, 6 Jun 2008 11:13:29 +0800
On Fri, Jun 6, 2008 at 10:28 AM, radj <email@hidden> wrote:
> Hello again.
>
> I have another problem now and it is how to set off DTrace from within the
> application. This is my code:
>
> // SNIPPET START
>
> int pid = [[NSProcessInfo processInfo] processIdentifier];
>
> NSArray *arguments = [NSArray arrayWithObjects: @"-w", // permit destructive
> actions
> @"-o /tmp/DTraceLog", //
> output file
> @"-s /tmp/DTrace.d", //
> D script
These are not your immediate problem, but they will break next. These
arguments are incorrect. You're passing the flag plus the value as a
*single* argument. This is equivalent to quoting it in the shell. You
don't want that. Pass them as separate arguments. See:
http://www.cocoadev.com/index.pl?NSTaskArguments
> [NSNumber
> numberWithInt:pid], // feed in PID for macro $1
> nil];
>
> NSTask *task;
> task = [[NSTask alloc] init];
> [task setLaunchPath: @"/dev/dtrace"];
This won't work. /dev is for "devices", not "developer". /dev/dtrace
is a dtrace kernel device, *not* the dtrace binary. Use "which dtrace"
in the shell to find out the path to the dtrace executable.
Mike
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden