8214526: Change CodeHeap State Analytics control from UL to Print*
authorlucy
Tue, 04 Dec 2018 11:57:18 +0100
changeset 52815 10bb941d7fd4
parent 52814 abccada595dd
child 52816 03253c32d8e7
8214526: Change CodeHeap State Analytics control from UL to Print* Reviewed-by: coleenp, kvn, stuefe, thartmann
src/hotspot/share/code/codeCache.cpp
src/hotspot/share/code/codeHeapState.cpp
src/hotspot/share/runtime/globals.hpp
src/hotspot/share/runtime/java.cpp
--- a/src/hotspot/share/code/codeCache.cpp	Tue Dec 04 09:30:10 2018 +0100
+++ b/src/hotspot/share/code/codeCache.cpp	Tue Dec 04 11:57:18 2018 +0100
@@ -1411,8 +1411,7 @@
     }
 
     if (heap->full_count() == 0) {
-      LogTarget(Debug, codecache) lt;
-      if (lt.is_enabled()) {
+      if (PrintCodeHeapAnalytics) {
         CompileBroker::print_heapinfo(tty, "all", "4096"); // details, may be a lot!
       }
     }
--- a/src/hotspot/share/code/codeHeapState.cpp	Tue Dec 04 09:30:10 2018 +0100
+++ b/src/hotspot/share/code/codeHeapState.cpp	Tue Dec 04 11:57:18 2018 +0100
@@ -38,7 +38,7 @@
 // Aggregation condenses the information of a piece of the CodeHeap
 // (4096 bytes by default) into an analysis granule. These granules
 // contain enough detail to gain initial insight while keeping the
-// internal sttructure sizes in check.
+// internal structure sizes in check.
 //
 // The CodeHeap is a living thing. Therefore, the aggregate is collected
 // under the CodeCache_lock. The subsequent print steps are only locked
@@ -63,15 +63,12 @@
 //
 // If you are (only) interested in how the CodeHeap looks like after running
 // a sample workload, you can use the command line option
-//   -Xlog:codecache=Trace
+//   -XX:+PrintCodeHeapAnalytics
+// It will cause a full analysis to be written to tty. In addition, a full
+// analysis will be written the first time a "CodeCache full" condition is
+// detected.
 //
-// To see the CodeHeap state in case of a "CodeCache full" condition, start the
-// VM with the
-//   -Xlog:codecache=Debug
-// command line option. It will produce output only for the first time the
-// condition is recognized.
-//
-// Both command line option variants produce output identical to the jcmd function
+// The command line option produces output identical to the jcmd function
 //   jcmd <pid> Compiler.CodeHeap_Analytics all 4096
 // ---------------------------------------------------------------------------------
 
--- a/src/hotspot/share/runtime/globals.hpp	Tue Dec 04 09:30:10 2018 +0100
+++ b/src/hotspot/share/runtime/globals.hpp	Tue Dec 04 11:57:18 2018 +0100
@@ -723,6 +723,9 @@
           "Print the code cache memory usage each time a method is "        \
           "compiled")                                                       \
                                                                             \
+  diagnostic(bool, PrintCodeHeapAnalytics, false,                           \
+          "Print code heap usage statistics on exit and on full condition") \
+                                                                            \
   diagnostic(bool, PrintStubCode, false,                                    \
           "Print generated stub code")                                      \
                                                                             \
--- a/src/hotspot/share/runtime/java.cpp	Tue Dec 04 09:30:10 2018 +0100
+++ b/src/hotspot/share/runtime/java.cpp	Tue Dec 04 11:57:18 2018 +0100
@@ -318,8 +318,7 @@
 
   // CodeHeap State Analytics.
   // Does also call NMethodSweeper::print(tty)
-  LogTarget(Trace, codecache) lt;
-  if (lt.is_enabled()) {
+  if (PrintCodeHeapAnalytics) {
     CompileBroker::print_heapinfo(NULL, "all", "4096"); // details
   } else if (PrintMethodFlushingStatistics) {
     NMethodSweeper::print(tty);
@@ -387,8 +386,7 @@
 
   // CodeHeap State Analytics.
   // Does also call NMethodSweeper::print(tty)
-  LogTarget(Trace, codecache) lt;
-  if (lt.is_enabled()) {
+  if (PrintCodeHeapAnalytics) {
     CompileBroker::print_heapinfo(NULL, "all", "4096"); // details
   } else if (PrintMethodFlushingStatistics) {
     NMethodSweeper::print(tty);