Hi Joachim,

You can't use variables, but you can use parameters from the command-line:

---8<--- arg.d ---8<---

#!/usr/sbin/dtrace -s

pid$target::$1:entry
{
        @[$$1] = count();
}

---8<--- arg.d ---8<---

# ./arg.d -p `pgrep -n firefox` malloc
dtrace: script './arg.d' matched 4 probes
^C
  malloc                                                        50262

Adam

On Tue, Aug 19, 2008 at 04:59:31PM +0200, Joachim Worringen wrote:
> Greetings,
> 
> is there a way to specify probes and other dtrace operations via command 
> line parameters, like
> "
> 
> BEGIN
> {
>      usr_exec=$$1;
>      usr_syscall=$$2;
> }
> 
> syscall::usr_syscall:entry
> /execname == usr_exec && guard++ == 0/
> {
> ...
> "
> [this does not work]
> 
> This would make it possible to create "generic" dtrace scripts.
> 
> Otherwise, some shellscript with sed-magic would need to be used.
> 
>   thanks Joachim
> 
> -- 
> Joachim Worringen, Software Architect, Dolphin Interconnect Solutions
> phone ++49/(0)228/324 08 17 - http://www.dolphinics.com
> _______________________________________________
> dtrace-discuss mailing list
> [email protected]

-- 
Adam Leventhal, Fishworks                     http://blogs.sun.com/ahl
_______________________________________________
dtrace-discuss mailing list
[email protected]

Reply via email to