1544 static int filler; // overhead caused by filler bytes
1545 static int entries; // total bytes consumed by vtable entries
1546 static int array_entries; // total bytes consumed by array vtable entries
1547
1548 static void do_class(Klass* k) {
1549 Klass* kl = k;
1550 klassVtable vt = kl->vtable();
1551 no_klasses++;
1552 if (kl->is_instance_klass()) {
1553 no_instance_klasses++;
1554 kl->array_klasses_do(do_class);
1555 }
1556 if (kl->is_array_klass()) {
1557 no_array_klasses++;
1558 sum_of_array_vtable_len += vt.length();
1559 }
1560 sum_of_vtable_len += vt.length();
1561 }
1562
1563 static void compute() {
1564 SystemDictionary::classes_do(do_class);
1565 fixed = no_klasses * oopSize; // vtable length
1566 // filler size is a conservative approximation
1567 filler = oopSize * (no_klasses - no_instance_klasses) * (sizeof(InstanceKlass) - sizeof(ArrayKlass) - 1);
1568 entries = sizeof(vtableEntry) * sum_of_vtable_len;
1569 array_entries = sizeof(vtableEntry) * sum_of_array_vtable_len;
1570 }
1571 };
1572
1573 int VtableStats::no_klasses = 0;
1574 int VtableStats::no_array_klasses = 0;
1575 int VtableStats::no_instance_klasses = 0;
1576 int VtableStats::sum_of_vtable_len = 0;
1577 int VtableStats::sum_of_array_vtable_len = 0;
1578 int VtableStats::fixed = 0;
1579 int VtableStats::filler = 0;
1580 int VtableStats::entries = 0;
1581 int VtableStats::array_entries = 0;
1582
1583 void klassVtable::print_statistics() {
1584 ResourceMark rm;
|
1544 static int filler; // overhead caused by filler bytes
1545 static int entries; // total bytes consumed by vtable entries
1546 static int array_entries; // total bytes consumed by array vtable entries
1547
1548 static void do_class(Klass* k) {
1549 Klass* kl = k;
1550 klassVtable vt = kl->vtable();
1551 no_klasses++;
1552 if (kl->is_instance_klass()) {
1553 no_instance_klasses++;
1554 kl->array_klasses_do(do_class);
1555 }
1556 if (kl->is_array_klass()) {
1557 no_array_klasses++;
1558 sum_of_array_vtable_len += vt.length();
1559 }
1560 sum_of_vtable_len += vt.length();
1561 }
1562
1563 static void compute() {
1564 ClassLoaderDataGraph::classes_do(do_class);
1565 fixed = no_klasses * oopSize; // vtable length
1566 // filler size is a conservative approximation
1567 filler = oopSize * (no_klasses - no_instance_klasses) * (sizeof(InstanceKlass) - sizeof(ArrayKlass) - 1);
1568 entries = sizeof(vtableEntry) * sum_of_vtable_len;
1569 array_entries = sizeof(vtableEntry) * sum_of_array_vtable_len;
1570 }
1571 };
1572
1573 int VtableStats::no_klasses = 0;
1574 int VtableStats::no_array_klasses = 0;
1575 int VtableStats::no_instance_klasses = 0;
1576 int VtableStats::sum_of_vtable_len = 0;
1577 int VtableStats::sum_of_array_vtable_len = 0;
1578 int VtableStats::fixed = 0;
1579 int VtableStats::filler = 0;
1580 int VtableStats::entries = 0;
1581 int VtableStats::array_entries = 0;
1582
1583 void klassVtable::print_statistics() {
1584 ResourceMark rm;
|