mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8098791: Remove PrintClassStatistics and PrintMethodStatistics
PrintClassStatistics and PrintMethodStatistics have been removed. Reviewed-by: coleenp, iklam
This commit is contained in:
parent
b206c669f7
commit
4694fbd776
4 changed files with 0 additions and 199 deletions
|
@ -2680,187 +2680,3 @@ void SystemDictionary::post_class_load_event(const Ticks& start_time,
|
|||
#endif // INCLUDE_TRACE
|
||||
}
|
||||
|
||||
#ifndef PRODUCT
|
||||
|
||||
// statistics code
|
||||
class ClassStatistics: AllStatic {
|
||||
private:
|
||||
static int nclasses; // number of classes
|
||||
static int nmethods; // number of methods
|
||||
static int nmethoddata; // number of methodData
|
||||
static int class_size; // size of class objects in words
|
||||
static int method_size; // size of method objects in words
|
||||
static int debug_size; // size of debug info in methods
|
||||
static int methoddata_size; // size of methodData objects in words
|
||||
|
||||
static void do_class(Klass* k) {
|
||||
nclasses++;
|
||||
class_size += k->size();
|
||||
if (k->oop_is_instance()) {
|
||||
InstanceKlass* ik = (InstanceKlass*)k;
|
||||
class_size += ik->methods()->size();
|
||||
class_size += ik->constants()->size();
|
||||
class_size += ik->local_interfaces()->size();
|
||||
class_size += ik->transitive_interfaces()->size();
|
||||
// We do not have to count implementors, since we only store one!
|
||||
// SSS: How should these be accounted now that they have moved?
|
||||
// class_size += ik->fields()->length();
|
||||
}
|
||||
}
|
||||
|
||||
static void do_method(Method* m) {
|
||||
nmethods++;
|
||||
method_size += m->size();
|
||||
// class loader uses same objArray for empty vectors, so don't count these
|
||||
if (m->has_stackmap_table()) {
|
||||
method_size += m->stackmap_data()->size();
|
||||
}
|
||||
|
||||
MethodData* mdo = m->method_data();
|
||||
if (mdo != NULL) {
|
||||
nmethoddata++;
|
||||
methoddata_size += mdo->size();
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
static void print() {
|
||||
SystemDictionary::classes_do(do_class);
|
||||
SystemDictionary::methods_do(do_method);
|
||||
tty->print_cr("Class statistics:");
|
||||
tty->print_cr("%d classes (%d bytes)", nclasses, class_size * oopSize);
|
||||
tty->print_cr("%d methods (%d bytes = %d base + %d debug info)", nmethods,
|
||||
(method_size + debug_size) * oopSize, method_size * oopSize, debug_size * oopSize);
|
||||
tty->print_cr("%d methoddata (%d bytes)", nmethoddata, methoddata_size * oopSize);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
int ClassStatistics::nclasses = 0;
|
||||
int ClassStatistics::nmethods = 0;
|
||||
int ClassStatistics::nmethoddata = 0;
|
||||
int ClassStatistics::class_size = 0;
|
||||
int ClassStatistics::method_size = 0;
|
||||
int ClassStatistics::debug_size = 0;
|
||||
int ClassStatistics::methoddata_size = 0;
|
||||
|
||||
void SystemDictionary::print_class_statistics() {
|
||||
ResourceMark rm;
|
||||
ClassStatistics::print();
|
||||
}
|
||||
|
||||
|
||||
class MethodStatistics: AllStatic {
|
||||
public:
|
||||
enum {
|
||||
max_parameter_size = 10
|
||||
};
|
||||
private:
|
||||
|
||||
static int _number_of_methods;
|
||||
static int _number_of_final_methods;
|
||||
static int _number_of_static_methods;
|
||||
static int _number_of_native_methods;
|
||||
static int _number_of_synchronized_methods;
|
||||
static int _number_of_profiled_methods;
|
||||
static int _number_of_bytecodes;
|
||||
static int _parameter_size_profile[max_parameter_size];
|
||||
static int _bytecodes_profile[Bytecodes::number_of_java_codes];
|
||||
|
||||
static void initialize() {
|
||||
_number_of_methods = 0;
|
||||
_number_of_final_methods = 0;
|
||||
_number_of_static_methods = 0;
|
||||
_number_of_native_methods = 0;
|
||||
_number_of_synchronized_methods = 0;
|
||||
_number_of_profiled_methods = 0;
|
||||
_number_of_bytecodes = 0;
|
||||
for (int i = 0; i < max_parameter_size ; i++) _parameter_size_profile[i] = 0;
|
||||
for (int j = 0; j < Bytecodes::number_of_java_codes; j++) _bytecodes_profile [j] = 0;
|
||||
};
|
||||
|
||||
static void do_method(Method* m) {
|
||||
_number_of_methods++;
|
||||
// collect flag info
|
||||
if (m->is_final() ) _number_of_final_methods++;
|
||||
if (m->is_static() ) _number_of_static_methods++;
|
||||
if (m->is_native() ) _number_of_native_methods++;
|
||||
if (m->is_synchronized()) _number_of_synchronized_methods++;
|
||||
if (m->method_data() != NULL) _number_of_profiled_methods++;
|
||||
// collect parameter size info (add one for receiver, if any)
|
||||
_parameter_size_profile[MIN2(m->size_of_parameters() + (m->is_static() ? 0 : 1), max_parameter_size - 1)]++;
|
||||
// collect bytecodes info
|
||||
{
|
||||
Thread *thread = Thread::current();
|
||||
HandleMark hm(thread);
|
||||
BytecodeStream s(methodHandle(thread, m));
|
||||
Bytecodes::Code c;
|
||||
while ((c = s.next()) >= 0) {
|
||||
_number_of_bytecodes++;
|
||||
_bytecodes_profile[c]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
static void print() {
|
||||
initialize();
|
||||
SystemDictionary::methods_do(do_method);
|
||||
// generate output
|
||||
tty->cr();
|
||||
tty->print_cr("Method statistics (static):");
|
||||
// flag distribution
|
||||
tty->cr();
|
||||
tty->print_cr("%6d final methods %6.1f%%", _number_of_final_methods , _number_of_final_methods * 100.0F / _number_of_methods);
|
||||
tty->print_cr("%6d static methods %6.1f%%", _number_of_static_methods , _number_of_static_methods * 100.0F / _number_of_methods);
|
||||
tty->print_cr("%6d native methods %6.1f%%", _number_of_native_methods , _number_of_native_methods * 100.0F / _number_of_methods);
|
||||
tty->print_cr("%6d synchronized methods %6.1f%%", _number_of_synchronized_methods, _number_of_synchronized_methods * 100.0F / _number_of_methods);
|
||||
tty->print_cr("%6d profiled methods %6.1f%%", _number_of_profiled_methods, _number_of_profiled_methods * 100.0F / _number_of_methods);
|
||||
// parameter size profile
|
||||
tty->cr();
|
||||
{ int tot = 0;
|
||||
int avg = 0;
|
||||
for (int i = 0; i < max_parameter_size; i++) {
|
||||
int n = _parameter_size_profile[i];
|
||||
tot += n;
|
||||
avg += n*i;
|
||||
tty->print_cr("parameter size = %1d: %6d methods %5.1f%%", i, n, n * 100.0F / _number_of_methods);
|
||||
}
|
||||
assert(tot == _number_of_methods, "should be the same");
|
||||
tty->print_cr(" %6d methods 100.0%%", _number_of_methods);
|
||||
tty->print_cr("(average parameter size = %3.1f including receiver, if any)", (float)avg / _number_of_methods);
|
||||
}
|
||||
// bytecodes profile
|
||||
tty->cr();
|
||||
{ int tot = 0;
|
||||
for (int i = 0; i < Bytecodes::number_of_java_codes; i++) {
|
||||
if (Bytecodes::is_defined(i)) {
|
||||
Bytecodes::Code c = Bytecodes::cast(i);
|
||||
int n = _bytecodes_profile[c];
|
||||
tot += n;
|
||||
tty->print_cr("%9d %7.3f%% %s", n, n * 100.0F / _number_of_bytecodes, Bytecodes::name(c));
|
||||
}
|
||||
}
|
||||
assert(tot == _number_of_bytecodes, "should be the same");
|
||||
tty->print_cr("%9d 100.000%%", _number_of_bytecodes);
|
||||
}
|
||||
tty->cr();
|
||||
}
|
||||
};
|
||||
|
||||
int MethodStatistics::_number_of_methods;
|
||||
int MethodStatistics::_number_of_final_methods;
|
||||
int MethodStatistics::_number_of_static_methods;
|
||||
int MethodStatistics::_number_of_native_methods;
|
||||
int MethodStatistics::_number_of_synchronized_methods;
|
||||
int MethodStatistics::_number_of_profiled_methods;
|
||||
int MethodStatistics::_number_of_bytecodes;
|
||||
int MethodStatistics::_parameter_size_profile[MethodStatistics::max_parameter_size];
|
||||
int MethodStatistics::_bytecodes_profile[Bytecodes::number_of_java_codes];
|
||||
|
||||
|
||||
void SystemDictionary::print_method_statistics() {
|
||||
MethodStatistics::print();
|
||||
}
|
||||
|
||||
#endif // PRODUCT
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue