14 * version 2 for more details (a copy is included in the LICENSE file that
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
26 package jdk.jfr.api.event;
27
28 import java.time.Duration;
29
30 import jdk.jfr.Event;
31 import jdk.jfr.Recording;
32 import jdk.test.lib.Asserts;
33
34 /*
35 * @test
36 * @summary Test enable/disable event and verify recording has expected events.
37 * @key jfr
38 * @library /test/lib
39 * @run main/othervm -Xlog:jfr+event+setting=trace jdk.jfr.api.event.TestShouldCommit
40 */
41
42 public class TestShouldCommit {
43
44 public static void main(String[] args) throws Exception {
45 Recording rA = new Recording();
46
47 verifyShouldCommitFalse(); // No active recordings
48
49 rA.start();
50 rA.enable(MyEvent.class).withoutThreshold(); // recA=all
51 verifyShouldCommitTrue();
52
53 setThreshold(rA, 100); // recA=100
54 verifyThreshold(100);
55
56 setThreshold(rA, 200); // recA=200
57 verifyThreshold(200);
|
14 * version 2 for more details (a copy is included in the LICENSE file that
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
26 package jdk.jfr.api.event;
27
28 import java.time.Duration;
29
30 import jdk.jfr.Event;
31 import jdk.jfr.Recording;
32 import jdk.test.lib.Asserts;
33
34 /**
35 * @test
36 * @summary Test enable/disable event and verify recording has expected events.
37 * @key jfr
38 * @requires vm.hasJFR
39 * @library /test/lib
40 * @run main/othervm -Xlog:jfr+event+setting=trace jdk.jfr.api.event.TestShouldCommit
41 */
42
43 public class TestShouldCommit {
44
45 public static void main(String[] args) throws Exception {
46 Recording rA = new Recording();
47
48 verifyShouldCommitFalse(); // No active recordings
49
50 rA.start();
51 rA.enable(MyEvent.class).withoutThreshold(); // recA=all
52 verifyShouldCommitTrue();
53
54 setThreshold(rA, 100); // recA=100
55 verifyThreshold(100);
56
57 setThreshold(rA, 200); // recA=200
58 verifyThreshold(200);
|