mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-04 13:10:15 +00:00
8243563: Doc comments cleanup
Reviewed-by: egahlin
This commit is contained in:
parent
5d783f761f
commit
32eb99e3e3
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -46,24 +46,22 @@ import jdk.jfr.internal.Utils;
|
||||
* <p>
|
||||
* The following example shows how {@code AnnotationElement} can be used to dynamically define events.
|
||||
*
|
||||
* <pre>
|
||||
* <code>
|
||||
* List{@literal <}AnnotationElement{@literal >} typeAnnotations = new ArrayList{@literal <}{@literal >}();
|
||||
* typeannotations.add(new AnnotationElement(Name.class, "com.example.HelloWorld");
|
||||
* <pre>{@literal
|
||||
* List<AnnotationElement> typeAnnotations = new ArrayList<>();
|
||||
* typeAnnotations.add(new AnnotationElement(Name.class, "com.example.HelloWorld"));
|
||||
* typeAnnotations.add(new AnnotationElement(Label.class, "Hello World"));
|
||||
* typeAnnotations.add(new AnnotationElement(Description.class, "Helps programmer getting started"));
|
||||
*
|
||||
* List{@literal <}AnnotationElement{@literal >} fieldAnnotations = new ArrayList{@literal <}{@literal >}();
|
||||
* List<AnnotationElement> fieldAnnotations = new ArrayList<>();
|
||||
* fieldAnnotations.add(new AnnotationElement(Label.class, "Message"));
|
||||
*
|
||||
* List{@literal <}ValueDescriptor{@literal >} fields = new ArrayList{@literal <}{@literal >}();
|
||||
* List<ValueDescriptor> fields = new ArrayList<>();
|
||||
* fields.add(new ValueDescriptor(String.class, "message", fieldAnnotations));
|
||||
*
|
||||
* EventFactory f = EventFactory.create(typeAnnotations, fields);
|
||||
* Event event = f.newEvent();
|
||||
* event.commit();
|
||||
* </code>
|
||||
* </pre>
|
||||
* }</pre>
|
||||
*
|
||||
* @since 9
|
||||
*/
|
||||
@ -357,7 +355,7 @@ public final class AnnotationElement {
|
||||
* @param annotationType the {@code Class object} corresponding to the annotation type,
|
||||
* not {@code null}
|
||||
* @return this element's annotation for the specified annotation type if
|
||||
* it it exists, else {@code null}
|
||||
* it exists, else {@code null}
|
||||
*/
|
||||
public final <A> A getAnnotation(Class<? extends Annotation> annotationType) {
|
||||
Objects.requireNonNull(annotationType);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -32,7 +32,7 @@ import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Event field annotation, specifies that the value is a boolean flag, a {@code true} or
|
||||
* {@code false} value
|
||||
* {@code false} value.
|
||||
*
|
||||
* @since 9
|
||||
*/
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -75,32 +75,32 @@ import java.lang.annotation.Target;
|
||||
* <tr>
|
||||
* <th scope="row">1</th>
|
||||
* <th scope="row">File Upload</th>
|
||||
* <td><code>@Category("Upload")</code></td>
|
||||
* <td>{@code @Category("Upload")}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <th scope="row">2</th>
|
||||
* <th scope="row">Image Read</th>
|
||||
* <td><code>@Category({"Upload", "Image Upload"})</code></td>
|
||||
* <td>{@code @Category({"Upload", "Image Upload"})}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <th scope="row">2</th>
|
||||
* <th scope="row">Image Resize</th>
|
||||
* <td><code>@Category({"Upload", "Image Upload"})</code></td>
|
||||
* <td>{@code @Category({"Upload", "Image Upload"})}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <th scope="row">2</th>
|
||||
* <th scope="row">Image Write</th>
|
||||
* <td><code>@Category({"Upload", "Image Upload"})</code></td>
|
||||
* <td>{@code @Category({"Upload", "Image Upload"})}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <th scope="row">3</th>
|
||||
* <th scope="row">Socket Read</th>
|
||||
* <td><code>@Category("Java Application")</code></td>
|
||||
* <td>{@code @Category("Java Application")}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <th scope="row">3</th>
|
||||
* <th scope="row">File Write</th>
|
||||
* <td><code>@Category("Java Application")</code></td>
|
||||
* <td>{@code @Category("Java Application")}</td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -31,18 +31,17 @@ package jdk.jfr;
|
||||
* <p>
|
||||
* The following example shows how to implement an {@code Event} class.
|
||||
*
|
||||
* <pre>
|
||||
* <code>
|
||||
* <pre>{@literal
|
||||
* import jdk.jfr.Event;
|
||||
* import jdk.jfr.Description;
|
||||
* import jdk.jfr.Label;
|
||||
*
|
||||
* public class Example {
|
||||
*
|
||||
* @Label("Hello World")
|
||||
* @Description("Helps programmer getting started")
|
||||
* @Label("Hello World")
|
||||
* @Description("Helps programmer getting started")
|
||||
* static class HelloWorld extends Event {
|
||||
* @Label("Message")
|
||||
* @Label("Message")
|
||||
* String message;
|
||||
* }
|
||||
*
|
||||
@ -52,11 +51,10 @@ package jdk.jfr;
|
||||
* event.commit();
|
||||
* }
|
||||
* }
|
||||
* </code>
|
||||
* </pre>
|
||||
* }</pre>
|
||||
* <p>
|
||||
* After an event is allocated and its field members are populated, it can be
|
||||
* written to the Flight Recorder system by using the {@code #commit()} method.
|
||||
* written to the Flight Recorder system by using the {@link #commit()} method.
|
||||
* <p>
|
||||
* By default, an event is enabled. To disable an event annotate the
|
||||
* {@link Event} class with {@code @Enabled(false)}.
|
||||
@ -79,8 +77,8 @@ package jdk.jfr;
|
||||
* Gathering data to store in an event can be expensive. The
|
||||
* {@link Event#shouldCommit()} method can be used to verify whether an event
|
||||
* instance would actually be written to the system when the
|
||||
* {@code Event#commit()commit} method is invoked. If
|
||||
* {@link Event#shouldCommit()} returns false, then those operations can be
|
||||
* {@code commit()} method is invoked. If
|
||||
* {@code shouldCommit()} returns false, then those operations can be
|
||||
* avoided.
|
||||
*
|
||||
* @since 9
|
||||
@ -156,7 +154,7 @@ abstract public class Event extends jdk.internal.event.Event {
|
||||
* {@code EventFactory} class.
|
||||
*
|
||||
* @param index the index of the field that is passed to
|
||||
* {@code EventFactory#create(String, java.util.List, java.util.List)}
|
||||
* {@link EventFactory#create(java.util.List, java.util.List)}
|
||||
* @param value value to set, can be {@code null}
|
||||
* @throws UnsupportedOperationException if it's not a dynamically generated
|
||||
* event
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -171,7 +171,7 @@ public final class EventFactory {
|
||||
try {
|
||||
return new EventFactory(eventClass, sanitizedAnnotation, sanitizedFields);
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new IllegalAccessError("Could not accees constructor of generated event handler, " + e.getMessage());
|
||||
throw new IllegalAccessError("Could not access constructor of generated event handler, " + e.getMessage());
|
||||
} catch (NoSuchMethodException e) {
|
||||
throw new InternalError("Could not find constructor in generated event handler, " + e.getMessage());
|
||||
}
|
||||
@ -189,7 +189,7 @@ public final class EventFactory {
|
||||
try {
|
||||
return (Event) constructorHandle.invoke();
|
||||
} catch (Throwable e) {
|
||||
throw new InstantiationError("Could not instantaite dynamically generated event class " + eventClass.getName() + ". " + e.getMessage());
|
||||
throw new InstantiationError("Could not instantiate dynamically generated event class " + eventClass.getName() + ". " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -67,10 +67,8 @@ public final class EventType {
|
||||
* Returns the field with the specified name, or {@code null} if it doesn't
|
||||
* exist.
|
||||
*
|
||||
* @return a value descriptor that describes the field, or <code>null</code> if
|
||||
* @return a value descriptor that describes the field, or {@code null} if
|
||||
* the field with the specified name doesn't exist
|
||||
*
|
||||
* @return a value descriptor, or <code>null</code> if it doesn't exist
|
||||
*/
|
||||
public ValueDescriptor getField(String name) {
|
||||
Objects.requireNonNull(name);
|
||||
|
||||
@ -85,7 +85,7 @@ public final class FlightRecorder {
|
||||
/**
|
||||
* Creates a snapshot of all available recorded data.
|
||||
* <p>
|
||||
* A snapshot is a synthesized recording in a {@code STOPPPED} state. If no data is
|
||||
* A snapshot is a synthesized recording in a {@code STOPPED} state. If no data is
|
||||
* available, a recording with size {@code 0} is returned.
|
||||
* <p>
|
||||
* A snapshot provides stable access to data for later operations (for example,
|
||||
@ -93,17 +93,15 @@ public final class FlightRecorder {
|
||||
* <p>
|
||||
* The following example shows how to create a snapshot and write a subset of the data to a file.
|
||||
*
|
||||
* <pre>
|
||||
* <code>
|
||||
* <pre>{@literal
|
||||
* try (Recording snapshot = FlightRecorder.getFlightRecorder().takeSnapshot()) {
|
||||
* if (snapshot.getSize() > 0) {
|
||||
* if (snapshot.getSize() > 0) {
|
||||
* snapshot.setMaxSize(100_000_000);
|
||||
* snapshot.setMaxAge(Duration.ofMinutes(5));
|
||||
* snapshot.dump(Paths.get("snapshot.jfr"));
|
||||
* }
|
||||
* }
|
||||
* </code>
|
||||
* </pre>
|
||||
* }</pre>
|
||||
*
|
||||
* The caller must close the recording when access to the data is no longer
|
||||
* needed.
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -41,12 +41,12 @@ public interface FlightRecorderListener {
|
||||
* <p>
|
||||
* This method allows clients to implement their own initialization mechanism
|
||||
* that is executed before a {@code FlightRecorder} instance is returned by
|
||||
* {@code FlightRecorder#getFlightRecorder()}.
|
||||
* {@link FlightRecorder#getFlightRecorder()}.
|
||||
*
|
||||
* @implNote This method should return as soon as possible, to avoid blocking
|
||||
* initialization of Flight Recorder. To avoid deadlocks or unexpected
|
||||
* behavior, this method should not call
|
||||
* {@link FlightRecorder#getFlightRecorder()} or start new recordings.
|
||||
* {@code FlightRecorder.getFlightRecorder()} or start new recordings.
|
||||
*
|
||||
* @implSpec The default implementation of this method is empty.
|
||||
*
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -36,39 +36,36 @@ import java.lang.annotation.Target;
|
||||
* In the following example, a transaction event is defined with two
|
||||
* user-defined annotations, {@code @Severity} and {@code @TransactionId}.
|
||||
*
|
||||
* <pre>
|
||||
* <code>
|
||||
*{@literal @}MetadataDefinition
|
||||
*{@literal @}Label("Severity")
|
||||
*{@literal @}Description("Value between 0 and 100 that indicates severity. 100 is most severe.")
|
||||
*{@literal @}Retention(RetentionPolicy.RUNTIME)
|
||||
*{@literal @}Target({ ElementType.TYPE })
|
||||
* public {@literal @}interface {@literal @}Severity {
|
||||
* int value() default 50;
|
||||
* <pre>{@literal
|
||||
* @MetadataDefinition
|
||||
* @Label("Severity")
|
||||
* @Description("Value between 0 and 100 that indicates severity. 100 is most severe.")
|
||||
* @Retention(RetentionPolicy.RUNTIME)
|
||||
* @Target({ElementType.TYPE})
|
||||
* public @interface Severity {
|
||||
* int value() default 50;
|
||||
* }
|
||||
*
|
||||
*{@literal @}MetadataDefinition
|
||||
*{@literal @}Label("Transaction Id")
|
||||
*{@literal @}Relational
|
||||
*{@literal @}Retention(RetentionPolicy.RUNTIME)
|
||||
*{@literal @}Target({ ElementType.FIELD })
|
||||
* public {@literal @}interface {@literal @}Severity {
|
||||
* @MetadataDefinition
|
||||
* @Label("Transaction Id")
|
||||
* @Relational
|
||||
* @Retention(RetentionPolicy.RUNTIME)
|
||||
* @Target({ElementType.FIELD})
|
||||
* public @interface TransactionId {
|
||||
* }
|
||||
*
|
||||
*{@literal @}Severity(80)
|
||||
*{@literal @}Label("Transaction Blocked");
|
||||
* @Severity(80)
|
||||
* @Label("Transaction Blocked")
|
||||
* class TransactionBlocked extends Event {
|
||||
* {@literal @}TransactionId
|
||||
* {@literal @}Label("Transaction");
|
||||
* long transactionId;
|
||||
* @TransactionId
|
||||
* @Label("Transaction")
|
||||
* long transactionId1;
|
||||
*
|
||||
* {@literal @}TransactionId
|
||||
* {@literal @}Label("Transaction Blocker");
|
||||
* long transactionId;
|
||||
* @TransactionId
|
||||
* @Label("Transaction Blocker")
|
||||
* long transactionId2;
|
||||
* }
|
||||
*
|
||||
* </code>
|
||||
* </pre>
|
||||
* }</pre>
|
||||
*
|
||||
* Adding {@code @MetadataDefinition} to the declaration of {@code @Severity} and {@code @TransactionId}
|
||||
* ensures the information is saved by Flight Recorder.
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -62,7 +62,7 @@ public @interface Period {
|
||||
* <p>
|
||||
* Example values: {@code "0 ns"}, {@code "10 ms"}, and {@code "1 s"}.
|
||||
* <p>
|
||||
* A period may also be <code>"everyChunk"</code> to specify that it occurs at
|
||||
* A period may also be {@code "everyChunk"} to specify that it occurs at
|
||||
* least once for every recording file. The number of events that are emitted
|
||||
* depends on how many times the file rotations occur when data is recorded.
|
||||
*
|
||||
|
||||
@ -46,8 +46,7 @@ import jdk.jfr.internal.WriteableUserPath;
|
||||
* <p>
|
||||
* The following example shows how configure, start, stop and dump recording data to disk.
|
||||
*
|
||||
* <pre>
|
||||
* <code>
|
||||
* <pre>{@literal
|
||||
* Configuration c = Configuration.getConfiguration("default");
|
||||
* Recording r = new Recording(c);
|
||||
* r.start();
|
||||
@ -55,8 +54,7 @@ import jdk.jfr.internal.WriteableUserPath;
|
||||
* Thread.sleep(5000);
|
||||
* r.stop();
|
||||
* r.dump(Files.createTempFile("my-recording", ".jfr"));
|
||||
* </code>
|
||||
* </pre>
|
||||
* }</pre>
|
||||
*
|
||||
* @since 9
|
||||
*/
|
||||
@ -145,11 +143,9 @@ public final class Recording implements Closeable {
|
||||
* <p>
|
||||
* The following example shows how create a recording that uses a predefined configuration.
|
||||
*
|
||||
* <pre>
|
||||
* <code>
|
||||
* <pre>{@literal
|
||||
* Recording r = new Recording(Configuration.getConfiguration("default"));
|
||||
* </code>
|
||||
* </pre>
|
||||
* }</pre>
|
||||
*
|
||||
* The newly created recording is in the {@link RecordingState#NEW} state. To
|
||||
* start the recording, invoke the {@link Recording#start()} method.
|
||||
@ -269,7 +265,7 @@ public final class Recording implements Closeable {
|
||||
/**
|
||||
* Returns the time when this recording was started.
|
||||
*
|
||||
* @return the the time, or {@code null} if this recording is not started
|
||||
* @return the time, or {@code null} if this recording is not started
|
||||
*/
|
||||
public Instant getStartTime() {
|
||||
return internal.getStartTime();
|
||||
@ -311,25 +307,21 @@ public final class Recording implements Closeable {
|
||||
* <p>
|
||||
* The following example shows how to set event settings for a recording.
|
||||
*
|
||||
* <pre>
|
||||
* <code>
|
||||
* Map{@literal <}String, String{@literal >} settings = new HashMap{@literal <}{@literal >}();
|
||||
* <pre>{@literal
|
||||
* Map<String, String> settings = new HashMap<>();
|
||||
* settings.putAll(EventSettings.enabled("jdk.CPUSample").withPeriod(Duration.ofSeconds(2)).toMap());
|
||||
* settings.putAll(EventSettings.enabled(MyEvent.class).withThreshold(Duration.ofSeconds(2)).withoutStackTrace().toMap());
|
||||
* settings.put("jdk.ExecutionSample#period", "10 ms");
|
||||
* recording.setSettings(settings);
|
||||
* </code>
|
||||
* </pre>
|
||||
* }</pre>
|
||||
*
|
||||
* The following example shows how to merge settings.
|
||||
*
|
||||
* <pre>
|
||||
* {@code
|
||||
* <pre>{@literal
|
||||
* Map<String, String> settings = recording.getSettings();
|
||||
* settings.putAll(additionalSettings);
|
||||
* recording.setSettings(settings);
|
||||
* }
|
||||
* </pre>
|
||||
* }</pre>
|
||||
*
|
||||
* @param settings the settings to set, not {@code null}
|
||||
*/
|
||||
@ -421,7 +413,7 @@ public final class Recording implements Closeable {
|
||||
*
|
||||
* @param maxSize the amount of data to retain, {@code 0} if infinite
|
||||
*
|
||||
* @throws IllegalArgumentException if <code>maxSize</code> is negative
|
||||
* @throws IllegalArgumentException if {@code maxSize} is negative
|
||||
*
|
||||
* @throws IllegalStateException if the recording is in {@code CLOSED} state
|
||||
*/
|
||||
@ -474,7 +466,7 @@ public final class Recording implements Closeable {
|
||||
*
|
||||
* @param maxAge the length of time that data is kept, or {@code null} if infinite
|
||||
*
|
||||
* @throws IllegalArgumentException if <code>maxAge</code> is negative
|
||||
* @throws IllegalArgumentException if {@code maxAge} is negative
|
||||
*
|
||||
* @throws IllegalStateException if the recording is in the {@code CLOSED} state
|
||||
*/
|
||||
@ -586,10 +578,10 @@ public final class Recording implements Closeable {
|
||||
* <p>
|
||||
* The stream may contain some data outside the specified range.
|
||||
*
|
||||
* @param the start start time for the stream, or {@code null} to get data from
|
||||
* @param start the start time for the stream, or {@code null} to get data from
|
||||
* start time of the recording
|
||||
*
|
||||
* @param the end end time for the stream, or {@code null} to get data until the
|
||||
* @param end the end time for the stream, or {@code null} to get data until the
|
||||
* present time.
|
||||
*
|
||||
* @return an input stream, or {@code null} if no data is available in the
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -65,7 +65,7 @@ public enum RecordingState {
|
||||
* recording are released.
|
||||
* <p>
|
||||
* Nothing that can be done with a recording from this point, and it's
|
||||
* no longer retrievable from the {@code FlightRrecorder.getRecordings()} method.
|
||||
* no longer retrievable from the {@link FlightRecorder#getRecordings()} method.
|
||||
*/
|
||||
CLOSED;
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -36,32 +36,30 @@ import jdk.jfr.internal.Control;
|
||||
* The following example shows a naive implementation of a setting control for
|
||||
* regular expressions:
|
||||
*
|
||||
* <pre>
|
||||
* <code>
|
||||
* <pre>{@literal
|
||||
* final class RegExpControl extends SettingControl {
|
||||
* private Pattern pattern = Pattern.compile(".*");
|
||||
*
|
||||
* {@literal @}Override
|
||||
* @Override
|
||||
* public void setValue(String value) {
|
||||
* this.pattern = Pattern.compile(value);
|
||||
* }
|
||||
*
|
||||
* {@literal @}Override
|
||||
* public String combine(Set{@literal <}String{@literal >} values) {
|
||||
* @Override
|
||||
* public String combine(Set<String> values) {
|
||||
* return String.join("|", values);
|
||||
* }
|
||||
*
|
||||
* {@literal @}Override
|
||||
* @Override
|
||||
* public String getValue() {
|
||||
* return pattern.toString();
|
||||
* }
|
||||
*
|
||||
* public String matches(String s) {
|
||||
* public boolean matches(String s) {
|
||||
* return pattern.matcher(s).find();
|
||||
* }
|
||||
* }
|
||||
* </code>
|
||||
* </pre>
|
||||
* }</pre>
|
||||
*
|
||||
* The {@code setValue(String)}, {@code getValue()} and
|
||||
* {@code combine(Set<String>)} methods are invoked when a setting value
|
||||
@ -86,28 +84,27 @@ import jdk.jfr.internal.Control;
|
||||
* The following example shows how to create an event that uses the
|
||||
* regular expression filter defined above.
|
||||
*
|
||||
* <pre>
|
||||
* <code>
|
||||
* <pre>{@literal
|
||||
* abstract class HTTPRequest extends Event {
|
||||
* {@literal @}Label("Request URI")
|
||||
* @Label("Request URI")
|
||||
* protected String uri;
|
||||
*
|
||||
* {@literal @}Label("Servlet URI Filter")
|
||||
* {@literal @}SettingDefinition
|
||||
* @Label("Servlet URI Filter")
|
||||
* @SettingDefinition
|
||||
* protected boolean uriFilter(RegExpControl regExp) {
|
||||
* return regExp.matches(uri);
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* {@literal @}Label("HTTP Get Request")
|
||||
* @Label("HTTP Get Request")
|
||||
* class HTTPGetRequest extends HTTPRequest {
|
||||
* }
|
||||
*
|
||||
* {@literal @}Label("HTTP Post Request")
|
||||
* @Label("HTTP Post Request")
|
||||
* class HTTPPostRequest extends HTTPRequest {
|
||||
* }
|
||||
*
|
||||
* class ExampleServlet extends HTTPServlet {
|
||||
* class ExampleServlet extends HttpServlet {
|
||||
* protected void doGet(HttpServletRequest req, HttpServletResponse resp) {
|
||||
* HTTPGetRequest request = new HTTPGetRequest();
|
||||
* request.begin();
|
||||
@ -124,22 +121,18 @@ import jdk.jfr.internal.Control;
|
||||
* request.commit();
|
||||
* }
|
||||
* }
|
||||
* </code>
|
||||
* </pre>
|
||||
* }</pre>
|
||||
*
|
||||
* <p>
|
||||
* The following example shows how an event can be filtered by assigning the
|
||||
* {@code "uriFilter"} setting with the specified regular expressions.
|
||||
*
|
||||
* <pre>
|
||||
* <code>
|
||||
* <pre>{@literal
|
||||
* Recording r = new Recording();
|
||||
* r.enable("HTTPGetRequest").with("uriFilter", "https://www.example.com/list/.*");
|
||||
* r.enable("HTTPPostRequest").with("uriFilter", "https://www.example.com/login/.*");
|
||||
* r.start();
|
||||
* </code>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* }</pre>
|
||||
*
|
||||
* @see SettingDefinition
|
||||
*
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -41,21 +41,19 @@ import java.lang.annotation.Target;
|
||||
* <p>
|
||||
* The following example shows how to annotate a method in an event class.
|
||||
*
|
||||
* <pre>
|
||||
* <code>
|
||||
* class HelloWorld extend Event {
|
||||
* <pre>{@literal
|
||||
* class HelloWorld extends Event {
|
||||
*
|
||||
* {@literal @}Label("Message");
|
||||
* @Label("Message")
|
||||
* String message;
|
||||
*
|
||||
* {@literal @}SettingDefinition;
|
||||
* {@literal @}Label("Message Filter");
|
||||
* @SettingDefinition
|
||||
* @Label("Message Filter")
|
||||
* public boolean filter(RegExpControl regExp) {
|
||||
* return regExp.matches(message);
|
||||
* }
|
||||
* }
|
||||
* </code>
|
||||
* </pre>
|
||||
* }</pre>
|
||||
*
|
||||
* For an example of how the setting controls are defined, see
|
||||
* {@link SettingControl}.
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -69,7 +69,7 @@ public @interface Timespan {
|
||||
* <p>
|
||||
* By default, the unit is nanoseconds.
|
||||
*
|
||||
* @return the time span unit, default {@code #NANOSECONDS}, not {@code null}
|
||||
* @return the time span unit, default {@link #NANOSECONDS}, not {@code null}
|
||||
*/
|
||||
String value() default NANOSECONDS;
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -87,15 +87,14 @@ import jdk.jfr.internal.consumer.FileAccess;
|
||||
* <p>
|
||||
* If an unexpected exception occurs in an action, it is possible to catch the
|
||||
* exception in an error handler. An error handler can be registered using the
|
||||
* {@link #onError(Runnable)} method. If no error handler is registered, the
|
||||
* {@link #onError(Consumer)} method. If no error handler is registered, the
|
||||
* default behavior is to print the exception and its backtrace to the standard
|
||||
* error stream.
|
||||
* <p>
|
||||
* The following example shows how an {@code EventStream} can be used to listen
|
||||
* to events on a JVM running Flight Recorder
|
||||
*
|
||||
* <pre>
|
||||
* <code>
|
||||
* <pre>{@literal
|
||||
* try (var es = EventStream.openRepository()) {
|
||||
* es.onEvent("jdk.CPULoad", event -> {
|
||||
* System.out.println("CPU Load " + event.getEndTime());
|
||||
@ -113,8 +112,7 @@ import jdk.jfr.internal.consumer.FileAccess;
|
||||
* });
|
||||
* es.start();
|
||||
* }
|
||||
* </code>
|
||||
* </pre>
|
||||
* }</pre>
|
||||
* <p>
|
||||
* To start recording together with the stream, see {@link RecordingStream}.
|
||||
*
|
||||
@ -139,7 +137,7 @@ public interface EventStream extends AutoCloseable {
|
||||
*/
|
||||
public static EventStream openRepository() throws IOException {
|
||||
Utils.checkAccessFlightRecorder();
|
||||
return new EventDirectoryStream(AccessController.getContext(), null, SecuritySupport.PRIVILIGED, null);
|
||||
return new EventDirectoryStream(AccessController.getContext(), null, SecuritySupport.PRIVILEGED, null);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -162,7 +160,7 @@ public interface EventStream extends AutoCloseable {
|
||||
public static EventStream openRepository(Path directory) throws IOException {
|
||||
Objects.nonNull(directory);
|
||||
AccessControlContext acc = AccessController.getContext();
|
||||
return new EventDirectoryStream(acc, directory, FileAccess.UNPRIVILIGED, null);
|
||||
return new EventDirectoryStream(acc, directory, FileAccess.UNPRIVILEGED, null);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -213,7 +211,7 @@ public interface EventStream extends AutoCloseable {
|
||||
/**
|
||||
* Registers an action to perform if an exception occurs.
|
||||
* <p>
|
||||
* if an action is not registered, an exception stack trace is printed to
|
||||
* If an action is not registered, an exception stack trace is printed to
|
||||
* standard error.
|
||||
* <p>
|
||||
* Registering an action overrides the default behavior. If multiple actions
|
||||
@ -273,7 +271,7 @@ public interface EventStream extends AutoCloseable {
|
||||
* Specifies that the event object in an {@link #onEvent(Consumer)} action
|
||||
* can be reused.
|
||||
* <p>
|
||||
* If reuse is set to {@code true), an action should not keep a reference
|
||||
* If reuse is set to {@code true}, an action should not keep a reference
|
||||
* to the event object after the action has completed.
|
||||
*
|
||||
* @param reuse {@code true} if an event object can be reused, {@code false}
|
||||
@ -286,7 +284,7 @@ public interface EventStream extends AutoCloseable {
|
||||
* they were committed to the stream.
|
||||
*
|
||||
* @param ordered if event objects arrive in chronological order to
|
||||
* {@code #onEvent(Consumer)}
|
||||
* {@link #onEvent(Consumer)}
|
||||
*/
|
||||
void setOrdered(boolean ordered);
|
||||
|
||||
@ -321,22 +319,22 @@ public interface EventStream extends AutoCloseable {
|
||||
void setEndTime(Instant endTime);
|
||||
|
||||
/**
|
||||
* Start processing of actions.
|
||||
* Starts processing of actions.
|
||||
* <p>
|
||||
* Actions are performed in the current thread.
|
||||
* <p>
|
||||
* To stop the stream, use the {@code #close()} method.
|
||||
* To stop the stream, use the {@link #close()} method.
|
||||
*
|
||||
* @throws IllegalStateException if the stream is already started or closed
|
||||
*/
|
||||
void start();
|
||||
|
||||
/**
|
||||
* Start asynchronous processing of actions.
|
||||
* Starts asynchronous processing of actions.
|
||||
* <p>
|
||||
* Actions are performed in a single separate thread.
|
||||
* <p>
|
||||
* To stop the stream, use the {@code #close()} method.
|
||||
* To stop the stream, use the {@link #close()} method.
|
||||
*
|
||||
* @throws IllegalStateException if the stream is already started or closed
|
||||
*/
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,8 +25,6 @@
|
||||
|
||||
package jdk.jfr.consumer;
|
||||
|
||||
import java.lang.reflect.Modifier;
|
||||
|
||||
import jdk.jfr.internal.consumer.ObjectContext;
|
||||
|
||||
/**
|
||||
@ -45,12 +43,10 @@ public final class RecordedClass extends RecordedObject {
|
||||
|
||||
/**
|
||||
* Returns the modifiers of the class.
|
||||
* <p>
|
||||
* See {@link java.lang.reflect.Modifier}
|
||||
*
|
||||
* @return the modifiers
|
||||
*
|
||||
* @see Modifier
|
||||
* @see java.lang.reflect.Modifier
|
||||
*/
|
||||
public int getModifiers() {
|
||||
return getTyped("modifiers", Integer.class, -1);
|
||||
@ -58,7 +54,7 @@ public final class RecordedClass extends RecordedObject {
|
||||
|
||||
/**
|
||||
* Returns the class loader that defined the class.
|
||||
* <P>
|
||||
* <p>
|
||||
* If the bootstrap class loader is represented as {@code null} in the Java
|
||||
* Virtual Machine (JVM), then {@code null} is also the return value of this method.
|
||||
*
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -43,7 +43,7 @@ public final class RecordedClassLoader extends RecordedObject {
|
||||
|
||||
/**
|
||||
* Returns the class of the class loader.
|
||||
* <P>
|
||||
* <p>
|
||||
* If the bootstrap class loader is represented as {@code null} in the Java
|
||||
* Virtual Machine (JVM), then {@code null} is also the return value of this
|
||||
* method.
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -72,13 +72,12 @@ public final class RecordedMethod extends RecordedObject {
|
||||
* Returns the method descriptor for this method (for example,
|
||||
* {@code "(Ljava/lang/String;)V"}).
|
||||
* <p>
|
||||
* See Java Virtual Machine Specification, 4.3
|
||||
* <p>
|
||||
* If this method doesn't belong to a Java frame then the the result is undefined.
|
||||
* If this method doesn't belong to a Java frame then the result is undefined.
|
||||
*
|
||||
* @return method descriptor.
|
||||
* @return method descriptor
|
||||
*
|
||||
* @see RecordedFrame#isJavaFrame()
|
||||
* @jvms 4.3 Descriptors
|
||||
*/
|
||||
public String getDescriptor() {
|
||||
return getTyped("descriptor", String.class, null);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -182,7 +182,7 @@ public class RecordedObject {
|
||||
*
|
||||
* @param name name of the field to get, not {@code null}
|
||||
*
|
||||
* @return {@code true} if the field exists, {@code false} otherwise.
|
||||
* @return {@code true} if the field exists, {@code false} otherwise
|
||||
*
|
||||
* @see #getFields()
|
||||
*/
|
||||
@ -222,8 +222,7 @@ public class RecordedObject {
|
||||
* <p>
|
||||
* Example
|
||||
*
|
||||
* <pre>
|
||||
* <code>
|
||||
* <pre>{@literal
|
||||
* if (event.hasField("intValue")) {
|
||||
* int intValue = event.getValue("intValue");
|
||||
* System.out.println("Int value: " + intValue);
|
||||
@ -236,10 +235,9 @@ public class RecordedObject {
|
||||
*
|
||||
* if (event.hasField("sampledThread")) {
|
||||
* RecordedThread sampledThread = event.getValue("sampledThread");
|
||||
* System.out.println("Sampled thread: " + sampledThread.getName());
|
||||
* System.out.println("Sampled thread: " + sampledThread.getJavaName());
|
||||
* }
|
||||
* </code>
|
||||
* </pre>
|
||||
* }</pre>
|
||||
*
|
||||
* @param <T> the return type
|
||||
* @param name of the field to get, not {@code null}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -70,7 +70,7 @@ public final class RecordedThread extends RecordedObject {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Java thread name, or {@code null} if if doesn't exist.
|
||||
* Returns the Java thread name, or {@code null} if doesn't exist.
|
||||
* <p>
|
||||
* Returns {@code java.lang.Thread.getName()} if the thread has a Java
|
||||
* representation. {@code null} otherwise.
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -50,7 +50,7 @@ public final class RecordedThreadGroup extends RecordedObject {
|
||||
/**
|
||||
* Returns the parent thread group, or {@code null} if it doesn't exist.
|
||||
*
|
||||
* @return parent thread group, or {@code null} if it doesn't exist.
|
||||
* @return parent thread group, or {@code null} if it doesn't exist
|
||||
*/
|
||||
public RecordedThreadGroup getParent() {
|
||||
return getTyped("parent", RecordedThreadGroup.class, null);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -48,16 +48,14 @@ import jdk.jfr.internal.consumer.RecordingInput;
|
||||
* <p>
|
||||
* The following example shows how read and print all events in a recording file.
|
||||
*
|
||||
* <pre>
|
||||
* <code>
|
||||
* <pre>{@literal
|
||||
* try (RecordingFile recordingFile = new RecordingFile(Paths.get("recording.jfr"))) {
|
||||
* while (recordingFile.hasMoreEvents()) {
|
||||
* RecordedEvent event = recordingFile.readEvent();
|
||||
* System.out.println(event);
|
||||
* }
|
||||
* }
|
||||
* </code>
|
||||
* </pre>
|
||||
* }</pre>
|
||||
*
|
||||
* @since 9
|
||||
*/
|
||||
@ -83,7 +81,7 @@ public final class RecordingFile implements Closeable {
|
||||
*/
|
||||
public RecordingFile(Path file) throws IOException {
|
||||
this.file = file.toFile();
|
||||
this.input = new RecordingInput(this.file, FileAccess.UNPRIVILIGED);
|
||||
this.input = new RecordingInput(this.file, FileAccess.UNPRIVILEGED);
|
||||
findNext();
|
||||
}
|
||||
|
||||
@ -93,7 +91,7 @@ public final class RecordingFile implements Closeable {
|
||||
* @return the next event, not {@code null}
|
||||
*
|
||||
* @throws EOFException if no more events exist in the recording file
|
||||
* @throws IOException if an I/O error occurs.
|
||||
* @throws IOException if an I/O error occurs
|
||||
*
|
||||
* @see #hasMoreEvents()
|
||||
*/
|
||||
@ -136,7 +134,7 @@ public final class RecordingFile implements Closeable {
|
||||
MetadataDescriptor previous = null;
|
||||
List<EventType> types = new ArrayList<>();
|
||||
HashSet<Long> foundIds = new HashSet<>();
|
||||
try (RecordingInput ri = new RecordingInput(file, FileAccess.UNPRIVILIGED)) {
|
||||
try (RecordingInput ri = new RecordingInput(file, FileAccess.UNPRIVILEGED)) {
|
||||
ChunkHeader ch = new ChunkHeader(ri);
|
||||
aggregateEventTypeForChunk(ch, null, types, foundIds);
|
||||
while (!ch.isLastChunk()) {
|
||||
@ -152,7 +150,7 @@ public final class RecordingFile implements Closeable {
|
||||
MetadataDescriptor previous = null;
|
||||
List<Type> types = new ArrayList<>();
|
||||
HashSet<Long> foundIds = new HashSet<>();
|
||||
try (RecordingInput ri = new RecordingInput(file, FileAccess.UNPRIVILIGED)) {
|
||||
try (RecordingInput ri = new RecordingInput(file, FileAccess.UNPRIVILEGED)) {
|
||||
ChunkHeader ch = new ChunkHeader(ri);
|
||||
ch.awaitFinished();
|
||||
aggregateTypeForChunk(ch, null, types, foundIds);
|
||||
|
||||
@ -51,18 +51,15 @@ import jdk.jfr.internal.consumer.EventDirectoryStream;
|
||||
* The following example shows how to record events using the default
|
||||
* configuration and print the Garbage Collection, CPU Load and JVM Information
|
||||
* event to standard out.
|
||||
* <pre>
|
||||
* <code>
|
||||
* <pre>{@literal
|
||||
* Configuration c = Configuration.getConfiguration("default");
|
||||
* try (var rs = new RecordingStream(c)) {
|
||||
* rs.onEvent("jdk.GarbageCollection", System.out::println);
|
||||
* rs.onEvent("jdk.CPULoad", System.out::println);
|
||||
* rs.onEvent("jdk.JVMInformation", System.out::println);
|
||||
* rs.start();
|
||||
* }
|
||||
* }
|
||||
* </code>
|
||||
* </pre>
|
||||
* }</pre>
|
||||
*
|
||||
* @since 14
|
||||
*/
|
||||
@ -88,7 +85,7 @@ public final class RecordingStream implements AutoCloseable, EventStream {
|
||||
this.recording = new Recording();
|
||||
try {
|
||||
PlatformRecording pr = PrivateAccess.getInstance().getPlatformRecording(recording);
|
||||
this.directoryStream = new EventDirectoryStream(acc, null, SecuritySupport.PRIVILIGED, pr);
|
||||
this.directoryStream = new EventDirectoryStream(acc, null, SecuritySupport.PRIVILEGED, pr);
|
||||
} catch (IOException ioe) {
|
||||
this.recording.close();
|
||||
throw new IllegalStateException(ioe.getMessage());
|
||||
@ -101,15 +98,13 @@ public final class RecordingStream implements AutoCloseable, EventStream {
|
||||
* The following example shows how to create a recording stream that uses a
|
||||
* predefined configuration.
|
||||
*
|
||||
* <pre>
|
||||
* <code>
|
||||
* <pre>{@literal
|
||||
* var c = Configuration.getConfiguration("default");
|
||||
* try (var rs = new RecordingStream(c)) {
|
||||
* rs.onEvent(System.out::println);
|
||||
* rs.start();
|
||||
* }
|
||||
* </code>
|
||||
* </pre>
|
||||
* }</pre>
|
||||
*
|
||||
* @param configuration configuration that contains the settings to use,
|
||||
* not {@code null}
|
||||
@ -152,19 +147,17 @@ public final class RecordingStream implements AutoCloseable, EventStream {
|
||||
* The following example records 20 seconds using the "default" configuration
|
||||
* and then changes settings to the "profile" configuration.
|
||||
*
|
||||
* <pre>
|
||||
* <code>
|
||||
* Configuration defaultConfiguration = Configuration.getConfiguration("default");
|
||||
* Configuration profileConfiguration = Configuration.getConfiguration("profile");
|
||||
* try (var rs = new RecordingStream(defaultConfiguration) {
|
||||
* rs.onEvent(System.out::println);
|
||||
* rs.startAsync();
|
||||
* Thread.sleep(20_000);
|
||||
* rs.setSettings(profileConfiguration.getSettings());
|
||||
* Thread.sleep(20_000);
|
||||
* }
|
||||
* </code>
|
||||
* </pre>
|
||||
* <pre>{@literal
|
||||
* Configuration defaultConfiguration = Configuration.getConfiguration("default");
|
||||
* Configuration profileConfiguration = Configuration.getConfiguration("profile");
|
||||
* try (var rs = new RecordingStream(defaultConfiguration)) {
|
||||
* rs.onEvent(System.out::println);
|
||||
* rs.startAsync();
|
||||
* Thread.sleep(20_000);
|
||||
* rs.setSettings(profileConfiguration.getSettings());
|
||||
* Thread.sleep(20_000);
|
||||
* }
|
||||
* }</pre>
|
||||
*
|
||||
* @param settings the settings to set, not {@code null}
|
||||
*
|
||||
@ -330,17 +323,16 @@ public final class RecordingStream implements AutoCloseable, EventStream {
|
||||
}
|
||||
|
||||
/**
|
||||
* Start asynchronous processing of actions.
|
||||
* Starts asynchronous processing of actions.
|
||||
* <p>
|
||||
* Actions are performed in a single separate thread.
|
||||
* <p>
|
||||
* To stop the stream, use the {@code #close()} method.
|
||||
* To stop the stream, use the {@link #close()} method.
|
||||
* <p>
|
||||
* The following example prints the CPU usage for ten seconds. When
|
||||
* the current thread leaves the try-with-resources block the
|
||||
* stream is stopped/closed.
|
||||
* <pre>
|
||||
* <code>
|
||||
* <pre>{@literal
|
||||
* try (var stream = new RecordingStream()) {
|
||||
* stream.enable("jdk.CPULoad").withPeriod(Duration.ofSeconds(1));
|
||||
* stream.onEvent("jdk.CPULoad", event -> {
|
||||
@ -349,11 +341,9 @@ public final class RecordingStream implements AutoCloseable, EventStream {
|
||||
* stream.startAsync();
|
||||
* Thread.sleep(10_000);
|
||||
* }
|
||||
* </code>
|
||||
* </pre>
|
||||
* }</pre>
|
||||
*
|
||||
* @throws IllegalStateException if the stream is already started or closed
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public void startAsync() {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -27,8 +27,7 @@
|
||||
* This package contains classes for consuming Flight Recorder data.
|
||||
* <p>
|
||||
* In the following example, the program prints a histogram of all method samples in a recording.
|
||||
* <pre>
|
||||
* <code>
|
||||
* <pre>{@literal
|
||||
* public static void main(String[] args) throws IOException {
|
||||
* if (args.length != 1) {
|
||||
* System.err.println("Must specify a recording file.");
|
||||
@ -50,8 +49,7 @@
|
||||
* .sorted((a, b) -> b.getValue().compareTo(a.getValue()))
|
||||
* .forEach(e -> System.out.printf("%8d %s\n", e.getValue(), e.getKey()));
|
||||
* }
|
||||
* </code>
|
||||
* </pre>
|
||||
* }</pre>
|
||||
* <p>
|
||||
* <b>Null-handling</b>
|
||||
* <p>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -102,7 +102,7 @@ abstract public class Control {
|
||||
return getValue();
|
||||
} catch (Throwable t) {
|
||||
// Prevent malicious user to propagate exception callback in the wrong context
|
||||
Logger.log(LogTag.JFR_SETTING, LogLevel.WARN, "Exception occured when trying to get value for " + getClass());
|
||||
Logger.log(LogTag.JFR_SETTING, LogLevel.WARN, "Exception occurred when trying to get value for " + getClass());
|
||||
}
|
||||
return defaultValue != null ? defaultValue : ""; // Need to return something
|
||||
}
|
||||
@ -123,7 +123,7 @@ abstract public class Control {
|
||||
try {
|
||||
setValue(value);
|
||||
} catch (Throwable t) {
|
||||
Logger.log(LogTag.JFR_SETTING, LogLevel.WARN, "Exception occured when setting value \"" + value + "\" for " + getClass());
|
||||
Logger.log(LogTag.JFR_SETTING, LogLevel.WARN, "Exception occurred when setting value \"" + value + "\" for " + getClass());
|
||||
}
|
||||
} else {
|
||||
AccessController.doPrivileged(new PrivilegedAction<Void>() {
|
||||
@ -133,7 +133,7 @@ abstract public class Control {
|
||||
setValue(value);
|
||||
} catch (Throwable t) {
|
||||
// Prevent malicious user to propagate exception callback in the wrong context
|
||||
Logger.log(LogTag.JFR_SETTING, LogLevel.WARN, "Exception occured when setting value \"" + value + "\" for " + getClass());
|
||||
Logger.log(LogTag.JFR_SETTING, LogLevel.WARN, "Exception occurred when setting value \"" + value + "\" for " + getClass());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -155,7 +155,7 @@ abstract public class Control {
|
||||
combine(Collections.unmodifiableSet(values));
|
||||
} catch (Throwable t) {
|
||||
// Prevent malicious user to propagate exception callback in the wrong context
|
||||
Logger.log(LogTag.JFR_SETTING, LogLevel.WARN, "Exception occured when combining " + values + " for " + getClass());
|
||||
Logger.log(LogTag.JFR_SETTING, LogLevel.WARN, "Exception occurred when combining " + values + " for " + getClass());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -37,7 +37,7 @@ import jdk.jfr.MetadataDefinition;
|
||||
* Event annotation, determines the cutoff above which an event should not be
|
||||
* recorded, i.e. {@code "20 ms"}.
|
||||
*
|
||||
* This settings is only supported for JVM events,
|
||||
* This settings is only supported for JVM events.
|
||||
*
|
||||
* @since 9
|
||||
*/
|
||||
@ -50,7 +50,7 @@ public @interface Cutoff {
|
||||
* Settings name {@code "cutoff"} for configuring event cutoffs.
|
||||
*/
|
||||
public final static String NAME = "cutoff";
|
||||
public final static String INIFITY = "infinity";
|
||||
public final static String INFINITY = "infinity";
|
||||
|
||||
/**
|
||||
* Cutoff, for example {@code "20 ms"}.
|
||||
@ -67,9 +67,9 @@ public @interface Cutoff {
|
||||
* {@code "d"} (days)<br>
|
||||
* <p>
|
||||
* Example values, {@code "0 ns"}, {@code "10 ms"} and {@code "1 s"}. If the
|
||||
* events has an infinite timespan, the text {@code"infinity"} should be used.
|
||||
* events has an infinite timespan, the text {@code "infinity"} should be used.
|
||||
*
|
||||
* @return the threshold, default {@code "0 ns"} not {@code null}
|
||||
*/
|
||||
String value() default "inifity";
|
||||
String value() default "infinity";
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -244,7 +244,7 @@ public final class EventControl {
|
||||
|
||||
private static Control defineCutoff(PlatformEventType type) {
|
||||
Cutoff cutoff = type.getAnnotation(Cutoff.class);
|
||||
String def = Cutoff.INIFITY;
|
||||
String def = Cutoff.INFINITY;
|
||||
if (cutoff != null) {
|
||||
def = cutoff.value();
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -56,7 +56,7 @@ final class EventHandlerCreator {
|
||||
// with for example WLS.
|
||||
private static final int CLASS_VERSION = 52;
|
||||
|
||||
// This is needed so a new EventHandler is automatically generated in MetadataRespoistory
|
||||
// This is needed so a new EventHandler is automatically generated in MetadataRepository
|
||||
// if a user Event class is loaded using APPCDS/CDS.
|
||||
private static final String SUFFIX = "_" + System.currentTimeMillis() + "-" + JVM.getJVM().getPid();
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -320,7 +320,7 @@ public final class EventInstrumentation {
|
||||
return result;
|
||||
}
|
||||
|
||||
public byte[] builUninstrumented() {
|
||||
public byte[] buildUninstrumented() {
|
||||
makeUninstrumented();
|
||||
return toByteArray();
|
||||
}
|
||||
|
||||
@ -25,7 +25,6 @@
|
||||
|
||||
package jdk.jfr.internal;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import jdk.internal.HotSpotIntrinsicCandidate;
|
||||
@ -283,7 +282,6 @@ public final class JVM {
|
||||
*
|
||||
* @param file the file where data should be written, or null if it should
|
||||
* not be copied out (in memory).
|
||||
* @throws IOException
|
||||
*/
|
||||
public native void setOutput(String file);
|
||||
|
||||
@ -362,8 +360,6 @@ public final class JVM {
|
||||
* Requires that JFR has been started with {@link #createNativeJFR()}
|
||||
*
|
||||
* @param bytes binary representation of metadata descriptor
|
||||
*
|
||||
* @param binary representation of descriptor
|
||||
*/
|
||||
public native void storeMetadataDescriptor(byte[] bytes);
|
||||
|
||||
@ -428,8 +424,8 @@ public final class JVM {
|
||||
public native double getTimeConversionFactor();
|
||||
|
||||
/**
|
||||
* Return a unique identifier for a class. Compared to {@link #getClassId()}
|
||||
* , this method does not tag the class as being "in-use".
|
||||
* Return a unique identifier for a class. Compared to {@link #getClassId(Class)},
|
||||
* this method does not tag the class as being "in-use".
|
||||
*
|
||||
* @param clazz class
|
||||
*
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -81,7 +81,7 @@ final class JVMUpcalls {
|
||||
* Id of the class
|
||||
* @param forceInstrumentation
|
||||
* add instrumentation regardless if event is enabled or not.
|
||||
* @param superClazz
|
||||
* @param superClass
|
||||
* the super class of the class being processed
|
||||
* @param oldBytes
|
||||
* byte code
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -328,7 +328,7 @@ final class MetadataHandler extends DefaultHandler implements EntityResolver {
|
||||
}
|
||||
}
|
||||
if (t.cutoff) {
|
||||
aes.add(new AnnotationElement(Cutoff.class, Cutoff.INIFITY));
|
||||
aes.add(new AnnotationElement(Cutoff.class, Cutoff.INFINITY));
|
||||
}
|
||||
}
|
||||
if (t.experimental) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -52,7 +52,7 @@ import jdk.jfr.internal.handlers.EventHandler;
|
||||
public final class MetadataRepository {
|
||||
|
||||
private static final JVM jvm = JVM.getJVM();
|
||||
private static final MetadataRepository instace = new MetadataRepository();
|
||||
private static final MetadataRepository instance = new MetadataRepository();
|
||||
|
||||
private final List<EventType> nativeEventTypes = new ArrayList<>(100);
|
||||
private final List<EventControl> nativeControls = new ArrayList<EventControl>(100);
|
||||
@ -93,7 +93,7 @@ public final class MetadataRepository {
|
||||
}
|
||||
|
||||
public static MetadataRepository getInstance() {
|
||||
return instace;
|
||||
return instance;
|
||||
}
|
||||
|
||||
public synchronized List<EventType> getRegisteredEventTypes() {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -61,7 +61,7 @@ public final class PlatformEventType extends Type {
|
||||
private boolean isInstrumented;
|
||||
private boolean markForInstrumentation;
|
||||
private boolean registered = true;
|
||||
private boolean commitable = enabled && registered;
|
||||
private boolean committable = enabled && registered;
|
||||
|
||||
|
||||
// package private
|
||||
@ -161,7 +161,7 @@ public final class PlatformEventType extends Type {
|
||||
|
||||
public void setEnabled(boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
updateCommitable();
|
||||
updateCommittable();
|
||||
if (isJVM) {
|
||||
if (isMethodSampling) {
|
||||
long p = enabled ? period : 0;
|
||||
@ -247,7 +247,7 @@ public final class PlatformEventType extends Type {
|
||||
public boolean setRegistered(boolean registered) {
|
||||
if (this.registered != registered) {
|
||||
this.registered = registered;
|
||||
updateCommitable();
|
||||
updateCommittable();
|
||||
LogTag logTag = isJVM() || isJDK() ? LogTag.JFR_SYSTEM_EVENT : LogTag.JFR_EVENT;
|
||||
if (registered) {
|
||||
Logger.log(logTag, LogLevel.INFO, "Registered " + getLogName());
|
||||
@ -262,8 +262,8 @@ public final class PlatformEventType extends Type {
|
||||
return false;
|
||||
}
|
||||
|
||||
private void updateCommitable() {
|
||||
this.commitable = enabled && registered;
|
||||
private void updateCommittable() {
|
||||
this.committable = enabled && registered;
|
||||
}
|
||||
|
||||
public final boolean isRegistered() {
|
||||
@ -271,8 +271,8 @@ public final class PlatformEventType extends Type {
|
||||
}
|
||||
|
||||
// Efficient check of enabled && registered
|
||||
public boolean isCommitable() {
|
||||
return commitable;
|
||||
public boolean isCommittable() {
|
||||
return committable;
|
||||
}
|
||||
|
||||
public int getStackTraceOffset() {
|
||||
|
||||
@ -243,7 +243,7 @@ public final class PlatformRecorder {
|
||||
RepositoryChunk newChunk = null;
|
||||
if (toDisk) {
|
||||
newChunk = repository.newChunk(now);
|
||||
MetadataRepository.getInstance().setOutput(newChunk.getUnfishedFile().toString());
|
||||
MetadataRepository.getInstance().setOutput(newChunk.getUnfinishedFile().toString());
|
||||
} else {
|
||||
MetadataRepository.getInstance().setOutput(null);
|
||||
}
|
||||
@ -258,7 +258,7 @@ public final class PlatformRecorder {
|
||||
if (toDisk) {
|
||||
newChunk = repository.newChunk(now);
|
||||
RequestEngine.doChunkEnd();
|
||||
MetadataRepository.getInstance().setOutput(newChunk.getUnfishedFile().toString());
|
||||
MetadataRepository.getInstance().setOutput(newChunk.getUnfinishedFile().toString());
|
||||
startNanos = jvm.getChunkStartNanos();
|
||||
}
|
||||
recording.setState(RecordingState.RUNNING);
|
||||
@ -326,7 +326,7 @@ public final class PlatformRecorder {
|
||||
updateSettingsButIgnoreRecording(recording);
|
||||
if (toDisk) {
|
||||
newChunk = repository.newChunk(now);
|
||||
MetadataRepository.getInstance().setOutput(newChunk.getUnfishedFile().toString());
|
||||
MetadataRepository.getInstance().setOutput(newChunk.getUnfinishedFile().toString());
|
||||
} else {
|
||||
MetadataRepository.getInstance().setOutput(null);
|
||||
}
|
||||
@ -378,7 +378,7 @@ public final class PlatformRecorder {
|
||||
Instant now = Instant.now();
|
||||
RepositoryChunk newChunk = repository.newChunk(now);
|
||||
RequestEngine.doChunkEnd();
|
||||
MetadataRepository.getInstance().setOutput(newChunk.getUnfishedFile().toString());
|
||||
MetadataRepository.getInstance().setOutput(newChunk.getUnfinishedFile().toString());
|
||||
writeMetaEvents();
|
||||
if (currentChunk != null) {
|
||||
finishChunk(currentChunk, now, null);
|
||||
|
||||
@ -83,14 +83,14 @@ public final class PlatformRecording implements AutoCloseable {
|
||||
private TimerTask stopTask;
|
||||
private TimerTask startTask;
|
||||
private AccessControlContext noDestinationDumpOnExitAccessControlContext;
|
||||
private boolean shuoldWriteActiveRecordingEvent = true;
|
||||
private boolean shouldWriteActiveRecordingEvent = true;
|
||||
private Duration flushInterval = Duration.ofSeconds(1);
|
||||
private long finalStartChunkNanos = Long.MIN_VALUE;
|
||||
|
||||
PlatformRecording(PlatformRecorder recorder, long id) {
|
||||
// Typically the access control context is taken
|
||||
// when you call dump(Path) or setDdestination(Path),
|
||||
// but if no destination is set and dumponexit=true
|
||||
// when you call dump(Path) or setDestination(Path),
|
||||
// but if no destination is set and dumpOnExit=true
|
||||
// the control context of the recording is taken when the
|
||||
// Recording object is constructed. This works well for
|
||||
// -XX:StartFlightRecording and JFR.dump
|
||||
@ -203,7 +203,7 @@ public final class PlatformRecording implements AutoCloseable {
|
||||
|
||||
private void ensureOkForSchedule() {
|
||||
if (getState() != RecordingState.NEW) {
|
||||
throw new IllegalStateException("Only a new recoridng can be scheduled for start");
|
||||
throw new IllegalStateException("Only a new recording can be scheduled for start");
|
||||
}
|
||||
}
|
||||
|
||||
@ -682,11 +682,11 @@ public final class PlatformRecording implements AutoCloseable {
|
||||
}
|
||||
|
||||
void setShouldWriteActiveRecordingEvent(boolean shouldWrite) {
|
||||
this.shuoldWriteActiveRecordingEvent = shouldWrite;
|
||||
this.shouldWriteActiveRecordingEvent = shouldWrite;
|
||||
}
|
||||
|
||||
boolean shouldWriteMetadataEvent() {
|
||||
return shuoldWriteActiveRecordingEvent;
|
||||
return shouldWriteActiveRecordingEvent;
|
||||
}
|
||||
|
||||
// Dump running and stopped recordings
|
||||
@ -700,7 +700,7 @@ public final class PlatformRecording implements AutoCloseable {
|
||||
|
||||
public void dumpStopped(WriteableUserPath userPath) throws IOException {
|
||||
synchronized (recorder) {
|
||||
userPath.doPriviligedIO(() -> {
|
||||
userPath.doPrivilegedIO(() -> {
|
||||
try (ChunksChannel cc = new ChunksChannel(chunks); FileChannel fc = FileChannel.open(userPath.getReal(), StandardOpenOption.WRITE, StandardOpenOption.APPEND)) {
|
||||
cc.transferTo(fc);
|
||||
fc.force(true);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -51,10 +51,10 @@ public abstract class PrivateAccess {
|
||||
|
||||
public static PrivateAccess getInstance() {
|
||||
// Can't be initialized in <clinit> because it may
|
||||
// deadlock with FlightRecordeerPermission.<clinit>
|
||||
// deadlock with FlightRecorderPermission.<clinit>
|
||||
if (instance == null) {
|
||||
// Will trigger
|
||||
// FlightRecordeerPermission.<clinit>
|
||||
// FlightRecorderPermission.<clinit>
|
||||
// which will call PrivateAccess.setPrivateAccess
|
||||
new FlightRecorderPermission(Utils.REGISTER_EVENT);
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -83,7 +83,7 @@ final class RepositoryChunk {
|
||||
return SecuritySupport.toRealPath(new SafePath(p));
|
||||
}
|
||||
|
||||
public SafePath getUnfishedFile() {
|
||||
public SafePath getUnfinishedFile() {
|
||||
return unFinishedFile;
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -74,7 +74,7 @@ public final class RequestEngine {
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
// Prevent malicious user to propagate exception callback in the wrong context
|
||||
Logger.log(LogTag.JFR_SYSTEM_EVENT, LogLevel.WARN, "Exception occured during execution of period hook for " + type.getLogName());
|
||||
Logger.log(LogTag.JFR_SYSTEM_EVENT, LogLevel.WARN, "Exception occurred during execution of period hook for " + type.getLogName());
|
||||
}
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@ public final class RequestEngine {
|
||||
Logger.log(LogTag.JFR_EVENT, LogLevel.DEBUG, ()-> "Executed periodic hook for " + type.getLogName());
|
||||
} catch (Throwable t) {
|
||||
// Prevent malicious user to propagate exception callback in the wrong context
|
||||
Logger.log(LogTag.JFR_EVENT, LogLevel.WARN, "Exception occured during execution of period hook for " + type.getLogName());
|
||||
Logger.log(LogTag.JFR_EVENT, LogLevel.WARN, "Exception occurred during execution of period hook for " + type.getLogName());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -238,7 +238,7 @@ public final class RequestEngine {
|
||||
// calculate time left
|
||||
left = (r_period - r_delta);
|
||||
|
||||
/**
|
||||
/*
|
||||
* nothing outside checks that a period is >= 0, so left can end up
|
||||
* negative here. ex. (r_period =(-1)) - (r_delta = 0) if it is,
|
||||
* handle it.
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -77,7 +77,7 @@ public final class SecuritySupport {
|
||||
private final static MethodHandles.Lookup LOOKUP = MethodHandles.lookup();
|
||||
private final static Module JFR_MODULE = Event.class.getModule();
|
||||
public final static SafePath JFC_DIRECTORY = getPathInProperty("java.home", "lib/jfr");
|
||||
public final static FileAccess PRIVILIGED = new Privileged();
|
||||
public final static FileAccess PRIVILEGED = new Privileged();
|
||||
static final SafePath USER_HOME = getPathInProperty("user.home", null);
|
||||
static final SafePath JAVA_IO_TMPDIR = getPathInProperty("java.io.tmpdir", null);
|
||||
|
||||
@ -453,8 +453,8 @@ public final class SecuritySupport {
|
||||
return doPrivilegedWithReturn(() -> new Thread(runnable, threadName), new Permission[0]);
|
||||
}
|
||||
|
||||
static void setDaemonThread(Thread t, boolean daeomn) {
|
||||
doPrivileged(()-> t.setDaemon(daeomn), new RuntimePermission("modifyThread"));
|
||||
static void setDaemonThread(Thread t, boolean daemon) {
|
||||
doPrivileged(()-> t.setDaemon(daemon), new RuntimePermission("modifyThread"));
|
||||
}
|
||||
|
||||
public static SafePath getAbsolutePath(SafePath path) throws IOException {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -82,24 +82,24 @@ public class Type implements Comparable<Type> {
|
||||
*
|
||||
* @param javaTypeName i.e "java.lang.String"
|
||||
* @param superType i.e "java.lang.Annotation"
|
||||
* @param id the class id that represents the class in the JVM
|
||||
* @param typeId the class id that represents the class in the JVM
|
||||
*
|
||||
*/
|
||||
public Type(String javaTypeName, String superType, long typeId) {
|
||||
this(javaTypeName, superType, typeId, false);
|
||||
}
|
||||
|
||||
Type(String javaTypeName, String superType, long typeId, boolean contantPool) {
|
||||
this(javaTypeName, superType, typeId, contantPool, null);
|
||||
Type(String javaTypeName, String superType, long typeId, boolean constantPool) {
|
||||
this(javaTypeName, superType, typeId, constantPool, null);
|
||||
}
|
||||
|
||||
Type(String javaTypeName, String superType, long typeId, boolean contantPool, Boolean simpleType) {
|
||||
Type(String javaTypeName, String superType, long typeId, boolean constantPool, Boolean simpleType) {
|
||||
Objects.requireNonNull(javaTypeName);
|
||||
|
||||
if (!isValidJavaIdentifier(javaTypeName)) {
|
||||
throw new IllegalArgumentException(javaTypeName + " is not a valid Java identifier");
|
||||
}
|
||||
this.constantPool = contantPool;
|
||||
this.constantPool = constantPool;
|
||||
this.superType = superType;
|
||||
this.name = javaTypeName;
|
||||
this.id = typeId;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -165,7 +165,7 @@ public final class TypeLibrary {
|
||||
try {
|
||||
m = annotation.getClass().getMethod(methodName, new Class<?>[0]);
|
||||
} catch (NoSuchMethodException e1) {
|
||||
throw (Error) new InternalError("Could not loacate method " + methodName + " in annotation " + annotation.getClass().getName());
|
||||
throw (Error) new InternalError("Could not locate method " + methodName + " in annotation " + annotation.getClass().getName());
|
||||
}
|
||||
SecuritySupport.setAccessible(m);
|
||||
try {
|
||||
|
||||
@ -213,7 +213,7 @@ public final class Utils {
|
||||
try {
|
||||
Long.parseLong(s);
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new NumberFormatException("'" + s + "' is not a valid timespan. Shoule be numeric value followed by a unit, i.e. 20 ms. Valid units are ns, us, s, m, h and d.");
|
||||
throw new NumberFormatException("'" + s + "' is not a valid timespan. Should be numeric value followed by a unit, i.e. 20 ms. Valid units are ns, us, s, m, h and d.");
|
||||
}
|
||||
// Only accept values with units
|
||||
throw new NumberFormatException("Timespan + '" + s + "' is missing unit. Valid units are ns, us, s, m, h and d.");
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -44,7 +44,7 @@ import java.util.concurrent.Callable;
|
||||
* A user supplied path must never be used in an unsafe context, such as a
|
||||
* shutdown hook or any other thread created by JFR.
|
||||
* <p>
|
||||
* All operation using this path must happen in {@link #doPriviligedIO(Callable)}
|
||||
* All operation using this path must happen in {@link #doPrivilegedIO(Callable)}
|
||||
*/
|
||||
public final class WriteableUserPath {
|
||||
private final AccessControlContext controlContext;
|
||||
@ -120,7 +120,7 @@ public final class WriteableUserPath {
|
||||
return real;
|
||||
}
|
||||
|
||||
public void doPriviligedIO(Callable<?> function) throws IOException {
|
||||
public void doPrivilegedIO(Callable<?> function) throws IOException {
|
||||
try {
|
||||
inPrivileged = true;
|
||||
AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -187,8 +187,6 @@ public final class ChunkParser {
|
||||
|
||||
/**
|
||||
* Reads an event and returns null when segment or chunk ends.
|
||||
*
|
||||
* @param awaitNewEvents wait for new data.
|
||||
*/
|
||||
RecordedEvent readStreamingEvent() throws IOException {
|
||||
long absoluteChunkEnd = chunkHeader.getEnd();
|
||||
@ -198,7 +196,7 @@ public final class ChunkParser {
|
||||
}
|
||||
long lastValid = absoluteChunkEnd;
|
||||
long metadataPosition = chunkHeader.getMetataPosition();
|
||||
long contantPosition = chunkHeader.getConstantPoolPosition();
|
||||
long constantPosition = chunkHeader.getConstantPoolPosition();
|
||||
chunkFinished = awaitUpdatedHeader(absoluteChunkEnd, configuration.filterEnd);
|
||||
if (chunkFinished) {
|
||||
Logger.log(LogTag.JFR_SYSTEM_PARSER, LogLevel.INFO, "At chunk end");
|
||||
@ -214,10 +212,10 @@ public final class ChunkParser {
|
||||
typeMap = factory.getTypeMap();
|
||||
updateConfiguration();
|
||||
}
|
||||
if (contantPosition != chunkHeader.getConstantPoolPosition()) {
|
||||
if (constantPosition != chunkHeader.getConstantPoolPosition()) {
|
||||
Logger.log(LogTag.JFR_SYSTEM_PARSER, LogLevel.INFO, "Found new constant pool data. Filling up pools with new values");
|
||||
constantLookups.forEach(c -> c.getLatestPool().setAllResolved(false));
|
||||
fillConstantPools(contantPosition + chunkHeader.getAbsoluteChunkStart());
|
||||
fillConstantPools(constantPosition + chunkHeader.getAbsoluteChunkStart());
|
||||
constantLookups.forEach(c -> c.getLatestPool().setResolving());
|
||||
constantLookups.forEach(c -> c.getLatestPool().resolve());
|
||||
constantLookups.forEach(c -> c.getLatestPool().setResolved());
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -34,7 +34,7 @@ import jdk.jfr.internal.LongMap;
|
||||
/**
|
||||
* Holds mapping between a set of keys and their corresponding object.
|
||||
*
|
||||
* If the type is a known type, i.e. {@link RecordedThread}, an
|
||||
* If the type is a known type, i.e. {@link jdk.jfr.consumer.RecordedThread}, an
|
||||
* {@link ObjectFactory} can be supplied which will instantiate a typed object.
|
||||
*/
|
||||
final class ConstantMap {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -33,9 +33,6 @@ import java.util.Comparator;
|
||||
import java.util.Objects;
|
||||
|
||||
import jdk.jfr.consumer.RecordedEvent;
|
||||
import jdk.jfr.internal.consumer.Dispatcher;
|
||||
import jdk.jfr.internal.consumer.FileAccess;
|
||||
import jdk.jfr.internal.consumer.RecordingInput;
|
||||
|
||||
/**
|
||||
* Implementation of an event stream that operates against a recording file.
|
||||
@ -52,7 +49,7 @@ public final class EventFileStream extends AbstractEventStream {
|
||||
public EventFileStream(AccessControlContext acc, Path path) throws IOException {
|
||||
super(acc, null);
|
||||
Objects.requireNonNull(path);
|
||||
this.input = new RecordingInput(path.toFile(), FileAccess.UNPRIVILIGED);
|
||||
this.input = new RecordingInput(path.toFile(), FileAccess.UNPRIVILEGED);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -157,7 +157,7 @@ final class EventParser extends Parser {
|
||||
|
||||
@Override
|
||||
public void skip(RecordingInput input) throws IOException {
|
||||
throw new InternalError("Should not call this method. More efficent to read event size and skip ahead");
|
||||
throw new InternalError("Should not call this method. More efficient to read event size and skip ahead");
|
||||
}
|
||||
|
||||
public void resetCache() {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -34,7 +34,7 @@ import java.nio.file.Path;
|
||||
|
||||
// Protected by modular boundaries.
|
||||
public abstract class FileAccess {
|
||||
public final static FileAccess UNPRIVILIGED = new UnPriviliged();
|
||||
public final static FileAccess UNPRIVILEGED = new UnPrivileged();
|
||||
|
||||
public abstract RandomAccessFile openRAF(File f, String mode) throws IOException;
|
||||
|
||||
@ -46,7 +46,7 @@ public abstract class FileAccess {
|
||||
|
||||
public abstract long fileSize(Path p) throws IOException;
|
||||
|
||||
private static class UnPriviliged extends FileAccess {
|
||||
private static class UnPrivileged extends FileAccess {
|
||||
@Override
|
||||
public RandomAccessFile openRAF(File f, String mode) throws IOException {
|
||||
return new RandomAccessFile(f, mode);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -49,7 +49,7 @@ public abstract class JdkJfrConsumer {
|
||||
private static JdkJfrConsumer instance;
|
||||
|
||||
// Initialization will trigger setAccess being called
|
||||
private static void forceInitializetion() {
|
||||
private static void forceInitialization() {
|
||||
try {
|
||||
Class<?> c = RecordedObject.class;
|
||||
Class.forName(c.getName(), true, c.getClassLoader());
|
||||
@ -64,7 +64,7 @@ public abstract class JdkJfrConsumer {
|
||||
|
||||
public static JdkJfrConsumer instance() {
|
||||
if (instance == null) {
|
||||
forceInitializetion();
|
||||
forceInitialization();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -42,7 +42,7 @@ abstract class Parser {
|
||||
public abstract Object parse(RecordingInput input) throws IOException;
|
||||
|
||||
/**
|
||||
* Skips data that would usually be by parsed the {@code #parse(RecordingInput)} method.
|
||||
* Skips data that would usually be by parsed the {@link #parse(RecordingInput)} method.
|
||||
*
|
||||
* @param input input to read from
|
||||
* @throws IOException if operation couldn't be completed due to I/O
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -31,7 +31,6 @@ import java.time.ZoneOffset;
|
||||
import jdk.jfr.internal.LogLevel;
|
||||
import jdk.jfr.internal.LogTag;
|
||||
import jdk.jfr.internal.Logger;
|
||||
import jdk.jfr.internal.consumer.ChunkHeader;
|
||||
|
||||
/**
|
||||
* Converts ticks to nanoseconds
|
||||
@ -40,13 +39,13 @@ final class TimeConverter {
|
||||
private final long startTicks;
|
||||
private final long startNanos;
|
||||
private final double divisor;
|
||||
private final ZoneOffset zoneOffet;
|
||||
private final ZoneOffset zoneOffset;
|
||||
|
||||
TimeConverter(ChunkHeader chunkHeader, int rawOffset) {
|
||||
this.startTicks = chunkHeader.getStartTicks();
|
||||
this.startNanos = chunkHeader.getStartNanos();
|
||||
this.divisor = chunkHeader.getTicksPerSecond() / 1000_000_000L;
|
||||
this.zoneOffet = zoneOfSet(rawOffset);
|
||||
this.zoneOffset = zoneOfSet(rawOffset);
|
||||
}
|
||||
|
||||
public long convertTimestamp(long ticks) {
|
||||
@ -58,7 +57,7 @@ final class TimeConverter {
|
||||
}
|
||||
|
||||
public ZoneOffset getZoneOffset() {
|
||||
return zoneOffet;
|
||||
return zoneOffset;
|
||||
}
|
||||
|
||||
private ZoneOffset zoneOfSet(int rawOffset) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -70,7 +70,7 @@ abstract class AbstractDCmd {
|
||||
// Invoking ProcessHandle.current().pid() would require loading more
|
||||
// classes during startup so instead JVM.getJVM().getPid() is used.
|
||||
// The pid will not be exposed to running Java application, only when starting
|
||||
// JFR from command line (-XX:StartFlightRecordin) or jcmd (JFR.start and JFR.check)
|
||||
// JFR from command line (-XX:StartFlightRecording) or jcmd (JFR.start and JFR.check)
|
||||
return JVM.getJVM().getPid();
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -50,7 +50,7 @@ final class DCmdCheck extends AbstractDCmd {
|
||||
* Execute JFR.check
|
||||
*
|
||||
* @param recordingText name or id of the recording to check, or
|
||||
* <code>null</code> to show a list of all recordings.
|
||||
* {@code null} to show a list of all recordings.
|
||||
*
|
||||
* @param verbose if event settings should be included.
|
||||
*
|
||||
@ -102,7 +102,7 @@ final class DCmdCheck extends AbstractDCmd {
|
||||
printGeneral(recording);
|
||||
if (verbose) {
|
||||
println();
|
||||
printSetttings(recording);
|
||||
printSettings(recording);
|
||||
}
|
||||
}
|
||||
|
||||
@ -130,7 +130,7 @@ final class DCmdCheck extends AbstractDCmd {
|
||||
println();
|
||||
}
|
||||
|
||||
private void printSetttings(Recording recording) {
|
||||
private void printSettings(Recording recording) {
|
||||
Map<String, String> settings = recording.getSettings();
|
||||
for (EventType eventType : sortByEventPath(getFlightRecorder().getEventTypes())) {
|
||||
StringJoiner sj = new StringJoiner(",", "[", "]");
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -58,7 +58,7 @@ final class DCmdDump extends AbstractDCmd {
|
||||
/**
|
||||
* Execute JFR.dump.
|
||||
*
|
||||
* @param name name or id of the recording to dump, or <code>null</code> to dump everything
|
||||
* @param name name or id of the recording to dump, or {@code null} to dump everything
|
||||
*
|
||||
* @param filename file path where recording should be written, not null
|
||||
* @param maxAge how far back in time to dump, may be null
|
||||
@ -114,7 +114,7 @@ final class DCmdDump extends AbstractDCmd {
|
||||
|
||||
if (beginTime != null && endTime != null) {
|
||||
if (endTime.isBefore(beginTime)) {
|
||||
throw new DCmdException("Dump failed, begin must preceed end.");
|
||||
throw new DCmdException("Dump failed, begin must precede end.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -69,10 +69,10 @@ final class DCmdStart extends AbstractDCmd {
|
||||
* @param disk if recording should be persisted to disk
|
||||
* @param path file path where recording data should be written
|
||||
* @param maxAge how long recording data should be kept in the disk
|
||||
* repository, or <code>0</code> if no limit should be set.
|
||||
* repository, or {@code 0} if no limit should be set.
|
||||
*
|
||||
* @param maxSize the minimum amount data to keep in the disk repository
|
||||
* before it is discarded, or <code>0</code> if no limit should be
|
||||
* before it is discarded, or {@code 0} if no limit should be
|
||||
* set.
|
||||
*
|
||||
* @param dumpOnExit if recording should dump on exit
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -44,12 +44,12 @@ final class DCmdStop extends AbstractDCmd {
|
||||
/**
|
||||
* Execute JFR.stop
|
||||
*
|
||||
* Requires that either <code>name or <code>id</code> is set.
|
||||
* Requires that either {@code name} or {@code id} is set.
|
||||
*
|
||||
* @param name name or id of the recording to stop.
|
||||
*
|
||||
* @param filename file path where data should be written after recording has
|
||||
* been stopped, or <code>null</code> if recording shouldn't be written
|
||||
* been stopped, or {@code null} if recording shouldn't be written
|
||||
* to disk.
|
||||
* @return result text
|
||||
*
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -64,7 +64,7 @@ public abstract class EventHandler {
|
||||
// Accessed by generated code in event class
|
||||
// Accessed by generated sub class
|
||||
public final boolean isEnabled() {
|
||||
return platformEventType.isCommitable();
|
||||
return platformEventType.isCommittable();
|
||||
}
|
||||
|
||||
public final EventType getEventType() {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -109,7 +109,7 @@ public final class JFC {
|
||||
* @throws IOException if the file can't be read
|
||||
*
|
||||
* @throws SecurityException if a security manager exists and its
|
||||
* <code>checkRead</code> method denies read access to the file.
|
||||
* {@code checkRead} method denies read access to the file
|
||||
* @see java.io.File#getPath()
|
||||
* @see java.lang.SecurityManager#checkRead(java.lang.String)
|
||||
*/
|
||||
|
||||
@ -73,7 +73,7 @@
|
||||
|
||||
<!-- Text represents a string based input which may have a contentType that hints how the text should be interpreted.
|
||||
For content that can be ordered (i.e numbers) it's possible to set a minimum and maximum value. How values are
|
||||
ordered are determined by the contentType. For instance, if the contenType would be "timeSpan" "1 s" would
|
||||
ordered are determined by the contentType. For instance, if the contentType would be "timeSpan" "1 s" would
|
||||
larger then "1 ns". -->
|
||||
<xsd:complexType name="textType">
|
||||
<xsd:simpleContent>
|
||||
@ -89,7 +89,7 @@
|
||||
</xsd:complexType>
|
||||
|
||||
<!-- Selection represents an input from a set of values. Values are stored in the option elements and
|
||||
they each have unique identifier (selectionIdentfier). The default attribute should point to one of
|
||||
they each have unique identifier (selectionIdentifier). The default attribute should point to one of
|
||||
these values -->
|
||||
<xsd:simpleType name="selectionIdentifier">
|
||||
<xsd:restriction base="xsd:NMTOKEN" />
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -59,7 +59,7 @@ public final class ManagementSupport {
|
||||
// This allows:
|
||||
//
|
||||
// 1) discoverability, so event settings can be exposed without the need to
|
||||
// create a new Recording in FlightrecorderMXBean.
|
||||
// create a new Recording in FlightRecorderMXBean.
|
||||
//
|
||||
// 2) a graphical JMX client to list all attributes to the user, without
|
||||
// loading JFR memory buffers. This is especially important when there is
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -77,7 +77,7 @@ final class Disassemble extends Command {
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Disassamble a recording file into smaller files/chunks";
|
||||
return "Disassemble a recording file into smaller files/chunks";
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -164,7 +164,7 @@ final class Disassemble extends Command {
|
||||
}
|
||||
|
||||
private List<Long> findChunkSizes(Path p) throws IOException {
|
||||
try (RecordingInput input = new RecordingInput(p.toFile(), FileAccess.UNPRIVILIGED)) {
|
||||
try (RecordingInput input = new RecordingInput(p.toFile(), FileAccess.UNPRIVILEGED)) {
|
||||
List<Long> sizes = new ArrayList<>();
|
||||
ChunkHeader ch = new ChunkHeader(input);
|
||||
sizes.add(ch.getSize());
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -58,7 +58,7 @@ abstract class EventPrintWriter extends StructuredWriter {
|
||||
private Predicate<EventType> eventFilter = x -> true;
|
||||
private int stackDepth;
|
||||
|
||||
// cach that will speed up annotation lookup
|
||||
// cache that will speed up annotation lookup
|
||||
private Map<ValueDescriptor, ValueType> typeOfValues = new HashMap<>();
|
||||
|
||||
EventPrintWriter(PrintWriter p) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -92,7 +92,7 @@ final class Summary extends Command {
|
||||
long totalDuration = 0;
|
||||
long chunks = 0;
|
||||
|
||||
try (RecordingInput input = new RecordingInput(p.toFile(), FileAccess.UNPRIVILIGED)) {
|
||||
try (RecordingInput input = new RecordingInput(p.toFile(), FileAccess.UNPRIVILEGED)) {
|
||||
ChunkHeader first = new ChunkHeader(input);
|
||||
ChunkHeader ch = first;
|
||||
String eventPrefix = Type.EVENT_NAME_PREFIX;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -39,7 +39,7 @@ final class UserSyntaxException extends Exception {
|
||||
*
|
||||
* @param errorMessage
|
||||
*/
|
||||
public UserSyntaxException(String message) {
|
||||
super(message);
|
||||
public UserSyntaxException(String errorMessage) {
|
||||
super(errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -35,20 +35,20 @@
|
||||
* To define a Flight Recorder event, extend {@link jdk.jfr.Event} and add
|
||||
* fields that matches the data types of the payload. Metadata about fields,
|
||||
* such as labels, descriptions and units, can be added by using the annotations
|
||||
* available in the <code>jdk.jfr</code> package, or by using a user-defined
|
||||
* available in the {@code jdk.jfr} package, or by using a user-defined
|
||||
* annotation that has the {@link jdk.jfr.MetadataDefinition} annotation.
|
||||
* <p>
|
||||
* After an event class is defined, instances can be created (event objects).
|
||||
* Data is stored in the event by assigning data to fields. Event timing can be
|
||||
* explicitly controlled by using the <code>begin</code> and {@code end} methods
|
||||
* available in the <code>Event</code> class.
|
||||
* explicitly controlled by using the {@code begin} and {@code end} methods
|
||||
* available in the {@code Event} class.
|
||||
* <p>
|
||||
* Gathering data to store in an event can be expensive. The
|
||||
* {@link Event#shouldCommit()} method can be used to verify whether an event
|
||||
* instance would actually be written to the system when the
|
||||
* {@code Event#commit()} method is invoked. If
|
||||
* {@link Event#shouldCommit()} returns {@code false}, then those operations can be
|
||||
* avoided.
|
||||
* {@link jdk.jfr.Event#shouldCommit()} method can be used to verify whether
|
||||
* an event instance would actually be written to the system when
|
||||
* the {@link jdk.jfr.Event#commit()} method is invoked.
|
||||
* If {@link jdk.jfr.Event#shouldCommit()} returns {@code false},
|
||||
* then those operations can be avoided.
|
||||
* <p>
|
||||
* Sometimes the field layout of an event is not known at compile time. In that
|
||||
* case, an event can be dynamically defined. However, dynamic events might not
|
||||
@ -63,8 +63,8 @@
|
||||
* <p>
|
||||
* <b>Controlling Flight Recorder</b>
|
||||
* <p>
|
||||
* Flight Recorder can be controlled locally by using the <code>jcmd</code>
|
||||
* command line tool or remotely by using the <code>FlightRecorderMXBean</code>
|
||||
* Flight Recorder can be controlled locally by using the {@code jcmd}
|
||||
* command line tool or remotely by using the {@code FlightRecorderMXBean}
|
||||
* interface, registered in the platform MBeanServer. When direct programmatic
|
||||
* access is needed, a Flight Recorder instance can be obtained by invoking
|
||||
* {@link jdk.jfr.FlightRecorder#getFlightRecorder()} and a recording created by
|
||||
@ -168,7 +168,7 @@
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <th scope="row">{@code stackTrace}</th>
|
||||
* <td>Specifies whether the stack trace from the {@code Event#commit()} method
|
||||
* <td>Specifies whether the stack trace from the {@link Event#commit()} method
|
||||
* is recorded</td>
|
||||
* <td>{@code "true"}</td>
|
||||
* <td>String representation of a {@code Boolean} ({@code "true"} or
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -160,7 +160,7 @@ public class TestJcmdDumpLimited {
|
||||
private static void testDumpEndBegin() throws Exception {
|
||||
Path testEndBegin = Paths.get("testEndBegin.jfr");
|
||||
OutputAnalyzer output = JcmdHelper.jcmd("JFR.dump", "filename=" + testEndBegin.toFile().getAbsolutePath(), "begin=" + Instant.now(), "end=" + Instant.now().minusSeconds(200));
|
||||
output.shouldContain("Dump failed, begin must preceed end.");
|
||||
output.shouldContain("Dump failed, begin must precede end.");
|
||||
assertMissingFile(testEndBegin);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user