8009298: NMT: Special version of class loading/unloading with runThese stresses out NMT

8009777: NMT: add new NMT dcmd to control auto shutdown option

Added diagnostic VM option and DCmd command to allow NMT stay alive under stress situation

Reviewed-by: dcubed, coleenp
This commit is contained in:
Zhengyu Gu 2013-03-20 09:42:48 -04:00
parent 3277de9dad
commit b799726f35
5 changed files with 52 additions and 8 deletions

View file

@ -84,6 +84,7 @@ class MemTracker : AllStatic {
static inline bool baseline() { return false; }
static inline bool has_baseline() { return false; }
static inline void set_autoShutdown(bool value) { }
static void shutdown(ShutdownReason reason) { }
static inline bool shutdown_in_progress() { }
static bool print_memory_usage(BaselineOutputer& out, size_t unit,
@ -238,6 +239,16 @@ class MemTracker : AllStatic {
// if native memory tracking tracks callsite
static inline bool track_callsite() { return _tracking_level == NMT_detail; }
// NMT automatically shuts itself down under extreme situation by default.
// When the value is set to false, NMT will try its best to stay alive,
// even it has to slow down VM.
static inline void set_autoShutdown(bool value) {
AutoShutdownNMT = value;
if (AutoShutdownNMT && _slowdown_calling_thread) {
_slowdown_calling_thread = false;
}
}
// shutdown native memory tracking capability. Native memory tracking
// can be shutdown by VM when it encounters low memory scenarios.
// Memory tracker should gracefully shutdown itself, and preserve the
@ -507,6 +518,10 @@ class MemTracker : AllStatic {
// although NMT is still procesing current generation, but
// there is not more recorder to process, set idle state
static volatile bool _worker_thread_idle;
// if NMT should slow down calling thread to allow
// worker thread to catch up
static volatile bool _slowdown_calling_thread;
};
#endif // !INCLUDE_NMT