src/share/vm/services/memTracker.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File hotspot.walk.1 Sdiff src/share/vm/services

src/share/vm/services/memTracker.cpp

Print this page




  63 MemTrackWorker*                 MemTracker::_worker_thread = NULL;
  64 int                             MemTracker::_sync_point_skip_count = 0;
  65 MemTracker::NMTLevel            MemTracker::_tracking_level = MemTracker::NMT_off;
  66 volatile MemTracker::NMTStates  MemTracker::_state = NMT_uninited;
  67 MemTracker::ShutdownReason      MemTracker::_reason = NMT_shutdown_none;
  68 int                             MemTracker::_thread_count = 255;
  69 volatile jint                   MemTracker::_pooled_recorder_count = 0;
  70 volatile unsigned long          MemTracker::_processing_generation = 0;
  71 volatile bool                   MemTracker::_worker_thread_idle = false;
  72 volatile bool                   MemTracker::_slowdown_calling_thread = false;
  73 debug_only(intx                 MemTracker::_main_thread_tid = 0;)
  74 NOT_PRODUCT(volatile jint       MemTracker::_pending_recorder_count = 0;)
  75 
  76 void MemTracker::init_tracking_options(const char* option_line) {
  77   _tracking_level = NMT_off;
  78   if (strcmp(option_line, "=summary") == 0) {
  79     _tracking_level = NMT_summary;
  80   } else if (strcmp(option_line, "=detail") == 0) {
  81     // detail relies on a stack-walking ability that may not
  82     // be available depending on platform and/or compiler flags
  83     if (PLATFORM_NMT_DETAIL_SUPPORTED) {
  84       _tracking_level = NMT_detail;
  85     } else {
  86       jio_fprintf(defaultStream::error_stream(),
  87         "NMT detail is not supported on this platform.  Using NMT summary instead.");
  88       _tracking_level = NMT_summary;
  89     }
  90   } else if (strcmp(option_line, "=off") != 0) {
  91     vm_exit_during_initialization("Syntax error, expecting -XX:NativeMemoryTracking=[off|summary|detail]", NULL);
  92   }
  93 }
  94 
  95 // first phase of bootstrapping, when VM is still in single-threaded mode.
  96 void MemTracker::bootstrap_single_thread() {
  97   if (_tracking_level > NMT_off) {
  98     assert(_state == NMT_uninited, "wrong state");
  99 
 100     // NMT is not supported with UseMallocOnly is on. NMT can NOT
 101     // handle the amount of malloc data without significantly impacting
 102     // runtime performance when this flag is on.
 103     if (UseMallocOnly) {
 104       shutdown(NMT_use_malloc_only);
 105       return;
 106     }
 107 
 108     _query_lock = new (std::nothrow) Mutex(Monitor::max_nonleaf, "NMT_queryLock");
 109     if (_query_lock == NULL) {




  63 MemTrackWorker*                 MemTracker::_worker_thread = NULL;
  64 int                             MemTracker::_sync_point_skip_count = 0;
  65 MemTracker::NMTLevel            MemTracker::_tracking_level = MemTracker::NMT_off;
  66 volatile MemTracker::NMTStates  MemTracker::_state = NMT_uninited;
  67 MemTracker::ShutdownReason      MemTracker::_reason = NMT_shutdown_none;
  68 int                             MemTracker::_thread_count = 255;
  69 volatile jint                   MemTracker::_pooled_recorder_count = 0;
  70 volatile unsigned long          MemTracker::_processing_generation = 0;
  71 volatile bool                   MemTracker::_worker_thread_idle = false;
  72 volatile bool                   MemTracker::_slowdown_calling_thread = false;
  73 debug_only(intx                 MemTracker::_main_thread_tid = 0;)
  74 NOT_PRODUCT(volatile jint       MemTracker::_pending_recorder_count = 0;)
  75 
  76 void MemTracker::init_tracking_options(const char* option_line) {
  77   _tracking_level = NMT_off;
  78   if (strcmp(option_line, "=summary") == 0) {
  79     _tracking_level = NMT_summary;
  80   } else if (strcmp(option_line, "=detail") == 0) {
  81     // detail relies on a stack-walking ability that may not
  82     // be available depending on platform and/or compiler flags
  83 #if PLATFORM_NATIVE_STACK_WALKING_SUPPORTED
  84       _tracking_level = NMT_detail;
  85 #else
  86       jio_fprintf(defaultStream::error_stream(),
  87         "NMT detail is not supported on this platform.  Using NMT summary instead.\n");
  88       _tracking_level = NMT_summary;
  89 #endif
  90   } else if (strcmp(option_line, "=off") != 0) {
  91     vm_exit_during_initialization("Syntax error, expecting -XX:NativeMemoryTracking=[off|summary|detail]", NULL);
  92   }
  93 }
  94 
  95 // first phase of bootstrapping, when VM is still in single-threaded mode.
  96 void MemTracker::bootstrap_single_thread() {
  97   if (_tracking_level > NMT_off) {
  98     assert(_state == NMT_uninited, "wrong state");
  99 
 100     // NMT is not supported with UseMallocOnly is on. NMT can NOT
 101     // handle the amount of malloc data without significantly impacting
 102     // runtime performance when this flag is on.
 103     if (UseMallocOnly) {
 104       shutdown(NMT_use_malloc_only);
 105       return;
 106     }
 107 
 108     _query_lock = new (std::nothrow) Mutex(Monitor::max_nonleaf, "NMT_queryLock");
 109     if (_query_lock == NULL) {


src/share/vm/services/memTracker.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File