Profiling c++ on mac os x

后端 未结 3 865
终归单人心
终归单人心 2020-12-22 16:11

I\'m attempting to profile some c++ code on my mac (os x Lion) and I haven\'t been able to find anything useful. I\'m looking for a profiler that will tell me what functions

3条回答
  •  一生所求
    2020-12-22 16:44

    Instruments really is the right answer, but if you can't figure out how to use it then another option is the profiler in the built-in Activity Monitor application. In Activity Monitor you can get info on any running process and there's a button to sample its execution for a while. You'll have to start your program, switch to Activity Monitor, find the process, and then sample it.

    Additionally you can do 'poor man's profiling' simply by running the program in a debugger and pausing it manually half a dozen times or so and noting the call stack at those times. It's very simple but it works surprisingly well as a first pass for a significant fraction of programs.

    There is also a command line sample program which samples the callstack like the others do.

提交回复
热议问题