Print heap steps more verbosely, but also less frequently epsilon-gc-branch
authorshade
Thu, 31 May 2018 15:44:47 +0200
branchepsilon-gc-branch
changeset 56642 224bfdcc6457
parent 56641 ecdf81479e0f
child 56666 80185413d7fd
Print heap steps more verbosely, but also less frequently
src/hotspot/share/gc/epsilon/epsilonHeap.cpp
src/hotspot/share/gc/epsilon/epsilon_globals.hpp
test/hotspot/jtreg/gc/epsilon/TestPrintHeapSteps.java
--- a/src/hotspot/share/gc/epsilon/epsilonHeap.cpp	Thu May 31 15:43:02 2018 +0200
+++ b/src/hotspot/share/gc/epsilon/epsilonHeap.cpp	Thu May 31 15:44:47 2018 +0200
@@ -48,7 +48,7 @@
   // Precompute hot fields
   _max_tlab_size = MIN2(CollectedHeap::max_tlab_size(), EpsilonMaxTLABSize / HeapWordSize);
   _step_counter_update = MIN2<size_t>(max_byte_size / 16, EpsilonUpdateCountersStep);
-  _step_heap_print = (EpsilonPrintHeapStep == 0) ? SIZE_MAX : (max_byte_size / EpsilonPrintHeapStep);
+  _step_heap_print = (EpsilonPrintHeapSteps == 0) ? SIZE_MAX : (max_byte_size / EpsilonPrintHeapSteps);
   _decay_time_ns = (int64_t) EpsilonTLABDecayTime * NANOSECS_PER_MILLISEC;
 
   // Enable monitoring
@@ -158,8 +158,10 @@
   {
     size_t last = _last_heap_print;
     if ((used - last >= _step_heap_print) && Atomic::cmpxchg(used, &_last_heap_print, last) == last) {
-      log_info(gc)("Heap: " SIZE_FORMAT "M reserved, " SIZE_FORMAT "M committed, " SIZE_FORMAT "M used",
-                   max_capacity() / M, capacity() / M, used / M);
+      log_info(gc)("Heap: " SIZE_FORMAT "M reserved, " SIZE_FORMAT "M (%.2f%%) committed, " SIZE_FORMAT "M (%.2f%%) used",
+                   max_capacity() / M,
+                   capacity() / M, capacity() * 100.0 / max_capacity(),
+                   used / M, used * 100.0 / max_capacity());
     }
   }
 
--- a/src/hotspot/share/gc/epsilon/epsilon_globals.hpp	Thu May 31 15:43:02 2018 +0200
+++ b/src/hotspot/share/gc/epsilon/epsilon_globals.hpp	Thu May 31 15:44:47 2018 +0200
@@ -45,13 +45,13 @@
                     constraint,                                             \
                     writeable)                                              \
                                                                             \
-  experimental(size_t, EpsilonPrintHeapStep, 100,                           \
+  experimental(size_t, EpsilonPrintHeapSteps, 20,                           \
           "Print heap occupancy stats with this number of steps. "          \
           "0 turns the printing off.")                                      \
           range(0, max_intx)                                                \
                                                                             \
   experimental(size_t, EpsilonUpdateCountersStep, 1 * M,                    \
-          "Update heap heap occupancy counters after allocating this much " \
+          "Update heap occupancy counters after allocating this much "      \
           "memory. Higher values would make allocations faster at "         \
           "the expense of lower resolution in heap counters.")              \
           range(1, max_intx)                                                \
--- a/test/hotspot/jtreg/gc/epsilon/TestPrintHeapSteps.java	Thu May 31 15:43:02 2018 +0200
+++ b/test/hotspot/jtreg/gc/epsilon/TestPrintHeapSteps.java	Thu May 31 15:44:47 2018 +0200
@@ -26,9 +26,9 @@
  * @key gc
  * @requires vm.gc.Epsilon
  * @summary Tests -XX:EpsilonPrintHeapSteps works
- * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC -Xlog:gc -XX:EpsilonPrintHeapStep=0    TestPrintHeapSteps
- * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC -Xlog:gc -XX:EpsilonPrintHeapStep=1    TestPrintHeapSteps
- * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC -Xlog:gc -XX:EpsilonPrintHeapStep=1000 TestPrintHeapSteps
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC -Xlog:gc -XX:EpsilonPrintHeapSteps=0    TestPrintHeapSteps
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC -Xlog:gc -XX:EpsilonPrintHeapSteps=1    TestPrintHeapSteps
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC -Xlog:gc -XX:EpsilonPrintHeapSteps=1000 TestPrintHeapSteps
  */
 
 public class TestPrintHeapSteps {