hotspot/src/share/vm/services/nmtDCmd.cpp
changeset 16436 6b67e51e3cfb
parent 14819 15be618136c6
child 17296 68557efd8583
equal deleted inserted replaced
16429:c5b14a727c72 16436:6b67e51e3cfb
    47             "allocation activities at different callsites.",
    47             "allocation activities at different callsites.",
    48             "BOOLEAN", false, "false"),
    48             "BOOLEAN", false, "false"),
    49   _shutdown("shutdown", "request runtime to shutdown itself and free the " \
    49   _shutdown("shutdown", "request runtime to shutdown itself and free the " \
    50             "memory used by runtime.",
    50             "memory used by runtime.",
    51             "BOOLEAN", false, "false"),
    51             "BOOLEAN", false, "false"),
       
    52   _auto_shutdown("autoShutdown", "automatically shutdown itself under "    \
       
    53             "stress situation",
       
    54             "BOOLEAN", true, "true"),
    52 #ifndef PRODUCT
    55 #ifndef PRODUCT
    53   _debug("debug", "print tracker statistics. Debug only, not thread safe", \
    56   _debug("debug", "print tracker statistics. Debug only, not thread safe", \
    54             "BOOLEAN", false, "false"),
    57             "BOOLEAN", false, "false"),
    55 #endif
    58 #endif
    56   _scale("scale", "Memory usage in which scale, KB, MB or GB",
    59   _scale("scale", "Memory usage in which scale, KB, MB or GB",
    59   _dcmdparser.add_dcmd_option(&_detail);
    62   _dcmdparser.add_dcmd_option(&_detail);
    60   _dcmdparser.add_dcmd_option(&_baseline);
    63   _dcmdparser.add_dcmd_option(&_baseline);
    61   _dcmdparser.add_dcmd_option(&_summary_diff);
    64   _dcmdparser.add_dcmd_option(&_summary_diff);
    62   _dcmdparser.add_dcmd_option(&_detail_diff);
    65   _dcmdparser.add_dcmd_option(&_detail_diff);
    63   _dcmdparser.add_dcmd_option(&_shutdown);
    66   _dcmdparser.add_dcmd_option(&_shutdown);
       
    67   _dcmdparser.add_dcmd_option(&_auto_shutdown);
    64 #ifndef PRODUCT
    68 #ifndef PRODUCT
    65   _dcmdparser.add_dcmd_option(&_debug);
    69   _dcmdparser.add_dcmd_option(&_debug);
    66 #endif
    70 #endif
    67   _dcmdparser.add_dcmd_option(&_scale);
    71   _dcmdparser.add_dcmd_option(&_scale);
    68 }
    72 }
    82     output()->print_cr("Incorrect scale value: %s", scale_value);
    86     output()->print_cr("Incorrect scale value: %s", scale_value);
    83     return;
    87     return;
    84   }
    88   }
    85 
    89 
    86   int nopt = 0;
    90   int nopt = 0;
    87   if(_summary.is_set() && _summary.value()) { ++nopt; }
    91   if (_summary.is_set() && _summary.value()) { ++nopt; }
    88   if(_detail.is_set() && _detail.value()) { ++nopt; }
    92   if (_detail.is_set() && _detail.value()) { ++nopt; }
    89   if(_baseline.is_set() && _baseline.value()) { ++nopt; }
    93   if (_baseline.is_set() && _baseline.value()) { ++nopt; }
    90   if(_summary_diff.is_set() && _summary_diff.value()) { ++nopt; }
    94   if (_summary_diff.is_set() && _summary_diff.value()) { ++nopt; }
    91   if(_detail_diff.is_set() && _detail_diff.value()) { ++nopt; }
    95   if (_detail_diff.is_set() && _detail_diff.value()) { ++nopt; }
    92   if(_shutdown.is_set() && _shutdown.value()) { ++nopt; }
    96   if (_shutdown.is_set() && _shutdown.value()) { ++nopt; }
       
    97   if (_auto_shutdown.is_set()) { ++nopt; }
       
    98 
    93 #ifndef PRODUCT
    99 #ifndef PRODUCT
    94   if(_debug.is_set() && _debug.value()) { ++nopt; }
   100   if (_debug.is_set() && _debug.value()) { ++nopt; }
    95 #endif
   101 #endif
    96 
   102 
    97   if(nopt > 1) {
   103   if (nopt > 1) {
    98       output()->print_cr("At most one of the following option can be specified: " \
   104       output()->print_cr("At most one of the following option can be specified: " \
    99         "summary, detail, baseline, summary.diff, detail.diff, shutdown"
   105         "summary, detail, baseline, summary.diff, detail.diff, shutdown"
   100 #ifndef PRODUCT
   106 #ifndef PRODUCT
   101         ", debug"
   107         ", debug"
   102 #endif
   108 #endif
   154     }
   160     }
   155   } else if (_shutdown.value()) {
   161   } else if (_shutdown.value()) {
   156     MemTracker::shutdown(MemTracker::NMT_shutdown_user);
   162     MemTracker::shutdown(MemTracker::NMT_shutdown_user);
   157     output()->print_cr("Shutdown is in progress, it will take a few moments to " \
   163     output()->print_cr("Shutdown is in progress, it will take a few moments to " \
   158       "completely shutdown");
   164       "completely shutdown");
       
   165   } else if (_auto_shutdown.is_set()) {
       
   166     MemTracker::set_autoShutdown(_auto_shutdown.value());
   159   } else {
   167   } else {
   160     ShouldNotReachHere();
   168     ShouldNotReachHere();
   161     output()->print_cr("Unknown command");
   169     output()->print_cr("Unknown command");
   162   }
   170   }
   163 }
   171 }