Java Code Examples for jdk.jfr.Recording#copy()
The following examples show how to use
jdk.jfr.Recording#copy() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestRecordingCopy.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { Recording original = new Recording(); original.enable(SimpleEvent.class); Recording newCopy = original.copy(false); Asserts.assertEquals(newCopy.getState(), RecordingState.NEW); Recording newStoppedCopy = original.copy(true); Asserts.assertEquals(newStoppedCopy.getState(), RecordingState.NEW); original.start(); SimpleEvent ev = new SimpleEvent(); ev.id = EVENT_ID; ev.commit(); // Verify a stopped copy Recording stoppedCopy = original.copy(true); Asserts.assertEquals(stoppedCopy.getState(), RecordingState.STOPPED); assertCopy(stoppedCopy, original); // Verify a running copy Recording runningCopy = original.copy(false); Asserts.assertEquals(runningCopy.getState(), RecordingState.RUNNING); assertCopy(runningCopy, original); original.stop(); // Verify a stopped copy of a stopped stoppedCopy = original.copy(true); Asserts.assertEquals(stoppedCopy.getState(), RecordingState.STOPPED); assertCopy(stoppedCopy, original); // Clean-up original.close(); runningCopy.stop(); runningCopy.close(); stoppedCopy.close(); }
Example 2
Source File: TestRecordingCopy.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { Recording original = new Recording(); original.enable(SimpleEvent.class); Recording newCopy = original.copy(false); Asserts.assertEquals(newCopy.getState(), RecordingState.NEW); Recording newStoppedCopy = original.copy(true); Asserts.assertEquals(newStoppedCopy.getState(), RecordingState.NEW); original.start(); SimpleEvent ev = new SimpleEvent(); ev.id = EVENT_ID; ev.commit(); // Verify a stopped copy Recording stoppedCopy = original.copy(true); Asserts.assertEquals(stoppedCopy.getState(), RecordingState.STOPPED); assertCopy(stoppedCopy, original); // Verify a running copy Recording runningCopy = original.copy(false); Asserts.assertEquals(runningCopy.getState(), RecordingState.RUNNING); assertCopy(runningCopy, original); original.stop(); // Verify a stopped copy of a stopped stoppedCopy = original.copy(true); Asserts.assertEquals(stoppedCopy.getState(), RecordingState.STOPPED); assertCopy(stoppedCopy, original); // Clean-up original.close(); runningCopy.stop(); runningCopy.close(); stoppedCopy.close(); }
Example 3
Source File: TestRecordingCopy.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { Recording original = new Recording(); original.enable(SimpleEvent.class); Recording newCopy = original.copy(false); Asserts.assertEquals(newCopy.getState(), RecordingState.NEW); Recording newStoppedCopy = original.copy(true); Asserts.assertEquals(newStoppedCopy.getState(), RecordingState.NEW); original.start(); SimpleEvent ev = new SimpleEvent(); ev.id = EVENT_ID; ev.commit(); // Verify a stopped copy Recording stoppedCopy = original.copy(true); Asserts.assertEquals(stoppedCopy.getState(), RecordingState.STOPPED); assertCopy(stoppedCopy, original); // Verify a running copy Recording runningCopy = original.copy(false); Asserts.assertEquals(runningCopy.getState(), RecordingState.RUNNING); assertCopy(runningCopy, original); original.stop(); // Verify a stopped copy of a stopped stoppedCopy = original.copy(true); Asserts.assertEquals(stoppedCopy.getState(), RecordingState.STOPPED); assertCopy(stoppedCopy, original); // Clean-up original.close(); runningCopy.stop(); runningCopy.close(); stoppedCopy.close(); }