24
24
*/
25
25
package com .oracle .svm .core ;
26
26
27
+ import static com .oracle .svm .core .jvmstat .PerfManager .Options .PerfDataMemoryMappedFile ;
28
+
27
29
import java .io .IOException ;
28
30
import java .util .HashSet ;
29
31
import java .util .List ;
@@ -78,14 +80,14 @@ public final class VMInspectionOptions {
78
80
", '" + MONITORING_JCMD_NAME + "' (experimental)" +
79
81
", or '" + MONITORING_ALL_NAME + "' (deprecated behavior: defaults to '" + MONITORING_ALL_NAME + "' if no argument is provided)" ;
80
82
81
- @ APIOption (name = ENABLE_MONITORING_OPTION , defaultValue = MONITORING_DEFAULT_NAME ) //
83
+ @ APIOption (name = ENABLE_MONITORING_OPTION , defaultValue = MONITORING_DEFAULT_NAME )//
82
84
@ Option (help = "Enable monitoring features that allow the VM to be inspected at run time. Comma-separated list can contain " + MONITORING_ALLOWED_VALUES_TEXT + ". " +
83
- "For example: '--" + ENABLE_MONITORING_OPTION + "=" + MONITORING_HEAPDUMP_NAME + "," + MONITORING_JFR_NAME + "'." , type = OptionType .User ) //
85
+ "For example: '--" + ENABLE_MONITORING_OPTION + "=" + MONITORING_HEAPDUMP_NAME + "," + MONITORING_JFR_NAME + "'." , type = OptionType .User )//
84
86
public static final HostedOptionKey <AccumulatingLocatableMultiOptionValue .Strings > EnableMonitoringFeatures = new HostedOptionKey <>(
85
87
AccumulatingLocatableMultiOptionValue .Strings .buildWithCommaDelimiter (),
86
88
VMInspectionOptions ::validateEnableMonitoringFeatures );
87
89
88
- @ Option (help = "Dumps all runtime compiled methods on SIGUSR2." , type = OptionType .User ) //
90
+ @ Option (help = "Dumps all runtime compiled methods on SIGUSR2." , type = OptionType .User )//
89
91
public static final HostedOptionKey <Boolean > DumpRuntimeCompilationOnSignal = new HostedOptionKey <>(false , VMInspectionOptions ::notSupportedOnWindows );
90
92
91
93
static {
@@ -100,7 +102,7 @@ private static void notSupportedOnWindows(HostedOptionKey<Boolean> optionKey) {
100
102
}
101
103
}
102
104
103
- @ Option (help = "Print native memory tracking statistics on shutdown if native memory tracking is enabled." , type = OptionType .User ) //
105
+ @ Option (help = "Print native memory tracking statistics on shutdown if native memory tracking is enabled." , type = OptionType .User )//
104
106
public static final RuntimeOptionKey <Boolean > PrintNMTStatistics = new RuntimeOptionKey <>(false );
105
107
106
108
@ Platforms (Platform .HOSTED_ONLY .class )
@@ -122,6 +124,11 @@ public static void validateEnableMonitoringFeatures(@SuppressWarnings("unused")
122
124
if (Platform .includedIn (WINDOWS_BASE .class )) {
123
125
Set <String > notSupported = getEnabledMonitoringFeatures ();
124
126
notSupported .retainAll (NOT_SUPPORTED_ON_WINDOWS );
127
+ if (!PerfDataMemoryMappedFile .getValue ()) {
128
+ /* Only not supported on Windows, if a memory-mapped file is needed. */
129
+ notSupported .remove (MONITORING_JVMSTAT_NAME );
130
+ }
131
+
125
132
if (!notSupported .isEmpty ()) {
126
133
String msg = String .format ("the option '%s' contains value(s) that are not supported on Windows: %s. Those values will be ignored." , getDefaultMonitoringCommandArgument (),
127
134
String .join (", " , notSupported ));
@@ -191,7 +198,8 @@ public static boolean hasJfrSupport() {
191
198
192
199
@ Fold
193
200
public static boolean hasJvmstatSupport () {
194
- return hasAllOrKeywordMonitoringSupport (MONITORING_JVMSTAT_NAME ) && !Platform .includedIn (WINDOWS_BASE .class );
201
+ /* Only not supported on Windows, if a memory-mapped file is needed. */
202
+ return hasAllOrKeywordMonitoringSupport (MONITORING_JVMSTAT_NAME ) && (!Platform .includedIn (WINDOWS_BASE .class ) || !PerfDataMemoryMappedFile .getValue ());
195
203
}
196
204
197
205
@ Fold
@@ -221,7 +229,7 @@ public static boolean hasJCmdSupport() {
221
229
222
230
static class DeprecatedOptions {
223
231
@ Option (help = "Enables features that allow the VM to be inspected during run time." , type = OptionType .User , //
224
- deprecated = true , deprecationMessage = "Please use '--" + ENABLE_MONITORING_OPTION + "'" ) //
232
+ deprecated = true , deprecationMessage = "Please use '--" + ENABLE_MONITORING_OPTION + "'" )//
225
233
static final HostedOptionKey <Boolean > AllowVMInspection = new HostedOptionKey <>(false ) {
226
234
@ Override
227
235
protected void onValueUpdate (EconomicMap <OptionKey <?>, Object > values , Boolean oldValue , Boolean newValue ) {
@@ -232,7 +240,7 @@ protected void onValueUpdate(EconomicMap<OptionKey<?>, Object> values, Boolean o
232
240
};
233
241
234
242
@ Option (help = "Dumps all thread stacktraces on SIGQUIT/SIGBREAK." , type = OptionType .User , //
235
- deprecated = true , deprecationMessage = "Please use '--" + ENABLE_MONITORING_OPTION + "=" + MONITORING_THREADDUMP_NAME + "'" ) //
243
+ deprecated = true , deprecationMessage = "Please use '--" + ENABLE_MONITORING_OPTION + "=" + MONITORING_THREADDUMP_NAME + "'" )//
236
244
public static final HostedOptionKey <Boolean > DumpThreadStacksOnSignal = new HostedOptionKey <>(false );
237
245
}
238
246
0 commit comments