hotspot/src/share/vm/services/memTracker.hpp
changeset 27162 0a4a7276949b
parent 26144 35e11b657728
child 27677 b1997f2f1b56
equal deleted inserted replaced
27159:3d2543e475e4 27162:0a4a7276949b
    68   static inline void record_virtual_memory_type(void* addr, MEMFLAGS flag) { }
    68   static inline void record_virtual_memory_type(void* addr, MEMFLAGS flag) { }
    69   static inline void record_thread_stack(void* addr, size_t size) { }
    69   static inline void record_thread_stack(void* addr, size_t size) { }
    70   static inline void release_thread_stack(void* addr, size_t size) { }
    70   static inline void release_thread_stack(void* addr, size_t size) { }
    71 
    71 
    72   static void final_report(outputStream*) { }
    72   static void final_report(outputStream*) { }
       
    73   static void error_report(outputStream*) { }
    73 };
    74 };
    74 
    75 
    75 #else
    76 #else
    76 
    77 
    77 #include "runtime/atomic.hpp"
    78 #include "runtime/atomic.hpp"
   268   // Query lock is used to synchronize the access to tracking data.
   269   // Query lock is used to synchronize the access to tracking data.
   269   // So far, it is only used by JCmd query, but it may be used by
   270   // So far, it is only used by JCmd query, but it may be used by
   270   // other tools.
   271   // other tools.
   271   static inline Mutex* query_lock() { return _query_lock; }
   272   static inline Mutex* query_lock() { return _query_lock; }
   272 
   273 
   273   // Make a final report and shutdown.
   274   // Make a final report or report for hs_err file.
   274   // This function generates summary report without creating snapshots,
   275   static void error_report(outputStream* output) {
   275   // to avoid additional memory allocation. It uses native memory summary
   276     if (tracking_level() >= NMT_summary) {
   276   // counters, and makes adjustment to them, once the adjustment is made,
   277       report(true, output);  // just print summary for error case.
   277   // the counters are no longer accurate. As the result, this function
   278     }
   278   // should only be used for final reporting before shutting down.
   279    }
   279   static void final_report(outputStream*);
   280 
       
   281   static void final_report(outputStream* output) {
       
   282     NMT_TrackingLevel level = tracking_level();
       
   283     if (level >= NMT_summary) {
       
   284       report(level == NMT_summary, output);
       
   285     }
       
   286   }
       
   287 
   280 
   288 
   281   // Stored baseline
   289   // Stored baseline
   282   static inline MemBaseline& get_baseline() {
   290   static inline MemBaseline& get_baseline() {
   283     return _baseline;
   291     return _baseline;
   284   }
   292   }
   289 
   297 
   290   static void tuning_statistics(outputStream* out);
   298   static void tuning_statistics(outputStream* out);
   291 
   299 
   292  private:
   300  private:
   293   static NMT_TrackingLevel init_tracking_level();
   301   static NMT_TrackingLevel init_tracking_level();
       
   302   static void report(bool summary_only, outputStream* output);
   294 
   303 
   295  private:
   304  private:
   296   // Tracking level
   305   // Tracking level
   297   static volatile NMT_TrackingLevel   _tracking_level;
   306   static volatile NMT_TrackingLevel   _tracking_level;
   298   // If NMT option value passed by launcher through environment
   307   // If NMT option value passed by launcher through environment