-----------------------------
Vtune是Intel公司的一个程序分析工具,今天Intel的讲师来我们公司做一个讲座,其中对vtune会有一些介绍和讲解,于是就提前预习了一下。
1、下载vtune
从intel的网站下载最新的vtune,linux平台的免费非商业版
http://www.intel.com/cd/software/products/apac/zho/275878.htm
linux版本:
http://www.intel.com/cd/software/products/apac/zho/245112.htm
下载前会让你填写邮箱信息,之后试用序列号会发到你的邮箱里面。试用期是1年。
2、安装vtune
下载以后,vtune9的大小大概是500M左右。
解包后使用"./install.sh"脚本在CLI中进行交互式的安装,不需要GUI的支持。
首先问你是否安装,如果你之前有安装过其他版本的,会自动uninstall,然后让你输入序列号。。。看清楚选项,一步一步往下走就可以了。
默认的安装路径是/opt/intel/vtune/目录,可以在第三步的第2个选项中更改路径。
由于vtune要安装ADK(Analyzer Driver Kit),所以需要内核源码进行模块的编译。
debian的话,安装headers就可以了,比如我的内核是2.6.18-6-686,那么安装
aptitude install linux-headers-2.6-686
就可以了让vtune安装程序自动进行编译了。
vtune的安装信息如下:
The current distribution of Linux on this system is Debian GNU/Linux lenny/sid
This platform has not been validated with the VTune(TM) Performance Analyzer 9.0 for Linux*.
It may work, but it is not supported.
The VTune(TM) Performance Analyzer 9.0 for Linux* was validated on
Red Hat* Enterprise Linux* 3.0 Update 9, 4.0 Update 5, 5.0, Fedora* Core 6, 7,
SuSE* 10.0, Linux* Enterprise Server (SLES) 9.0 Service Pack 3, 10 Service Pack 1,
Mandriva* Limited Edition 2005,Turbolinux* 10,Ubuntu* 7.04, Debian 4.0
and Red Flag* Linux* 5.0
Proceed with the install? ( Yes/No )
The Intel(R) VTune(TM) Performance Analyzer 9.0 for Linux* (full install) is being installed...
Please wait ...
------------------------------------------------------------
EntireX DCOM for Linux* component is being installed...
EntireX DCOM for Linux* component was successfully installed.
------------------------------------------------------------
------------------------------------------------------------
The VTune(TM) Performance Analyzer Driver Kit component is being installed...
Searching a pre-built driver ... FAILED
Building the driver for your kernel ... OK
Installing sampling driver boot script ... OK
Loading the driver ... OK
The VTune(TM) Performance Analyzer Driver Kit component was successfully installed.
------------------------------------------------------------
------------------------------------------------------------
The VTune(TM) Performance Analyzer Remote Agent component is being installed...
The VTune(TM) Performance Analyzer Remote Agent component was successfully installed.
------------------------------------------------------------
------------------------------------------------------------
The VTune(TM) Performance Analyzer component is being installed...
The VTune(TM) Performance Analyzer component was successfully installed.
------------------------------------------------------------
------------------------------------------------------------
The Eclipse component is being installed...
The Eclipse component installation failed.
------------------------------------------------------------
============================================
INSTALLATION NOTES
Intel(R) VTune(TM) Performance Analyzer 9.0 for Linux* installation
-------------------------------------------------------------------------------
Note: You need to be a member of the "vtune" group
in order to use the VTune(TM) Performance Analyzer.
Note: To invoke the VTune(TM) Performance Analyzer, run
"/home/joe/tmp/intel/vtune/bin/vtl" for command line
and "/home/joe/tmp/intel/vtune/bin/vtlec" to start
the VTune(TM) Performance Analyzer within Eclipse.
Note: To uninstall the VTune(TM) Performance Analyzer 9.0 for Linux*
please run "/home/joe/tmp/intel/vtune/bin/uninstall_vtune.sh" file.
Press .
============================================
INSTALLATION WARNINGS
Intel(R) VTune(TM) Performance Analyzer 9.0 for Linux* installation
-------------------------------------------------------------------------------
从安装信息可以看到,安装程序编译了一个模块,并load进内存中了。
lsmod|grep vtune_drv
检查模块是否已经挂载。
vtune安装文档上面没有说debian可以安装,但我测试过etch和sid都可以正常安装vtune。
3、使用vtune:
运行vtune命令的用户需要加入到"vtune"组,主要是需要权限写"vtune/global_data"目录和"/dev/vtune_*"设备。
运行
/home/joe/tmp/intel/vtune/bin/vtlec
命令可以在X-window下打开vtune;
/home/joe/tmp/intel/vtune/bin/vtl
命令是在CLI下使用vtune。
CLI下面的"vtl"命令我现在还没有怎么试,当前主要用了"vtlec"命令打开vtune的GUI程序。
linux版本的Vtune在GUI上面似乎也是少了一些功能,看到Intel的讲师在台上演示windows版本的vtune,"callgraph"是会有一些柱图产生的,而我laptop上面安装的linux版本却没有,只有一堆的数字。
vtune的主要作用是通过CPU寄存器的记录,对调试程序进行分析,指出各个函数使用的CPU时间。如果有的函数使用CPU时间比较高,那就要看是否可以改成多线程的方式。vtune甚至会给你指出哪个函数中的哪个操作使用了多少CPU时间(百分比),当然前提是你需要将源代码也放在目录中。个人感觉vtune对于程序员还是很有用的,可以对自己的程序进行更细致的分析,当然,前提是你要使用Intel的CPU。