< prev index next >
test/gc/logging/TestPrintReferences.java
Print this page
rev 13070 : [mq]: webrev.0a
rev 13071 : [mq]: webrev.1
*** 1,7 ****
/*
! * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
--- 1,7 ----
/*
! * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*** 35,56 ****
import jdk.test.lib.process.ProcessTools;
public class TestPrintReferences {
public static void main(String[] args) throws Exception {
ProcessBuilder pb_enabled =
! ProcessTools.createJavaProcessBuilder("-Xlog:gc+ref=debug", "-Xmx10M", GCTest.class.getName());
OutputAnalyzer output = new OutputAnalyzer(pb_enabled.start());
! String countRegex = "[0-9]+ refs";
! String timeRegex = "[0-9]+[.,][0-9]+ms";
!
! output.shouldMatch(".* GC\\([0-9]+\\) SoftReference " + timeRegex + "\n" +
! ".* GC\\([0-9]+\\) WeakReference " + timeRegex + "\n" +
! ".* GC\\([0-9]+\\) FinalReference " + timeRegex + "\n" +
! ".* GC\\([0-9]+\\) PhantomReference " + timeRegex + "\n" +
! ".* GC\\([0-9]+\\) JNI Weak Reference " + timeRegex + "\n" +
! ".* GC\\([0-9]+\\) Ref Counts: Soft: [0-9]+ Weak: [0-9]+ Final: [0-9]+ Phantom: [0-9]+\n");
output.shouldHaveExitValue(0);
}
static class GCTest {
--- 35,73 ----
import jdk.test.lib.process.ProcessTools;
public class TestPrintReferences {
public static void main(String[] args) throws Exception {
ProcessBuilder pb_enabled =
! ProcessTools.createJavaProcessBuilder("-Xlog:gc+ref=debug", "-Xmx32M", GCTest.class.getName());
OutputAnalyzer output = new OutputAnalyzer(pb_enabled.start());
! String gcLogTimeRegex = ".* GC\\([0-9]+\\)";
! String countRegex = "[0-9]+";
! String timeRegex = "[0-9]+[.,][0-9]+ms\n";
! String refDetailRegex = gcLogTimeRegex + " Phase2: " + timeRegex +
! gcLogTimeRegex + " Phase3: " + timeRegex +
! gcLogTimeRegex + " Cleared: " + countRegex + "\n" +
! gcLogTimeRegex + " Discovered: " + countRegex + "\n";
! String softRefDetailRegex = gcLogTimeRegex + " Phase1: " + timeRegex +
! refDetailRegex;
!
! output.shouldMatch(/* SoftReference processing */
! gcLogTimeRegex + " SoftReference " + timeRegex + softRefDetailRegex +
! /* WeakReference processing */
! gcLogTimeRegex + " WeakReference " + timeRegex + refDetailRegex +
! /* FinalReference processing */
! gcLogTimeRegex + " FinalReference " + timeRegex + refDetailRegex +
! /* PhantomReference processing */
! gcLogTimeRegex + " PhantomReference " + timeRegex + refDetailRegex +
! /* JNI Weak Reference processing */
! gcLogTimeRegex + " JNI Weak Reference " + timeRegex +
! /* Enqueue Reference Lists */
! gcLogTimeRegex + " Enqueue reference lists " + timeRegex +
! /* Enqueued Stats */
! gcLogTimeRegex + " Ref Counts: Soft: " + countRegex + " Weak: " + countRegex +
! " Final: " + countRegex + " Phantom: " + countRegex
! );
output.shouldHaveExitValue(0);
}
static class GCTest {
< prev index next >