perf性能分析(5) -- linux perf 工具介绍
1. perf 介绍 perf及子命令可以测量/记录系统性能,可以记录的性能数据项繁多。包括CPU/PMU等硬件数据,以及software counter/tracepoint等系统内核采集的数据。可以关注的几类: CPU / PMU (Performance Monitoring Unit)数据。包括: dTLB, iTLB, cache 计数以及miss计数;branch及br...
1. perf 介绍 perf及子命令可以测量/记录系统性能,可以记录的性能数据项繁多。包括CPU/PMU等硬件数据,以及software counter/tracepoint等系统内核采集的数据。可以关注的几类: CPU / PMU (Performance Monitoring Unit)数据。包括: dTLB, iTLB, cache 计数以及miss计数;branch及br...
1. perf stat 基本使用 perf stat 基本功能 – 统计: cycles 数, IPC (instructions per cycle)。IPC >= 1 表示指令执行效率高 分支切换次数(branchs), 分支预测失败次数(branch-misses),以及失败比例 上下文切换次数(context switches),以及每秒切换次数 CPU...
1. Virtual Memory Statistics – vmstat vmstat 检测cpu、系统内存(包括 slab)、进程、块设备IO等使用情况: CPU相关:用户时间 / 系统时间 / 空闲时间占比。每秒中断数量 / 上下文切换数量。活动进程数量 / 阻塞进程数量,fork进程数量。 内存相关:active/inactive内存,buff/cache内存,swap...
1. 编译选项 -fverbose-asm -fverbose-asm 将编译信息(编译选项等等)、C源码中的变量名,以注释的形式嵌入到汇编代码中,便于分析。
“真实的” 内存空闲率 = (free + shared + buffers + cached)/ Total = 5860 M / 7983M X 100 % = 73.4 % 1. Linux内存分类 匿名内存:存储用户计算过程中间的数据,与物理磁盘上的文件无关; File-Backed内存:用作磁盘高速缓存,其物理内存与物理磁盘上的文件对应; 1.1 Shmem...
1. 配置 1.1 安装 perf sudo apt-get install linux-tools-common linux-tools-generic linux-tools-`uname -r` 1.2 设置系统相关设置项以允许 perf 采集 # 允许非特权用户进行内核分析和访问 CPU 事件 echo 0 | sudo tee /proc/sys/kernel/perf_...
测试代码:test_tbb_perf_vtune_profiler 注意:编译选项需要添加”-g”,以便于VTune Profiler可以显示源码信息。 1. 测试原始来源 VTune Profiler 进行性能分析:使用VTune Profiler测试TBB overhead。 2. 资料 Intel TBB API 使用教程:Intel® oneAPI Threading...
1. 使用函数 #include <iostream> #include <memory> void deleter(Sample* ptr) { std::cout << "delete function called" << std::endl; delete ptr; } std::shared_ptr<Sam...
1. Intel VTune 配置 1.1 使能 ptrace 使能进程跟踪 (ptrace) 功能 (attach ID),以便 VTune 可以监控到进程的运行情况。 sudo vim /etc/sysctl.d/10-ptrace.conf # set kernel.yama.ptrace_scope = 0 # 使配置生效 sudo sysctl --system -a -p...
使用 BOOST_DLL_ALIAS 定义插件接口。 使用 import_alias 导入插件接口。 使用 creator / Factory 模式,提供创建插件实例的接口。 Demo Code: test_plugin_dll 1. 实现插件接口 1.1 DSO/DLL原型定义 class DIInterface { public: DIInterface()...