Search code examples
c++clangprofile

Does clang support "-fprofile-generate" and "-fprofile-use"?


I am using 3.5 and it doesn't seem to be in there... Am I missing something?

For example, with GCC I can compile a program like this:

gcc -fprofile-generate main.cpp

...then I run the program, and after it exits (gracefully) it will generate a set of files (extensions are .gcda I think). These files contain branching results that can be used to do profile-based optimization like this:

gcc -fprofile-use main.cpp

Is there a similar feature in Clang that I have overlooked?

Thanks!


Solution

  • Profiling with Instrumentation section of Clang manual mentions the flags -fprofile-instr-generate and -fprofile-instr-use with almost the same meaning.