Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
JDK 17 jdk.jfr.jmod - JFR Module
JDK 17 jdk.jfr.jmod is the JMOD file for JDK 17 JFR module.
JDK 17 JFR module compiled class files are stored in \fyicenter\jdk-17.0.5\jmods\jdk.jfr.jmod.
JDK 17 JFR module compiled class files are also linked and stored in the \fyicenter\jdk-17.0.5\lib\modules JImage file.
JDK 17 JFR module source code files are stored in \fyicenter\jdk-17.0.5\lib\src.zip\jdk.jfr.
You can click and view the content of each source code file in the list below.
✍: FYIcenter
⏎ jdk/jfr/internal/dcmd/DCmdDump.java
/*
* Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package jdk.jfr.internal.dcmd;
import java.io.IOException;
import java.nio.file.InvalidPathException;
import java.time.Duration;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeParseException;
import jdk.jfr.FlightRecorder;
import jdk.jfr.Recording;
import jdk.jfr.internal.PlatformRecorder;
import jdk.jfr.internal.PlatformRecording;
import jdk.jfr.internal.PrivateAccess;
import jdk.jfr.internal.SecuritySupport.SafePath;
import jdk.jfr.internal.Utils;
import jdk.jfr.internal.WriteableUserPath;
/**
* JFR.dump
*
*/
// Instantiated by native
final class DCmdDump extends AbstractDCmd {
@Override
public void execute(ArgumentParser parser) throws DCmdException {
parser.checkUnknownArguments();
String name = parser.getOption("name");
String filename = parser.getOption("filename");
Long maxAge = parser.getOption("maxage");
Long maxSize = parser.getOption("maxsize");
String begin = parser.getOption("begin");
String end = parser.getOption("end");
Boolean pathToGcRoots = parser.getOption("path-to-gc-roots");
if (FlightRecorder.getFlightRecorder().getRecordings().isEmpty()) {
throw new DCmdException("No recordings to dump from. Use JFR.start to start a recording.");
}
if (maxAge != null) {
if (end != null || begin != null) {
throw new DCmdException("Dump failed, maxage can't be combined with begin or end.");
}
if (maxAge < 0) {
throw new DCmdException("Dump failed, maxage can't be negative.");
}
if (maxAge == 0) {
maxAge = Long.MAX_VALUE / 2; // a high value that won't overflow
}
}
if (maxSize!= null) {
if (maxSize < 0) {
throw new DCmdException("Dump failed, maxsize can't be negative.");
}
if (maxSize == 0) {
maxSize = Long.MAX_VALUE / 2; // a high value that won't overflow
}
}
Instant beginTime = parseTime(begin, "begin");
Instant endTime = parseTime(end, "end");
if (beginTime != null && endTime != null) {
if (endTime.isBefore(beginTime)) {
throw new DCmdException("Dump failed, begin must precede end.");
}
}
Duration duration = null;
if (maxAge != null) {
duration = Duration.ofNanos(maxAge);
beginTime = Instant.now().minus(duration);
}
Recording recording = null;
if (name != null) {
recording = findRecording(name);
}
PlatformRecorder recorder = PrivateAccess.getInstance().getPlatformRecorder();
try {
synchronized (recorder) {
dump(recorder, recording, name, filename, maxSize, pathToGcRoots, beginTime, endTime);
}
} catch (IOException | InvalidPathException e) {
throw new DCmdException("Dump failed. Could not copy recording data. %s", e.getMessage());
}
}
public void dump(PlatformRecorder recorder, Recording recording, String name, String filename, Long maxSize, Boolean pathToGcRoots, Instant beginTime, Instant endTime) throws DCmdException, IOException {
try (PlatformRecording r = newSnapShot(recorder, recording, pathToGcRoots)) {
r.filter(beginTime, endTime, maxSize);
if (r.getChunks().isEmpty()) {
throw new DCmdException("Dump failed. No data found in the specified interval.");
}
// If a filename exist, use it
// if a filename doesn't exist, use destination set earlier
// if destination doesn't exist, generate a filename
WriteableUserPath wup = null;
if (recording != null) {
PlatformRecording pRecording = PrivateAccess.getInstance().getPlatformRecording(recording);
wup = pRecording.getDestination();
}
if (filename != null || (filename == null && wup == null) ) {
SafePath safe = resolvePath(recording, filename);
wup = new WriteableUserPath(safe.toPath());
}
r.dumpStopped(wup);
reportOperationComplete("Dumped", name, new SafePath(wup.getRealPathText()));
}
}
private Instant parseTime(String time, String parameter) throws DCmdException {
if (time == null) {
return null;
}
try {
return Instant.parse(time);
} catch (DateTimeParseException dtp) {
// fall through
}
try {
LocalDateTime ldt = LocalDateTime.parse(time);
return ZonedDateTime.of(ldt, ZoneId.systemDefault()).toInstant();
} catch (DateTimeParseException dtp) {
// fall through
}
try {
LocalTime lt = LocalTime.parse(time);
LocalDate ld = LocalDate.now();
Instant instant = ZonedDateTime.of(ld, lt, ZoneId.systemDefault()).toInstant();
Instant now = Instant.now();
if (instant.isAfter(now) && !instant.isBefore(now.plusSeconds(3600))) {
// User must have meant previous day
ld = ld.minusDays(1);
}
return ZonedDateTime.of(ld, lt, ZoneId.systemDefault()).toInstant();
} catch (DateTimeParseException dtp) {
// fall through
}
if (time.startsWith("-")) {
try {
long durationNanos = Utils.parseTimespan(time.substring(1));
Duration duration = Duration.ofNanos(durationNanos);
return Instant.now().minus(duration);
} catch (NumberFormatException nfe) {
// fall through
}
}
throw new DCmdException("Dump failed, not a valid %s time.", parameter);
}
private PlatformRecording newSnapShot(PlatformRecorder recorder, Recording recording, Boolean pathToGcRoots) throws DCmdException, IOException {
if (recording == null) {
// Operate on all recordings
PlatformRecording snapshot = recorder.newTemporaryRecording();
recorder.fillWithRecordedData(snapshot, pathToGcRoots);
return snapshot;
}
PlatformRecording pr = PrivateAccess.getInstance().getPlatformRecording(recording);
return pr.newSnapshotClone("Dumped by user", pathToGcRoots);
}
@Override
public String[] printHelp() {
// 0123456789001234567890012345678900123456789001234567890012345678900123456789001234567890
return """
Syntax : JFR.dump [options]
Options:
begin (Optional) Specify the time from which recording data will be included
in the dump file. The format is specified as local time.
(STRING, no default value)
end (Optional) Specify the time to which recording data will be included
in the dump file. The format is specified as local time.
(STRING, no default value)
Note: For both begin and end, the time must be in a format that can
be read by any of these methods:
java.time.LocalTime::parse(String),
java.time.LocalDateTime::parse(String)
java.time.Instant::parse(String)
For example, "13:20:15", "2020-03-17T09:00:00" or
"2020-03-17T09:00:00Z".
Note: begin and end times correspond to the timestamps found within
the recorded information in the flight recording data.
Another option is to use a time relative to the current time that is
specified by a negative integer followed by "s", "m" or "h".
For example, "-12h", "-15m" or "-30s"
filename (Optional) Name of the file to which the flight recording data is
dumped. If no filename is given, a filename is generated from the PID
and the current date. The filename may also be a directory in which
case, the filename is generated from the PID and the current date in
the specified directory. (STRING, no default value)
maxage (Optional) Length of time for dumping the flight recording data to a
file. (INTEGER followed by 's' for seconds 'm' for minutes or 'h' for
hours, no default value)
maxsize (Optional) Maximum size for the amount of data to dump from a flight
recording in bytes if one of the following suffixes is not used:
'm' or 'M' for megabytes OR 'g' or 'G' for gigabytes.
(STRING, no default value)
name (Optional) Name of the recording. If no name is given, data from all
recordings is dumped. (STRING, no default value)
path-to-gc-root (Optional) Flag for saving the path to garbage collection (GC) roots
at the time the recording data is dumped. The path information is
useful for finding memory leaks but collecting it can cause the
application to pause for a short period of time. Turn on this flag
only when you have an application that you suspect has a memory
leak. (BOOLEAN, false)
Options must be specified using the <key> or <key>=<value> syntax.
Example usage:
$ jcmd <pid> JFR.dump
$ jcmd <pid> JFR.dump filename=recording.jfr
$ jcmd <pid> JFR.dump filename=%s
$ jcmd <pid> JFR.dump name=1 filename=%s
$ jcmd <pid> JFR.dump maxage=1h
$ jcmd <pid> JFR.dump maxage=1h maxsize=50M
$ jcmd <pid> JFR.dump fillename=leaks.jfr path-to-gc-root=true
$ jcmd <pid> JFR.dump begin=13:15
$ jcmd <pid> JFR.dump begin=13:15 end=21:30:00
$ jcmd <pid> JFR.dump end=18:00 maxage=10m
$ jcmd <pid> JFR.dump begin=2021-09-15T09:00:00 end=2021-09-15T10:00:00
$ jcmd <pid> JFR.dump begin=-1h
$ jcmd <pid> JFR.dump begin=-15m end=-5m
""".formatted(exampleDirectory(), exampleFilename()).lines().toArray(String[]::new);
}
@Override
public Argument[] getArgumentInfos() {
return new Argument[] {
new Argument("name",
"Recording name, e.g. \\\"My Recording\\\"",
"STRING", false, null, false),
new Argument("filename",
"Copy recording data to file, e.g. \\\"" + exampleFilename() + "\\\"",
"STRING", false, null, false),
new Argument("maxage",
"Maximum duration to dump, in (s)econds, (m)inutes, (h)ours, or (d)ays, e.g. 60m, or 0 for no limit",
"NANOTIME", false, null, false),
new Argument("maxsize", "Maximum amount of bytes to dump, in (M)B or (G)B, e.g. 500M, or 0 for no limit",
"MEMORY SIZE", false, "hotspot-pid-xxxxx-id-y-YYYY_MM_dd_HH_mm_ss.jfr", false),
new Argument("begin",
"Point in time to dump data from, e.g. 09:00, 21:35:00, 2018-06-03T18:12:56.827Z, 2018-06-03T20:13:46.832, -10m, -3h, or -1d",
"STRING", false, null, false),
new Argument("end",
"Point in time to dump data to, e.g. 09:00, 21:35:00, 2018-06-03T18:12:56.827Z, 2018-06-03T20:13:46.832, -10m, -3h, or -1d",
"STRING", false, null, false),
new Argument("path-to-gc-roots",
"Collect path to GC roots",
"BOOLEAN", false, "false", false)
};
}
}
⏎ jdk/jfr/internal/dcmd/DCmdDump.java
Or download all of them as a single archive file:
File name: jdk.jfr-17.0.5-src.zip File size: 363343 bytes Release date: 2022-09-13 Download
⇒ JDK 17 jdk.jlink.jmod - JLink Tool
2023-04-17, ≈41🔥, 0💬
Popular Posts:
JDK 11 jdk.internal.JVM Stat.jmod is the JMOD file for JDK 11 Internal Jvmstat module. JDK 11 Intern...
JDK 11 jdk.internal.vm.ci.jmod is the JMOD file for JDK 11 Internal VM CI module. JDK 11 Internal VM...
Apache Commons Codec library provides implementations of common encoders and decoders such as Base64...
How to download and install JDK (Java Development Kit) 1.4? If you want to write Java applications, ...
GJT (Giant Java Tree) implementation of XML Pull Parser. JAR File Size and Download Location: File n...