Java Code Examples for jdk.management.jfr.FlightRecorderMXBean#setPredefinedConfiguration()
The following examples show how to use
jdk.management.jfr.FlightRecorderMXBean#setPredefinedConfiguration() .
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: TestEnoughPermission.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
private static long testRecording(FlightRecorderMXBean bean) throws Exception { System.out.println("A"); long recId = bean.newRecording(); System.out.println("B"); bean.setPredefinedConfiguration(recId, "profile"); System.out.println("C"); bean.startRecording(recId); System.out.println("D"); Asserts.assertTrue(bean.getRecordings().stream().anyMatch(r -> { return r.getId() == recId; }), "recId not found"); System.out.println("E"); bean.stopRecording(recId); final Path path = Paths.get(".", String.format("rec%d.jfr", recId)); bean.copyTo(recId, path.toString()); //EventSet events = EventSet.fromFile(path); return recId; }
Example 2
Source File: TestPredefinedConfiguration.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { FlightRecorderMXBean bean = JmxHelper.getFlighteRecorderMXBean(); long recId = bean.newRecording(); List<String> configNames = new ArrayList<>(); for (Configuration config : Configuration.getConfigurations()) { System.out.println("name=" + config.getName()); configNames.add(config.getName()); bean.setPredefinedConfiguration(recId, config.getName()); RecordingInfo jmxRecording = JmxHelper.getJmxRecording(recId); JmxHelper.verifyMapEquals(jmxRecording.getSettings(), config.getSettings()); JmxHelper.verifyMapEquals(bean.getRecordingSettings(recId), config.getSettings()); } Asserts.assertTrue(configNames.contains("default"), "Missing config 'default'"); Asserts.assertTrue(configNames.contains("profile"), "Missing config 'profile'"); }
Example 3
Source File: TestEnoughPermission.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
private static long testRecording(FlightRecorderMXBean bean) throws Exception { System.out.println("A"); long recId = bean.newRecording(); System.out.println("B"); bean.setPredefinedConfiguration(recId, "profile"); System.out.println("C"); bean.startRecording(recId); System.out.println("D"); Asserts.assertTrue(bean.getRecordings().stream().anyMatch(r -> { return r.getId() == recId; }), "recId not found"); System.out.println("E"); bean.stopRecording(recId); final Path path = Paths.get(".", "rec" + recId + ".jfr"); bean.copyTo(recId, path.toString()); //EventSet events = EventSet.fromFile(path); return recId; }
Example 4
Source File: TestPredefinedConfiguration.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { FlightRecorderMXBean bean = JmxHelper.getFlighteRecorderMXBean(); long recId = bean.newRecording(); List<String> configNames = new ArrayList<>(); for (Configuration config : Configuration.getConfigurations()) { System.out.println("name=" + config.getName()); configNames.add(config.getName()); bean.setPredefinedConfiguration(recId, config.getName()); RecordingInfo jmxRecording = JmxHelper.getJmxRecording(recId); JmxHelper.verifyMapEquals(jmxRecording.getSettings(), config.getSettings()); JmxHelper.verifyMapEquals(bean.getRecordingSettings(recId), config.getSettings()); } Asserts.assertTrue(configNames.contains("default"), "Missing config 'default'"); Asserts.assertTrue(configNames.contains("profile"), "Missing config 'profile'"); }
Example 5
Source File: TestEnoughPermission.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
private static long testRecording(FlightRecorderMXBean bean) throws Exception { System.out.println("A"); long recId = bean.newRecording(); System.out.println("B"); bean.setPredefinedConfiguration(recId, "profile"); System.out.println("C"); bean.startRecording(recId); System.out.println("D"); Asserts.assertTrue(bean.getRecordings().stream().anyMatch(r -> { return r.getId() == recId; }), "recId not found"); System.out.println("E"); bean.stopRecording(recId); final Path path = Paths.get(".", "rec" + recId + ".jfr"); bean.copyTo(recId, path.toString()); //EventSet events = EventSet.fromFile(path); return recId; }
Example 6
Source File: TestPredefinedConfiguration.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { FlightRecorderMXBean bean = JmxHelper.getFlighteRecorderMXBean(); long recId = bean.newRecording(); List<String> configNames = new ArrayList<>(); for (Configuration config : Configuration.getConfigurations()) { System.out.println("name=" + config.getName()); configNames.add(config.getName()); bean.setPredefinedConfiguration(recId, config.getName()); RecordingInfo jmxRecording = JmxHelper.getJmxRecording(recId); JmxHelper.verifyMapEquals(jmxRecording.getSettings(), config.getSettings()); JmxHelper.verifyMapEquals(bean.getRecordingSettings(recId), config.getSettings()); } Asserts.assertTrue(configNames.contains("default"), "Missing config 'default'"); Asserts.assertTrue(configNames.contains("profile"), "Missing config 'profile'"); }
Example 7
Source File: TestPredefinedConfigurationInvalid.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Throwable { FlightRecorderMXBean bean = JmxHelper.getFlighteRecorderMXBean(); long recId = bean.newRecording(); // Test invalid named configs. verifyNullPointer(()->{ bean.setPredefinedConfiguration(recId, null); }, "setNamedConfig(null)"); setInvalidConfigName(recId, ""); setInvalidConfigName(recId, "invalidname"); // Verify we can set named config after failed attempts. Configuration config = Configuration.getConfigurations().get(0); bean.setPredefinedConfiguration(recId, config.getName()); JmxHelper.verifyMapEquals(bean.getRecordingSettings(recId), config.getSettings()); }
Example 8
Source File: TestPredefinedConfigurationInvalid.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Throwable { FlightRecorderMXBean bean = JmxHelper.getFlighteRecorderMXBean(); long recId = bean.newRecording(); // Test invalid named configs. verifyNullPointer(()->{ bean.setPredefinedConfiguration(recId, null); }, "setNamedConfig(null)"); setInvalidConfigName(recId, ""); setInvalidConfigName(recId, "invalidname"); // Verify we can set named config after failed attempts. Configuration config = Configuration.getConfigurations().get(0); bean.setPredefinedConfiguration(recId, config.getName()); JmxHelper.verifyMapEquals(bean.getRecordingSettings(recId), config.getSettings()); }
Example 9
Source File: TestPredefinedConfigurationInvalid.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Throwable { FlightRecorderMXBean bean = JmxHelper.getFlighteRecorderMXBean(); long recId = bean.newRecording(); // Test invalid named configs. verifyNullPointer(()->{ bean.setPredefinedConfiguration(recId, null); }, "setNamedConfig(null)"); setInvalidConfigName(recId, ""); setInvalidConfigName(recId, "invalidname"); // Verify we can set named config after failed attempts. Configuration config = Configuration.getConfigurations().get(0); bean.setPredefinedConfiguration(recId, config.getName()); JmxHelper.verifyMapEquals(bean.getRecordingSettings(recId), config.getSettings()); }