本文整理汇总了Java中net.openhft.chronicle.core.OS.pageSize方法的典型用法代码示例。如果您正苦于以下问题:Java OS.pageSize方法的具体用法?Java OS.pageSize怎么用?Java OS.pageSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.openhft.chronicle.core.OS
的用法示例。
在下文中一共展示了OS.pageSize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: tryHashLookupSlotSize
import net.openhft.chronicle.core.OS; //导入方法依赖的package包/类
private long tryHashLookupSlotSize(int hashLookupSlotSize) {
long entriesPerSegment = findMaxEntriesPerSegmentToFitHashLookupSlotSize(
hashLookupSlotSize);
long entrySpaceSize = roundUp(entriesPerSegment * entrySizeInfo().averageEntrySize);
// Not to lose too much on linux because of "poor distribution" entry over-allocation.
// This condition should likely filter cases when we target very small hash lookup
// size + entry size is small.
// * 5 => segment will lose not more than 20% of memory, 10% on average
if (entrySpaceSize < OS.pageSize() * 5L)
return -1;
return trySegments(entriesPerSegment, MAX_SEGMENTS);
}
示例2: segmentHeaderSize
import net.openhft.chronicle.core.OS; //导入方法依赖的package包/类
int segmentHeaderSize() {
int segments = actualSegments();
long pageSize = OS.pageSize();
if (segments * (64 * 3) < (2 * pageSize)) // i. e. <= 42 segments, if page size is 4K
return 64 * 3; // cache line per header, plus one CL to the left, plus one to the right
if (segments * (64 * 2) < (3 * pageSize)) // i. e. <= 96 segments, if page size is 4K
return 64 * 2;
// reduce false sharing unless we have a lot of segments.
return segments <= 16 * 1024 ? 64 : 32;
}
示例3: computeNumberOfTiersInBulk
import net.openhft.chronicle.core.OS; //导入方法依赖的package包/类
private long computeNumberOfTiersInBulk() {
// TODO review heuristics
int tiersInBulk = actualSegments / 8;
tiersInBulk = Maths.nextPower2(tiersInBulk, 1);
while (computeTierBulkBytesSize(tiersInBulk) < OS.pageSize()) {
tiersInBulk *= 2;
}
return tiersInBulk;
}
示例4: msync
import net.openhft.chronicle.core.OS; //导入方法依赖的package包/类
private void msync(long address, long length) throws IOException {
// address should be a multiple of page size
if (OS.pageAlign(address) != address) {
long oldAddress = address;
address = OS.pageAlign(address) - OS.pageSize();
length += oldAddress - address;
}
if (OS.isWindows()) {
WindowsMsync.msync(raf, address, length);
} else {
PosixMsync.msync(address, length);
}
}