< prev index next >

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

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


  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  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.List;
  29 
  30 import jdk.jfr.Recording;
  31 import jdk.jfr.consumer.RecordedEvent;
  32 import jdk.test.lib.jfr.Events;
  33 import jdk.test.lib.jfr.SimpleEvent;
  34 
  35 /*
  36  * @test
  37  * @summary Test for RecordedEvent.getDuration()
  38  * @key jfr

  39  * @library /test/lib
  40  * @run main/othervm jdk.jfr.api.event.TestBeginEnd
  41  */
  42 public class TestBeginEnd {
  43 
  44     public static void main(String[] args) throws Exception {
  45 
  46         Recording r = new Recording();
  47         r.enable(SimpleEvent.class);
  48         r.start();
  49 
  50         // Test enabled - single commit
  51         SimpleEvent e1 = new SimpleEvent();
  52         e1.id = 1; // should be included
  53         e1.commit();
  54 
  55         // Test enabled - begin - commit
  56         SimpleEvent e2 = new SimpleEvent();
  57         e2.begin();
  58         e2.id = 2; // should be included




  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  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.List;
  29 
  30 import jdk.jfr.Recording;
  31 import jdk.jfr.consumer.RecordedEvent;
  32 import jdk.test.lib.jfr.Events;
  33 import jdk.test.lib.jfr.SimpleEvent;
  34 
  35 /**
  36  * @test
  37  * @summary Test for RecordedEvent.getDuration()
  38  * @key jfr
  39  * @requires vm.hasJFR
  40  * @library /test/lib
  41  * @run main/othervm jdk.jfr.api.event.TestBeginEnd
  42  */
  43 public class TestBeginEnd {
  44 
  45     public static void main(String[] args) throws Exception {
  46 
  47         Recording r = new Recording();
  48         r.enable(SimpleEvent.class);
  49         r.start();
  50 
  51         // Test enabled - single commit
  52         SimpleEvent e1 = new SimpleEvent();
  53         e1.id = 1; // should be included
  54         e1.commit();
  55 
  56         // Test enabled - begin - commit
  57         SimpleEvent e2 = new SimpleEvent();
  58         e2.begin();
  59         e2.id = 2; // should be included


< prev index next >