cfs/src/perfutil/Util.cc
/**
 * Allocate a block of memory aligned at the beginning of a cache line.
 *
 * \param size
 *     The amount of memory to allocate.
 */
Allocate a block of memory aligned at the beginning of a cache line.
\param size
The amount of memory to allocate.
Allocate a block of memory aligned at the beginning of a cache line . \ param size The amount of memory to allocate .
void*
cacheAlignAlloc(size_t size) {
  void* temp;
  int result = posix_memalign(&temp, CACHE_LINE_SIZE, size);
  if (result == 0) {
    assert((reinterpret_cast<uint64_t>(temp) & (CACHE_LINE_SIZE - 1)) == 0);
    return temp;
  }
  return NULL;
}
void * cacheAlignAlloc ( size_t size ) { void * temp ; int result = posix_memalign ( & temp , CACHE_LINE_SIZE , size ) ; if ( result == 0 ) { assert ( ( reinterpret_cast < uint64_t > ( temp ) & ( CACHE_LINE_SIZE - 1 ) ) == 0 ) ; return temp ; } return NULL ; }
Allocate a block of memory aligned at the beginning of a cache line.
Allocate a block of memory aligned at the beginning of a cache line .