[dtrace-discuss] self-> in BEGIN probe

Menno Lageman Menno.Lageman at Sun.COM
Wed Feb 14 02:30:16 PST 2007



----- Original Message -----
From: Robert Milkowski <rmilkowski at task.gda.pl>
Date: Wednesday, February 14, 2007 11:02 am
Subject: [dtrace-discuss] self-> in BEGIN probe
To: dtrace-discuss at opensolaris.org

> Hello dtrace-discuss,
> 
> 
> With a bug id
> 
> 6495013 Loops and recursion in metaslab_ff_alloc can kill
>        performance, even on a pool with lots of free data
> 
> There's associated D script below.
> 
> What's the point setting self->in_metaslab in a BEGIN probe?
> I'm not talking about setting it to 0 as this is not necessary but
> rather about self-> variables in BEGIN probe. I guess it has no
> rather about self-> predictable meaning, right?
> 

I think it is used as a forward declaration. The predicate on the first clause would cause the script not to run since slef->in_metaslab would be undefined at that point. The proper way to do the forward declaration would be something like:

#!/usr/sbin/dtrace -s

#pragma D option quiet

self int in_metaslab;

fbt::metaslab_ff_alloc:entry
/self->in_metaslab == 0/
{
         self->in_metaslab = 1;
         self->loopcount = 0;
}


More information about the dtrace-discuss mailing list