Could you please recommend a C++ performance profiler for Windows 64-bit that can attach to a running process and collect stack traces? The profiled program is massively-multithreaded: thousands of threads that are mostly waiting for network activity. Some tools do not work with my program because my program throws exceptions.
Since you do not have many requirements, I suggest starting with Windows Performance Toolkit (WPT). WPT is not available as a standalone tool. It is part of the Windows Assessment and Deployment Kit (WADK).
WPT is not a single tool. It's made of two parts: Windows Performance Recorder (WPR) and Windows Performance Analyzer (WPA).
By default, the recorder (WPR) will capture the activity of the whole system (that's ~2800 threads here currently) without any issues.
And here's an example of what a stack analysis looks like for the Windows Compatibility Telemetry process, done with WPA after recording:
The blue highlighting in the CPU graph corresponds to the selection of MSXML6 calling SchemaCache::validate(). You can see how many times it was called and how many milliseconds were spent there.
Windows Performance Toolkit
- is made by Microsoft and works on Windows
- can analyze C++ or any language that compiles to x86 code. It's not so good for stuff that compiles to intermediate languages (IL) such as C# or Java.
- is gratis (free of cost, but not open source)
- is capable of analyzing 2000+ threads
- does not care about exceptions in your program (when your program crashes, you'll still have the data up to that point)