Java Code Examples for sun.misc.Unsafe#pageSize()

The following examples show how to use sun.misc.Unsafe#pageSize() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NativeIO.java    From hadoop with Apache License 2.0 5 votes vote down vote up
/**
 * @return the operating system's page size.
 */
static long getOperatingSystemPageSize() {
  try {
    Field f = Unsafe.class.getDeclaredField("theUnsafe");
    f.setAccessible(true);
    Unsafe unsafe = (Unsafe)f.get(null);
    return unsafe.pageSize();
  } catch (Throwable e) {
    LOG.warn("Unable to get operating system page size.  Guessing 4096.", e);
    return 4096;
  }
}
 
Example 2
Source File: NativeIO.java    From big-c with Apache License 2.0 5 votes vote down vote up
/**
 * @return the operating system's page size.
 */
static long getOperatingSystemPageSize() {
  try {
    Field f = Unsafe.class.getDeclaredField("theUnsafe");
    f.setAccessible(true);
    Unsafe unsafe = (Unsafe)f.get(null);
    return unsafe.pageSize();
  } catch (Throwable e) {
    LOG.warn("Unable to get operating system page size.  Guessing 4096.", e);
    return 4096;
  }
}
 
Example 3
Source File: NativeIO.java    From yuzhouwan with Apache License 2.0 5 votes vote down vote up
/**
 * @return the operating system's page size.
 */
static long getOperatingSystemPageSize() {
    try {
        Field f = Unsafe.class.getDeclaredField("theUnsafe");
        f.setAccessible(true);
        Unsafe unsafe = (Unsafe) f.get(null);
        return unsafe.pageSize();
    } catch (Throwable e) {
        LOG.warn("Unable to get operating system page size.  Guessing 4096.", e);
        return 4096;
    }
}
 
Example 4
Source File: PageSizeUtil.java    From flink with Apache License 2.0 4 votes vote down vote up
static int getSystemPageSize() {
	Unsafe unsafe = unsafe();
	return unsafe == null ? PAGE_SIZE_UNKNOWN : unsafe.pageSize();
}
 
Example 5
Source File: PageSizeUtil.java    From flink with Apache License 2.0 4 votes vote down vote up
static int getSystemPageSize() {
	Unsafe unsafe = unsafe();
	return unsafe == null ? PAGE_SIZE_UNKNOWN : unsafe.pageSize();
}