1.1 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/binaryTreeDictionary.cpp Tue Feb 26 15:57:49 2008 -0800 1.2 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/binaryTreeDictionary.cpp Fri Feb 29 14:42:56 2008 -0800 1.3 @@ -1071,85 +1071,56 @@ 1.4 // for each list in the tree. Also print some summary 1.5 // information. 1.6 class printTreeCensusClosure : public AscendTreeCensusClosure { 1.7 + int _print_line; 1.8 size_t _totalFree; 1.9 - AllocationStats _totals; 1.10 - size_t _count; 1.11 + FreeList _total; 1.12 1.13 public: 1.14 printTreeCensusClosure() { 1.15 + _print_line = 0; 1.16 _totalFree = 0; 1.17 - _count = 0; 1.18 - _totals.initialize(); 1.19 } 1.20 - AllocationStats* totals() { return &_totals; } 1.21 - size_t count() { return _count; } 1.22 - void increment_count_by(size_t v) { _count += v; } 1.23 + FreeList* total() { return &_total; } 1.24 size_t totalFree() { return _totalFree; } 1.25 - void increment_totalFree_by(size_t v) { _totalFree += v; } 1.26 void do_list(FreeList* fl) { 1.27 - bool nl = false; // "maybe this is not needed" isNearLargestChunk(fl->head()); 1.28 - 1.29 - gclog_or_tty->print("%c %4d\t\t" "%7d\t" "%7d\t" 1.30 - "%7d\t" "%7d\t" "%7d\t" "%7d\t" 1.31 - "%7d\t" "%7d\t" "%7d\t" 1.32 - "%7d\t" "\n", 1.33 - " n"[nl], fl->size(), fl->bfrSurp(), fl->surplus(), 1.34 - fl->desired(), fl->prevSweep(), fl->beforeSweep(), fl->count(), 1.35 - fl->coalBirths(), fl->coalDeaths(), fl->splitBirths(), 1.36 - fl->splitDeaths()); 1.37 - 1.38 - increment_totalFree_by(fl->count() * fl->size()); 1.39 - increment_count_by(fl->count()); 1.40 - totals()->set_bfrSurp(totals()->bfrSurp() + fl->bfrSurp()); 1.41 - totals()->set_surplus(totals()->splitDeaths() + fl->surplus()); 1.42 - totals()->set_prevSweep(totals()->prevSweep() + fl->prevSweep()); 1.43 - totals()->set_beforeSweep(totals()->beforeSweep() + fl->beforeSweep()); 1.44 - totals()->set_coalBirths(totals()->coalBirths() + fl->coalBirths()); 1.45 - totals()->set_coalDeaths(totals()->coalDeaths() + fl->coalDeaths()); 1.46 - totals()->set_splitBirths(totals()->splitBirths() + fl->splitBirths()); 1.47 - totals()->set_splitDeaths(totals()->splitDeaths() + fl->splitDeaths()); 1.48 + if (++_print_line >= 40) { 1.49 + FreeList::print_labels_on(gclog_or_tty, "size"); 1.50 + _print_line = 0; 1.51 + } 1.52 + fl->print_on(gclog_or_tty); 1.53 + _totalFree += fl->count() * fl->size() ; 1.54 + total()->set_count( total()->count() + fl->count() ); 1.55 + total()->set_bfrSurp( total()->bfrSurp() + fl->bfrSurp() ); 1.56 + total()->set_surplus( total()->splitDeaths() + fl->surplus() ); 1.57 + total()->set_desired( total()->desired() + fl->desired() ); 1.58 + total()->set_prevSweep( total()->prevSweep() + fl->prevSweep() ); 1.59 + total()->set_beforeSweep(total()->beforeSweep() + fl->beforeSweep()); 1.60 + total()->set_coalBirths( total()->coalBirths() + fl->coalBirths() ); 1.61 + total()->set_coalDeaths( total()->coalDeaths() + fl->coalDeaths() ); 1.62 + total()->set_splitBirths(total()->splitBirths() + fl->splitBirths()); 1.63 + total()->set_splitDeaths(total()->splitDeaths() + fl->splitDeaths()); 1.64 } 1.65 }; 1.66 1.67 void BinaryTreeDictionary::printDictCensus(void) const { 1.68 1.69 gclog_or_tty->print("\nBinaryTree\n"); 1.70 - gclog_or_tty->print( 1.71 - "%4s\t\t" "%7s\t" "%7s\t" "%7s\t" "%7s\t" "%7s\t" 1.72 - "%7s\t" "%7s\t" "%7s\t" "%7s\t" "%7s\t" "\n", 1.73 - "size", "bfrsurp", "surplus", "desired", "prvSwep", "bfrSwep", 1.74 - "count", "cBirths", "cDeaths", "sBirths", "sDeaths"); 1.75 - 1.76 + FreeList::print_labels_on(gclog_or_tty, "size"); 1.77 printTreeCensusClosure ptc; 1.78 ptc.do_tree(root()); 1.79 1.80 + FreeList* total = ptc.total(); 1.81 + FreeList::print_labels_on(gclog_or_tty, " "); 1.82 + total->print_on(gclog_or_tty, "TOTAL\t"); 1.83 gclog_or_tty->print( 1.84 - "\t\t" "%7s\t" "%7s\t" "%7s\t" "%7s\t" 1.85 - "%7s\t" "%7s\t" "%7s\t" "%7s\t" "%7s\t" "\n", 1.86 - "bfrsurp", "surplus", "prvSwep", "bfrSwep", 1.87 - "count", "cBirths", "cDeaths", "sBirths", "sDeaths"); 1.88 - gclog_or_tty->print( 1.89 - "%s\t\t" "%7d\t" "%7d\t" "%7d\t" "%7d\t" 1.90 - "%7d\t" "%7d\t" "%7d\t" "%7d\t" "%7d\t" "\n", 1.91 - "totl", 1.92 - ptc.totals()->bfrSurp(), 1.93 - ptc.totals()->surplus(), 1.94 - ptc.totals()->prevSweep(), 1.95 - ptc.totals()->beforeSweep(), 1.96 - ptc.count(), 1.97 - ptc.totals()->coalBirths(), 1.98 - ptc.totals()->coalDeaths(), 1.99 - ptc.totals()->splitBirths(), 1.100 - ptc.totals()->splitDeaths()); 1.101 - gclog_or_tty->print("totalFree(words): %7d growth: %8.5f deficit: %8.5f\n", 1.102 + "totalFree(words): " SIZE_FORMAT_W(16) 1.103 + " growth: %8.5f deficit: %8.5f\n", 1.104 ptc.totalFree(), 1.105 - (double)(ptc.totals()->splitBirths()+ptc.totals()->coalBirths() 1.106 - -ptc.totals()->splitDeaths()-ptc.totals()->coalDeaths()) 1.107 - /(ptc.totals()->prevSweep() != 0 ? 1.108 - (double)ptc.totals()->prevSweep() : 1.0), 1.109 - (double)(ptc.totals()->desired() - ptc.count()) 1.110 - /(ptc.totals()->desired() != 0 ? 1.111 - (double)ptc.totals()->desired() : 1.0)); 1.112 + (double)(total->splitBirths() + total->coalBirths() 1.113 + - total->splitDeaths() - total->coalDeaths()) 1.114 + /(total->prevSweep() != 0 ? (double)total->prevSweep() : 1.0), 1.115 + (double)(total->desired() - total->count()) 1.116 + /(total->desired() != 0 ? (double)total->desired() : 1.0)); 1.117 } 1.118 1.119 // Verify the following tree invariants: