[dtrace-discuss] can i use if/else/for/while in dtrace script?

Chip Bennett cbennett at laurustech.com
Wed Jun 4 10:07:27 PDT 2008


> > The reason for no looping is ... loop became long, or even worse,
> > infinite, your system would be hosed.
> >
> > The reason for no if/else construct is because each probe clause must
> > produce a fixed length trace record.
> 
> I always thought that it's deliberate way of torturing us, the users :)
> 

Amen to that!  Am I an experienced user of DTrace who understands why we don't need flow control, or am I a lemming rationalizing what I've been taught to live with?  To quote the USENIX paper (http://www.sun.com/bigadmin/content/dtrace/dtrace_usenix.pdf), "To prevent DIF from inducing an infinite loop in probe context, only forward branches are permitted. This safety provision may seem draconian — it eliminates loops altogether — but in practice we have not discovered it to present a serious limitation."

But this is now becoming philosophical.  ;-)

Chip


More information about the dtrace-discuss mailing list