# HG changeset patch # User Christian Haeubl # Date 1328897268 28800 # Node ID 35ca3ade314d5e0b62b78b28697c81cd3adeaac5 # Parent daba89671d29c0d28a1c356f55330ff723fc8c66 enabled nmethod statistics for product build diff -r daba89671d29 -r 35ca3ade314d graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/ri/HotSpotProfilingInfo.java --- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/ri/HotSpotProfilingInfo.java Thu Feb 09 18:36:11 2012 -0800 +++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/ri/HotSpotProfilingInfo.java Fri Feb 10 10:07:48 2012 -0800 @@ -34,6 +34,7 @@ * */ private static final long serialVersionUID = -8307682725047864875L; + private static final DebugMetric metricInsufficentSpace = Debug.metric("InsufficientSpaceForProfilingData"); private int position; private int hintPosition; @@ -111,7 +112,7 @@ if (!methodData.isWithin(currentPosition)) { exceptionPossiblyNotRecorded = true; - Debug.metric("InsufficientSpaceForProfilingData").increment(); + metricInsufficentSpace.increment(); } } diff -r daba89671d29 -r 35ca3ade314d src/share/vm/code/nmethod.cpp --- a/src/share/vm/code/nmethod.cpp Thu Feb 09 18:36:11 2012 -0800 +++ b/src/share/vm/code/nmethod.cpp Fri Feb 10 10:07:48 2012 -0800 @@ -119,7 +119,6 @@ // PrintC1Statistics, PrintOptoStatistics, LogVMOutput, and LogCompilation. // (In the latter two cases, they like other stats are printed to the log only.) -#ifndef PRODUCT // These variables are put into one block to reduce relocations // and make it simpler to print from the debugger. static @@ -209,7 +208,6 @@ pc_desc_tests, pc_desc_searches, pc_desc_adds); } } nmethod_stats; -#endif //PRODUCT //--------------------------------------------------------------------------------- @@ -512,7 +510,7 @@ code_buffer, frame_size, basic_lock_owner_sp_offset, basic_lock_sp_offset, oop_maps); - NOT_PRODUCT(if (nm != NULL) nmethod_stats.note_native_nmethod(nm)); + if (nm != NULL) nmethod_stats.note_native_nmethod(nm); if (PrintAssembly && nm != NULL) Disassembler::decode(nm); } @@ -545,7 +543,7 @@ nm = new (nmethod_size) nmethod(method(), nmethod_size, &offsets, code_buffer, frame_size); - NOT_PRODUCT(if (nm != NULL) nmethod_stats.note_nmethod(nm)); + if (nm != NULL) nmethod_stats.note_nmethod(nm); if (PrintAssembly && nm != NULL) Disassembler::decode(nm); } @@ -612,7 +610,7 @@ instanceKlass::cast(klass)->add_dependent_nmethod(nm); } } - NOT_PRODUCT(if (nm != NULL) nmethod_stats.note_nmethod(nm)); + if (nm != NULL) nmethod_stats.note_nmethod(nm); if (PrintAssembly && nm != NULL) Disassembler::decode(nm); } @@ -2832,6 +2830,8 @@ ImplicitExceptionTable(this).print(code_begin()); } +#endif // PRODUCT + void nmethod::print_statistics() { ttyLocker ttyl; if (xtty != NULL) xtty->head("statistics type='nmethod'"); @@ -2842,5 +2842,3 @@ Dependencies::print_statistics(); if (xtty != NULL) xtty->tail("statistics"); } - -#endif // PRODUCT diff -r daba89671d29 -r 35ca3ade314d src/share/vm/code/nmethod.hpp --- a/src/share/vm/code/nmethod.hpp Thu Feb 09 18:36:11 2012 -0800 +++ b/src/share/vm/code/nmethod.hpp Fri Feb 10 10:07:48 2012 -0800 @@ -643,7 +643,7 @@ // Prints a comment for one native instruction (reloc info, pc desc) void print_code_comment_on(outputStream* st, int column, address begin, address end); - static void print_statistics() PRODUCT_RETURN; + static void print_statistics(); // Compiler task identification. Note that all OSR methods // are numbered in an independent sequence if CICountOSR is true, diff -r daba89671d29 -r 35ca3ade314d src/share/vm/runtime/globals.hpp --- a/src/share/vm/runtime/globals.hpp Thu Feb 09 18:36:11 2012 -0800 +++ b/src/share/vm/runtime/globals.hpp Fri Feb 10 10:07:48 2012 -0800 @@ -922,6 +922,9 @@ diagnostic(ccstr, PrintAssemblyOptions, NULL, \ "Options string passed to disassembler.so") \ \ + product(bool, PrintNMethodStatistics, false, \ + "Print a summary statistic for the generated nmethods") \ + \ diagnostic(bool, PrintNMethods, false, \ "Print assembly code for nmethods when generated") \ \ diff -r daba89671d29 -r 35ca3ade314d src/share/vm/runtime/java.cpp --- a/src/share/vm/runtime/java.cpp Thu Feb 09 18:36:11 2012 -0800 +++ b/src/share/vm/runtime/java.cpp Fri Feb 10 10:07:48 2012 -0800 @@ -250,9 +250,12 @@ Runtime1::print_statistics(); Deoptimization::print_statistics(); SharedRuntime::print_statistics(); + } +#endif /* COMPILER1 */ + + if(PrintNMethodStatistics) { nmethod::print_statistics(); } -#endif /* COMPILER1 */ #ifdef COMPILER2 if ((PrintOptoStatistics || LogVMOutput || LogCompilation) && UseCompiler) { @@ -364,6 +367,9 @@ if (CITime) { CompileBroker::print_times(); } + if(PrintNMethodStatistics) { + nmethod::print_statistics(); + } #ifdef COMPILER2 if (PrintPreciseBiasedLockingStatistics) { OptoRuntime::print_named_counters();