< prev index next >

test/jdk/jdk/jfr/api/recording/event/TestPeriod.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.util.ArrayList;
  31 import java.util.List;
  32 
  33 import jdk.jfr.Recording;
  34 import jdk.jfr.consumer.RecordedEvent;
  35 import jdk.jfr.consumer.RecordedThread;
  36 import jdk.test.lib.Asserts;
  37 import jdk.test.lib.jfr.EventNames;
  38 import jdk.test.lib.jfr.Events;
  39 
  40 /*
  41  * @test
  42  * @summary Test event period.
  43  * @key jfr

  44  * @library /test/lib
  45  * @run main/othervm jdk.jfr.api.recording.event.TestPeriod
  46  */
  47 public class TestPeriod {
  48     private static final String EVENT_PATH = EventNames.ThreadAllocationStatistics;
  49     private static final long ERROR_MARGIN = 20; // 186 ms has been measured, when period was set to 200 ms
  50 
  51     public static void main(String[] args) throws Throwable {
  52         long[] periods = { 100, 200 };
  53         int eventCount = 4;
  54         int deltaCount;
  55         for (long period : periods) {
  56             List<Long> deltaBetweenEvents;
  57             do {
  58                 deltaBetweenEvents = createPeriodicEvents(period, eventCount);
  59                 deltaCount = deltaBetweenEvents.size();
  60                 if (deltaCount < eventCount - 1) {
  61                     System.out.println("Didn't get sufficent number of events. Retrying...");
  62                     System.out.println();
  63                 }




  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.util.ArrayList;
  31 import java.util.List;
  32 
  33 import jdk.jfr.Recording;
  34 import jdk.jfr.consumer.RecordedEvent;
  35 import jdk.jfr.consumer.RecordedThread;
  36 import jdk.test.lib.Asserts;
  37 import jdk.test.lib.jfr.EventNames;
  38 import jdk.test.lib.jfr.Events;
  39 
  40 /**
  41  * @test
  42  * @summary Test event period.
  43  * @key jfr
  44  * @requires vm.hasJFR
  45  * @library /test/lib
  46  * @run main/othervm jdk.jfr.api.recording.event.TestPeriod
  47  */
  48 public class TestPeriod {
  49     private static final String EVENT_PATH = EventNames.ThreadAllocationStatistics;
  50     private static final long ERROR_MARGIN = 20; // 186 ms has been measured, when period was set to 200 ms
  51 
  52     public static void main(String[] args) throws Throwable {
  53         long[] periods = { 100, 200 };
  54         int eventCount = 4;
  55         int deltaCount;
  56         for (long period : periods) {
  57             List<Long> deltaBetweenEvents;
  58             do {
  59                 deltaBetweenEvents = createPeriodicEvents(period, eventCount);
  60                 deltaCount = deltaBetweenEvents.size();
  61                 if (deltaCount < eventCount - 1) {
  62                     System.out.println("Didn't get sufficent number of events. Retrying...");
  63                     System.out.println();
  64                 }


< prev index next >