I'm trying to profile with perf
on Ubuntu 20.04, but the problem is that many functions do not appear in it (likely because they are inlined), or only their addresses appear (without names etc.). I'm using CMake's RelWithDebInfo
build. But there are some template functions that I don't know how to bring to the profiler results. I think marking them noinline
may help if this is legal in C for template functions, but this screws up the codebase and needs to be done per-function. Any suggestions how to make all functions noinline
at once?
CodePudding user response:
You could add -fno-inline
to CMAKE_CXX_FLAGS
.
From GCC man page:
-fno-inline Do not expand any functions inline apart from those marked with the "always_inline" attribute. This is the default when not optimizing. Single functions can be exempted from inlining by marking them with the "noinline" attribute.