开发者

How to check if app is cpu-bound or memory-bound?

I've got an application that does few computational CPU work, but mostly memory accesses (allocating objects and moving them ar开发者_Go百科ound, there's few numeric or arithmetic code).

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?

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.


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.

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

  • OProfile
  • sysprof
  • valgrind + kcachegrind

EDIT:

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.


Unless you have a latency built into the system, just run the application for some time on a dedicated machine and check the CPU counters. If the app uses 100% of the CPU core it can access, it's CPU bound. Otherwise, it spends time on other things like memory allocations and IOs.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜