hotspot/src/share/vm/services/mallocTracker.cpp
changeset 27162 0a4a7276949b
parent 26925 c77fdcf78eeb
child 27469 34008cfb8994
equal deleted inserted replaced
27159:3d2543e475e4 27162:0a4a7276949b
    47   size_t amount = 0;
    47   size_t amount = 0;
    48   for (int index = 0; index < mt_number_of_types; index ++) {
    48   for (int index = 0; index < mt_number_of_types; index ++) {
    49     amount += _malloc[index].arena_size();
    49     amount += _malloc[index].arena_size();
    50   }
    50   }
    51   return amount;
    51   return amount;
    52 }
       
    53 
       
    54 
       
    55 void MallocMemorySnapshot::reset() {
       
    56   _tracking_header.reset();
       
    57   for (int index = 0; index < mt_number_of_types; index ++) {
       
    58     _malloc[index].reset();
       
    59   }
       
    60 }
    52 }
    61 
    53 
    62 // Make adjustment by subtracting chunks used by arenas
    54 // Make adjustment by subtracting chunks used by arenas
    63 // from total chunks to get total free chunck size
    55 // from total chunks to get total free chunck size
    64 void MallocMemorySnapshot::make_adjustment() {
    56 void MallocMemorySnapshot::make_adjustment() {
   114 }
   106 }
   115 
   107 
   116 bool MallocTracker::transition(NMT_TrackingLevel from, NMT_TrackingLevel to) {
   108 bool MallocTracker::transition(NMT_TrackingLevel from, NMT_TrackingLevel to) {
   117   assert(from != NMT_off, "Can not transition from off state");
   109   assert(from != NMT_off, "Can not transition from off state");
   118   assert(to != NMT_off, "Can not transition to off state");
   110   assert(to != NMT_off, "Can not transition to off state");
   119   if (from == NMT_minimal) {
   111   assert (from != NMT_minimal, "cannot transition from minimal state");
   120     MallocMemorySummary::reset();
       
   121   }
       
   122 
   112 
   123   if (to == NMT_detail) {
   113   if (from == NMT_detail) {
   124     assert(from == NMT_minimal || from == NMT_summary, "Just check");
       
   125     return MallocSiteTable::initialize();
       
   126   } else if (from == NMT_detail) {
       
   127     assert(to == NMT_minimal || to == NMT_summary, "Just check");
   114     assert(to == NMT_minimal || to == NMT_summary, "Just check");
   128     MallocSiteTable::shutdown();
   115     MallocSiteTable::shutdown();
   129   }
   116   }
   130   return true;
   117   return true;
   131 }
   118 }