changeset 4786:c30107a847a3

Merge
author vladidan
date Wed, 10 Jul 2013 10:24:00 -0400
parents fc4858327ae8 (current diff) f4d7fb7ba02e (diff)
children 6fa8cb2866c0 c0b13febbf45 f9b44439e294
files
diffstat 2 files changed, 18 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/services/memTracker.cpp	Wed Jul 10 00:15:41 2013 -0400
+++ b/src/share/vm/services/memTracker.cpp	Wed Jul 10 10:24:00 2013 -0400
@@ -35,6 +35,7 @@
 #include "services/memReporter.hpp"
 #include "services/memTracker.hpp"
 #include "utilities/decoder.hpp"
+#include "utilities/defaultStream.hpp"
 #include "utilities/globalDefinitions.hpp"
 
 
@@ -80,7 +81,15 @@
   if (strcmp(option_line, "=summary") == 0) {
     _tracking_level = NMT_summary;
   } else if (strcmp(option_line, "=detail") == 0) {
-    _tracking_level = NMT_detail;
+    // detail relies on a stack-walking ability that may not
+    // be available depending on platform and/or compiler flags
+    if (PLATFORM_NMT_DETAIL_SUPPORTED) {
+      _tracking_level = NMT_detail;
+    } else {
+      jio_fprintf(defaultStream::error_stream(),
+        "NMT detail is not supported on this platform.  Using NMT summary instead.\n");
+       _tracking_level = NMT_summary;
+    }
   } else if (strcmp(option_line, "=off") != 0) {
     vm_exit_during_initialization("Syntax error, expecting -XX:NativeMemoryTracking=[off|summary|detail]", NULL);
   }
--- a/src/share/vm/utilities/globalDefinitions.hpp	Wed Jul 10 00:15:41 2013 -0400
+++ b/src/share/vm/utilities/globalDefinitions.hpp	Wed Jul 10 10:24:00 2013 -0400
@@ -353,6 +353,14 @@
 # include "globalDefinitions_ppc.hpp"
 #endif
 
+/*
+ * If a platform does not support NMT_detail
+ * the platform specific globalDefinitions (above)
+ * can set PLATFORM_NMT_DETAIL_SUPPORTED to false
+ */
+#ifndef PLATFORM_NMT_DETAIL_SUPPORTED
+#define PLATFORM_NMT_DETAIL_SUPPORTED true
+#endif
 
 // The byte alignment to be used by Arena::Amalloc.  See bugid 4169348.
 // Note: this value must be a power of 2