Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Aug 2013 11:50:29 -0700
From:      hiren panchasara <hiren.panchasara@gmail.com>
To:        George Neville-Neil <gnn@freebsd.org>
Cc:        "freebsd-net@freebsd.org" <freebsd-net@freebsd.org>, freebsd-dtrace@freebsd.org
Subject:   Re: DTrace network providers
Message-ID:  <CALCpEUFiAVe6Yj7Tqpzm-09G2Zn0POukF6_P7NHZbL8uGcvOQw@mail.gmail.com>
In-Reply-To: <CALCpEUEZYLs0D3ufW4mKRybqgGKcX98%2BVGbnWWRHnRVRo0XDmQ@mail.gmail.com>
References:  <20130821045926.GA17196@raichu> <5CA94104-0489-4DD2-8EC2-D42FF7339E39@freebsd.org> <CALCpEUEZYLs0D3ufW4mKRybqgGKcX98%2BVGbnWWRHnRVRo0XDmQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Aug 22, 2013 at 10:25 AM, hiren panchasara <
hiren.panchasara@gmail.com> wrote:

>
>
>
> On Thu, Aug 22, 2013 at 8:36 AM, George Neville-Neil <gnn@freebsd.org>wrote:
>
>>
>> On Aug 21, 2013, at 1:00 , Mark Johnston <markj@freebsd.org> wrote:
>>
>> > Hello!
>> >
>> > I've ported the ip, tcp and udp DTrace providers to FreeBSD, following
>> > the Solaris documentation here:
>> >
>> > https://wikis.oracle.com/display/DTrace/ip+Provider
>> > https://wikis.oracle.com/display/DTrace/tcp+Provider
>> > https://wikis.oracle.com/display/DTrace/udp+Provider
>> >
>> > My implementation of these providers makes use of dynamic translators,
>> > for which FreeBSD support was added in r254468; this patch won't compile
>> > with earlier revisions. The use of dynamic translators means that
>> > existing DTrace scripts which use these providers will just work when
>> run
>> > on FreeBSD - no modifications needed. In particular, all of the examples
>> > in the links above will work properly on FreeBSD with my diff.
>> >
>> > I've collected a bunch of example scripts for these providers and placed
>> > them here:
>> >
>> > http://people.freebsd.org/~markj/dtrace/network-providers/
>> >
>> > To run one you just need to execute "dtrace -s <script>".
>> >
>> > In general these providers make it trivial to monitor or count packets
>> > and bytes on a per-host/port/protocol/interface basis. One can also do
>> > neat things like watch TCP connection state transitions in real time
>> > (tcpstate.d) and measure connection latency. All of the probes
>> > correspond to logical events in their respective protocol
>> > implementations; all of the providers have send and receive probes, and
>> > the tcp provider has a few more.
>> >
>> > I didn't have to make any major changes to add support for these
>> > providers, but I've made a few small tweaks:
>> >
>> > 1. Add a little helper function for TCP state changes instead of
>> >   sprinkling a bunch of SDT_PROBE calls throughout the code.
>> > 2. Set the IPv6 payload size in TCP and UDP before calling ip6_output().
>> >   This is done for the send probes so that the ipinfo_t argument
>> >   can be used to get the payload size. It's not quite correct since it
>> >   doesn't include the length of IPv6 option headers (they aren't known
>> >   yet), but I think that's ok for the purposes of these providers.
>> > 3. Set the IPv4 header version in udp_output(). This is already done for
>> >   IPv6.
>> >
>> > I'm hoping that none of this (or the rest of the diff) is controversial,
>> > but I wanted to make sure, so any review would be really appreciated.
>> >
>> > The patch is here:
>> >
>> >
>> http://people.freebsd.org/~markj/patches/network-providers/network-providers-1.diff
>> >
>> > It depends on r254468. To use it, just recompile the kernel (assuming
>> > that KDTRACE_HOOKS is enabled) and copy
>> > $SRC/cddl/lib/libdtrace/{ip,tcp,udp}.d (added by the patch) to
>> > /usr/lib/dtrace. Then the example scripts I linked above should just
>> > work.
>> >
>>
>> Excellent work.  I'll test these today.
>>
>
> +1. Great work.
>
> Updating my laptop right now to test.
>

Tried a bunch of basic things and it works great!

Thanks again.
Hiren

>
> cheers,
> Hiren
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CALCpEUFiAVe6Yj7Tqpzm-09G2Zn0POukF6_P7NHZbL8uGcvOQw>