如何检查应用程序是cpu绑定还是内存绑定? [英] How to check if app is cpu-bound or memory-bound?

查看:185
本文介绍了如何检查应用程序是cpu绑定还是内存绑定?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,它几乎不执行计算CPU的工作,但是主要是内存访问(分配对象并移动它们,几乎没有数字或算术代码).

I've got an application that does few computational CPU work, but mostly memory accesses (allocating objects and moving them around, there's few numeric or arithmetic code).

在CPU空闲的情况下,如何测量我在内存访问等待时间(由于高速缓存未命中)上所花费的时间份额?

How can I measure the share of the time that am I spending in memory access latencies (due to cache misses), with the CPU being idle?

我应该注意,该应用程序正在Hyper-V来宾上运行;我不确定会带来什么困难,但是可能会带来困难.

I should note that the app is running on a Hyper-V guest; I'm not sure it will pose any difficulties, but it might.

推荐答案

您始终可以profile在您的应用程序中查看其大部分时间在哪里.

You could always profile your application to see where it spends most of the time.

通过这种方式,您可以了解有关应用程序行为和数据访问模式的很多知识.

You can learn a lot about your application's behaviour and data access patterns this way.

如果您使用的是Linux,则可以使用多种工具进行性能分析,例如:

If you are using Linux, you have a wide range of available tools for profiling, like:

  • OProfile
  • sysprof
  • valgrind + kcachegrind

要更准确地评估处理器性能以及内存访问,您还可以尝试 AMD CodeAnalyst性能分析器. 此处是有关如何在Intel处理器上使用它的说明,尽管我自己还没有尝试过.

For a more exact measurement of the processor performance as well as memory accesses, you could also try the AMD CodeAnalyst Performance Analyzer. Here are instructions on how to use it with Intel processors, though I haven't tried it myself.

另一个可能也有用的工具是英特尔性能调整实用程序.

Another tool that you might also find useful is the Intel Performance Tuning Utility.

这篇关于如何检查应用程序是cpu绑定还是内存绑定?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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