42
42
import jdk .jfr .FlightRecorder ;
43
43
import jdk .jfr .Recording ;
44
44
import jdk .jfr .internal .JVM ;
45
+ import jdk .jfr .internal .LogLevel ;
46
+ import jdk .jfr .internal .LogTag ;
47
+ import jdk .jfr .internal .Logger ;
45
48
import jdk .jfr .internal .OldObjectSample ;
46
49
import jdk .jfr .internal .PlatformRecording ;
47
50
import jdk .jfr .internal .PrivateAccess ;
48
51
import jdk .jfr .internal .SecuritySupport .SafePath ;
52
+ import jdk .jfr .internal .SecuritySupport ;
49
53
import jdk .jfr .internal .Type ;
50
54
import jdk .jfr .internal .jfc .JFC ;
51
55
import jdk .jfr .internal .jfc .model .JFCModel ;
@@ -364,7 +368,7 @@ Virtual Machine (JVM) shuts down. If set to 'true' and no value
364
368
Turn on this flag only when you have an application that you
365
369
suspect has a memory leak. If the settings parameter is set to
366
370
'profile', then the information collected includes the stack
367
- trace from where the potential leaking object wasallocated .
371
+ trace from where the potential leaking object was allocated .
368
372
(BOOLEAN, false)
369
373
370
374
settings (Optional) Name of the settings file that identifies which events
@@ -394,7 +398,7 @@ Virtual Machine (JVM) shuts down. If set to 'true' and no value
394
398
take precedence. The whitespace character can be omitted for timespan values,
395
399
i.e. 20s. For more information about the settings syntax, see Javadoc of the
396
400
jdk.jfr package.
397
-
401
+ %s
398
402
Options must be specified using the <key> or <key>=<value> syntax.
399
403
400
404
Example usage:
@@ -414,7 +418,28 @@ Virtual Machine (JVM) shuts down. If set to 'true' and no value
414
418
415
419
Note, if the default event settings are modified, overhead may exceed 1%%.
416
420
417
- """ .formatted (exampleDirectory ()).lines ().toArray (String []::new );
421
+ """ .formatted (jfcOptions (), exampleDirectory ()).lines ().toArray (String []::new );
422
+ }
423
+
424
+ private static String jfcOptions () {
425
+ try {
426
+ StringBuilder sb = new StringBuilder ();
427
+ for (SafePath s : SecuritySupport .getPredefinedJFCFiles ()) {
428
+ String name = JFC .nameFromPath (s .toPath ());
429
+ JFCModel model = JFCModel .create (s , l -> {});
430
+ sb .append ('\n' );
431
+ sb .append ("Options for " ).append (name ).append (":\n " );
432
+ sb .append ('\n' );
433
+ for (XmlInput input : model .getInputs ()) {
434
+ sb .append (" " ).append (input .getOptionSyntax ()).append ('\n' );
435
+ sb .append ('\n' );
436
+ }
437
+ }
438
+ return sb .toString ();
439
+ } catch (IOException | ParseException e ) {
440
+ Logger .log (LogTag .JFR_DCMD , LogLevel .DEBUG , "Could not list .jfc options for JFR.start. " + e .getMessage ());
441
+ return "" ;
442
+ }
418
443
}
419
444
420
445
@ Override
0 commit comments