< prev index next >

src/hotspot/share/services/memTracker.cpp

Print this page
rev 49873 : [mq]: 8201572-improve-metaspace-reporting


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


< prev index next >