提交 71dfd6fe 编写于 作者: J jcoomes

Merge

...@@ -1978,6 +1978,12 @@ bool Arguments::check_vm_args_consistency() { ...@@ -1978,6 +1978,12 @@ bool Arguments::check_vm_args_consistency() {
status = status && verify_min_value(ClassMetaspaceSize, 1*M, status = status && verify_min_value(ClassMetaspaceSize, 1*M,
"ClassMetaspaceSize"); "ClassMetaspaceSize");
// check native memory tracking flags
if (PrintNMTStatistics && MemTracker::tracking_level() == MemTracker::NMT_off) {
warning("PrintNMTStatistics is disabled, because native memory tracking is not enabled");
PrintNMTStatistics = false;
}
return status; return status;
} }
......
...@@ -863,6 +863,9 @@ class CommandLineFlags { ...@@ -863,6 +863,9 @@ class CommandLineFlags {
product(ccstr, NativeMemoryTracking, "off", \ product(ccstr, NativeMemoryTracking, "off", \
"Native memory tracking options") \ "Native memory tracking options") \
\ \
diagnostic(bool, PrintNMTStatistics, false, \
"Print native memory tracking summary data if it is on") \
\
diagnostic(bool, LogCompilation, false, \ diagnostic(bool, LogCompilation, false, \
"Log compilation activity in detail to hotspot.log or LogFile") \ "Log compilation activity in detail to hotspot.log or LogFile") \
\ \
......
...@@ -56,6 +56,8 @@ ...@@ -56,6 +56,8 @@
#include "runtime/task.hpp" #include "runtime/task.hpp"
#include "runtime/timer.hpp" #include "runtime/timer.hpp"
#include "runtime/vm_operations.hpp" #include "runtime/vm_operations.hpp"
#include "services/memReporter.hpp"
#include "services/memTracker.hpp"
#include "trace/tracing.hpp" #include "trace/tracing.hpp"
#include "trace/traceEventTypes.hpp" #include "trace/traceEventTypes.hpp"
#include "utilities/dtrace.hpp" #include "utilities/dtrace.hpp"
...@@ -359,6 +361,15 @@ void print_statistics() { ...@@ -359,6 +361,15 @@ void print_statistics() {
} }
#endif // COMPILER2 #endif // COMPILER2
#endif // ENABLE_ZAP_DEAD_LOCALS #endif // ENABLE_ZAP_DEAD_LOCALS
// Native memory tracking data
if (PrintNMTStatistics) {
if (MemTracker::is_on()) {
BaselineTTYOutputer outputer(tty);
MemTracker::print_memory_usage(outputer, K, false);
} else {
tty->print_cr(MemTracker::reason());
}
}
} }
#else // PRODUCT MODE STATISTICS #else // PRODUCT MODE STATISTICS
...@@ -376,6 +387,16 @@ void print_statistics() { ...@@ -376,6 +387,16 @@ void print_statistics() {
if (PrintBiasedLockingStatistics) { if (PrintBiasedLockingStatistics) {
BiasedLocking::print_counters(); BiasedLocking::print_counters();
} }
// Native memory tracking data
if (PrintNMTStatistics) {
if (MemTracker::is_on()) {
BaselineTTYOutputer outputer(tty);
MemTracker::print_memory_usage(outputer, K, false);
} else {
tty->print_cr(MemTracker::reason());
}
}
} }
#endif #endif
......
...@@ -85,7 +85,7 @@ class MemTracker : AllStatic { ...@@ -85,7 +85,7 @@ class MemTracker : AllStatic {
NMT_shutdown // shutdown NMT_shutdown // shutdown
}; };
public:
// native memory tracking level // native memory tracking level
enum NMTLevel { enum NMTLevel {
NMT_off, // native memory tracking is off NMT_off, // native memory tracking is off
...@@ -93,7 +93,6 @@ class MemTracker : AllStatic { ...@@ -93,7 +93,6 @@ class MemTracker : AllStatic {
NMT_detail // track callsite also NMT_detail // track callsite also
}; };
public:
enum ShutdownReason { enum ShutdownReason {
NMT_shutdown_none, // no shutdown requested NMT_shutdown_none, // no shutdown requested
NMT_shutdown_user, // user requested shutdown NMT_shutdown_user, // user requested shutdown
...@@ -117,6 +116,10 @@ class MemTracker : AllStatic { ...@@ -117,6 +116,10 @@ class MemTracker : AllStatic {
_state >= NMT_bootstrapping_single_thread); _state >= NMT_bootstrapping_single_thread);
} }
static inline enum NMTLevel tracking_level() {
return _tracking_level;
}
// user readable reason for shutting down NMT // user readable reason for shutting down NMT
static const char* reason() { static const char* reason() {
switch(_reason) { switch(_reason) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册