title: How to measure sequential memory read speed in C/C++
body: <p>The problem does not take CPU cache into consideration. That is, let the cache do its job (let cpu cache improve the performance).</p>
  <p>My idea is to allocate a big enough chunk of memory (so that not all of it fit into cache) and treat them as one data type(like <code>int</code>) and do addition to avoid the compiler completely optimize away the code to read the memory. The problem is does the data type affect the measurement? Or is there a more general way of doing it?</p>
  <p>EDIT: Might be a bit mis-leading before. An example is AIDA64's memory and cache benchmark, which is able to measure the memory read/write speed as well as latency. I want to know a general idea of how it is done.</p>