如何将Vtune Analysis限制为特定功能

时间:2016-04-19 23:55:16

标签: assembly x86 64-bit profiling vtune

我有一个程序,其基本结构如下:

<c language headers>
main() {
    some malloc() allocations and file reads into these buffers
    call to an assembly language routine that needs to be optimized to the maximum
    write back the output of to files and do free()
exit()
}

汇编语言程序本质上是计算缓冲区中数据的校验和,我的目的是将其优化到绝对最大值。它不会进行任何系统调用或任何库函数调用。

我刚刚在VS 2015中安装了英特尔vTune放大器XE套件。

如何指定vtune严格关注汇编语言例程部分,并跳过“C”语言准备部分的所有分析。我似乎正在获取累积的所有数据,如INSTRUCTION COUNT或CPI等。是否可以仅为汇编语言子例程中的循环和分支获取数据。如果是这样,请告诉我如何做到这一点。

由于

1 个答案:

答案 0 :(得分:4)

您可以通过VTune提供的API检测代码,以分析工作负载中的特定区域。使用Task API来跟踪特定于线程的活动,或使用Frame API来分析工作负载中的全局阶段。

配置分析类型,选择选项&#34;分析用户任务&#34;处理检测任务。收集完成后,选择以“任务”或“框架”开头的分组,以查看汇总到检测间隔的性能数据。您还会在时间轴中看到您的任务/框架。

作为示例,您可以更改代码,如:

<c language headers>
#include "ittnotify.h"

main() {

  __itt_domain* domain = __itt_domain_create("MyDomain");
  __itt_string_handle* task = __itt_string_handle_create("MyTask");

  some malloc() allocations and file reads into these buffers

  __itt_task_begin(domain, __itt_null, __itt_null, task);

  call to an assembly language routine that needs to be optimized to the maximum

  __itt_task_end(domain);

  write back the output of to files and do free()
  exit()
}

请勿忘记按basic configuration编译此代码。