src/jdk.jfr/share/classes/jdk/jfr/consumer/UseCasesStream.java
branchJEP-349-branch
changeset 57944 f1610739fe86
parent 57860 588a3f63efff
equal deleted inserted replaced
57937:c72ed9929e02 57944:f1610739fe86
   151     // - Low overhead
   151     // - Low overhead
   152     //
   152     //
   153     public static void tooling() throws IOException, ParseException {
   153     public static void tooling() throws IOException, ParseException {
   154         Deque<Double> measurements = new ArrayDeque<>();
   154         Deque<Double> measurements = new ArrayDeque<>();
   155         try (RecordingStream rs = new RecordingStream(Configuration.getConfiguration("profile"))) {
   155         try (RecordingStream rs = new RecordingStream(Configuration.getConfiguration("profile"))) {
   156             rs.setInterval(Duration.ofSeconds(1));
   156             rs.setFlushInterval(Duration.ofSeconds(1));
   157             rs.setMaxAge(Duration.ofMinutes(1));
   157             rs.setMaxAge(Duration.ofMinutes(1));
   158             rs.setOrdered(true); // default
   158             rs.setOrdered(true); // default
   159             rs.setReuse(false);
   159             rs.setReuse(false);
   160             rs.onEvent("jdk.CPULoad", e -> {
   160             rs.onEvent("jdk.CPULoad", e -> {
   161                 double d = e.getDouble("totalMachine");
   161                 double d = e.getDouble("totalMachine");
   186             rs.enable("jdk.JavaMonitorEnter").withThreshold(Duration.ofMillis(10));
   186             rs.enable("jdk.JavaMonitorEnter").withThreshold(Duration.ofMillis(10));
   187             rs.enable("jdk.ExceptionThrow");
   187             rs.enable("jdk.ExceptionThrow");
   188             rs.onEvent("jdk.JavaMonitorEnter", System.out::println);
   188             rs.onEvent("jdk.JavaMonitorEnter", System.out::println);
   189             rs.onEvent("jdk.ExceptionThrow", System.out::println);
   189             rs.onEvent("jdk.ExceptionThrow", System.out::println);
   190             rs.start();
   190             rs.start();
   191             ;
       
   192         }
   191         }
   193     }
   192     }
   194 }
   193 }