Zend certified PHP/Magento developer

Windows: How do I measure network traffic per process?

I am developing a benchmarking tool on Windows that measures startup performance of a process. I have been recording total network traffic using Get-AdapterStatistics | ConvertTo-JSON powershell cmdlet and it gives me good data:

  1. Record current network stats (sum all bytes sent/receved for all adapters)
  2. Run my benchmark
  3. Record current network stats (sum all bytes sent/receved for all adapters), display the difference

This works fine and I see a strong (0.8) correlation between process startup time and bytes sent. What I don’t know is which processes send the data. How do I get this data?

What have I considered?

  1. Windows Resource Monitor – it samples network traffic by process but doesn’t save it anywhere
  2. Sysinternals Procmon – too low-level, also a GUI so a pain to work with
  3. Microsoft Network Monitor 3 – comes with nmcap.exe and could work but trouble is that it actually captures packets which is terribly inefficient
  4. Wireshark – has stats, but doesn’t understand processes

Ideally, I’d like a command-line tool on an API that can either give me total network bytes per process between time A and time B.

Suboptimal is throughput sampling similar to Resource Monitor, but again I need a command-line tool or an API, because I am automating this.

References: