< prev index next >

test/jdk/jdk/jfr/api/event/TestGetDuration.java

Print this page
rev 51054 : imported patch 9000013-aixDisableJFR-requires.patch


  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 package jdk.jfr.api.event;
  26 
  27 import java.time.Duration;
  28 import java.util.ArrayList;
  29 import java.util.List;
  30 
  31 import jdk.jfr.Recording;
  32 import jdk.jfr.consumer.RecordedEvent;
  33 import jdk.test.lib.Asserts;
  34 import jdk.test.lib.jfr.CommonHelper;
  35 import jdk.test.lib.jfr.EventNames;
  36 import jdk.test.lib.jfr.Events;
  37 import jdk.test.lib.jfr.SimpleEvent;
  38 
  39 /*
  40  * @test
  41  * @summary Test for RecordedEvent.getDuration()
  42  * @key jfr

  43  * @library /test/lib
  44  * @run main/othervm jdk.jfr.api.event.TestGetDuration
  45  */
  46 public class TestGetDuration {
  47 
  48     private static final int DURATIONAL_EVENT_ID = 1;
  49     private static final int INSTANT_EVENT_ID = 2;
  50 
  51     public static void main(String[] args) throws Exception {
  52         verifyCustomEvents();
  53         verifyNativeEvents();
  54     }
  55 
  56     private static void verifyCustomEvents() throws Exception {
  57         boolean fastTimeEnabled = CommonHelper.hasFastTimeEnabled();
  58         System.out.println("Fast time enabled: " + fastTimeEnabled);
  59         Recording r = new Recording();
  60         r.enable(SimpleEvent.class).withoutStackTrace();
  61         r.enable(EventNames.CPUTimeStampCounter); // for debugging purposes
  62         r.start();




  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 package jdk.jfr.api.event;
  26 
  27 import java.time.Duration;
  28 import java.util.ArrayList;
  29 import java.util.List;
  30 
  31 import jdk.jfr.Recording;
  32 import jdk.jfr.consumer.RecordedEvent;
  33 import jdk.test.lib.Asserts;
  34 import jdk.test.lib.jfr.CommonHelper;
  35 import jdk.test.lib.jfr.EventNames;
  36 import jdk.test.lib.jfr.Events;
  37 import jdk.test.lib.jfr.SimpleEvent;
  38 
  39 /**
  40  * @test
  41  * @summary Test for RecordedEvent.getDuration()
  42  * @key jfr
  43  * @requires vm.hasJFR
  44  * @library /test/lib
  45  * @run main/othervm jdk.jfr.api.event.TestGetDuration
  46  */
  47 public class TestGetDuration {
  48 
  49     private static final int DURATIONAL_EVENT_ID = 1;
  50     private static final int INSTANT_EVENT_ID = 2;
  51 
  52     public static void main(String[] args) throws Exception {
  53         verifyCustomEvents();
  54         verifyNativeEvents();
  55     }
  56 
  57     private static void verifyCustomEvents() throws Exception {
  58         boolean fastTimeEnabled = CommonHelper.hasFastTimeEnabled();
  59         System.out.println("Fast time enabled: " + fastTimeEnabled);
  60         Recording r = new Recording();
  61         r.enable(SimpleEvent.class).withoutStackTrace();
  62         r.enable(EventNames.CPUTimeStampCounter); // for debugging purposes
  63         r.start();


< prev index next >