< prev index next >

src/share/vm/runtime/java.cpp

Print this page




  63 #include "utilities/globalDefinitions.hpp"
  64 #include "utilities/histogram.hpp"
  65 #include "utilities/macros.hpp"
  66 #include "utilities/vmError.hpp"
  67 #if INCLUDE_ALL_GCS
  68 #include "gc/cms/concurrentMarkSweepThread.hpp"
  69 #include "gc/parallel/psScavenge.hpp"
  70 #endif // INCLUDE_ALL_GCS
  71 #ifdef COMPILER1
  72 #include "c1/c1_Compiler.hpp"
  73 #include "c1/c1_Runtime1.hpp"
  74 #endif
  75 #ifdef COMPILER2
  76 #include "code/compiledIC.hpp"
  77 #include "compiler/methodLiveness.hpp"
  78 #include "opto/compile.hpp"
  79 #include "opto/indexSet.hpp"
  80 #include "opto/runtime.hpp"
  81 #endif
  82 
  83 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
  84 
  85 GrowableArray<Method*>* collected_profiled_methods;
  86 
  87 int compare_methods(Method** a, Method** b) {
  88   // %%% there can be 32-bit overflow here
  89   return ((*b)->invocation_count() + (*b)->compiled_invocation_count())
  90        - ((*a)->invocation_count() + (*a)->compiled_invocation_count());
  91 }
  92 
  93 void collect_profiled_methods(Method* m) {
  94   Thread* thread = Thread::current();
  95   // This HandleMark prevents a huge amount of handles from being added
  96   // to the metadata_handles() array on the thread.
  97   HandleMark hm(thread);
  98   methodHandle mh(thread, m);
  99   if ((m->method_data() != NULL) &&
 100       (PrintMethodData || CompilerOracle::should_print(mh))) {
 101     collected_profiled_methods->push(m);
 102   }
 103 }
 104 


 142 
 143 GrowableArray<Method*>* collected_invoked_methods;
 144 
 145 void collect_invoked_methods(Method* m) {
 146   if (m->invocation_count() + m->compiled_invocation_count() >= 1 ) {
 147     collected_invoked_methods->push(m);
 148   }
 149 }
 150 
 151 
 152 
 153 
 154 void print_method_invocation_histogram() {
 155   ResourceMark rm;
 156   HandleMark hm;
 157   collected_invoked_methods = new GrowableArray<Method*>(1024);
 158   SystemDictionary::methods_do(collect_invoked_methods);
 159   collected_invoked_methods->sort(&compare_methods);
 160   //
 161   tty->cr();
 162   tty->print_cr("Histogram Over MethodOop Invocation Counters (cutoff = %d):", MethodHistogramCutoff);
 163   tty->cr();
 164   tty->print_cr("____Count_(I+C)____Method________________________Module_________________");
 165   unsigned total = 0, int_total = 0, comp_total = 0, static_total = 0, final_total = 0,
 166       synch_total = 0, nativ_total = 0, acces_total = 0;
 167   for (int index = 0; index < collected_invoked_methods->length(); index++) {
 168     Method* m = collected_invoked_methods->at(index);
 169     int c = m->invocation_count() + m->compiled_invocation_count();
 170     if (c >= MethodHistogramCutoff) m->print_invocation_count();
 171     int_total  += m->invocation_count();
 172     comp_total += m->compiled_invocation_count();
 173     if (m->is_final())        final_total  += c;
 174     if (m->is_static())       static_total += c;
 175     if (m->is_synchronized()) synch_total  += c;
 176     if (m->is_native())       nativ_total  += c;
 177     if (m->is_accessor())     acces_total  += c;
 178   }
 179   tty->cr();
 180   total = int_total + comp_total;
 181   tty->print_cr("Invocations summary:");
 182   tty->print_cr("\t%9d (%4.1f%%) interpreted",  int_total,    100.0 * int_total    / total);


 317     tty->print("allocation stats: ");
 318     alloc_stats.print();
 319     tty->cr();
 320   }
 321 
 322   if (PrintSystemDictionaryAtExit) {
 323     SystemDictionary::print();
 324   }
 325 
 326   if (LogTouchedMethods && PrintTouchedMethodsAtExit) {
 327     Method::print_touched_methods(tty);
 328   }
 329 
 330   if (PrintBiasedLockingStatistics) {
 331     BiasedLocking::print_counters();
 332   }
 333 
 334 #ifdef ENABLE_ZAP_DEAD_LOCALS
 335 #ifdef COMPILER2
 336   if (ZapDeadCompiledLocals) {
 337     tty->print_cr("Compile::CompiledZap_count = %d", Compile::CompiledZap_count);
 338     tty->print_cr("OptoRuntime::ZapDeadCompiledLocals_count = %d", OptoRuntime::ZapDeadCompiledLocals_count);
 339   }
 340 #endif // COMPILER2
 341 #endif // ENABLE_ZAP_DEAD_LOCALS
 342   // Native memory tracking data
 343   if (PrintNMTStatistics) {
 344     MemTracker::final_report(tty);
 345   }
 346 }
 347 
 348 #else // PRODUCT MODE STATISTICS
 349 
 350 void print_statistics() {
 351 
 352   if (PrintMethodData) {
 353     print_method_profiling_data();
 354   }
 355 
 356   if (CITime) {
 357     CompileBroker::print_times();




  63 #include "utilities/globalDefinitions.hpp"
  64 #include "utilities/histogram.hpp"
  65 #include "utilities/macros.hpp"
  66 #include "utilities/vmError.hpp"
  67 #if INCLUDE_ALL_GCS
  68 #include "gc/cms/concurrentMarkSweepThread.hpp"
  69 #include "gc/parallel/psScavenge.hpp"
  70 #endif // INCLUDE_ALL_GCS
  71 #ifdef COMPILER1
  72 #include "c1/c1_Compiler.hpp"
  73 #include "c1/c1_Runtime1.hpp"
  74 #endif
  75 #ifdef COMPILER2
  76 #include "code/compiledIC.hpp"
  77 #include "compiler/methodLiveness.hpp"
  78 #include "opto/compile.hpp"
  79 #include "opto/indexSet.hpp"
  80 #include "opto/runtime.hpp"
  81 #endif
  82 


  83 GrowableArray<Method*>* collected_profiled_methods;
  84 
  85 int compare_methods(Method** a, Method** b) {
  86   // %%% there can be 32-bit overflow here
  87   return ((*b)->invocation_count() + (*b)->compiled_invocation_count())
  88        - ((*a)->invocation_count() + (*a)->compiled_invocation_count());
  89 }
  90 
  91 void collect_profiled_methods(Method* m) {
  92   Thread* thread = Thread::current();
  93   // This HandleMark prevents a huge amount of handles from being added
  94   // to the metadata_handles() array on the thread.
  95   HandleMark hm(thread);
  96   methodHandle mh(thread, m);
  97   if ((m->method_data() != NULL) &&
  98       (PrintMethodData || CompilerOracle::should_print(mh))) {
  99     collected_profiled_methods->push(m);
 100   }
 101 }
 102 


 140 
 141 GrowableArray<Method*>* collected_invoked_methods;
 142 
 143 void collect_invoked_methods(Method* m) {
 144   if (m->invocation_count() + m->compiled_invocation_count() >= 1 ) {
 145     collected_invoked_methods->push(m);
 146   }
 147 }
 148 
 149 
 150 
 151 
 152 void print_method_invocation_histogram() {
 153   ResourceMark rm;
 154   HandleMark hm;
 155   collected_invoked_methods = new GrowableArray<Method*>(1024);
 156   SystemDictionary::methods_do(collect_invoked_methods);
 157   collected_invoked_methods->sort(&compare_methods);
 158   //
 159   tty->cr();
 160   tty->print_cr("Histogram Over MethodOop Invocation Counters (cutoff = " INTX_FORMAT "):", MethodHistogramCutoff);
 161   tty->cr();
 162   tty->print_cr("____Count_(I+C)____Method________________________Module_________________");
 163   unsigned total = 0, int_total = 0, comp_total = 0, static_total = 0, final_total = 0,
 164       synch_total = 0, nativ_total = 0, acces_total = 0;
 165   for (int index = 0; index < collected_invoked_methods->length(); index++) {
 166     Method* m = collected_invoked_methods->at(index);
 167     int c = m->invocation_count() + m->compiled_invocation_count();
 168     if (c >= MethodHistogramCutoff) m->print_invocation_count();
 169     int_total  += m->invocation_count();
 170     comp_total += m->compiled_invocation_count();
 171     if (m->is_final())        final_total  += c;
 172     if (m->is_static())       static_total += c;
 173     if (m->is_synchronized()) synch_total  += c;
 174     if (m->is_native())       nativ_total  += c;
 175     if (m->is_accessor())     acces_total  += c;
 176   }
 177   tty->cr();
 178   total = int_total + comp_total;
 179   tty->print_cr("Invocations summary:");
 180   tty->print_cr("\t%9d (%4.1f%%) interpreted",  int_total,    100.0 * int_total    / total);


 315     tty->print("allocation stats: ");
 316     alloc_stats.print();
 317     tty->cr();
 318   }
 319 
 320   if (PrintSystemDictionaryAtExit) {
 321     SystemDictionary::print();
 322   }
 323 
 324   if (LogTouchedMethods && PrintTouchedMethodsAtExit) {
 325     Method::print_touched_methods(tty);
 326   }
 327 
 328   if (PrintBiasedLockingStatistics) {
 329     BiasedLocking::print_counters();
 330   }
 331 
 332 #ifdef ENABLE_ZAP_DEAD_LOCALS
 333 #ifdef COMPILER2
 334   if (ZapDeadCompiledLocals) {
 335     tty->print_cr("Compile::CompiledZap_count = %d", Compile::CompiledZap_count());
 336     tty->print_cr("OptoRuntime::ZapDeadCompiledLocals_count = %d", OptoRuntime::ZapDeadCompiledLocals_count);
 337   }
 338 #endif // COMPILER2
 339 #endif // ENABLE_ZAP_DEAD_LOCALS
 340   // Native memory tracking data
 341   if (PrintNMTStatistics) {
 342     MemTracker::final_report(tty);
 343   }
 344 }
 345 
 346 #else // PRODUCT MODE STATISTICS
 347 
 348 void print_statistics() {
 349 
 350   if (PrintMethodData) {
 351     print_method_profiling_data();
 352   }
 353 
 354   if (CITime) {
 355     CompileBroker::print_times();


< prev index next >