src/hotspot/share/jfr/dcmd/jfrDcmds.cpp
changeset 58863 c16ac7a2eba4
parent 55302 686dedba1d9a
equal deleted inserted replaced
58861:2c3cc4b01880 58863:c16ac7a2eba4
   347   _duration("duration", "Duration of recording in (s)econds, (m)inutes, (h)ours, or (d)ays, e.g. 300s.", "NANOTIME", false, "0"),
   347   _duration("duration", "Duration of recording in (s)econds, (m)inutes, (h)ours, or (d)ays, e.g. 300s.", "NANOTIME", false, "0"),
   348   _disk("disk", "Recording should be persisted to disk", "BOOLEAN", false),
   348   _disk("disk", "Recording should be persisted to disk", "BOOLEAN", false),
   349   _filename("filename", "Resulting recording filename, e.g. \\\"" JFR_FILENAME_EXAMPLE "\\\"", "STRING", false),
   349   _filename("filename", "Resulting recording filename, e.g. \\\"" JFR_FILENAME_EXAMPLE "\\\"", "STRING", false),
   350   _maxage("maxage", "Maximum time to keep recorded data (on disk) in (s)econds, (m)inutes, (h)ours, or (d)ays, e.g. 60m, or 0 for no limit", "NANOTIME", false, "0"),
   350   _maxage("maxage", "Maximum time to keep recorded data (on disk) in (s)econds, (m)inutes, (h)ours, or (d)ays, e.g. 60m, or 0 for no limit", "NANOTIME", false, "0"),
   351   _maxsize("maxsize", "Maximum amount of bytes to keep (on disk) in (k)B, (M)B or (G)B, e.g. 500M, or 0 for no limit", "MEMORY SIZE", false, "0"),
   351   _maxsize("maxsize", "Maximum amount of bytes to keep (on disk) in (k)B, (M)B or (G)B, e.g. 500M, or 0 for no limit", "MEMORY SIZE", false, "0"),
       
   352   _flush_interval("flush-interval", "Minimum time before flushing buffers, measured in (s)econds, e.g. 4 s, or 0 for flushing when a recording ends", "NANOTIME", false, "1s"),
   352   _dump_on_exit("dumponexit", "Dump running recording when JVM shuts down", "BOOLEAN", false),
   353   _dump_on_exit("dumponexit", "Dump running recording when JVM shuts down", "BOOLEAN", false),
   353   _path_to_gc_roots("path-to-gc-roots", "Collect path to GC roots", "BOOLEAN", false, "false") {
   354   _path_to_gc_roots("path-to-gc-roots", "Collect path to GC roots", "BOOLEAN", false, "false") {
   354   _dcmdparser.add_dcmd_option(&_name);
   355   _dcmdparser.add_dcmd_option(&_name);
   355   _dcmdparser.add_dcmd_option(&_settings);
   356   _dcmdparser.add_dcmd_option(&_settings);
   356   _dcmdparser.add_dcmd_option(&_delay);
   357   _dcmdparser.add_dcmd_option(&_delay);
   357   _dcmdparser.add_dcmd_option(&_duration);
   358   _dcmdparser.add_dcmd_option(&_duration);
   358   _dcmdparser.add_dcmd_option(&_disk);
   359   _dcmdparser.add_dcmd_option(&_disk);
   359   _dcmdparser.add_dcmd_option(&_filename);
   360   _dcmdparser.add_dcmd_option(&_filename);
   360   _dcmdparser.add_dcmd_option(&_maxage);
   361   _dcmdparser.add_dcmd_option(&_maxage);
   361   _dcmdparser.add_dcmd_option(&_maxsize);
   362   _dcmdparser.add_dcmd_option(&_maxsize);
       
   363   _dcmdparser.add_dcmd_option(&_flush_interval);
   362   _dcmdparser.add_dcmd_option(&_dump_on_exit);
   364   _dcmdparser.add_dcmd_option(&_dump_on_exit);
   363   _dcmdparser.add_dcmd_option(&_path_to_gc_roots);
   365   _dcmdparser.add_dcmd_option(&_path_to_gc_roots);
   364 };
   366 };
   365 
   367 
   366 int JfrStartFlightRecordingDCmd::num_arguments() {
   368 int JfrStartFlightRecordingDCmd::num_arguments() {
   409   jobject maxsize = NULL;
   411   jobject maxsize = NULL;
   410   if (_maxsize.is_set()) {
   412   if (_maxsize.is_set()) {
   411     maxsize = JfrJavaSupport::new_java_lang_Long(_maxsize.value()._size, CHECK);
   413     maxsize = JfrJavaSupport::new_java_lang_Long(_maxsize.value()._size, CHECK);
   412   }
   414   }
   413 
   415 
       
   416   jobject flush_interval = NULL;
       
   417   if (_flush_interval.is_set()) {
       
   418     flush_interval = JfrJavaSupport::new_java_lang_Long(_flush_interval.value()._nanotime, CHECK);
       
   419   }
   414   jobject duration = NULL;
   420   jobject duration = NULL;
   415   if (_duration.is_set()) {
   421   if (_duration.is_set()) {
   416     duration = JfrJavaSupport::new_java_lang_Long(_duration.value()._nanotime, CHECK);
   422     duration = JfrJavaSupport::new_java_lang_Long(_duration.value()._nanotime, CHECK);
   417   }
   423   }
   418 
   424 
   462 
   468 
   463   static const char klass[] = "jdk/jfr/internal/dcmd/DCmdStart";
   469   static const char klass[] = "jdk/jfr/internal/dcmd/DCmdStart";
   464   static const char method[] = "execute";
   470   static const char method[] = "execute";
   465   static const char signature[] = "(Ljava/lang/String;[Ljava/lang/String;Ljava/lang/Long;"
   471   static const char signature[] = "(Ljava/lang/String;[Ljava/lang/String;Ljava/lang/Long;"
   466     "Ljava/lang/Long;Ljava/lang/Boolean;Ljava/lang/String;"
   472     "Ljava/lang/Long;Ljava/lang/Boolean;Ljava/lang/String;"
   467     "Ljava/lang/Long;Ljava/lang/Long;Ljava/lang/Boolean;Ljava/lang/Boolean;)Ljava/lang/String;";
   473     "Ljava/lang/Long;Ljava/lang/Long;Ljava/lang/Long;Ljava/lang/Boolean;Ljava/lang/Boolean;)Ljava/lang/String;";
   468 
   474 
   469   JfrJavaArguments execute_args(&result, klass, method, signature, CHECK);
   475   JfrJavaArguments execute_args(&result, klass, method, signature, CHECK);
   470   execute_args.set_receiver(h_dcmd_instance);
   476   execute_args.set_receiver(h_dcmd_instance);
   471 
   477 
   472   // arguments
   478   // arguments
   476   execute_args.push_jobject(duration);
   482   execute_args.push_jobject(duration);
   477   execute_args.push_jobject(disk);
   483   execute_args.push_jobject(disk);
   478   execute_args.push_jobject(filename);
   484   execute_args.push_jobject(filename);
   479   execute_args.push_jobject(maxage);
   485   execute_args.push_jobject(maxage);
   480   execute_args.push_jobject(maxsize);
   486   execute_args.push_jobject(maxsize);
       
   487   execute_args.push_jobject(flush_interval);
   481   execute_args.push_jobject(dump_on_exit);
   488   execute_args.push_jobject(dump_on_exit);
   482   execute_args.push_jobject(path_to_gc_roots);
   489   execute_args.push_jobject(path_to_gc_roots);
   483 
   490 
   484   JfrJavaSupport::call_virtual(&execute_args, THREAD);
   491   JfrJavaSupport::call_virtual(&execute_args, THREAD);
   485   handle_dcmd_result(output(), (oop)result.get_jobject(), source, THREAD);
   492   handle_dcmd_result(output(), (oop)result.get_jobject(), source, THREAD);