mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 14:24:46 +02:00
8037970: make PrintMethodData a diagnostic options
Make PrintMethodData a diagnostic options for performance investigation Reviewed-by: kvn, iveresov
This commit is contained in:
parent
fa3b0a8f47
commit
b21d142f01
10 changed files with 83 additions and 142 deletions
|
@ -98,21 +98,14 @@
|
|||
#endif
|
||||
|
||||
|
||||
#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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GrowableArray<Method*>* collected_profiled_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());
|
||||
}
|
||||
|
||||
void collect_profiled_methods(Method* m) {
|
||||
Thread* thread = Thread::current();
|
||||
// This HandleMark prevents a huge amount of handles from being added
|
||||
|
@ -125,14 +118,54 @@ void collect_profiled_methods(Method* 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;
|
||||
|
@ -173,37 +206,6 @@ void print_method_invocation_histogram() {
|
|||
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());
|
||||
|
@ -281,9 +283,9 @@ void print_statistics() {
|
|||
if (CountCompiledCalls) {
|
||||
print_method_invocation_histogram();
|
||||
}
|
||||
if (ProfileInterpreter COMPILER1_PRESENT(|| C1UpdateMethodData)) {
|
||||
print_method_profiling_data();
|
||||
}
|
||||
|
||||
print_method_profiling_data();
|
||||
|
||||
if (TimeCompiler) {
|
||||
COMPILER2_PRESENT(Compile::print_timers();)
|
||||
}
|
||||
|
@ -373,6 +375,10 @@ void print_statistics() {
|
|||
|
||||
void print_statistics() {
|
||||
|
||||
if (PrintMethodData) {
|
||||
print_method_profiling_data();
|
||||
}
|
||||
|
||||
if (CITime) {
|
||||
CompileBroker::print_times();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue