对C ++多线程应用程序进行性能分析 [英] Profiling C++ multi-threaded applications

查看:162
本文介绍了对C ++多线程应用程序进行性能分析的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您是否使用过任何像Intel Vtune分析器这样的配置工具?

您对Linux和Windows上的C ++多线程应用程序有何建议?我主要对缓存未命中,内存使用率,内存泄漏和CPU使用率感兴趣.

我使用valgrind(仅在UNIX上),但主要用于查找内存错误和泄漏.

解决方案

以下是多线程应用程序的良好工具.您可以尝试评估版.

  1. 运行时完整性检查工具
    • 线程检查器-英特尔线程检查器/VTune,此处
  2. 内存一致性检查工具(内存使用情况,内存泄漏) -内存验证器,此处
  3. 性能分析. (CPU使用率) -AQTime,此处

编辑:英特尔线程检查器可用于诊断数据争用,死锁,停顿的线程,废弃的锁等.请耐心分析结果,因为这很容易引起混淆. /p>

一些提示:

  1. 禁用不需要的功能.(在识别死锁的情况下,可以禁用数据争用,反之亦然.)
  2. 根据需要使用检测级别. "All Function"和"Full Image"等级别用于数据争用,而"API Imports"可用于死锁检测)
  3. 经常使用上下文相关菜单诊断帮助".

Have you used any profiling tool like Intel Vtune analyzer?

What are your recommendations for a C++ multi threaded application on Linux and windows? I am primarily interested in cache misses, memory usage, memory leaks and CPU usage.

I use valgrind (only on UNIX), but mainly for finding memory errors and leaks.

解决方案

Following are the good tools for multithreaded applications. You can try evaluation copy.

  1. Runtime sanity check tool
    • Thread Checker -- Intel Thread checker / VTune, here
  2. Memory consistency-check tools (memory usage, memory leaks) - Memory Validator, here
  3. Performance Analysis. (CPU usage) - AQTime , here

EDIT: Intel thread checker can be used to diagnose Data races, Deadlocks, Stalled threads, abandoned locks etc. Please have lots of patience in analyzing the results as it is easy to get confused.

Few tips:

  1. Disable the features that are not required.(In case of identifying deadlocks, data race can be disabled and vice versa.)
  2. Use Instrumentation level based on your need. Levels like "All Function" and "Full Image" are used for data races, where as "API Imports" can be used for deadlock detection)
  3. use context sensitive menu "Diagnostic Help" often.

这篇关于对C ++多线程应用程序进行性能分析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆