我正在尝试perf
在 Ubuntu 20.04 上进行分析,但问题是其中没有出现许多函数(可能是因为它们是内联的),或者只出现了它们的地址(没有名称等)。我正在使用 CMake 的RelWithDebInfo
构建。但是有一些模板函数我不知道如何将它们带到分析器结果中。我认为noinline
如果这在 C++ 中对于模板函数是合法的,那么标记它们可能会有所帮助,但这会破坏代码库并且需要按函数完成。有什么建议可以noinline
一次完成所有功能吗?
问问题
67 次
1 回答
3
您可以添加-fno-inline
到CMAKE_CXX_FLAGS
.
从GCC 手册页:
-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.
于 2021-12-03T11:53:36.150 回答