Saturday, February 12, 2011

Finding per-process bandwidth usage on the mac?

On the PC there are several programs that will show you your bandwidth usage on a per process or per program basis. Is there anyway of doing something similar on the Mac?

  • Little Snitch

  • Out of the box, OS X will give you data totals with netstat

    $ netstat -a
    Proto Recv-Q Send-Q  Local Address          Foreign Address        (state)
    tcp4       0      0  192.168.1.113.62913    blah.http              ESTABLISHED
    tcp4  199610      0  192.168.1.113.61334    blah                   ESTABLISHED
    
    Alnitak : that's not right - that Recv-Q column only tells you how much data has been received by the kernel and _not yet_ read by the application. It's not a running total
    From Purfideas
  • In addition to LittleSnitch (which I love for other reasons), there is a more UNIX-like way to monitor network traffic: ntop.

    ntop has the advantage of being portable to other UNIX systems.

    You'll need to download and install gdbm. A note about the gdbm install, you'll want to edit the Makefile and set the user and group, the package default of bin doesn't exist on macosx.

    I actually went to compile ntop on my mac, and found to my disgust that they expanded the basic app out into a pseudo network monitoring application... thereby requiring a lot of crap that I don't want ;( Not a very UNIX thing to do.

    Alnitak : I don't think ntop does the job either, it's just a glorified tcpdump and can't account for packets on a per-process basis.
    From ceretullis
  • Install macports and then run

    sudo port install iftop

    which will install iftop. Now run

    sudo iftop

    Alnitak : iftop doesn't measure per-process bandwidth, it measures bandwidth between pairs of hosts
    From ob

0 comments:

Post a Comment