changeset 19729:f8147c931ce4

Add PrintNMethodsAtLevel option to hotspot
author Tom Rodriguez <tom.rodriguez@oracle.com>
date Mon, 09 Mar 2015 12:43:19 -0700
parents f3eed864acdc
children 6f7cb87ac0fa
files src/share/vm/code/nmethod.cpp src/share/vm/runtime/globals.hpp
diffstat 2 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/code/nmethod.cpp	Mon Mar 09 12:18:19 2015 -0700
+++ b/src/share/vm/code/nmethod.cpp	Mon Mar 09 12:43:19 2015 -0700
@@ -856,7 +856,8 @@
     CodeCache::commit(this);
   }
 
-  if (PrintNMethods || PrintDebugInfo || PrintRelocations || PrintDependencies) {
+  bool printnmethods = PrintNMethods || PrintNMethodsAtLevel == _comp_level;
+  if (printnmethods || PrintDebugInfo || PrintRelocations || PrintDependencies) {
     ttyLocker ttyl;  // keep the following output all in one block
     // This output goes directly to the tty, not the compiler log.
     // To enable tools to match it up with the compilation activity,
@@ -870,7 +871,7 @@
     // print the header part first
     print();
     // then print the requested information
-    if (PrintNMethods) {
+    if (printnmethods) {
       print_code();
     }
     if (PrintRelocations) {
@@ -1014,7 +1015,7 @@
            " entry points must be same for static methods and vice versa");
   }
 
-  bool printnmethods = PrintNMethods
+  bool printnmethods = PrintNMethods || PrintNMethodsAtLevel == _comp_level
     || CompilerOracle::should_print(_method)
     || CompilerOracle::has_option_string(_method, "PrintNMethods");
   if (printnmethods || PrintDebugInfo || PrintRelocations || PrintDependencies || PrintExceptionHandlers) {
--- a/src/share/vm/runtime/globals.hpp	Mon Mar 09 12:18:19 2015 -0700
+++ b/src/share/vm/runtime/globals.hpp	Mon Mar 09 12:43:19 2015 -0700
@@ -993,6 +993,9 @@
   diagnostic(bool, PrintNMethods, false,                                    \
           "Print assembly code for nmethods when generated")                \
                                                                             \
+  diagnostic(intx, PrintNMethodsAtLevel, -1,                                \
+          "Only print code for nmethods at the given compilation level")    \
+                                                                            \
   diagnostic(bool, PrintNativeNMethods, false,                              \
           "Print assembly code for native nmethods when generated")         \
                                                                             \