Re: [dtrace-discuss] Passing arguments to DTrace script

2008-11-06 Thread Chris Gerhard
There is another way. Let cpp handle the arguments:

#!/usr/sbin/dtrace -Cs

syscall:::entry {
#ifdef VERBOSE
printf("%s", probefunc);
#endif
@[probefunc] = count();
}

[EMAIL PROTECTED]:~/lang/d$ pfexec /usr/sbin/dtrace -Cs /tmp/cpp.d -n 'tick-1s 
{ exit(0) }'
dtrace: script '/tmp/cpp.d' matched 234 probes
dtrace: description 'tick-1s ' matched 1 probe
CPU IDFUNCTION:NAME
  0  69410 :tick-1s 

  close 1
  llseek1
  lseek 1
  mmap  1
  open641
  yield 1
  fstat64   2
  gtime 2
  statvfs   2
  sigaction 4
  lwp_sigmask   5
  setcontext5
  sysconfig 5
  brk   6
  setitimer10
  portfs   16
  clock_gettime21
  getpid   26
  p_online 34
  writev   50
  write60
  read 99
  lwp_park102
  pollsys 192
  ioctl   256
[EMAIL PROTECTED]:~/lang/d$ 
pfexec /usr/sbin/dtrace -Cs /tmp/cpp.d -D VERBOSE -n 'tick-1s { exit(0) }'
  0  69231pollsys:entry pollsys
  0  68915  write:entry write
  0  68913   read:entry read
  0  68913   read:entry read
  0  69007  ioctl:entry ioctl
  0  69231pollsys:entry pollsys
...
-- 
This message posted from opensolaris.org
___
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org


Re: [dtrace-discuss] truss "-fall" equivalent in DTrace

2008-11-06 Thread michael schuster
[EMAIL PROTECTED] wrote:
> What I mean to ask is will PID provider trace child processes forked by the 
> parent process? 

no. You need to trace fork/exec system calls (or similar events) and run a 
new script (or the same again ...) with appropriate arguments (ie pid).

HTH
Michael
-- 
Michael Schuster http://blogs.sun.com/recursion
Recursion, n.: see 'Recursion'
___
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org


Re: [dtrace-discuss] truss "-fall" equivalent in DTrace

2008-11-06 Thread [EMAIL PROTECTED]
What I mean to ask is will PID provider trace child processes forked by the 
parent process? 


--- On Wed, 11/5/08, Angelo Rajadurai <[EMAIL PROTECTED]> wrote:

> From: Angelo Rajadurai <[EMAIL PROTECTED]>
> Subject: Re: [dtrace-discuss] truss "-fall" equivalent in DTrace
> To: [EMAIL PROTECTED]
> Cc: dtrace-discuss@opensolaris.org
> Date: Wednesday, November 5, 2008, 2:52 PM
> Change $1 to $target!
> 
> (ie)
> 
> ./sample.d -c "a.out"
> pid$target::somefunctionname:entry
> {
>printf("%s is called by %d",probefunc, tid);
> }
> 
> In case you want to find the funcstions of a running
> process (say pid 1234)
> you have two options.
> 
> ./sample.d --p 1234
> pid$target::somefunctionname:entry
> {
>printf("%s is called by %d",probefunc, tid);
> }
> 
> or
> ./sample.d  1234
> pid$1::somefunctionname:entry
> {
>printf("%s is called by %d",probefunc, tid);
> }
> 
> 
> HTHs
> 
> Angelo
> 
> On Nov 5, 2008, at 5:21 AM, [EMAIL PROTECTED] wrote:
> 
> > I have an executable. When I attach a truss, we have
> to give $truss -o truss.out -fall ./a.out. It shows all
> system calls made by this program and all the child
> processes it forks.
> > 
> > Where as if I am using a DTrace script I am not able
> to do it.
> > 
> > ./sample.d -c "a.out"
> > pid$1::somefunctionname:entry
> > {
> >printf("%s is called by %d",probefunc,
> tid);
> > }
> > 
> > 
> > 
> > 
> > ___
> > dtrace-discuss mailing list
> > dtrace-discuss@opensolaris.org


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