Alternatives to nettop for Monitoring Process Network Usage on macOS

Hi everyone,

I am developing an application for macOS and need to monitor the network usage (bytes sent and received) of specific processes. Previously, I used the nettop command to achieve this, but I found that it leads to high CPU usage, often reaching 95%.

I'm looking for alternative methods to obtain the network usage information of processes. This could be through a different command or an available macOS API. Any suggestions or guidance on more efficient ways to gather this data would be greatly appreciated.

Thank you!

Sorry I didn’t reply earlier; I’m not sure why I missed this when it was first posted back in June.

On the API front, I cover that in the Network Interface Statistics post that’s linked to by Extra-ordinary Networking.

On the tools front, nettop is the obvious choice here. Still, that CPU usage is a concern. Did you file a bug about that already? If so, what was the bug number?

The other tool I reach for is Instruments. Remember that it’s not just a GUI; it has a command-line tool interface as well. See xctrace man page for the details.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Alternatives to nettop for Monitoring Process Network Usage on macOS
 
 
Q