Intel的vtune工具提供了很好的profiling功能,可以用来对软件应用进行性能调优。

 

第1步:下载vtune工具,官网地址如下,现在intel将其整合到oneAPI中了。

https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/vtune-profiler.html

我之前现在好的Ubuntu 版本,百度网盘路径链接: https://pan.baidu.com/s/131OyKvm6kE9MqEDT8oQtTA  提取码: 828a

 

第2步:安装vtune

tar -xzvf vtune_amplifier_xxx.tar.gz  #xxx为你下载的版本号
su root
./install_GUI.sh

 

第3步:跑你的应用,并通过ps aux 查到此应用的pid

 

第4步,打开vtune进行监测。

进入一个路径,执行以下命令。Vtune会将profiling数据文件存在此路径下,如果看到类似r000hs的文件件,就是vtune的profiling文件。

/opt/intel/vtune_profiler/bin64/vtune -collect hotspots -run-pass-thru=--no-altstack -target-install-dir=HOST/VTUNE/INSTALL/PATH -target-pid xxxx   
#以上命令中,只需要修改下 pid的num  ,  这个  HOST/VTUNE/INSTALL/PATH 不需要修改

因为centos安装vtune 会有一些问题,如果想监测centos上的应用程序,此时可以使用另外一台ubuntu系统的机器,安装vtune,通过ssh来进行监测。注意,你的应用跑完之后,需要按 ctrl +c 来停滞vtune的监测功能,此时只能按一次ctrl +c,如果按多次,会导致vtune profiling的数据文件错误。

安装好vtune后,在ubuntu上执行:
ssh-keygen -t rsa
ssh-copy-id  your_centos_user_name @your_centos_ip_address
/opt/intel/vtune_profiler/bin64/vtune -target-system=ssh:your_centos_user_name @your_centos_ip_address -collect hotspots -run-pass-thru=--no-altstack -target-install-dir=HOST/VTUNE/INSTALL/PATH -target-pid xxxx 

 

第5步,打开vtune gui用户界面,查看profiling结果。

执行以下命令后,load相应的 profiling数据文件,主要查看Top-down Tree。如果是多线程应用,可以在vtune窗口的下面 找到Thread栏,选择不同的线程进行查看。

source /opt/intel/vtune_profiler/amplxe-vars.sh
vtune-gui

 

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐