Is there a command, utility, or Cocoa API for monitoring bandwidth usage, per process? [closed]

Original question: 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?

@note As this question has a LARGE number of hits, yet was closed before it could be answered properly, let me rephrase it (hopefully more palatably) so that it can get answered / canonicalized, once and for all!

So then.. Is there an officially sanctioned / system-installed (i.e. nettop, Activity-Monitor.app), third-party (i.e. brew-able), or Objecive-C API to track, or otherwise stat the specific bandwidth usage totals, per running process? Ideally this would be a programatically-accessible resource, i.e. through a library call, XPC helper, or a readable output stream.

Get how many bytes received/sent by given process in OS X programatically? [duplicate]

This question already has an answer here: Is there a command, utility, or Cocoa API for monitoring bandwidth usage, per process? [closed] 4 answers How to get how many bytes received and sent b

Android — How to track bandwidth usage by application or process?

I can track the overall bandwidth usage of Android device. I wanted to know if there is any method or way, maybe an API or class, that can help me track my bandwidth usage per application or process?

Programmatic resource monitoring per process in Linux

I want to know if there is an efficient solution to monitor a process resource consumption (cpu, memory, network bandwidth) in Linux. I want to write a daemon in C++ that does this monitoring for some

cpu usage per process?

How can I grab the percentage of cpu usage on a per process basis? So, for example, I’d like to run my program prog and get the cpu usage it incurred in, for example: prog name cpu0 cpu1 cpu2 cpu3 to

Android — How to track bandwidth usage by a process?

I can track the overall and per uid (application) bandwidth usage of Android device by android.net.TrafficStats. However a uid can execute more than one binaries to invoke more than one processes. I w

Setting maximum CPU usage per process in Windows [closed]

Is there a way to set the maximum CPU usage for a process in Windows 7?

Monitoring Bandwidth on your server [closed]

I use to be on a shared host and I could use there standard tools to look at bandwidth graph. I now have my sites running on a dedicated server and I have no idea whats going on 😛 sigh I have install

How to get the accurate CPU Usage per process and process Idle CPU Time

I’hv been struggling to get the accurate CPU Usage per process and process Idle CPU Time.. I tried top command proc/[pid]/stat folder but still trying my luck.. TOP command gives CPU usage for all

Bandwidth utility using javascript

IS there any utility to measure bandwidth from my server to the client or any standard APIS.Need this for web application

Monitor bandwidth, memory, cpu per domain on EC2 [closed]

What is the best solution in python, to monitor CPU, memory, and bandwidth usage per domain? This solution has to also work on multiple instances.

Answers

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

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.

Install macports and then run

sudo port install iftop

which will install iftop. Now run

sudo iftop