I have an application of my own that increases the CPU usage of a process on Windows (in this case: audiodg.exe, which handles audio in 'some' way). I want to measure the overall CPU performance of this process over a minute or so.
It is possible to attach Visual Studio to this process (run as administrator and just do Attach to Process...), so I can view the CPU and memory performance. However, this isn't very useful. The process in constantly around 1-2% of the total CPU, so the graph doesn't give any interesting visual information. Moreover, I'm interested in an average over ~1 minute, which the Performance Profiler can't do (I think?).
What is the best way to get accurate average CPU performance data out of a Windows process? Are there any tools for this or API that can get me this data?
I think Visual Studio is not the best tool for that usage as it's very heavy on its own.
I would use Windows Performance Recorder where you can select what you want to record:
Then you start the logging, replicate the issue and then stop the recording. After that, you can open the log in Windows Performance Analyzer and try to understand why the issue is occurring.
Alternatively, you could take the process memory dump with ProcDump.exe when the CPU spikes above certain thresholds and then from the dump try to investigate the problem.