src/share/vm/runtime/java.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File
*** old/src/share/vm/runtime/java.cpp Thu Mar 20 17:15:29 2014
--- new/src/share/vm/runtime/java.cpp Thu Mar 20 17:15:29 2014
*** 96,120 ****
--- 96,113 ----
#include "opto/indexSet.hpp"
#include "opto/runtime.hpp"
#endif
#ifndef PRODUCT
// Statistics printing (method invocation histogram)
GrowableArray<Method*>* collected_invoked_methods;
+ GrowableArray<Method*>* collected_profiled_methods;
! void collect_invoked_methods(Method* m) {
if (m->invocation_count() + m->compiled_invocation_count() >= 1 ) {
! collected_invoked_methods->push(m);
}
! int compare_methods(Method** a, Method** b) {
+ // %%% there can be 32-bit overflow here
! return (*b)->invocation_count() - (*a)->invocation_count();
}
GrowableArray<Method*>* collected_profiled_methods;
void collect_profiled_methods(Method* m) {
Thread* thread = Thread::current();
// This HandleMark prevents a huge amount of handles from being added
// to the metadata_handles() array on the thread.
HandleMark hm(thread);
*** 123,140 ****
--- 116,173 ----
(PrintMethodData || CompilerOracle::should_print(mh))) {
collected_profiled_methods->push(m);
}
}
+ void print_method_profiling_data() {
+ if (ProfileInterpreter COMPILER1_PRESENT(|| C1UpdateMethodData)) {
+ ResourceMark rm;
+ HandleMark hm;
+ collected_profiled_methods = new GrowableArray<Method*>(1024);
+ ClassLoaderDataGraph::methods_do(collect_profiled_methods);
+ collected_profiled_methods->sort(&compare_methods);
int compare_methods(Method** a, Method** b) {
// %%% there can be 32-bit overflow here
return ((*b)->invocation_count() + (*b)->compiled_invocation_count())
- ((*a)->invocation_count() + (*a)->compiled_invocation_count());
+ int count = collected_profiled_methods->length();
+ int total_size = 0;
+ if (count > 0) {
+ for (int index = 0; index < count; index++) {
+ Method* m = collected_profiled_methods->at(index);
+ ttyLocker ttyl;
+ tty->print_cr("------------------------------------------------------------------------");
+ m->print_invocation_count();
+ tty->print_cr(" mdo size: %d bytes", m->method_data()->size_in_bytes());
+ tty->cr();
+ // Dump data on parameters if any
+ if (m->method_data() != NULL && m->method_data()->parameters_type_data() != NULL) {
+ tty->fill_to(2);
+ m->method_data()->parameters_type_data()->print_data_on(tty);
+ }
+ m->print_codes();
+ total_size += m->method_data()->size_in_bytes();
+ }
+ tty->print_cr("------------------------------------------------------------------------");
+ tty->print_cr("Total MDO size: %d bytes", total_size);
+ }
+ }
}
+ #ifndef PRODUCT
+
+ // Statistics printing (method invocation histogram)
+
+ GrowableArray<Method*>* collected_invoked_methods;
+
+ void collect_invoked_methods(Method* m) {
+ if (m->invocation_count() + m->compiled_invocation_count() >= 1 ) {
+ collected_invoked_methods->push(m);
+ }
+ }
+
+
+
+
void print_method_invocation_histogram() {
ResourceMark rm;
HandleMark hm;
collected_invoked_methods = new GrowableArray<Method*>(1024);
SystemDictionary::methods_do(collect_invoked_methods);
*** 171,211 ****
--- 204,213 ----
tty->print_cr("\t%9d (%4.1f%%) accessor", acces_total, 100.0 * acces_total / total);
tty->cr();
SharedRuntime::print_call_statistics(comp_total);
}
void print_method_profiling_data() {
ResourceMark rm;
HandleMark hm;
collected_profiled_methods = new GrowableArray<Method*>(1024);
SystemDictionary::methods_do(collect_profiled_methods);
collected_profiled_methods->sort(&compare_methods);
int count = collected_profiled_methods->length();
int total_size = 0;
if (count > 0) {
for (int index = 0; index < count; index++) {
Method* m = collected_profiled_methods->at(index);
ttyLocker ttyl;
tty->print_cr("------------------------------------------------------------------------");
//m->print_name(tty);
m->print_invocation_count();
tty->print_cr(" mdo size: %d bytes", m->method_data()->size_in_bytes());
tty->cr();
// Dump data on parameters if any
if (m->method_data() != NULL && m->method_data()->parameters_type_data() != NULL) {
tty->fill_to(2);
m->method_data()->parameters_type_data()->print_data_on(tty);
}
m->print_codes();
total_size += m->method_data()->size_in_bytes();
}
tty->print_cr("------------------------------------------------------------------------");
tty->print_cr("Total MDO size: %d bytes", total_size);
}
}
void print_bytecode_count() {
if (CountBytecodes || TraceBytecodes || StopInterpreterAt) {
tty->print_cr("[BytecodeCounter::counter_value = %d]", BytecodeCounter::counter_value());
}
}
*** 279,291 ****
--- 281,293 ----
#endif // ASSERT
#endif // COMPILER2
if (CountCompiledCalls) {
print_method_invocation_histogram();
}
if (ProfileInterpreter COMPILER1_PRESENT(|| C1UpdateMethodData)) {
+
print_method_profiling_data();
}
+
if (TimeCompiler) {
COMPILER2_PRESENT(Compile::print_timers();)
}
if (TimeCompilationPolicy) {
CompilationPolicy::policy()->print_time();
*** 371,380 ****
--- 373,386 ----
#else // PRODUCT MODE STATISTICS
void print_statistics() {
+ if (PrintMethodData) {
+ print_method_profiling_data();
+ }
+
if (CITime) {
CompileBroker::print_times();
}
if (PrintCodeCache) {
src/share/vm/runtime/java.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File