use of com.oracle.svm.core.log.Log in project graal by oracle.
the class GarbageCollectorManagementFactory method visitWatchersReport.
private void visitWatchersReport() {
final Log trace = Log.noopLog().string("[GCImpl.visitWatchersReport:").newline();
/*
* Run single-threaded (but not at a safepoint) so as not be bothered by concurrent
* scrubbing of the list due to random garbage collections. There is still window if someone
* has unregistered a watcher and then there is another collection, because that will scrub
* the list I am walking, even though I am in a VMOperation. I consider that a small-enough
* possibility.
*/
VMOperation.enqueueBlockingNoSafepoint("GCImpl.visitWatchersReport", () -> {
for (CollectionWatcher watcher = collectionWatcherList.getFirst(); watcher != null; watcher = watcher.getNextElement()) {
try {
watcher.report();
} catch (Throwable t) {
trace.string("[GCImpl.visitWatchersReport: Caught: ").string(t.getClass().getName()).string("]").newline();
}
}
});
trace.string("]").newline();
}
use of com.oracle.svm.core.log.Log in project graal by oracle.
the class GarbageCollectorManagementFactory method printGCBefore.
/*
* Implementation methods.
*/
private void printGCBefore(String cause) {
final Log verboseGCLog = Log.log();
final HeapImpl heap = HeapImpl.getHeapImpl();
sizeBefore = ((SubstrateOptions.PrintGC.getValue() || HeapOptions.PrintHeapShape.getValue()) ? heap.getUsedChunkBytes() : WordFactory.zero());
if (SubstrateOptions.VerboseGC.getValue() && getCollectionEpoch().equal(1)) {
/* Print the command line options that shape the heap. */
verboseGCLog.string("[Heap policy parameters: ").newline();
verboseGCLog.string(" YoungGenerationSize: ").unsigned(HeapPolicy.getMaximumYoungGenerationSize()).newline();
verboseGCLog.string(" MaximumHeapSize: ").unsigned(HeapPolicy.getMaximumHeapSize()).newline();
verboseGCLog.string(" MinimumHeapSize: ").unsigned(HeapPolicy.getMinimumHeapSize()).newline();
verboseGCLog.string(" AlignedChunkSize: ").unsigned(HeapPolicy.getAlignedHeapChunkSize()).newline();
verboseGCLog.string(" LargeArrayThreshold: ").unsigned(HeapPolicy.getLargeArrayThreshold()).string("]").newline();
if (HeapOptions.PrintHeapShape.getValue()) {
HeapImpl.getHeapImpl().bootImageHeapBoundariesToLog(verboseGCLog);
}
}
if (SubstrateOptions.VerboseGC.getValue()) {
verboseGCLog.string("[");
verboseGCLog.string("[");
final long startTime = System.nanoTime();
if (SubstrateOptions.PrintGCTimeStamps.getValue()) {
verboseGCLog.unsigned(TimeUtils.roundNanosToMillis(Timer.getTimeSinceFirstAllocation(startTime))).string(" msec: ");
} else {
verboseGCLog.unsigned(startTime);
}
verboseGCLog.string(" GC:").string(" before").string(" epoch: ").unsigned(getCollectionEpoch()).string(" cause: ").string(cause);
if (HeapOptions.PrintHeapShape.getValue()) {
heap.report(verboseGCLog);
}
verboseGCLog.string("]").newline();
}
}
use of com.oracle.svm.core.log.Log in project graal by oracle.
the class GarbageCollectorManagementFactory method swapSpaces.
private static void swapSpaces() {
final Log trace = Log.noopLog().string("[GCImpl.swapSpaces:");
final HeapImpl heap = HeapImpl.getHeapImpl();
final OldGeneration oldGen = heap.getOldGeneration();
oldGen.swapSpaces();
trace.string("]").newline();
}
use of com.oracle.svm.core.log.Log in project graal by oracle.
the class GarbageCollectorManagementFactory method visitWatchersAfter.
@SuppressWarnings("try")
private void visitWatchersAfter() {
final Log trace = Log.noopLog().string("[GCImpl.visitWatchersAfter:").newline();
trace.string(" Watchers after: ");
try (Timer wat = watchersAfterTimer.open()) {
/* Run the registered collection watchers. */
for (CollectionWatcher watcher = collectionWatcherList.getFirst(); watcher != null; watcher = watcher.getNextElement()) {
try {
watcher.afterCollection();
} catch (Throwable t) {
trace.string("[GCImpl.visitWatchersAfter: Caught: ").string(t.getClass().getName()).string("]").newline();
}
}
}
trace.string("]").newline();
}
use of com.oracle.svm.core.log.Log in project graal by oracle.
the class GarbageCollectorManagementFactory method printGCSummary.
@Override
public void printGCSummary() {
final Log log = Log.log();
final String prefix = "PrintGCSummary: ";
/* Print GC configuration. */
log.string(prefix).string("YoungGenerationSize: ").unsigned(HeapPolicy.getMaximumYoungGenerationSize()).newline();
log.string(prefix).string("MinimumHeapSize: ").unsigned(HeapPolicy.getMinimumHeapSize()).newline();
log.string(prefix).string("MaximumHeapSize: ").unsigned(HeapPolicy.getMaximumHeapSize()).newline();
log.string(prefix).string("AlignedChunkSize: ").unsigned(HeapPolicy.getAlignedHeapChunkSize()).newline();
/* Add in any young and pinned objects allocated since the last collection. */
VMOperation.enqueueBlockingSafepoint("PrintGCSummaryShutdownHook", ThreadLocalAllocation::disableThreadLocalAllocation);
final HeapImpl heap = HeapImpl.getHeapImpl();
final Space youngSpace = heap.getYoungGeneration().getSpace();
final UnsignedWord youngChunkBytes = youngSpace.getChunkBytes();
final UnsignedWord youngObjectBytes = youngSpace.getObjectBytes();
final Space pinnedSpace = heap.getOldGeneration().getPinnedFromSpace();
final UnsignedWord pinnedChunkBytes = pinnedSpace.getChunkBytes().subtract(accounting.getPinnedChunkBytesAfter());
final UnsignedWord pinnedObjectBytes = pinnedSpace.getObjectBytes().subtract(accounting.getPinnedObjectBytesAfter());
/* Compute updated values. */
final UnsignedWord allocatedNormalChunkBytes = accounting.getNormalChunkBytes().add(youngChunkBytes);
final UnsignedWord allocatedNormalObjectBytes = accounting.getNormalObjectBytes().add(youngObjectBytes);
final UnsignedWord allocatedPinnedChunkBytes = accounting.getPinnedChunkBytes().add(pinnedChunkBytes);
final UnsignedWord allocatedPinnedObjectBytes = accounting.getPinnedObjectBytes().add(pinnedObjectBytes);
final UnsignedWord allocatedTotalChunkBytes = allocatedNormalChunkBytes.add(allocatedPinnedChunkBytes);
final UnsignedWord allocatedTotalObjectBytes = allocatedNormalObjectBytes.add(allocatedPinnedObjectBytes);
/* Print the total bytes allocated and collected by chunks. */
log.string(prefix).string("CollectedTotalChunkBytes: ").signed(accounting.getCollectedTotalChunkBytes()).newline();
log.string(prefix).string("CollectedTotalObjectBytes: ").signed(accounting.getCollectedTotalObjectBytes()).newline();
log.string(prefix).string("AllocatedNormalChunkBytes: ").signed(allocatedNormalChunkBytes).newline();
log.string(prefix).string("AllocatedNormalObjectBytes: ").signed(allocatedNormalObjectBytes).newline();
log.string(prefix).string("AllocatedPinnedChunkBytes: ").signed(allocatedPinnedChunkBytes).newline();
log.string(prefix).string("AllocatedPinnedObjectBytes: ").signed(allocatedPinnedObjectBytes).newline();
log.string(prefix).string("AllocatedTotalChunkBytes: ").signed(allocatedTotalChunkBytes).newline();
log.string(prefix).string("AllocatedTotalObjectBytes: ").signed(allocatedTotalObjectBytes).newline();
/* Print the collection counts and times. */
final long incrementalNanos = accounting.getIncrementalCollectionTotalNanos();
log.string(prefix).string("IncrementalGCCount: ").signed(accounting.getIncrementalCollectionCount()).newline();
log.string(prefix).string("IncrementalGCNanos: ").signed(incrementalNanos).newline();
final long completeNanos = accounting.getCompleteCollectionTotalNanos();
log.string(prefix).string("CompleteGCCount: ").signed(accounting.getCompleteCollectionCount()).newline();
log.string(prefix).string("CompleteGCNanos: ").signed(completeNanos).newline();
/* Compute a GC load percent. */
final long gcNanos = incrementalNanos + completeNanos;
final long mutatorNanos = mutatorTimer.getCollectedNanos();
final long totalNanos = gcNanos + mutatorNanos;
final long roundedGCLoad = (0 < totalNanos ? TimeUtils.roundedDivide(100 * gcNanos, totalNanos) : 0);
log.string(prefix).string("GCNanos: ").signed(gcNanos).newline();
log.string(prefix).string("TotalNanos: ").signed(totalNanos).newline();
log.string(prefix).string("GCLoadPercent: ").signed(roundedGCLoad).newline();
}
Aggregations