src/share/vm/memory/binaryTreeDictionary.cpp

Print this page
rev 6220 : [mq]: printffmt_size.gc.patch


1188 // Do reporting and post sweep clean up.
1189 template <class Chunk_t, class FreeList_t>
1190 void BinaryTreeDictionary<Chunk_t, FreeList_t>::end_sweep_dict_census(double splitSurplusPercent) {
1191   // Does walking the tree 3 times hurt?
1192   set_tree_surplus(splitSurplusPercent);
1193   set_tree_hints();
1194   if (PrintGC && Verbose) {
1195     report_statistics();
1196   }
1197   clear_tree_census();
1198 }
1199 
1200 // Print summary statistics
1201 template <class Chunk_t, class FreeList_t>
1202 void BinaryTreeDictionary<Chunk_t, FreeList_t>::report_statistics() const {
1203   FreeBlockDictionary<Chunk_t>::verify_par_locked();
1204   gclog_or_tty->print("Statistics for BinaryTreeDictionary:\n"
1205          "------------------------------------\n");
1206   size_t total_size = total_chunk_size(debug_only(NULL));
1207   size_t    free_blocks = num_free_blocks();
1208   gclog_or_tty->print("Total Free Space: %d\n", total_size);
1209   gclog_or_tty->print("Max   Chunk Size: %d\n", max_chunk_size());
1210   gclog_or_tty->print("Number of Blocks: %d\n", free_blocks);
1211   if (free_blocks > 0) {
1212     gclog_or_tty->print("Av.  Block  Size: %d\n", total_size/free_blocks);
1213   }
1214   gclog_or_tty->print("Tree      Height: %d\n", tree_height());
1215 }
1216 
1217 // Print census information - counts, births, deaths, etc.
1218 // for each list in the tree.  Also print some summary
1219 // information.
1220 template <class Chunk_t, class FreeList_t>
1221 class PrintTreeCensusClosure : public AscendTreeCensusClosure<Chunk_t, FreeList_t> {
1222   int _print_line;
1223   size_t _total_free;
1224   FreeList_t _total;
1225 
1226  public:
1227   PrintTreeCensusClosure() {
1228     _print_line = 0;
1229     _total_free = 0;
1230   }
1231   FreeList_t* total() { return &_total; }
1232   size_t total_free() { return _total_free; }
1233   void do_list(FreeList<Chunk_t>* fl) {
1234     if (++_print_line >= 40) {




1188 // Do reporting and post sweep clean up.
1189 template <class Chunk_t, class FreeList_t>
1190 void BinaryTreeDictionary<Chunk_t, FreeList_t>::end_sweep_dict_census(double splitSurplusPercent) {
1191   // Does walking the tree 3 times hurt?
1192   set_tree_surplus(splitSurplusPercent);
1193   set_tree_hints();
1194   if (PrintGC && Verbose) {
1195     report_statistics();
1196   }
1197   clear_tree_census();
1198 }
1199 
1200 // Print summary statistics
1201 template <class Chunk_t, class FreeList_t>
1202 void BinaryTreeDictionary<Chunk_t, FreeList_t>::report_statistics() const {
1203   FreeBlockDictionary<Chunk_t>::verify_par_locked();
1204   gclog_or_tty->print("Statistics for BinaryTreeDictionary:\n"
1205          "------------------------------------\n");
1206   size_t total_size = total_chunk_size(debug_only(NULL));
1207   size_t    free_blocks = num_free_blocks();
1208   gclog_or_tty->print("Total Free Space: " SIZE_FORMAT "\n", total_size);
1209   gclog_or_tty->print("Max   Chunk Size: " SIZE_FORMAT "\n", max_chunk_size());
1210   gclog_or_tty->print("Number of Blocks: " SIZE_FORMAT "\n", free_blocks);
1211   if (free_blocks > 0) {
1212     gclog_or_tty->print("Av.  Block  Size: " SIZE_FORMAT "\n", total_size/free_blocks);
1213   }
1214   gclog_or_tty->print("Tree      Height: " SIZE_FORMAT "\n", tree_height());
1215 }
1216 
1217 // Print census information - counts, births, deaths, etc.
1218 // for each list in the tree.  Also print some summary
1219 // information.
1220 template <class Chunk_t, class FreeList_t>
1221 class PrintTreeCensusClosure : public AscendTreeCensusClosure<Chunk_t, FreeList_t> {
1222   int _print_line;
1223   size_t _total_free;
1224   FreeList_t _total;
1225 
1226  public:
1227   PrintTreeCensusClosure() {
1228     _print_line = 0;
1229     _total_free = 0;
1230   }
1231   FreeList_t* total() { return &_total; }
1232   size_t total_free() { return _total_free; }
1233   void do_list(FreeList<Chunk_t>* fl) {
1234     if (++_print_line >= 40) {