Which has been the most reliable, fastest Windows C++ profiler that you have used?

前端 未结 7 1142
不知归路
不知归路 2020-12-31 19:28

I need to profile a real time C++ app on Windows. Most of the available profilers are either terribly expensive, total overkill, or both. I don\'t need any .NET stuff. Since

7条回答
  •  醉话见心
    2020-12-31 20:09

    When I have to profile realtime code, I think the only solution is something hand-rolled. You don't want too much coverage or you end up slowing the code down, but with a small data set, you need to be very focused, essentially picking each point by hand.

    So I wrote a header file several years ago that defines some macros and a mechanism for capturing data, either as function timings or as a timeline (at time T in function X). The code uses QueryPerformanceCounter for the timings and writes the data into named shared memory via CreateFileMapping so that I can look at the timing data from another process live.

    It takes a recompile to change what timing information I want to capture, but the code is so inexpensive that It has virtually no effect on the code.

    All of the code is in the header file, (with macro guards so the code only gets included once). so the header file itself is my 'profiler'. I change some tables in the header, then and markup the target code, recompile and start profiling.

提交回复
热议问题