8148733: G1: Add log message to print the heap region size
authorbrutisso
Tue, 02 Feb 2016 12:12:17 +0100
changeset 35908 cb12f847b199
parent 35907 57bdb6243428
child 35909 cf5f3c85e179
8148733: G1: Add log message to print the heap region size Reviewed-by: sjohanss, david
hotspot/src/share/vm/gc/g1/heapRegion.cpp
hotspot/test/gc/logging/TestDeprecatedPrintFlags.java
--- a/hotspot/src/share/vm/gc/g1/heapRegion.cpp	Tue Feb 02 10:50:08 2016 +0100
+++ b/hotspot/src/share/vm/gc/g1/heapRegion.cpp	Tue Feb 02 12:12:17 2016 +0100
@@ -143,6 +143,7 @@
   // The cast to int is safe, given that we've bounded region_size by
   // MIN_REGION_SIZE and MAX_REGION_SIZE.
   GrainBytes = region_size;
+  log_info(gc, heap)("Heap region size: " SIZE_FORMAT "M", GrainBytes / M);
 
   guarantee(GrainWords == 0, "we should only set it once");
   GrainWords = GrainBytes >> LogHeapWordSize;
--- a/hotspot/test/gc/logging/TestDeprecatedPrintFlags.java	Tue Feb 02 10:50:08 2016 +0100
+++ b/hotspot/test/gc/logging/TestDeprecatedPrintFlags.java	Tue Feb 02 12:12:17 2016 +0100
@@ -45,7 +45,7 @@
         OutputAnalyzer output = new OutputAnalyzer(pb.start());
         output.shouldContain("-XX:+PrintGC is deprecated. Will use -Xlog:gc instead.");
         output.shouldNotContain("PrintGCDetails");
-        output.stdoutShouldMatch("\\[info.*\\]\\[gc\\]");
+        output.stdoutShouldMatch("\\[info.*\\]\\[gc *\\]");
         output.stdoutShouldNotMatch("\\[info.*\\]\\[gc\\,");
         output.shouldHaveExitValue(0);
     }
@@ -55,7 +55,7 @@
         OutputAnalyzer output = new OutputAnalyzer(pb.start());
         output.shouldContain("-XX:+PrintGCDetails is deprecated. Will use -Xlog:gc* instead.");
         output.shouldNotContain("PrintGC is deprecated");
-        output.stdoutShouldMatch("\\[info.*\\]\\[gc\\]");
+        output.stdoutShouldMatch("\\[info.*\\]\\[gc *\\]");
         output.stdoutShouldMatch("\\[info.*\\]\\[gc\\,");
         output.shouldHaveExitValue(0);
     }
@@ -67,13 +67,13 @@
         output.shouldContain("-Xloggc is deprecated. Will use -Xlog:gc:gc-test.log instead.");
         output.shouldNotContain("PrintGCDetails");
         output.shouldNotContain("PrintGC");
-        output.stdoutShouldNotMatch("\\[info.*\\]\\[gc\\]");
+        output.stdoutShouldNotMatch("\\[info.*\\]\\[gc *\\]");
         output.stdoutShouldNotMatch("\\[info.*\\]\\[gc\\,");
         output.shouldHaveExitValue(0);
         String lines = Files.lines(Paths.get(fileName)).collect(Collectors.joining());
         System.out.println("lines: " + lines);
         OutputAnalyzer outputLog = new OutputAnalyzer(lines, "");
-        outputLog.stdoutShouldMatch("\\[info.*\\]\\[gc\\]");
+        outputLog.stdoutShouldMatch("\\[info.*\\]\\[gc *\\]");
         outputLog.stdoutShouldNotMatch("\\[info.*\\]\\[gc\\,");
     }
 
@@ -84,12 +84,12 @@
         output.shouldContain("-XX:+PrintGCDetails is deprecated. Will use -Xlog:gc* instead.");
         output.shouldContain("-Xloggc is deprecated. Will use -Xlog:gc:gc-test.log instead.");
         output.shouldNotContain("PrintGC is deprecated");
-        output.stdoutShouldNotMatch("\\[info.*\\]\\[gc\\]");
+        output.stdoutShouldNotMatch("\\[info.*\\]\\[gc *\\]");
         output.stdoutShouldNotMatch("\\[info.*\\]\\[gc\\,");
         output.shouldHaveExitValue(0);
         String lines = Files.lines(Paths.get(fileName)).collect(Collectors.joining());
         OutputAnalyzer outputLog = new OutputAnalyzer(lines, "");
-        outputLog.stdoutShouldMatch("\\[info.*\\]\\[gc\\]");
+        outputLog.stdoutShouldMatch("\\[info.*\\]\\[gc *\\]");
         outputLog.stdoutShouldMatch("\\[info.*\\]\\[gc\\,");
     }