性能分析报告
性能测试工具CPU profiler(gperftools) 编译安装gperftools gperftools是一个工具包,CPU profiler是其中的工具之一,用于程序性能分析。要使用CPU profiler就要先编译安装gperftools,下面是简单的编译安装过程. 从github下载gperftools源码并解压wgethttps://github.com/gperftools/gperftools/archive/gperftools-2.7.tar.gztarxvf gperftools-2.7.tar.gz# 解压文件夹改名mvgperftools-gperftools-2.7 gperftools-2.7cdgperftools-2.7./autogen.sh./configuremake-j8# 安装到系统文件夹sudomakeinstall 注意:在64位操作系统下需要libunwind支持,如果没有安装libunwind,还要先编译安装libunwind。 使用cpu profiler 根据CPU profiler的官方说明(https://gperftools.github.io/gperftools/cpuprofile.html),对一个程序进行测试是很简单的。 只要加上-lprofiler对程序重新编译一次,再执行程序就可以了