< prev index next > src/hotspot/share/interpreter/bytecodeHistogram.cpp
Print this page
#include "memory/resourceArea.hpp"
#include "runtime/os.hpp"
#include "utilities/growableArray.hpp"
// ------------------------------------------------------------------------------------------------
- // Non-product code
- #ifndef PRODUCT
// Implementation of BytecodeCounter
- int BytecodeCounter::_counter_value = 0;
+ jlong BytecodeCounter::_counter_value = 0;
jlong BytecodeCounter::_reset_time = 0;
-
void BytecodeCounter::reset() {
_counter_value = 0;
_reset_time = os::elapsed_counter();
}
-
double BytecodeCounter::elapsed_time() {
return (double)(os::elapsed_counter() - _reset_time) / (double)os::elapsed_frequency();
}
-
double BytecodeCounter::frequency() {
return (double)counter_value() / elapsed_time();
}
-
void BytecodeCounter::print() {
- tty->print_cr(
- "%d bytecodes executed in %.1fs (%.3fMHz)",
- counter_value(),
- elapsed_time(),
- frequency() / 1000000.0
- );
+ tty->print_cr(JLONG_FORMAT " bytecodes executed in %.1fs (%.3fMHz)",
+ counter_value(), elapsed_time(), frequency() / 1000000.0);
}
// Helper class for sorting
class HistoEntry: public ResourceObj {
- private:
+ private:
int _index;
int _count;
- public:
+ public:
HistoEntry(int index, int count) { _index = index; _count = count; }
int index() const { return _index; }
int count() const { return _count; }
static int compare(HistoEntry** x, HistoEntry** y) { return (*x)->count() - (*y)->count(); }
};
-
// Helper functions
static GrowableArray<HistoEntry*>* sorted_array(int* array, int length) {
GrowableArray<HistoEntry*>* a = new GrowableArray<HistoEntry*>(length);
int i = length;
float rel_sum = (float)abs_sum * 100.0F / (float)tot;
tty->print_cr("%10d %7.2f%% (cutoff = %.2f%%)", abs_sum, rel_sum, cutoff);
tty->cr();
}
+ // Non-product code
+ #ifndef PRODUCT
// Implementation of BytecodePairHistogram
int BytecodePairHistogram::_index;
int BytecodePairHistogram::_counters[BytecodePairHistogram::number_of_pairs];
< prev index next >