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