其他分享
首页 > 其他分享> > Profile your program using GNU gprof

Profile your program using GNU gprof

作者:互联网

Profiling is an indispensable measure for analyzing and optimizing the performance of your program. A typical profiler like GNU gprof will complete this task by running your program after a special compilation.

There are 3 forms of the profiling analysis:

Compiler options for generating the code which can be profiled by gprof:

Options for gprof command

Steps for using gprof:

  1. Compile the program for gprof:

    g++ -std=gnu++11 -g -O2 -o output input.cpp -gp
  2. Run the program: ./output1. After execution, the profiling data will be stored in the file gmon.out.

  3. Call gprof command with the generated gmon file as argument to generate profiling reports.

标签:Profile,function,profiling,GNU,enable,gprof,source,program
来源: https://www.cnblogs.com/quantumman/p/14672800.html