ubuntu上编译和使用easy_profiler对C++程序进行性能分析
本文首发于个人博客https://kezunlin.me/post/91b7cf13/,欢迎阅读最新内容!
tutorial to compile and use esay profiler with c++ on ubuntu 16.04
Guide
compile
git clone https://github.com/yse/easy_profiler.git
cd easy_profiler && mkdir build && cd build && cmake-gui ..
make -j8
sudo make install
usage
CMakeLists.txt
find_package(easy_profiler REQUIRED)
#easy_profiler_Dir /usr/local/lib/cmake/easy_profiler
target_link_libraries(my_application easy_profiler)
code
#include <easy/profiler.h>
void foo() {
EASY_FUNCTION(profiler::colors::Magenta); // Magenta block with name "foo"
EASY_BLOCK("Calculating sum"); // Begin block with default color == Amber100
int sum = 0;
for (int i = 0; i < 10; ++i) {
EASY_BLOCK("Addition", profiler::colors::Red); // Scoped red block (no EASY_END_BLOCK needed)
sum += i;
}
EASY_END_BLOCK; // End of "Calculating sum" block
EASY_BLOCK("Calculating multiplication", profiler::colors::Blue500); // Blue block
int mul = 1;
for (int i = 1; i < 11; ++i)
mul *= i;
//EASY_END_BLOCK; // This is not needed because all blocks are ended on destructor when closing braces met
}
void bar() {
EASY_FUNCTION(0xfff080aa); // Function block with custom ARGB color
}
void baz() {
EASY_FUNCTION(); // Function block with default color == Amber100
}
Reference
History
- 20191010: created.
Copyright
- Post author: kezunlin
- Post link: https://kezunlin.me/post/91b7cf13/
- Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 3.0 unless stating additionally.
ubuntu上编译和使用easy_profiler对C++程序进行性能分析的更多相关文章
- 在ubuntu上编译chrome
在ubuntu上编译chrome 在ubuntu上编译chrome 红心地瓜 1.获取代码 1)下载tarball,http://chromium-browser-source.commondatas ...
- 【转】Ubuntu 上编译Android出现cannot find -lstdc++解决办法
[转]Ubuntu 上编译Android出现cannot find -lstdc++解决办法 在Ubuntu 12.04 x86_64机器上编译Android出现下面错误,是因为找不到32bit的li ...
- (原)ubuntu上编译PANet/Detectron.pytorch时-std=c99的错误
转载请注明出处: https://www.cnblogs.com/darkknightzh/p/10494787.html 在ubuntu上编译PANet/Detectron.pytorch时,总提示 ...
- .NET跨平台:在Linux Ubuntu上编译coreclr/corefx/dnx(20150617)
编译时间:北京2015年6月17日上午 操作系统:Ubuntu 14.04.2 LTS Mono版本:Mono JIT compiler version 4.3.0 (master/3445ac5 T ...
- Qt+MPlayer音乐播放器开发笔记(一):ubuntu上编译MPlayer以及Demo演示
前言 在ubuntu上实现MPlayer播放器播放音乐. Demo Mplayer MPlayer是一款开源多媒体播放器,以GNU通用公共许可证发布.此款软件 ...
- Ubuntu上用快捷键关闭没有响应的程序
Linux 上有很多方法可以强制关闭无响应的程序,比如你可以通过按快捷键 Ctrl + Shift + T 来调出 Terminal 或者用 Ctrl + Shift + F1 进入 Console ...
- 在Linux Ubuntu上编译DNX
DNX是.NET Execution Environment,前身是XRE,XRE的前身是KRuntime,项目网址:https://github.com/aspnet/DNX . 签出DNX的代码: ...
- Ubuntu 上编译opencv_contrib模块for Android
https://blog.csdn.net/ipfpm/article/details/81132144 [ubuntu]Ubuntu中Android SDK下载跟配置 android24的版本 (1 ...
- 在64位Ubuntu上编译32位程序常见错误
问 题1: 找不到头文件 asm/errno.h 解决办法 : [/usr/lib/gcc$ ]sudo ln -s x86_64-linux-gnu/asm asm 问题2:找不到gcc ...
随机推荐
- ASP.NET Core知多少(13):路由重写及重定向
背景 在做微信公众号的改版工作,之前的业务逻辑全塞在一个控制器中,现需要将其按厂家拆分,但要求入口不变. 拆分很简单,定义控制器基类,添加公用虚方法并实现,各个厂家按需重载. 但如何根据统一的入口参数 ...
- Mybatis使用心德
什么是Mybatis? Mybatis是一个半ORM(对象关系映射)框架,它内部封装了JDBC,开发时只需要关注SQL语句本身,不需要花费精力去处理加载驱动.创建连接.创建statement等繁杂的过 ...
- 【每天一题】LeetCode 0067. 二进制求和
开源地址:https://github.com/jiauzhang/algorithms 题目描述 * https://leetcode-cn.com/problems/add-binary * 给定 ...
- Winform中实现将照片剪贴到系统剪切板中(附代码下载)
场景 效果 点击剪切按钮 点击粘贴按钮 注: 博客主页: https://blog.csdn.net/badao_liumang_qizhi 关注公众号 霸道的程序猿 获取编程相关电子书.教程推送与免 ...
- C# get md5,renamed file and can not change file's md5
using System; using System.Text; using System.IO; using System.Security.Cryptography; namespace Cons ...
- How we implemented consistent hashing efficiently
原文链接https://medium.com/ably-realtime/how-to-implement-consistent-hashing-efficiently-fe038d59fff2 我们 ...
- Windows下安装和破解redis desktopmanager 2019.4
redis可视化客户端工具:redis desktop manager 破解版链接:https://www.52pojie.cn/thread-1042770-1-1.html redis deskt ...
- IEEE754 32位浮点数表示范围
6.1浮点数的数值范围 根据上面的探讨,浮点数可以表示-∞到+∞,这只是一种特殊情况,显然不是我们想要的数值范围. 以32位单精度浮点数为例,阶码E由8位表示,取值范围为0-255,去除0和255这两 ...
- 面试连环炮系列(五):你们的项目为什么要用RabbitMQ
你们的项目为什么要用RabbitMQ? 消息队列的作用是系统解耦.同步改异步.请求消峰,举个下订单的例子: 前端获取用户订单信息,请求后端的订单创建接口.这个接口并不直接请求订单服务,而是首先生成唯一 ...
- 流式计算(一)-Java8Stream
大约各位看官君多少也听说了Storm/Spark/Flink,这些都是大数据流式处理框架.如果一条手机组装流水线上不同的人做不同的事,有的装电池,有的装屏幕,直到最后完成,这就是典型的流式处理.如果手 ...