8213015: Inconsistent settings between JFR.configure and -XX:FlightRecorderOptions
authorysuenaga
Fri, 23 Nov 2018 16:36:07 +0900
changeset 52669 e21361bccfa1
parent 52668 02747dfbd776
child 52670 eb6864cdcd61
8213015: Inconsistent settings between JFR.configure and -XX:FlightRecorderOptions Reviewed-by: mgronlun, egahlin
src/hotspot/share/jfr/dcmd/jfrDcmds.cpp
src/hotspot/share/jfr/dcmd/jfrDcmds.hpp
src/hotspot/share/jfr/recorder/service/jfrOptionSet.cpp
test/jdk/jdk/jfr/jcmd/TestJcmdConfigure.java
--- a/src/hotspot/share/jfr/dcmd/jfrDcmds.cpp	Fri Nov 23 12:45:47 2018 +0800
+++ b/src/hotspot/share/jfr/dcmd/jfrDcmds.cpp	Fri Nov 23 16:36:07 2018 +0900
@@ -544,12 +544,12 @@
                                                                bool heap) : DCmdWithParser(output, heap),
   _repository_path("repositorypath", "Path to repository,.e.g \\\"My Repository\\\"", "STRING", false, NULL),
   _dump_path("dumppath", "Path to dump,.e.g \\\"My Dump path\\\"", "STRING", false, NULL),
-  _stack_depth("stackdepth", "Stack Depth", "JLONG", false, "64"),
-  _global_buffer_count("globalbuffercount", "Number of global buffers,", "JLONG", false, "32"),
-  _global_buffer_size("globalbuffersize", "Size of a global buffers,", "JLONG", false, "524288"),
-  _thread_buffer_size("thread_buffer_size", "Size of a thread buffer", "JLONG", false, "8192"),
-  _memory_size("memorysize", "Overall memory size, ", "JLONG", false, "16777216"),
-  _max_chunk_size("maxchunksize", "Size of an individual disk chunk", "JLONG", false, "12582912"),
+  _stack_depth("stackdepth", "Stack Depth", "JULONG", false, "64"),
+  _global_buffer_count("globalbuffercount", "Number of global buffers,", "JULONG", false, "20"),
+  _global_buffer_size("globalbuffersize", "Size of a global buffers,", "MEMORY SIZE", false, "512k"),
+  _thread_buffer_size("thread_buffer_size", "Size of a thread buffer", "MEMORY SIZE", false, "8k"),
+  _memory_size("memorysize", "Overall memory size, ", "MEMORY SIZE", false, "10m"),
+  _max_chunk_size("maxchunksize", "Size of an individual disk chunk", "MEMORY SIZE", false, "12m"),
   _sample_threads("samplethreads", "Activate Thread sampling", "BOOLEAN", false, "true") {
   _dcmdparser.add_dcmd_option(&_repository_path);
   _dcmdparser.add_dcmd_option(&_dump_path);
@@ -612,22 +612,22 @@
 
   jobject global_buffer_size = NULL;
   if (_global_buffer_size.is_set()) {
-    global_buffer_size = JfrJavaSupport::new_java_lang_Long(_global_buffer_size.value(), CHECK);
+    global_buffer_size = JfrJavaSupport::new_java_lang_Long(_global_buffer_size.value()._size, CHECK);
   }
 
   jobject thread_buffer_size = NULL;
   if (_thread_buffer_size.is_set()) {
-    thread_buffer_size = JfrJavaSupport::new_java_lang_Long(_thread_buffer_size.value(), CHECK);
+    thread_buffer_size = JfrJavaSupport::new_java_lang_Long(_thread_buffer_size.value()._size, CHECK);
   }
 
   jobject max_chunk_size = NULL;
   if (_max_chunk_size.is_set()) {
-    max_chunk_size = JfrJavaSupport::new_java_lang_Long(_max_chunk_size.value(), CHECK);
+    max_chunk_size = JfrJavaSupport::new_java_lang_Long(_max_chunk_size.value()._size, CHECK);
   }
 
   jobject memory_size = NULL;
   if (_memory_size.is_set()) {
-    memory_size = JfrJavaSupport::new_java_lang_Long(_memory_size.value(), CHECK);
+    memory_size = JfrJavaSupport::new_java_lang_Long(_memory_size.value()._size, CHECK);
   }
 
   jobject sample_threads = NULL;
--- a/src/hotspot/share/jfr/dcmd/jfrDcmds.hpp	Fri Nov 23 12:45:47 2018 +0800
+++ b/src/hotspot/share/jfr/dcmd/jfrDcmds.hpp	Fri Nov 23 16:36:07 2018 +0900
@@ -145,10 +145,10 @@
   DCmdArgument<char*> _dump_path;
   DCmdArgument<jlong> _stack_depth;
   DCmdArgument<jlong> _global_buffer_count;
-  DCmdArgument<jlong> _global_buffer_size;
-  DCmdArgument<jlong> _thread_buffer_size;
-  DCmdArgument<jlong> _memory_size;
-  DCmdArgument<jlong> _max_chunk_size;
+  DCmdArgument<MemorySizeArgument> _global_buffer_size;
+  DCmdArgument<MemorySizeArgument> _thread_buffer_size;
+  DCmdArgument<MemorySizeArgument> _memory_size;
+  DCmdArgument<MemorySizeArgument> _max_chunk_size;
   DCmdArgument<bool>  _sample_threads;
 
  public:
--- a/src/hotspot/share/jfr/recorder/service/jfrOptionSet.cpp	Fri Nov 23 12:45:47 2018 +0800
+++ b/src/hotspot/share/jfr/recorder/service/jfrOptionSet.cpp	Fri Nov 23 16:36:07 2018 +0900
@@ -352,19 +352,19 @@
   configure._stack_depth.set_value(_dcmd_stackdepth.value());
 
   configure._thread_buffer_size.set_is_set(_dcmd_threadbuffersize.is_set());
-  configure._thread_buffer_size.set_value(_dcmd_threadbuffersize.value()._size);
+  configure._thread_buffer_size.set_value(_dcmd_threadbuffersize.value());
 
   configure._global_buffer_count.set_is_set(_dcmd_numglobalbuffers.is_set());
   configure._global_buffer_count.set_value(_dcmd_numglobalbuffers.value());
 
   configure._global_buffer_size.set_is_set(_dcmd_globalbuffersize.is_set());
-  configure._global_buffer_size.set_value(_dcmd_globalbuffersize.value()._size);
+  configure._global_buffer_size.set_value(_dcmd_globalbuffersize.value());
 
   configure._max_chunk_size.set_is_set(_dcmd_maxchunksize.is_set());
-  configure._max_chunk_size.set_value(_dcmd_maxchunksize.value()._size);
+  configure._max_chunk_size.set_value(_dcmd_maxchunksize.value());
 
   configure._memory_size.set_is_set(_dcmd_memorysize.is_set());
-  configure._memory_size.set_value(_dcmd_memorysize.value()._size);
+  configure._memory_size.set_value(_dcmd_memorysize.value());
 
   configure._sample_threads.set_is_set(_dcmd_sample_threads.is_set());
   configure._sample_threads.set_value(_dcmd_sample_threads.value());
--- a/test/jdk/jdk/jfr/jcmd/TestJcmdConfigure.java	Fri Nov 23 12:45:47 2018 +0800
+++ b/test/jdk/jdk/jfr/jcmd/TestJcmdConfigure.java	Fri Nov 23 16:36:07 2018 +0900
@@ -99,9 +99,7 @@
 
     private static void testNegative(String configName, Object value) {
         try {
-            // Syntactically invalid arguments are catched by the JCMD framework where an error code of 1 is returned.
-            // Syntactically valid arguments that are semantically invalid (invalid value ranges for example) are handled by JFR code, it will always return a value of 0.
-            JcmdHelper.jcmd(configName.equals(UNSUPPORTED_OPTION) ? 1 : 0, "JFR.configure", configName + "=" + value);
+            JcmdHelper.jcmd(1, "JFR.configure", configName + "=" + value);
         } catch(Exception e) {
             testExceptions.add(e);
         }