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
26 package jdk.jfr.event.runtime;
27
28 import java.time.Duration;
29 import java.util.List;
30 import java.util.concurrent.CountDownLatch;
31
32 import jdk.jfr.Recording;
33 import jdk.jfr.consumer.RecordedEvent;
34 import jdk.test.lib.jfr.EventNames;
35 import jdk.test.lib.jfr.Events;
36
37 /*
38 * @test
39 * @key jfr
40 * @library /test/lib
41 * @run main/othervm jdk.jfr.event.runtime.TestThreadStartEndEvents
42 */
43
44 /**
45 * Starts and stops a number of threads in order.
46 * Verifies that events are in the same order.
47 */
48 public class TestThreadStartEndEvents {
49 private final static String EVENT_NAME_THREAD_START = EventNames.ThreadStart;
50 private final static String EVENT_NAME_THREAD_END = EventNames.ThreadEnd;
51 private static final String THREAD_NAME_PREFIX = "TestThread-";
52
53 public static void main(String[] args) throws Throwable {
54 // Test Java Thread Start event
55 Recording recording = new Recording();
56 recording.enable(EVENT_NAME_THREAD_START).withThreshold(Duration.ofMillis(0));
57 recording.enable(EVENT_NAME_THREAD_END).withThreshold(Duration.ofMillis(0));
58 recording.start();
59 LatchedThread[] threads = startThreads();
|
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
26 package jdk.jfr.event.runtime;
27
28 import java.time.Duration;
29 import java.util.List;
30 import java.util.concurrent.CountDownLatch;
31
32 import jdk.jfr.Recording;
33 import jdk.jfr.consumer.RecordedEvent;
34 import jdk.test.lib.jfr.EventNames;
35 import jdk.test.lib.jfr.Events;
36
37 /**
38 * @test
39 * @key jfr
40 * @requires vm.hasJFR
41 * @library /test/lib
42 * @run main/othervm jdk.jfr.event.runtime.TestThreadStartEndEvents
43 */
44
45 /**
46 * Starts and stops a number of threads in order.
47 * Verifies that events are in the same order.
48 */
49 public class TestThreadStartEndEvents {
50 private final static String EVENT_NAME_THREAD_START = EventNames.ThreadStart;
51 private final static String EVENT_NAME_THREAD_END = EventNames.ThreadEnd;
52 private static final String THREAD_NAME_PREFIX = "TestThread-";
53
54 public static void main(String[] args) throws Throwable {
55 // Test Java Thread Start event
56 Recording recording = new Recording();
57 recording.enable(EVENT_NAME_THREAD_START).withThreshold(Duration.ofMillis(0));
58 recording.enable(EVENT_NAME_THREAD_END).withThreshold(Duration.ofMillis(0));
59 recording.start();
60 LatchedThread[] threads = startThreads();
|