src/share/vm/runtime/java.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/runtime

src/share/vm/runtime/java.cpp

Print this page
rev 5240 : 8023657: New type profiling points: arguments to call
Summary: x86 interpreter and c1 type profiling for arguments at calls
Reviewed-by:


 105 // Statistics printing (method invocation histogram)
 106 
 107 GrowableArray<Method*>* collected_invoked_methods;
 108 
 109 void collect_invoked_methods(Method* m) {
 110   if (m->invocation_count() + m->compiled_invocation_count() >= 1 ) {
 111     collected_invoked_methods->push(m);
 112   }
 113 }
 114 
 115 
 116 GrowableArray<Method*>* collected_profiled_methods;
 117 
 118 void collect_profiled_methods(Method* m) {
 119   Thread* thread = Thread::current();
 120   // This HandleMark prevents a huge amount of handles from being added
 121   // to the metadata_handles() array on the thread.
 122   HandleMark hm(thread);
 123   methodHandle mh(thread, m);
 124   if ((m->method_data() != NULL) &&
 125       (PrintMethodData || CompilerOracle::should_print(mh))) {
 126     collected_profiled_methods->push(m);
 127   }
 128 }
 129 
 130 
 131 int compare_methods(Method** a, Method** b) {
 132   // %%% there can be 32-bit overflow here
 133   return ((*b)->invocation_count() + (*b)->compiled_invocation_count())
 134        - ((*a)->invocation_count() + (*a)->compiled_invocation_count());
 135 }
 136 
 137 
 138 void print_method_invocation_histogram() {
 139   ResourceMark rm;
 140   HandleMark hm;
 141   collected_invoked_methods = new GrowableArray<Method*>(1024);
 142   SystemDictionary::methods_do(collect_invoked_methods);
 143   collected_invoked_methods->sort(&compare_methods);
 144   //
 145   tty->cr();


 166   tty->print_cr("\t%9d (%4.1f%%) interpreted",  int_total,    100.0 * int_total    / total);
 167   tty->print_cr("\t%9d (%4.1f%%) compiled",     comp_total,   100.0 * comp_total   / total);
 168   tty->print_cr("\t%9d (100%%)  total",         total);
 169   tty->print_cr("\t%9d (%4.1f%%) synchronized", synch_total,  100.0 * synch_total  / total);
 170   tty->print_cr("\t%9d (%4.1f%%) final",        final_total,  100.0 * final_total  / total);
 171   tty->print_cr("\t%9d (%4.1f%%) static",       static_total, 100.0 * static_total / total);
 172   tty->print_cr("\t%9d (%4.1f%%) native",       nativ_total,  100.0 * nativ_total  / total);
 173   tty->print_cr("\t%9d (%4.1f%%) accessor",     acces_total,  100.0 * acces_total  / total);
 174   tty->cr();
 175   SharedRuntime::print_call_statistics(comp_total);
 176 }
 177 
 178 void print_method_profiling_data() {
 179   ResourceMark rm;
 180   HandleMark hm;
 181   collected_profiled_methods = new GrowableArray<Method*>(1024);
 182   SystemDictionary::methods_do(collect_profiled_methods);
 183   collected_profiled_methods->sort(&compare_methods);
 184 
 185   int count = collected_profiled_methods->length();

 186   if (count > 0) {
 187     for (int index = 0; index < count; index++) {
 188       Method* m = collected_profiled_methods->at(index);

 189       ttyLocker ttyl;
 190       tty->print_cr("------------------------------------------------------------------------");
 191       //m->print_name(tty);
 192       m->print_invocation_count();
 193       tty->cr();
 194       m->print_codes();
 195     }




 196     tty->print_cr("------------------------------------------------------------------------");



 197   }
 198 }
 199 
 200 void print_bytecode_count() {
 201   if (CountBytecodes || TraceBytecodes || StopInterpreterAt) {
 202     tty->print_cr("[BytecodeCounter::counter_value = %d]", BytecodeCounter::counter_value());
 203   }
 204 }
 205 
 206 AllocStats alloc_stats;
 207 
 208 
 209 
 210 // General statistics printing (profiling ...)
 211 
 212 void print_statistics() {
 213 
 214 #ifdef ASSERT
 215 
 216   if (CountRuntimeCalls) {




 105 // Statistics printing (method invocation histogram)
 106 
 107 GrowableArray<Method*>* collected_invoked_methods;
 108 
 109 void collect_invoked_methods(Method* m) {
 110   if (m->invocation_count() + m->compiled_invocation_count() >= 1 ) {
 111     collected_invoked_methods->push(m);
 112   }
 113 }
 114 
 115 
 116 GrowableArray<Method*>* collected_profiled_methods;
 117 
 118 void collect_profiled_methods(Method* m) {
 119   Thread* thread = Thread::current();
 120   // This HandleMark prevents a huge amount of handles from being added
 121   // to the metadata_handles() array on the thread.
 122   HandleMark hm(thread);
 123   methodHandle mh(thread, m);
 124   if ((m->method_data() != NULL) &&
 125       (PrintMethodData || PrintMethodDataStats || CompilerOracle::should_print(mh))) {
 126     collected_profiled_methods->push(m);
 127   }
 128 }
 129 
 130 
 131 int compare_methods(Method** a, Method** b) {
 132   // %%% there can be 32-bit overflow here
 133   return ((*b)->invocation_count() + (*b)->compiled_invocation_count())
 134        - ((*a)->invocation_count() + (*a)->compiled_invocation_count());
 135 }
 136 
 137 
 138 void print_method_invocation_histogram() {
 139   ResourceMark rm;
 140   HandleMark hm;
 141   collected_invoked_methods = new GrowableArray<Method*>(1024);
 142   SystemDictionary::methods_do(collect_invoked_methods);
 143   collected_invoked_methods->sort(&compare_methods);
 144   //
 145   tty->cr();


 166   tty->print_cr("\t%9d (%4.1f%%) interpreted",  int_total,    100.0 * int_total    / total);
 167   tty->print_cr("\t%9d (%4.1f%%) compiled",     comp_total,   100.0 * comp_total   / total);
 168   tty->print_cr("\t%9d (100%%)  total",         total);
 169   tty->print_cr("\t%9d (%4.1f%%) synchronized", synch_total,  100.0 * synch_total  / total);
 170   tty->print_cr("\t%9d (%4.1f%%) final",        final_total,  100.0 * final_total  / total);
 171   tty->print_cr("\t%9d (%4.1f%%) static",       static_total, 100.0 * static_total / total);
 172   tty->print_cr("\t%9d (%4.1f%%) native",       nativ_total,  100.0 * nativ_total  / total);
 173   tty->print_cr("\t%9d (%4.1f%%) accessor",     acces_total,  100.0 * acces_total  / total);
 174   tty->cr();
 175   SharedRuntime::print_call_statistics(comp_total);
 176 }
 177 
 178 void print_method_profiling_data() {
 179   ResourceMark rm;
 180   HandleMark hm;
 181   collected_profiled_methods = new GrowableArray<Method*>(1024);
 182   SystemDictionary::methods_do(collect_profiled_methods);
 183   collected_profiled_methods->sort(&compare_methods);
 184 
 185   int count = collected_profiled_methods->length();
 186   int total_size = 0;
 187   if (count > 0) {
 188     for (int index = 0; index < count; index++) {
 189       Method* m = collected_profiled_methods->at(index);
 190       if (PrintMethodData || CompilerOracle::should_print(m)) {
 191         ttyLocker ttyl;
 192         tty->print_cr("------------------------------------------------------------------------");
 193         //m->print_name(tty);
 194         m->print_invocation_count();
 195         tty->cr();
 196         m->print_codes();
 197       }
 198       if (PrintMethodDataStats) {
 199         total_size += m->method_data()->size_in_bytes();
 200       }
 201     }
 202     tty->print_cr("------------------------------------------------------------------------");
 203   }
 204   if (PrintMethodDataStats) {
 205     tty->print_cr("Total MDO space = %d", total_size);
 206   }
 207 }
 208 
 209 void print_bytecode_count() {
 210   if (CountBytecodes || TraceBytecodes || StopInterpreterAt) {
 211     tty->print_cr("[BytecodeCounter::counter_value = %d]", BytecodeCounter::counter_value());
 212   }
 213 }
 214 
 215 AllocStats alloc_stats;
 216 
 217 
 218 
 219 // General statistics printing (profiling ...)
 220 
 221 void print_statistics() {
 222 
 223 #ifdef ASSERT
 224 
 225   if (CountRuntimeCalls) {


src/share/vm/runtime/java.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File