views:

306

answers:

2

How do you calculate memory(RAM) bandwidth used?

Which performance counters are required?

I came across a tool that was able to do it, the "Rightmark multi-threaded memory test". But unlike the rest of Rightmark's tests, I haven't found the source code for it, just the binaries.

Thanks in Advance

  • Tom De Bie
+1  A: 

It is very difficult to 'calculate' memory bandwidth usage. There are lots of non-trivial cache and MMU issues to contend with. The only real way to do it is either through the use of simulation or real-world measurements.

You can get a 'rough' idea by debugging the code and counting the number of memory load and store operations performed. However, knowing whether it was a cache hit/miss is another issue.

It depends on your purpose. If it is to obtain a guesstimate, you can use the rule of thumb that about 30% of general purpose code is memory loads and stores. If you're trying to get a worst case, you can assume that caches miss all the time and work it out.

One potential thing you could do is to look at virtualisation. There are several open source options (QEMU comes to mind). It may be possible to export certain hardware measurements from them.

sybreon
+1  A: 

Coincidentally, the CLR Inside Out article in the June issue of MSDN Magazine is about profiling memory usage in .NET applications.

http://msdn.microsoft.com/en-us/magazine/dd882521.aspx