|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.lwjgl.util.mapped.CacheUtil
public final class CacheUtil
This class provides utility methods for allocating cache-line-aligned NIO buffers. The CPU cache line size is detected using a micro-benchmark that exploits the performation degredation that occurs when different threads write to different locations of the same cache line. The detection should be reasonably robust on both the server and client VM, but there are a few system properties that can be used to tune it.
Method Summary | |
---|---|
static java.nio.ByteBuffer |
createByteBuffer(int size)
Construct a direct, native-ordered and cache-line-aligned bytebuffer with the specified size. |
static java.nio.CharBuffer |
createCharBuffer(int size)
Construct a direct, native-ordered and cache-line-aligned charbuffer with the specified number of elements. |
static java.nio.DoubleBuffer |
createDoubleBuffer(int size)
Construct a direct, native-ordered and cache-line-aligned doublebuffer with the specified number of elements. |
static java.nio.FloatBuffer |
createFloatBuffer(int size)
Construct a direct, native-ordered and cache-line-aligned floatbuffer with the specified number of elements. |
static java.nio.IntBuffer |
createIntBuffer(int size)
Construct a direct, native-ordered and cache-line-aligned intbuffer with the specified number of elements. |
static java.nio.LongBuffer |
createLongBuffer(int size)
Construct a direct, native-ordered and cache-line-aligned longbuffer with the specified number of elements. |
static PointerBuffer |
createPointerBuffer(int size)
Construct a cache-line-aligned PointerBuffer with the specified number of elements. |
static java.nio.ShortBuffer |
createShortBuffer(int size)
Construct a direct, native-ordered and cache-line-aligned shortbuffer with the specified number of elements. |
static int |
getCacheLineSize()
Returns the CPU cache line size, in number of bytes. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static int getCacheLineSize()
public static java.nio.ByteBuffer createByteBuffer(int size)
size
- The size, in bytes
public static java.nio.ShortBuffer createShortBuffer(int size)
size
- The size, in shorts
public static java.nio.CharBuffer createCharBuffer(int size)
size
- The size, in chars
public static java.nio.IntBuffer createIntBuffer(int size)
size
- The size, in ints
public static java.nio.LongBuffer createLongBuffer(int size)
size
- The size, in longs
public static java.nio.FloatBuffer createFloatBuffer(int size)
size
- The size, in floats
public static java.nio.DoubleBuffer createDoubleBuffer(int size)
size
- The size, in floats
public static PointerBuffer createPointerBuffer(int size)
size
- The size, in memory addresses
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |