@@ -367,14 +367,15 @@ GrowableArray<const char*>* JfrDCmd::argument_name_array() const {
367
367
JfrConfigureFlightRecorderDCmd::JfrConfigureFlightRecorderDCmd (outputStream* output,
368
368
bool heap) : DCmdWithParser(output, heap),
369
369
_repository_path(" repositorypath" , " Path to repository,.e.g \\\" My Repository\\\" " , " STRING" , false , NULL ),
370
- _dump_path(" dumppath" , " Path to dump,. e.g \\\" My Dump path\\\" " , " STRING" , false , NULL ),
371
- _stack_depth(" stackdepth" , " Stack Depth " , " JULONG" , false , " 64" ),
370
+ _dump_path(" dumppath" , " Path to dump, e.g. \\\" My Dump path\\\" " , " STRING" , false , NULL ),
371
+ _stack_depth(" stackdepth" , " Stack depth " , " JULONG" , false , " 64" ),
372
372
_global_buffer_count(" globalbuffercount" , " Number of global buffers," , " JULONG" , false , " 20" ),
373
373
_global_buffer_size(" globalbuffersize" , " Size of a global buffers," , " MEMORY SIZE" , false , " 512k" ),
374
374
_thread_buffer_size(" thread_buffer_size" , " Size of a thread buffer" , " MEMORY SIZE" , false , " 8k" ),
375
375
_memory_size(" memorysize" , " Overall memory size, " , " MEMORY SIZE" , false , " 10m" ),
376
376
_max_chunk_size(" maxchunksize" , " Size of an individual disk chunk" , " MEMORY SIZE" , false , " 12m" ),
377
- _sample_threads(" samplethreads" , " Activate Thread sampling" , " BOOLEAN" , false , " true" ),
377
+ _sample_threads(" samplethreads" , " Activate thread sampling" , " BOOLEAN" , false , " true" ),
378
+ _preserve_repository(" preserve-repository" , " Preserve the disk repository after JVM exit" , " BOOLEAN" , false , " false" ),
378
379
_verbose(true ) {
379
380
_dcmdparser.add_dcmd_option (&_repository_path);
380
381
_dcmdparser.add_dcmd_option (&_dump_path);
@@ -385,56 +386,60 @@ JfrConfigureFlightRecorderDCmd::JfrConfigureFlightRecorderDCmd(outputStream* out
385
386
_dcmdparser.add_dcmd_option (&_memory_size);
386
387
_dcmdparser.add_dcmd_option (&_max_chunk_size);
387
388
_dcmdparser.add_dcmd_option (&_sample_threads);
389
+ _dcmdparser.add_dcmd_option (&_preserve_repository);
388
390
};
389
391
390
392
void JfrConfigureFlightRecorderDCmd::print_help (const char * name) const {
391
393
outputStream* out = output ();
392
394
// 0123456789001234567890012345678900123456789001234567890012345678900123456789001234567890
393
395
out->print_cr (" Options:" );
394
396
out->print_cr (" " );
395
- out->print_cr (" globalbuffercount (Optional) Number of global buffers. This option is a legacy" );
396
- out->print_cr (" option: change the memorysize parameter to alter the number of" );
397
- out->print_cr (" global buffers. This value cannot be changed once JFR has been" );
398
- out->print_cr (" initialized. (STRING, default determined by the value for" );
399
- out->print_cr (" memorysize)" );
397
+ out->print_cr (" globalbuffercount (Optional) Number of global buffers. This option is a legacy" );
398
+ out->print_cr (" option: change the memorysize parameter to alter the number of" );
399
+ out->print_cr (" global buffers. This value cannot be changed once JFR has been" );
400
+ out->print_cr (" initialized. (STRING, default determined by the value for" );
401
+ out->print_cr (" memorysize)" );
400
402
out->print_cr (" " );
401
- out->print_cr (" globalbuffersize (Optional) Size of the global buffers, in bytes. This option is a" );
402
- out->print_cr (" legacy option: change the memorysize parameter to alter the size" );
403
- out->print_cr (" of the global buffers. This value cannot be changed once JFR has" );
404
- out->print_cr (" been initialized. (STRING, default determined by the value for" );
405
- out->print_cr (" memorysize)" );
403
+ out->print_cr (" globalbuffersize (Optional) Size of the global buffers, in bytes. This option is a" );
404
+ out->print_cr (" legacy option: change the memorysize parameter to alter the size" );
405
+ out->print_cr (" of the global buffers. This value cannot be changed once JFR has" );
406
+ out->print_cr (" been initialized. (STRING, default determined by the value for" );
407
+ out->print_cr (" memorysize)" );
406
408
out->print_cr (" " );
407
- out->print_cr (" maxchunksize (Optional) Maximum size of an individual data chunk in bytes if" );
408
- out->print_cr (" one of the following suffixes is not used: 'm' or 'M' for" );
409
- out->print_cr (" megabytes OR 'g' or 'G' for gigabytes. This value cannot be" );
410
- out->print_cr (" changed once JFR has been initialized. (STRING, 12M)" );
409
+ out->print_cr (" maxchunksize (Optional) Maximum size of an individual data chunk in bytes if" );
410
+ out->print_cr (" one of the following suffixes is not used: 'm' or 'M' for" );
411
+ out->print_cr (" megabytes OR 'g' or 'G' for gigabytes. This value cannot be" );
412
+ out->print_cr (" changed once JFR has been initialized. (STRING, 12M)" );
411
413
out->print_cr (" " );
412
- out->print_cr (" memorysize (Optional) Overall memory size, in bytes if one of the following" );
413
- out->print_cr (" suffixes is not used: 'm' or 'M' for megabytes OR 'g' or 'G' for" );
414
- out->print_cr (" gigabytes. This value cannot be changed once JFR has been" );
415
- out->print_cr (" initialized. (STRING, 10M)" );
414
+ out->print_cr (" memorysize (Optional) Overall memory size, in bytes if one of the following" );
415
+ out->print_cr (" suffixes is not used: 'm' or 'M' for megabytes OR 'g' or 'G' for" );
416
+ out->print_cr (" gigabytes. This value cannot be changed once JFR has been" );
417
+ out->print_cr (" initialized. (STRING, 10M)" );
416
418
out->print_cr (" " );
417
- out->print_cr (" repositorypath (Optional) Path to the location where recordings are stored until" );
418
- out->print_cr (" they are written to a permanent file. (STRING, The default" );
419
- out->print_cr (" location is the temporary directory for the operating system. On" );
420
- out->print_cr (" Linux operating systems, the temporary directory is /tmp. On" );
421
- out->print_cr (" Windows, the temporary directory is specified by the TMP" );
422
- out->print_cr (" environment variable)" );
419
+ out->print_cr (" repositorypath (Optional) Path to the location where recordings are stored until" );
420
+ out->print_cr (" they are written to a permanent file. (STRING, The default" );
421
+ out->print_cr (" location is the temporary directory for the operating system. On" );
422
+ out->print_cr (" Linux operating systems, the temporary directory is /tmp. On" );
423
+ out->print_cr (" Windows, the temporary directory is specified by the TMP" );
424
+ out->print_cr (" environment variable)" );
423
425
out->print_cr (" " );
424
- out->print_cr (" dumppath (Optional) Path to the location where a recording file is written" );
425
- out->print_cr (" in case the VM runs into a critical error, such as a system" );
426
- out->print_cr (" crash. (STRING, The default location is the current directory)" );
426
+ out->print_cr (" dumppath (Optional) Path to the location where a recording file is written" );
427
+ out->print_cr (" in case the VM runs into a critical error, such as a system" );
428
+ out->print_cr (" crash. (STRING, The default location is the current directory)" );
427
429
out->print_cr (" " );
428
- out->print_cr (" stackdepth (Optional) Stack depth for stack traces. Setting this value" );
429
- out->print_cr (" greater than the default of 64 may cause a performance" );
430
- out->print_cr (" degradation. This value cannot be changed once JFR has been" );
431
- out->print_cr (" initialized. (LONG, 64)" );
430
+ out->print_cr (" stackdepth (Optional) Stack depth for stack traces. Setting this value" );
431
+ out->print_cr (" greater than the default of 64 may cause a performance" );
432
+ out->print_cr (" degradation. This value cannot be changed once JFR has been" );
433
+ out->print_cr (" initialized. (LONG, 64)" );
432
434
out->print_cr (" " );
433
- out->print_cr (" thread_buffer_size (Optional) Local buffer size for each thread in bytes if one of" );
434
- out->print_cr (" the following suffixes is not used: 'k' or 'K' for kilobytes or" );
435
- out->print_cr (" 'm' or 'M' for megabytes. Overriding this parameter could reduce" );
436
- out->print_cr (" performance and is not recommended. This value cannot be changed" );
437
- out->print_cr (" once JFR has been initialized. (STRING, 8k)" );
435
+ out->print_cr (" thread_buffer_size (Optional) Local buffer size for each thread in bytes if one of" );
436
+ out->print_cr (" the following suffixes is not used: 'k' or 'K' for kilobytes or" );
437
+ out->print_cr (" 'm' or 'M' for megabytes. Overriding this parameter could reduce" );
438
+ out->print_cr (" performance and is not recommended. This value cannot be changed" );
439
+ out->print_cr (" once JFR has been initialized. (STRING, 8k)" );
440
+ out->print_cr (" " );
441
+ out->print_cr (" preserve-repository (Optional) Preserve files stored in the disk repository after the" );
442
+ out->print_cr (" Java Virtual Machine has exited. (BOOLEAN, false)" );
438
443
out->print_cr (" " );
439
444
out->print_cr (" Options must be specified using the <key> or <key>=<value> syntax." );
440
445
out->print_cr (" " );
@@ -480,6 +485,7 @@ void JfrConfigureFlightRecorderDCmd::execute(DCmdSource source, TRAPS) {
480
485
jobject thread_buffer_size = NULL ;
481
486
jobject max_chunk_size = NULL ;
482
487
jobject memory_size = NULL ;
488
+ jobject preserve_repository = nullptr ;
483
489
484
490
if (!JfrRecorder::is_created ()) {
485
491
if (_stack_depth.is_set ()) {
@@ -510,12 +516,15 @@ void JfrConfigureFlightRecorderDCmd::execute(DCmdSource source, TRAPS) {
510
516
}
511
517
}
512
518
}
519
+ if (_preserve_repository.is_set ()) {
520
+ preserve_repository = JfrJavaSupport::new_java_lang_Boolean (_preserve_repository.value (), CHECK);
521
+ }
513
522
514
523
static const char klass[] = " jdk/jfr/internal/dcmd/DCmdConfigure" ;
515
524
static const char method[] = " execute" ;
516
525
static const char signature[] = " (ZLjava/lang/String;Ljava/lang/String;Ljava/lang/Integer;"
517
526
" Ljava/lang/Long;Ljava/lang/Long;Ljava/lang/Long;Ljava/lang/Long;"
518
- " Ljava/lang/Long;)[Ljava/lang/String;" ;
527
+ " Ljava/lang/Long;Ljava/lang/Boolean; )[Ljava/lang/String;" ;
519
528
520
529
JfrJavaArguments execute_args (&result, klass, method, signature, CHECK);
521
530
execute_args.set_receiver (h_dcmd_instance);
@@ -530,6 +539,7 @@ void JfrConfigureFlightRecorderDCmd::execute(DCmdSource source, TRAPS) {
530
539
execute_args.push_jobject (thread_buffer_size);
531
540
execute_args.push_jobject (memory_size);
532
541
execute_args.push_jobject (max_chunk_size);
542
+ execute_args.push_jobject (preserve_repository);
533
543
534
544
JfrJavaSupport::call_virtual (&execute_args, THREAD);
535
545
handle_dcmd_result (output (), result.get_oop (), source, THREAD);
0 commit comments