// Write the compact table void CompactHashtableWriter::dump(char** top, char* end) { NumberSeq summary; char* old_top = *top; juint* p = (juint*)(*top); uintx base_address = uintx(MetaspaceShared::shared_rs()->base()); *p++ = high(base_address); *p++ = low (base_address); // base address *p++ = _num_entries; // number of entries in the table *p++ = _num_buckets; // number of buckets in the table juint* first_bucket = NULL; juint* compact_table = dump_table(p, &first_bucket, &summary); juint* bucket_end = dump_buckets(compact_table, first_bucket, &summary); assert(bucket_end <= (juint*)end, "cannot write past end"); *top = (char*)bucket_end; if (PrintSharedSpaces) { double avg_cost = 0.0; if (_num_entries > 0) { avg_cost = double(_required_bytes)/double(_num_entries); } tty->print_cr("Shared %s table stats -------- base: " PTR_FORMAT, _table_name, (intptr_t)base_address); tty->print_cr("Number of entries : %9d", _num_entries); tty->print_cr("Total bytes used : %9d", (int)((*top) - old_top)); tty->print_cr("Average bytes per entry : %9.3f", avg_cost); tty->print_cr("Average bucket size : %9.3f", summary.avg()); tty->print_cr("Variance of bucket size : %9.3f", summary.variance()); tty->print_cr("Std. dev. of bucket size: %9.3f", summary.sd()); tty->print_cr("Maximum bucket size : %9d", (int)summary.maximum()); } }
// Write the compact table void CompactHashtableWriter::dump(SimpleCompactHashtable *cht, const char* table_name) { NumberSeq summary; allocate_table(); dump_table(&summary); int table_bytes = _stats->bucket_bytes + _stats->hashentry_bytes; address base_address = address(MetaspaceShared::shared_rs()->base()); cht->init(base_address, _num_entries, _num_buckets, _compact_buckets->data(), _compact_entries->data()); if (PrintSharedSpaces) { double avg_cost = 0.0; if (_num_entries > 0) { avg_cost = double(table_bytes)/double(_num_entries); } tty->print_cr("Shared %s table stats -------- base: " PTR_FORMAT, table_name, (intptr_t)base_address); tty->print_cr("Number of entries : %9d", _num_entries); tty->print_cr("Total bytes used : %9d", table_bytes); tty->print_cr("Average bytes per entry : %9.3f", avg_cost); tty->print_cr("Average bucket size : %9.3f", summary.avg()); tty->print_cr("Variance of bucket size : %9.3f", summary.variance()); tty->print_cr("Std. dev. of bucket size: %9.3f", summary.sd()); tty->print_cr("Empty buckets : %9d", _num_empty_buckets); tty->print_cr("Value_Only buckets : %9d", _num_value_only_buckets); tty->print_cr("Other buckets : %9d", _num_other_buckets); } }