< prev index next >

test/jdk/jdk/jfr/api/recording/event/TestChunkPeriod.java

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


  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 
  26 package jdk.jfr.api.recording.event;
  27 
  28 import java.io.IOException;
  29 import java.time.Duration;
  30 import java.time.Instant;
  31 import java.util.List;
  32 
  33 import jdk.jfr.FlightRecorder;
  34 import jdk.jfr.Recording;
  35 import jdk.jfr.consumer.RecordedEvent;
  36 import jdk.test.lib.Asserts;
  37 import jdk.test.lib.jfr.Events;
  38 import jdk.test.lib.jfr.SimpleEvent;
  39 
  40 /*
  41  * @test
  42  * @summary Test periodic setting that involves chunks.
  43  * @key jfr

  44  * @library /test/lib
  45  * @run main/othervm jdk.jfr.api.recording.event.TestChunkPeriod
  46  */
  47 public class TestChunkPeriod {
  48 
  49     // Margin of error is to avoid issues where JFR and
  50     // System.currentMillis take the clock differently
  51     private static final Duration MARGIN_OF_ERROR = Duration.ofNanos(1_000_000_000); // 1 s
  52 
  53     public static void main(String[] args) throws Throwable {
  54         FlightRecorder.addPeriodicEvent(SimpleEvent.class, () -> {
  55             SimpleEvent  pe = new SimpleEvent();
  56             pe.commit();
  57         });
  58         testBeginChunk();
  59         testEndChunk();
  60         testEveryChunk();
  61     }
  62 
  63     private static void testBeginChunk() throws IOException {




  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 
  26 package jdk.jfr.api.recording.event;
  27 
  28 import java.io.IOException;
  29 import java.time.Duration;
  30 import java.time.Instant;
  31 import java.util.List;
  32 
  33 import jdk.jfr.FlightRecorder;
  34 import jdk.jfr.Recording;
  35 import jdk.jfr.consumer.RecordedEvent;
  36 import jdk.test.lib.Asserts;
  37 import jdk.test.lib.jfr.Events;
  38 import jdk.test.lib.jfr.SimpleEvent;
  39 
  40 /**
  41  * @test
  42  * @summary Test periodic setting that involves chunks.
  43  * @key jfr
  44  * @requires vm.hasJFR
  45  * @library /test/lib
  46  * @run main/othervm jdk.jfr.api.recording.event.TestChunkPeriod
  47  */
  48 public class TestChunkPeriod {
  49 
  50     // Margin of error is to avoid issues where JFR and
  51     // System.currentMillis take the clock differently
  52     private static final Duration MARGIN_OF_ERROR = Duration.ofNanos(1_000_000_000); // 1 s
  53 
  54     public static void main(String[] args) throws Throwable {
  55         FlightRecorder.addPeriodicEvent(SimpleEvent.class, () -> {
  56             SimpleEvent  pe = new SimpleEvent();
  57             pe.commit();
  58         });
  59         testBeginChunk();
  60         testEndChunk();
  61         testEveryChunk();
  62     }
  63 
  64     private static void testBeginChunk() throws IOException {


< prev index next >