// Memory to be promoted by PLAB for one thread. privatestaticfinallong MEM_ALLOC_WORDS = 32768; // Defined by properties. privatestaticfinalint ITERATIONS = Integer.getInteger("iterations"); privatestaticfinallong CHUNK = Long.getLong("chunk.size");
if (ITERATIONS == 0 || CHUNK == 0) { thrownew IllegalArgumentException("Properties should be set");
}
long wordSize = Platform.is32bit() ? 4l : 8l; // PLAB size is shared between threads. long initialMemorySize = wordSize * MEM_ALLOC_WORDS;
// Expect changing memory to half during all iterations. long memChangeStep = initialMemorySize / 2 / ITERATIONS;
WHITE_BOX.fullGC();
// Warm the PLAB. Fill memory ITERATIONS times without changing memory size.
iterateAllocation(initialMemorySize, 0); // Fill memory ITERATIONS times. // Initial size is initialMemorySize and step is -memChangeStep
iterateAllocation(initialMemorySize, -memChangeStep); // Fill memory ITERATIONS times. // Initial size is memoryAfterChanging, step is memChangeStep. // Memory size at start should be greater then last size on previous step. // Last size on previous step is initialMemorySize - memChangeStep*(ITERATIONS - 1) long memoryAfterChanging = initialMemorySize - memChangeStep * (ITERATIONS - 2);
iterateAllocation(memoryAfterChanging, memChangeStep);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.