本文整理匯總了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);
}
}