title: How to find the miss rate in a cache friendly code?
body: <pre><code>int sumarrayrows(int a[M][N])
  {
      int i, j, sum = 0;
      for (i = 0; i &lt; M; i++)
          for (j = 0; j &lt; N; j++)
              sum += a[i][j];
      return sum;
  }
  </code></pre>
  
  <p>I was wondering how to find the miss rate of any cache friendly code and does measure the size of a cache or a cache block if so how to find the size of it.</p>
  
  <p>Update I figured out how to find the miss rate</p>
  
  <p>Since this uses 4 bytes 
  there will be a 25% chance of a miss rate
      a[0] = M
      a[1] = H
      a[2] = H
      a[3] = H</p>