【问题标题】:How to restrict Vtune Analysis to a specific function如何将 Vtune 分析限制为特定功能
【发布时间】:2016-08-12 09:40:39
【问题描述】:

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

<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()
}

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

我刚刚将 Intel vTune Amplifier XE 套件安装到 VS 2015 中。

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

谢谢

【问题讨论】:

  • 我认为 vtune 不太可能尝试对您嵌入在 C 代码中的手写程序集做任何事情。毕竟,您在 C 代码中嵌入汇编的原因是因为您想在没有编译器帮助或修改的情况下自行汇编它。
  • VTune 将收集所有已执行函数的所有信息。只能根据进程/模块/函数名称进行过滤。我想这会对你有所帮助。

标签: assembly x86 64-bit profiling intel-vtune


【解决方案1】:

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

配置分析类型,选择“分析用户任务”选项来处理检测任务。收集完成后,选择以 Task 或 Frame 开头的分组,以查看聚合到您的检测间隔的性能数据。您还将在时间轴中看到您的任务/框架。

作为一个例子,你可以改变你的代码:

<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 编译这段代码。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-10-29
    • 1970-01-01
    • 2012-10-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多