當前位置: 首頁>>代碼示例>>Java>>正文


Java OS.pageSize方法代碼示例

本文整理匯總了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);
}
 
開發者ID:OpenHFT,項目名稱:Chronicle-Map,代碼行數:13,代碼來源:ChronicleMapBuilder.java

示例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;
}
 
開發者ID:OpenHFT,項目名稱:Chronicle-Map,代碼行數:14,代碼來源:ChronicleMapBuilder.java

示例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;
}
 
開發者ID:OpenHFT,項目名稱:Chronicle-Map,代碼行數:10,代碼來源:VanillaChronicleHash.java

示例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);
    }
}
 
開發者ID:OpenHFT,項目名稱:Chronicle-Map,代碼行數:14,代碼來源:VanillaChronicleHash.java


注:本文中的net.openhft.chronicle.core.OS.pageSize方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。