I’m running a test that launches two processes, using C#. I need to get the top memory and CPU used by my process. How can I do it using managed code? (I also run it on Linux using Mono).
The architecture is the following: the process test.exe launches two processes: A.exe and B.exe. I need to measure max memory and CPU for processes A and B, from test.exe
Is it possible to do?
You can use the
System.Diagnostics.Processclass to start the process. You can then check theUserProcessorTime,TotalProcessorTime,PeakWorkingSet64and other properties to check processor usage and memory usage. Check this MSDN Article for System.Diagnostics.Process.