src/hotspot/share/jfr/dcmd/jfrDcmds.cpp
changeset 50745 a390cbb82d47
parent 50195 ec881a19d294
child 51334 cc2c79d22508
equal deleted inserted replaced
50744:6c306d54366d 50745:a390cbb82d47
   177   return (oop)args->result()->get_jobject();
   177   return (oop)args->result()->get_jobject();
   178 }
   178 }
   179 
   179 
   180 JfrDumpFlightRecordingDCmd::JfrDumpFlightRecordingDCmd(outputStream* output,
   180 JfrDumpFlightRecordingDCmd::JfrDumpFlightRecordingDCmd(outputStream* output,
   181                                                        bool heap) : DCmdWithParser(output, heap),
   181                                                        bool heap) : DCmdWithParser(output, heap),
   182   _name("name", "Recording name, e.g. \\\"My Recording\\\"", "STRING", true, NULL),
   182   _name("name", "Recording name, e.g. \\\"My Recording\\\"", "STRING", false, NULL),
   183   _filename("filename", "Copy recording data to file, i.e \\\"" JFR_FILENAME_EXAMPLE "\\\"", "STRING", true),
   183   _filename("filename", "Copy recording data to file, e.g. \\\"" JFR_FILENAME_EXAMPLE "\\\"", "STRING", false),
       
   184   _maxage("maxage", "Maximum duration to dump, in (s)econds, (m)inutes, (h)ours, or (d)ays, e.g. 60m, or 0 for no limit", "NANOTIME", false, "0"),
       
   185   _maxsize("maxsize", "Maximum amount of bytes to dump, in (M)B or (G)B, e.g. 500M, or 0 for no limit", "MEMORY SIZE", false, "0"),
       
   186   _begin("begin", "Point in time to dump data from, e.g. 09:00, 21:35:00, 2018-06-03T18:12:56.827Z, 2018-06-03T20:13:46.832, -10m, -3h, or -1d", "STRING", false),
       
   187   _end("end", "Point in time to dump data to, e.g. 09:00, 21:35:00, 2018-06-03T18:12:56.827Z, 2018-06-03T20:13:46.832, -10m, -3h, or -1d", "STRING", false),
   184   _path_to_gc_roots("path-to-gc-roots", "Collect path to GC roots", "BOOLEAN", false, "false") {
   188   _path_to_gc_roots("path-to-gc-roots", "Collect path to GC roots", "BOOLEAN", false, "false") {
   185   _dcmdparser.add_dcmd_option(&_name);
   189   _dcmdparser.add_dcmd_option(&_name);
   186   _dcmdparser.add_dcmd_option(&_filename);
   190   _dcmdparser.add_dcmd_option(&_filename);
       
   191   _dcmdparser.add_dcmd_option(&_maxage);
       
   192   _dcmdparser.add_dcmd_option(&_maxsize);
       
   193   _dcmdparser.add_dcmd_option(&_begin);
       
   194   _dcmdparser.add_dcmd_option(&_end);
   187   _dcmdparser.add_dcmd_option(&_path_to_gc_roots);
   195   _dcmdparser.add_dcmd_option(&_path_to_gc_roots);
   188 };
   196 };
   189 
   197 
   190 int JfrDumpFlightRecordingDCmd::num_arguments() {
   198 int JfrDumpFlightRecordingDCmd::num_arguments() {
   191   ResourceMark rm;
   199   ResourceMark rm;
   223   jstring filepath = NULL;
   231   jstring filepath = NULL;
   224   if (_filename.is_set() && _filename.value() != NULL) {
   232   if (_filename.is_set() && _filename.value() != NULL) {
   225     filepath = JfrJavaSupport::new_string(_filename.value(), CHECK);
   233     filepath = JfrJavaSupport::new_string(_filename.value(), CHECK);
   226   }
   234   }
   227 
   235 
       
   236   jobject maxage = NULL;
       
   237   if (_maxage.is_set()) {
       
   238     maxage = JfrJavaSupport::new_java_lang_Long(_maxage.value()._nanotime, CHECK);
       
   239   }
       
   240 
       
   241   jobject maxsize = NULL;
       
   242   if (_maxsize.is_set()) {
       
   243     maxsize = JfrJavaSupport::new_java_lang_Long(_maxsize.value()._size, CHECK);
       
   244   }
       
   245 
       
   246   jstring begin = NULL;
       
   247   if (_begin.is_set() && _begin.value() != NULL) {
       
   248     begin = JfrJavaSupport::new_string(_begin.value(), CHECK);
       
   249   }
       
   250 
       
   251   jstring end = NULL;
       
   252   if (_end.is_set() && _end.value() != NULL) {
       
   253     end = JfrJavaSupport::new_string(_end.value(), CHECK);
       
   254   }
       
   255 
   228   jobject path_to_gc_roots = NULL;
   256   jobject path_to_gc_roots = NULL;
   229   if (_path_to_gc_roots.is_set()) {
   257   if (_path_to_gc_roots.is_set()) {
   230     path_to_gc_roots = JfrJavaSupport::new_java_lang_Boolean(_path_to_gc_roots.value(), CHECK);
   258     path_to_gc_roots = JfrJavaSupport::new_java_lang_Boolean(_path_to_gc_roots.value(), CHECK);
   231   }
   259   }
   232 
   260 
   233   static const char klass[] = "jdk/jfr/internal/dcmd/DCmdDump";
   261   static const char klass[] = "jdk/jfr/internal/dcmd/DCmdDump";
   234   static const char method[] = "execute";
   262   static const char method[] = "execute";
   235   static const char signature[] = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Boolean;)Ljava/lang/String;";
   263   static const char signature[] = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Long;Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Boolean;)Ljava/lang/String;";
   236 
   264 
   237   JfrJavaArguments execute_args(&result, klass, method, signature, CHECK);
   265   JfrJavaArguments execute_args(&result, klass, method, signature, CHECK);
   238   execute_args.set_receiver(h_dcmd_instance);
   266   execute_args.set_receiver(h_dcmd_instance);
   239 
   267 
   240   // arguments
   268   // arguments
   241   execute_args.push_jobject(name);
   269   execute_args.push_jobject(name);
   242   execute_args.push_jobject(filepath);
   270   execute_args.push_jobject(filepath);
       
   271   execute_args.push_jobject(maxage);
       
   272   execute_args.push_jobject(maxsize);
       
   273   execute_args.push_jobject(begin);
       
   274   execute_args.push_jobject(end);
   243   execute_args.push_jobject(path_to_gc_roots);
   275   execute_args.push_jobject(path_to_gc_roots);
   244 
   276 
   245   JfrJavaSupport::call_virtual(&execute_args, THREAD);
   277   JfrJavaSupport::call_virtual(&execute_args, THREAD);
   246   handle_dcmd_result(output(), (oop)result.get_jobject(), source, THREAD);
   278   handle_dcmd_result(output(), (oop)result.get_jobject(), source, THREAD);
   247 }
   279 }
   248 
   280 
   249 JfrCheckFlightRecordingDCmd::JfrCheckFlightRecordingDCmd(outputStream* output, bool heap) : DCmdWithParser(output, heap),
   281 JfrCheckFlightRecordingDCmd::JfrCheckFlightRecordingDCmd(outputStream* output, bool heap) : DCmdWithParser(output, heap),
   250   _name("name","Recording text, e.g. \\\"My Recording\\\" or omit to see all recordings","STRING",false, NULL),
   282   _name("name","Recording name, e.g. \\\"My Recording\\\" or omit to see all recordings","STRING",false, NULL),
   251   _verbose("verbose","Print event settings for the recording(s)","BOOLEAN",
   283   _verbose("verbose","Print event settings for the recording(s)","BOOLEAN",
   252            false, "false") {
   284            false, "false") {
   253   _dcmdparser.add_dcmd_option(&_name);
   285   _dcmdparser.add_dcmd_option(&_name);
   254   _dcmdparser.add_dcmd_option(&_verbose);
   286   _dcmdparser.add_dcmd_option(&_verbose);
   255 };
   287 };