0

I'm trying to get cpu, ram and network usage (like bytes sent per second or total bytes/s) of certain services.

I can get cpu counter like this:

PerformanceCounterCategory processCategory = PerformanceCounterCategory.GetCategories().FirstOrDefault(x => x.CategoryName == "Process");
var counter = processCategory.GetCounters(serviceName).FirstOrDefault(x => x.CounterName == "% Processor Time");

From this counter i can get the cpu usage. I can do the same thing for memory.

How to do the same for the network? If i can't do it in similar way, how should I do it instead?

PawZaw
  • 1,033
  • 7
  • 15
  • There are [Network Related Performance Counters](https://learn.microsoft.com/en-us/windows-server/networking/technologies/network-subsystem/net-sub-performance-counters), but I am not sure if you break them down to a process ... – Fildor Oct 12 '20 at 11:17
  • Does this answer your question? [Retrieve process network usage](https://stackoverflow.com/questions/17026204/retrieve-process-network-usage) – kshkarin Oct 12 '20 at 11:35
  • @Fildor I tried them, but only could get the usage of network cards (wifi and ethernet) – PawZaw Oct 12 '20 at 12:53
  • @kshkarin i'll try it, but it doesn't look like it fits my needs. I need to monitor other proccesses, not the one I'm in, – PawZaw Oct 16 '20 at 06:54

0 Answers0