buf_size = buf_size / CL_SIZE; /* mem size in cache lines */
for (i = 0; i < buf_size; i++)
cl_flush(&cp[i * CL_SIZE]);
sb();
}
/* * Buffer index step advance to workaround HW prefetching interfering with * the measurements. * * Must be a prime to step through all indexes of the buffer. * * Some primes work better than others on some architectures (from MBA/MBM * result stability point of view).
*/ #define FILL_IDX_MULT 23
/* * Read the buffer in an order that is unexpected by HW prefetching * optimizations to prevent them interfering with the caching pattern. * * The read order is (in terms of halves of cachelines): * i * FILL_IDX_MULT % size * The formula is open-coded below to avoiding modulo inside the loop * as it improves MBA/MBM result stability on some architectures.
*/ for (i = 0; i < size; i++) {
sum += buf[idx * (CL_SIZE / 2)];
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.