void BytecodeHistogram::print(float cutoff) { jlong total = total_count(); jlong absolute_sum = 0; SortedHistogramEntry* sorted_histogram = NEW_GLOBAL_HEAP_ARRAY(SortedHistogramEntry, Bytecodes::number_of_java_codes, "BytecodeHistogram"); for (int i = 0; i < Bytecodes::number_of_java_codes; i++) { sorted_histogram[i].count = counter_at(i); sorted_histogram[i].code = (Bytecodes::Code) i; } jvm_qsort(sorted_histogram, Bytecodes::number_of_java_codes, sizeof(SortedHistogramEntry), compare_entries); tty->cr(); tty->print_cr("Histogram of executed bytecodes:"); tty->cr(); tty->print_cr(" absolute relative code name"); tty->print_cr("----------------------------------------------------------------------"); if (total > 0) { for (int i = 0; i < Bytecodes::number_of_java_codes; i++) { Bytecodes::Code code = sorted_histogram[i].code; jlong count = sorted_histogram[i].count; if (Bytecodes::is_defined(code)) { jlong absolute = count; float relative = jvm_fdiv(jvm_fmul(jvm_l2f(absolute), 100.0F), jvm_l2f(total)); if (!jvm_fcmpg(cutoff, relative)) { tty->print_cr(FLL " %7.2f%% 0x%02x %s", absolute, jvm_f2d(relative), code, Bytecodes::name(Bytecodes::cast(code))); absolute_sum += absolute; } } } } tty->print_cr("----------------------------------------------------------------------"); if (total > 0) { float relative_sum = jvm_fdiv(jvm_fmul(jvm_l2f(absolute_sum), 100.0F), jvm_l2f(total)); tty->print_cr(FLL " %7.2f%% cutoff = %.2f%%", absolute_sum, jvm_f2d(relative_sum), jvm_f2d(cutoff)); tty->print_cr(FLL " %7.2f%% total", total, 100.0, 0.0); } tty->cr(); FREE_GLOBAL_HEAP_ARRAY(sorted_histogram, "BytecodeHistogram"); }
void Globals::print_flags(void *_st) { Stream *st = (Stream*)_st; // Compute size int length= 0; while (flagTable[length].name != NULL) { length++; } // Sort flags alphabetically by name const JVMFlag** array = NEW_GLOBAL_HEAP_ARRAY(const JVMFlag*, length, "Global flags sorting"); for (int index = 0; index < length; index++) { array[index] = &flagTable[index]; } jvm_qsort(array, length, sizeof(JVMFlag*), compare_flags); // Print st->print_cr("\n%-42s %s\n", "\040[Global Flags]", "Default value"); for (int i = 0; i < length; i++) { array[i]->print_on(st); } FREE_GLOBAL_HEAP_ARRAY(array, "Global flags sorting array"); }