性能分析方法
Profile分析方法
定时采样 获取Stack Frame
gperftools CPUPROFILER实现分析
不支持Windows 支持目前主流的UNIX
1 |
libunwind
1 | struct sigaction sa; |
1 | CpuProfiler CpuProfiler::instance_; |
静态初始化 模块载入时进入构造函数
win32支持仅限于内存
http://gaiacrtn.free.fr/articles/win32perftools.htmlfastallocator
https://github.com/kasicass/gperftools-win32heap-profiler
编译器指令插入Profile
MSVC /Gh /GH
GCC/Clang -finstrument-functions
https://github.com/botman99/AeonProfiler
The Aeon profiler works by using the Microsoft Visual Studio compiler options /Gh and /GH to insert hooks to external functions _penter() and _pexit() (respectively).
https://github.com/tyoma/micro-profiler
(Linux) Build the application with -finstrument-functions flag on. Link with micro-profiler_
(Windows, MSVC) Build the application with /GH /Gh flags on. Link with micro-profiler_
外部采样 Debug权限
windows CPU profiler
https://github.com/VerySleepy/verysleepy
Very Sleepy, a sampling CPU profiler for Windows –> dbghelp
LookupPrivilegeValue( NULL, SE_DEBUG_NAME, &luid );
可以导出Callgrind格式
profiler-using-clang-based-ast-instrumentation
kcachegrind