8216283: Allow shorter method sampling interval than 10 ms
authoregahlin
Thu, 06 Jun 2019 20:19:03 +0200 (2019-06-06)
changeset 55267 eabe64456156
parent 55266 fb250e9cfe67
child 55268 c5fe45d1281d
8216283: Allow shorter method sampling interval than 10 ms Reviewed-by: mgronlun
src/hotspot/share/jfr/periodic/sampling/jfrThreadSampler.cpp
src/jdk.jfr/share/conf/jfr/default.jfc
src/jdk.jfr/share/conf/jfr/profile.jfc
--- a/src/hotspot/share/jfr/periodic/sampling/jfrThreadSampler.cpp	Thu Jun 06 10:36:43 2019 -0700
+++ b/src/hotspot/share/jfr/periodic/sampling/jfrThreadSampler.cpp	Thu Jun 06 20:19:03 2019 +0200
@@ -462,8 +462,8 @@
       last_native_ms = last_java_ms;
     }
     _sample.signal();
-    jlong java_interval = _interval_java == 0 ? max_jlong : MAX2<jlong>(_interval_java, 10);
-    jlong native_interval = _interval_native == 0 ? max_jlong : MAX2<jlong>(_interval_native, 10);
+    jlong java_interval = _interval_java == 0 ? max_jlong : MAX2<jlong>(_interval_java, 1);
+    jlong native_interval = _interval_native == 0 ? max_jlong : MAX2<jlong>(_interval_native, 1);
 
     jlong now_ms = get_monotonic_ms();
 
--- a/src/jdk.jfr/share/conf/jfr/default.jfc	Thu Jun 06 10:36:43 2019 -0700
+++ b/src/jdk.jfr/share/conf/jfr/default.jfc	Thu Jun 06 20:19:03 2019 +0200
@@ -140,12 +140,12 @@
 
     <event name="jdk.ExecutionSample">
       <setting name="enabled" control="method-sampling-enabled">true</setting>
-      <setting name="period" control="method-sampling-interval">20 ms</setting>
+      <setting name="period" control="method-sampling-java-interval">20 ms</setting>
     </event>
 
     <event name="jdk.NativeMethodSample">
       <setting name="enabled" control="method-sampling-enabled">true</setting>
-      <setting name="period" control="method-sampling-interval">20 ms</setting>
+      <setting name="period" control="method-sampling-native-interval">20 ms</setting>
     </event>
 
     <event name="jdk.SafepointBegin">
@@ -812,13 +812,42 @@
       </condition>
 
       <selection name="method-sampling-interval" default="normal" label="Method Sampling">
-        <option label="Off" name="off">999 d</option>
-        <option label="Normal" name="normal">20 ms</option>
-        <option label="Maximum" name="maximum">10 ms</option>
+        <option label="Off" name="off">off</option>
+        <option label="Normal" name="normal">normal</option>
+        <option label="High" name="high">high</option>
+        <option label="Ludicrous (High Overhead)" name="ludicrous">ludicrous</option>
       </selection>
+      
+      <condition name="method-sampling-java-interval" true="999 d">
+        <test name="method-sampling-interval" operator="equal" value="off"/>
+      </condition>
+
+      <condition name="method-sampling-java-interval" true="20 ms">
+        <test name="method-sampling-interval" operator="equal" value="normal"/>
+      </condition>
+
+      <condition name="method-sampling-java-interval" true="10 ms">
+        <test name="method-sampling-interval" operator="equal" value="high"/>
+      </condition>
+
+      <condition name="method-sampling-java-interval" true="1 ms">
+        <test name="method-sampling-interval" operator="equal" value="ludicrous"/>
+      </condition>
+      
+      <condition name="method-sampling-native-interval" true="999 d">
+        <test name="method-sampling-interval" operator="equal" value="off"/>
+      </condition>
+
+      <condition name="method-sampling-native-interval" true="20 ms">
+        <or>
+          <test name="method-sampling-interval" operator="equal" value="normal"/>
+          <test name="method-sampling-interval" operator="equal" value="high"/>
+          <test name="method-sampling-interval" operator="equal" value="ludicrous"/>
+        </or>
+      </condition>  
 
       <condition name="method-sampling-enabled" true="false" false="true">
-        <test name="method-sampling-interval" operator="equal" value="999 d"/>
+        <test name="method-sampling-interval" operator="equal" value="off"/>
       </condition>
 
       <selection name="thread-dump-interval" default="normal" label="Thread Dump">
--- a/src/jdk.jfr/share/conf/jfr/profile.jfc	Thu Jun 06 10:36:43 2019 -0700
+++ b/src/jdk.jfr/share/conf/jfr/profile.jfc	Thu Jun 06 20:19:03 2019 +0200
@@ -140,12 +140,12 @@
 
     <event name="jdk.ExecutionSample">
       <setting name="enabled" control="method-sampling-enabled">true</setting>
-      <setting name="period" control="method-sampling-interval">10 ms</setting>
+      <setting name="period" control="method-sampling-java-interval">10 ms</setting>
     </event>
 
     <event name="jdk.NativeMethodSample">
       <setting name="enabled" control="method-sampling-enabled">true</setting>
-      <setting name="period" control="method-sampling-interval">10 ms</setting>
+      <setting name="period" control="method-sampling-native-interval">20 ms</setting>
     </event>
 
     <event name="jdk.SafepointBegin">
@@ -812,14 +812,43 @@
         <test name="compiler-level" operator="equal" value="all"/>
       </condition>
 
-      <selection name="method-sampling-interval" default="maximum" label="Method Sampling">
-        <option label="Off" name="off">999 d</option>
-        <option label="Normal" name="normal">20 ms</option>
-        <option label="Maximum" name="maximum">10 ms</option>
+      <selection name="method-sampling-interval" default="normal" label="Method Sampling">
+        <option label="Off" name="off">off</option>
+        <option label="Normal" name="normal">normal</option>
+        <option label="High" name="high">high</option>
+        <option label="Ludicrous (High Overhead)" name="ludicrous">ludicrous</option>
       </selection>
+      
+      <condition name="method-sampling-java-interval" true="999 d">
+        <test name="method-sampling-interval" operator="equal" value="off"/>
+      </condition>
 
+      <condition name="method-sampling-java-interval" true="20 ms">
+        <test name="method-sampling-interval" operator="equal" value="normal"/>
+      </condition>
+
+      <condition name="method-sampling-java-interval" true="10 ms">
+        <test name="method-sampling-interval" operator="equal" value="high"/>
+      </condition>
+
+      <condition name="method-sampling-java-interval" true="1 ms">
+        <test name="method-sampling-interval" operator="equal" value="ludicrous"/>
+      </condition>
+      
+      <condition name="method-sampling-native-interval" true="999 d">
+        <test name="method-sampling-interval" operator="equal" value="off"/>
+      </condition>
+
+      <condition name="method-sampling-native-interval" true="20 ms">
+        <or>
+          <test name="method-sampling-interval" operator="equal" value="normal"/>
+          <test name="method-sampling-interval" operator="equal" value="high"/>
+          <test name="method-sampling-interval" operator="equal" value="ludicrous"/>
+        </or>
+      </condition>    
+      
       <condition name="method-sampling-enabled" true="false" false="true">
-        <test name="method-sampling-interval" operator="equal" value="999 d"/>
+        <test name="method-sampling-interval" operator="equal" value="off"/>
       </condition>
 
       <selection name="thread-dump-interval" default="everyMinute" label="Thread Dump">