Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,12 @@ private void remove(JfrOldObject sample) {
next.increaseSpan(sample.getSpan());
queue.add(next);
} else {
/* No remaining elements, we can't redistribute the weight. */
/*
* No younger element, we can't redistribute the weight. The next sample should absorb
* the extra span.
*/
totalInQueue = totalInQueue.subtract(sample.getSpan());
assert totalInQueue.equal(0);
assert totalInQueue.aboveOrEqual(0);
}
queue.remove(sample);
release(sample);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@
import java.util.Collections;
import java.util.List;

import jdk.jfr.Recording;
import org.graalvm.word.WordFactory;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;

import com.oracle.svm.core.jfr.HasJfrSupport;
Expand All @@ -45,6 +47,16 @@
import jdk.graal.compiler.api.directives.GraalDirectives;

public class TestOldObjectProfiler extends AbstractJfrTest {

/*
* Old object samples will not have allocation ticks set correctly if JfrTicks is not first
* initialized. We need to create the first JFR recording to lazily initialize JfrTicks.
*/
@BeforeClass
public static void initializeJfrTicks() {
GraalDirectives.blackhole(new Recording());
}

@Test
public void testScavenge() {
int count = 10;
Expand Down