News, tips, partners, and perspectives for the Oracle Solaris operating system

A D Script for Observing the Network

Guest Author

A little gem included with the Crossbow Virtual Wire Demo Tool is a DTrace script and associated Chime display written by Crossbow engineer Kais Belgaied. I've augmented the script a bit by adding an END clause to format the output, which shows the number of bits transferred over the period of time the script is run:

bleonard@opensolaris:~$ dtrace -s vWireBuilder/VWire/so.d 
Tracing... Hit Ctrl-C to end.
Process Zone Protocol Destination Port Bits
pidgin global TCP 5050 296
firefox-bin global TCP 443 13968
Trace ran for 29 seconds

The associated Chime display is useful when you want to monitor a system with lots of network traffic. In this example I'm using Netperf to simulate traffic between my global zone and a local zone, which has been configured to run at IP address

In this example you can see we're achieving a throughput of 932,708,352 bits per second, or approximately 933 megabits per second. In my case the local zone is configured using a Crossbow VNIC, myzone0:

bleonard@opensolaris:~$ dladm show-vnic
myzone0 e1000g0 1000 2:8:20:59:0:b5 random 0

Notice the link speed of myzone0 is 1000 megabits per second, and at the moment it's using just about every bit of that bandwitdh, potentially starving other virtual NICs and the physical NIC itself from the network. Fortunately, Crossbow allows me to put some reigns on my virtual NICs. For example, if I do the following:

pfexec dladm set-linkprop -p maxbw=200 myzone0

Above we can see we're now running just under 200 megabits per second. Or More ridiculously:

pfexec dladm set-linkprop -p maxbw=2 myzone0

We're now under 2 megabits per second.

Now it is also possible to drill down on the Chime display, graphing throughput over time. The above scenario looks like so:

If you want to check this out on your own environment, you only need the D script, Chime and the Network display:

Note, you'll have to edit the programFileName property of Network.xml to the location you saved the D script:
 <void property="programFileName">

To launch the Chime display:

chime -C ./Network.xml

Join the discussion

Comments ( 5 )
  • gerard Wednesday, November 11, 2009


    tested on solaris 10, it fails:

    dtrace: failed to compile script ./so.d: line 27: undefined function name: inet_ntoa

    is there a chance to have it working on solaris 10?


  • Espen Martinsen Friday, November 13, 2009


    This would be a great tool if I could get it working.

    Im running snv_126, with dtrace API 1.6.2

    I'm getting the followin error:

    dtrace: failed to compile script ./so.d: line 20: operator -> must be applied to a pointer

    line 20 looks like this:

    self->uio_resid = self->uio->uio_resid;

  • Brian Leonard Friday, November 13, 2009

    Hi Espen,

    The script runs fine for me on snv_126. Are you running SXCE? That could be our difference (although I can't imagine why that would matter).


  • Espen Martinsen Friday, November 13, 2009

    Hi again,

    no, I'm running "indiana". I'll have to investigate my environment, cause I just tried it on SXCE on a sparc, and there it worked fine.


  • rick jones Tuesday, November 17, 2009

    As there is more to networking than just bits per second, it might be worthwhile having a variation on the theme that can do packets per second.

Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.