< prev index next >

src/hotspot/share/services/memTracker.cpp

Print this page
rev 49736 : [mq]: metaspace-additions-to-jcmd


 160     VirtualMemoryTracker::transition(current_level, level);
 161     MallocTracker::transition(current_level, level);
 162   } else {
 163     // Upgrading tracking level is not supported and has never been supported.
 164     // Allocating and deallocating malloc tracking structures is not thread safe and
 165     // leads to inconsistencies unless a lot coarser locks are added.
 166   }
 167   return true;
 168 }
 169 
 170 void MemTracker::report(bool summary_only, outputStream* output) {
 171  assert(output != NULL, "No output stream");
 172   MemBaseline baseline;
 173   if (baseline.baseline(summary_only)) {
 174     if (summary_only) {
 175       MemSummaryReporter rpt(baseline, output);
 176       rpt.report();
 177     } else {
 178       MemDetailReporter rpt(baseline, output);
 179       rpt.report();
 180 
 181       // Metadata reporting requires a safepoint, so avoid it if VM is not in good state.
 182       assert(!VMError::fatal_error_in_progress(), "Do not report metadata in error report");
 183       VM_PrintMetadata vmop(output, K);

 184       VMThread::execute(&vmop);
 185     }
 186   }
 187 }
 188 
 189 // This is a walker to gather malloc site hashtable statistics,
 190 // the result is used for tuning.
 191 class StatisticsWalker : public MallocSiteWalker {
 192  private:
 193   enum Threshold {
 194     // aggregates statistics over this threshold into one
 195     // line item.
 196     report_threshold = 20
 197   };
 198 
 199  private:
 200   // Number of allocation sites that have all memory freed
 201   int   _empty_entries;
 202   // Total number of allocation sites, include empty sites
 203   int   _total_entries;




 160     VirtualMemoryTracker::transition(current_level, level);
 161     MallocTracker::transition(current_level, level);
 162   } else {
 163     // Upgrading tracking level is not supported and has never been supported.
 164     // Allocating and deallocating malloc tracking structures is not thread safe and
 165     // leads to inconsistencies unless a lot coarser locks are added.
 166   }
 167   return true;
 168 }
 169 
 170 void MemTracker::report(bool summary_only, outputStream* output) {
 171  assert(output != NULL, "No output stream");
 172   MemBaseline baseline;
 173   if (baseline.baseline(summary_only)) {
 174     if (summary_only) {
 175       MemSummaryReporter rpt(baseline, output);
 176       rpt.report();
 177     } else {
 178       MemDetailReporter rpt(baseline, output);
 179       rpt.report();

 180       // Metadata reporting requires a safepoint, so avoid it if VM is not in good state.
 181       assert(!VMError::fatal_error_in_progress(), "Do not report metadata in error report");
 182       VM_PrintMetadata vmop(output, K,
 183           MetaspaceUtils::rf_show_loaders);
 184       VMThread::execute(&vmop);
 185     }
 186   }
 187 }
 188 
 189 // This is a walker to gather malloc site hashtable statistics,
 190 // the result is used for tuning.
 191 class StatisticsWalker : public MallocSiteWalker {
 192  private:
 193   enum Threshold {
 194     // aggregates statistics over this threshold into one
 195     // line item.
 196     report_threshold = 20
 197   };
 198 
 199  private:
 200   // Number of allocation sites that have all memory freed
 201   int   _empty_entries;
 202   // Total number of allocation sites, include empty sites
 203   int   _total_entries;


< prev index next >