I searched for a long time in Objective-C on how I could retrieve some stats for bytes in/out of macOS network interface and haven't found anything.
I thought about using command line, and find an OS stats on socket (maybe in sysctl) which I could use to make some math, but haven't found. I tried to grep on nettop, but the way it's done in CLI is impossible to grep.
I just found 2 apps on AppStore which does't exactly this, showing bandwidth used in real time: https://itunes.apple.com/us/app/network-scanner/id1103147103?l=en&mt=12 https://itunes.apple.com/us/app/network-inspector/id515794671?l=en&mt=12
I tried to use Activity Monitor and sample process to understand the call they do without success.
Any idea on how those two apps retrieve number of bytes in/out of network interface?