Search in sources :

Example 1 with CollectionWatcher

use of com.oracle.svm.core.heap.CollectionWatcher 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();
}
Also used : CollectionWatcher(com.oracle.svm.core.heap.CollectionWatcher) Log(com.oracle.svm.core.log.Log)

Example 2 with CollectionWatcher

use of com.oracle.svm.core.heap.CollectionWatcher 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();
}
Also used : CollectionWatcher(com.oracle.svm.core.heap.CollectionWatcher) Log(com.oracle.svm.core.log.Log)

Example 3 with CollectionWatcher

use of com.oracle.svm.core.heap.CollectionWatcher in project graal by oracle.

the class GarbageCollectorManagementFactory method visitWatchersBefore.

@SuppressWarnings("try")
private void visitWatchersBefore() {
    final Log trace = Log.noopLog().string("[GCImpl.visitWatchersBefore:").newline();
    trace.string("  Watchers before: ");
    try (Timer wbt = watchersBeforeTimer.open()) {
        for (CollectionWatcher watcher = collectionWatcherList.getFirst(); watcher != null; watcher = watcher.getNextElement()) {
            try {
                watcher.beforeCollection();
            } catch (Throwable t) {
                trace.string("[GCImpl.visitWatchersBefore: Caught: ").string(t.getClass().getName()).string("]").newline();
            }
        }
    }
    trace.string("]").newline();
}
Also used : CollectionWatcher(com.oracle.svm.core.heap.CollectionWatcher) Log(com.oracle.svm.core.log.Log)

Aggregations

CollectionWatcher (com.oracle.svm.core.heap.CollectionWatcher)3 Log (com.oracle.svm.core.log.Log)3