[dtrace-discuss] [networking-discuss] Re: DTrace Network Providers, take 2

Adam Leventhal ahl at eng.sun.com
Tue Jul 3 23:59:56 PDT 2007


On Tue, Jul 03, 2007 at 08:41:26PM -0700, Darren.Reed at Sun.COM wrote:
> When it is possible to write a dtrace script that use a probe named
> "ip4-physical-out-end" and there is no requirement for me to know
> about fbt, all will be good.

That's only a reasonable goal if we expect customers to gather actionable
data from probe points of that nature. If such a probe's only consumer were
a developer of the IP stack, well, fbt is really the right tool.

> The use of "?" in D to achieve "if-else" assignments is not obvious at first
> and the lack of "if-else" is the biggest obstacle I run into with D.

Was the ?: operator unfamiliar to you? We chose to implement that -- obviously
-- because it was used in C (and all C-derivates I know of). Perhaps you
should add an entry to the wiki for people unfamilar with the construct.

> >	fbt::hook_run:entry
> >	{
> >		self->info = (hook_pkt_event_t *)arg1;
> >	}
> >
> >	fbt::hook_run:return
> >	/self->info/
> >	{
> >		this->mp = arg1 != 0 ? NULL : (uint64_t)*self->info->hpe_mp;
> >		printf("mp: %x", this->mp);
> >		self->info = 0;
> >	}
> >
> >The above shows the value of mp after FW_HOOKS(), and accounts for both
> >hook_run() and FW_HOOKS() itself changing mp.
> 
> But it requires me to use 2 probes, not 1, and in a more complex
> method than simply doing:
> 
> dtrace -n 'sdt:::ip4-physical-out-end{printf("mp: %x", this->mp);}'
> 
> People able to put it all on one command line has its advantages ;)

The point of SDT is not to make it easier to fit your D program in 80
columns, and the script that Brendan quoted is the kind of thing that
users of DTrace do on the command line all the time. The fbt provider
has an important place in the pantheon of DTrace providers and is not
meant to be obviated by SDT. Rather SDT is meant to expose points of
semantic relevance and stability.

> I'd also reject the assertion that using SDT probes implies that
> someone is "working on code."

Well, as implemented the stability is private so I'm not sure how a
constomer could reasonably be expected to use or rely on the probes.

Adam

-- 
Adam Leventhal, Solaris Kernel Development       http://blogs.sun.com/ahl


More information about the dtrace-discuss mailing list