C++ benchmark,rapidcheck 检查瓶颈(QuickCheck 克隆) good

rapidcheck 检查瓶颈(QuickCheck 克隆)
目标是使用尽可能少的样板简单易用
https://github.com/emil-e/rapidcheck

C++ micro-benchmarking framework
https://nonius.io
https://github.com/libnonius/nonius

C++ benchmarking framework
https://bruun.co/2012/02/07/easy-cpp-benchmarking
https://github.com/nickbruun/hayai

----------------------------------------------------------------------------------------------------------

代码剖析(Code profiling)
程序员在优化软件性能时要注意应尽量优化软件中被频繁调用的部分,这样才能对程序进行有效优化。使用真实的数据,精确的分析应用程序在时间上的花费的行为就成为_代码剖析_。现在几乎所有的开发平台都支持代码剖析,本文要介绍的是linux下针对c/c++的GNU的gprof代码剖析工具。

PS:gprof不只能对c/c++,还可对Pascal和Fortran 77进行代码剖析。

gprof
GNU gprof 是一款linux平台上的程序分析软件(unix也有prof)。借助gprof可以获得C/C++程序运行期间的统计数据,例如每个函数耗费的时间,函数被调用的次数以及各个函数相互之间的调用关系。gprof可以帮助我们找到程序运行的瓶颈,对占据大量CPU时间的函数进行调优。

PS:gprof统计的只是用户态CPU的占用时间,不包括内核态的CPU时间。gprof对I/O瓶颈无能为力,耗时甚久的I/O操作很可能只占据极少的CPU时间。

如何使用gprof
gprof的使用很简单,遵循以下步骤即可:

参考文档:

https://fooyou.github.io/document/2015/07/22/performance-tools-for-linux-cplusplus.html

https://www.cnblogs.com/dylancao/p/10778721.html

----------------------------------------------------------------------------------------------------------

ubuntu 16.04安装perf

ljc@ubuntu:~$ perf

程序“perf”尚未安装。 您可以使用以下命令安装:

sudo apt install linux-tools-common

ljc@ubuntu:~$ sudo apt install linux-tools-common

正在读取软件包列表... 完成

正在分析软件包的依赖关系树

正在读取状态信息... 完成

 

ljc@ubuntu:~$ perf

WARNING: perf not found for kernel 4.4.0-24

You may need to install the following packages for this specific kernel:

linux-tools-4.4.0-24-generic

linux-cloud-tools-4.4.0-24-generic

You may also want to install one of the following packages to keep up to date:

linux-tools-generic

linux-cloud-tools-generic

ljc@ubuntu:~$ sudo apt-get install linux-tools-4.4.0-24-generic linux-cloud-tools-4.4.0-24-generic linux-tools-generic linux-cloud-tools-generic

正在读取软件包列表... 完成

正在分析软件包的依赖关系树

正在读取状态信息... 完成

https://www.cnblogs.com/dylancao/p/10778662.html

原文链接: https://www.cnblogs.com/findumars/p/10811635.html

欢迎关注

微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍

    C++ benchmark,rapidcheck 检查瓶颈(QuickCheck 克隆) good

原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/294695

非原创文章文中已经注明原地址,如有侵权,联系删除

关注公众号【高性能架构探索】,第一时间获取最新文章

转载文章受原作者版权保护。转载请注明原作者出处!

(0)
上一篇 2023年2月15日 下午4:09
下一篇 2023年2月15日 下午4:10

相关推荐