I've seen methods here for retrieving CPU and memory usage for the CURRENT process, i.e. 'my application', but I need to write a service that monitors the performance of a separate application.
In C++ I used PSAPI for this, but I'm new to C# and would like to use the managed framework if possible. Has anyone done this?
long memory;
Process[] notepads;
notepads = Process.GetProcessesByName("Notepad.exe");
memory = notepads[0].PrivateMemorySize64;
Console.WriteLine("Memory used: {0}.", memory);
more info here:
https://msdn.microsoft.com/en-us/library/s80a75e5(v=vs.90).aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With