src/share/vm/classfile/symbolTable.cpp

changeset 5144
a5d6f0c3585f
parent 4987
f258c5828eb8
child 5195
95c00927be11
equal deleted inserted replaced
5143:386b77bf6427 5144:a5d6f0c3585f
33 #include "memory/gcLocker.inline.hpp" 33 #include "memory/gcLocker.inline.hpp"
34 #include "oops/oop.inline.hpp" 34 #include "oops/oop.inline.hpp"
35 #include "oops/oop.inline2.hpp" 35 #include "oops/oop.inline2.hpp"
36 #include "runtime/mutexLocker.hpp" 36 #include "runtime/mutexLocker.hpp"
37 #include "utilities/hashtable.inline.hpp" 37 #include "utilities/hashtable.inline.hpp"
38 #include "utilities/numberSeq.hpp"
39 38
40 // -------------------------------------------------------------------------- 39 // --------------------------------------------------------------------------
41 40
42 SymbolTable* SymbolTable::_the_table = NULL; 41 SymbolTable* SymbolTable::_the_table = NULL;
43 // Static arena for symbols that are not deallocated 42 // Static arena for symbols that are not deallocated
449 } 448 }
450 } 449 }
451 } 450 }
452 451
453 void SymbolTable::dump(outputStream* st) { 452 void SymbolTable::dump(outputStream* st) {
454 NumberSeq summary; 453 the_table()->dump_table(st, "SymbolTable");
455 for (int i = 0; i < the_table()->table_size(); ++i) {
456 int count = 0;
457 for (HashtableEntry<Symbol*, mtSymbol>* e = the_table()->bucket(i);
458 e != NULL; e = e->next()) {
459 count++;
460 }
461 summary.add((double)count);
462 }
463 st->print_cr("SymbolTable statistics:");
464 st->print_cr("Number of buckets : %7d", summary.num());
465 st->print_cr("Average bucket size : %7.0f", summary.avg());
466 st->print_cr("Variance of bucket size : %7.0f", summary.variance());
467 st->print_cr("Std. dev. of bucket size: %7.0f", summary.sd());
468 st->print_cr("Maximum bucket size : %7.0f", summary.maximum());
469 } 454 }
470 455
471 456
472 //--------------------------------------------------------------------------- 457 //---------------------------------------------------------------------------
473 // Non-product code 458 // Non-product code
812 } 797 }
813 } 798 }
814 } 799 }
815 800
816 void StringTable::dump(outputStream* st) { 801 void StringTable::dump(outputStream* st) {
817 NumberSeq summary; 802 the_table()->dump_table(st, "StringTable");
818 for (int i = 0; i < the_table()->table_size(); ++i) {
819 HashtableEntry<oop, mtSymbol>* p = the_table()->bucket(i);
820 int count = 0;
821 for ( ; p != NULL; p = p->next()) {
822 count++;
823 }
824 summary.add((double)count);
825 }
826 st->print_cr("StringTable statistics:");
827 st->print_cr("Number of buckets : %7d", summary.num());
828 st->print_cr("Average bucket size : %7.0f", summary.avg());
829 st->print_cr("Variance of bucket size : %7.0f", summary.variance());
830 st->print_cr("Std. dev. of bucket size: %7.0f", summary.sd());
831 st->print_cr("Maximum bucket size : %7.0f", summary.maximum());
832 } 803 }
833 804
834 805
835 // Create a new table and using alternate hash code, populate the new table 806 // Create a new table and using alternate hash code, populate the new table
836 // with the existing strings. Set flag to use the alternate hash code afterwards. 807 // with the existing strings. Set flag to use the alternate hash code afterwards.

mercurial