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/tool/Metadata.java
/*
* Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package jdk.jfr.internal.tool;
import java.io.IOException;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.nio.charset.Charset;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Deque;
import java.util.List;
import java.util.function.Predicate;
import jdk.jfr.EventType;
import jdk.jfr.FlightRecorder;
import jdk.jfr.consumer.RecordingFile;
import jdk.jfr.internal.PlatformEventType;
import jdk.jfr.internal.PrivateAccess;
import jdk.jfr.internal.Type;
import jdk.jfr.internal.TypeLibrary;
import jdk.jfr.internal.consumer.JdkJfrConsumer;
final class Metadata extends Command {
private static final JdkJfrConsumer PRIVATE_ACCESS = JdkJfrConsumer.instance();
private static class TypeComparator implements Comparator<Type> {
@Override
public int compare(Type t1, Type t2) {
int g1 = groupValue(t1);
int g2 = groupValue(t2);
if (g1 == g2) {
String n1 = t1.getName();
String n2 = t2.getName();
String package1 = n1.substring(0, n1.lastIndexOf('.') + 1);
String package2 = n2.substring(0, n2.lastIndexOf('.') + 1);
if (package1.equals(package2)) {
return n1.compareTo(n2);
} else {
// Ensure that jdk.* are printed first
// This makes it easier to find user defined events at the end.
if (Type.SUPER_TYPE_EVENT.equals(t1.getSuperType()) && !package1.equals(package2)) {
if (package1.equals("jdk.jfr")) {
return -1;
}
if (package2.equals("jdk.jfr")) {
return 1;
}
}
return package1.compareTo(package2);
}
} else {
return Integer.compare(groupValue(t1), groupValue(t2));
}
}
int groupValue(Type t) {
String superType = t.getSuperType();
if (superType == null) {
return 1;
}
if (Type.SUPER_TYPE_ANNOTATION.equals(superType)) {
return 3;
}
if (Type.SUPER_TYPE_SETTING.equals(superType)) {
return 4;
}
if (Type.SUPER_TYPE_EVENT.equals(superType)) {
return 5;
}
return 2; // reserved for enums in the future
}
}
@Override
public String getName() {
return "metadata";
}
@Override
public List<String> getOptionSyntax() {
List<String> list = new ArrayList<>();
list.add("[--categories <filter>]");
list.add("[--events <filter>]");
list.add("[<file>]");
return list;
}
@Override
protected String getTitle() {
return "Display event metadata, such as labels, descriptions and field layout";
}
@Override
public String getDescription() {
return getTitle() + ". See 'jfr help metadata' for details.";
}
@Override
public void displayOptionUsage(PrintStream stream) {
char q = quoteCharacter();
stream.println(" --categories <filter> Select events matching a category name.");
stream.println(" The filter is a comma-separated list of names,");
stream.println(" simple and/or qualified, and/or quoted glob patterns");
stream.println();
stream.println(" --events <filter> Select events matching an event name.");
stream.println(" The filter is a comma-separated list of names,");
stream.println(" simple and/or qualified, and/or quoted glob patterns");
stream.println();
stream.println(" <file> Location of the recording file (.jfr)");
stream.println();
stream.println("If the <file> parameter is omitted, metadata from the JDK where");
stream.println("the " + q + "jfr" + q + " tool is located will be used");
stream.println();
stream.println();
stream.println("Example usage:");
stream.println();
stream.println(" jfr metadata");
stream.println();
stream.println(" jfr metadata --events jdk.ThreadStart recording.jfr");
stream.println();
stream.println(" jfr metadata --events CPULoad,GarbageCollection");
stream.println();
stream.println(" jfr metadata --categories " + q + "GC,JVM,Java*" + q);
stream.println();
stream.println(" jfr metadata --events " + q + "Thread*" + q);
stream.println();
}
@Override
public void execute(Deque<String> options) throws UserSyntaxException, UserDataException {
Path file = getOptionalJFRInputFile(options);
boolean showIds = false;
boolean foundEventFilter = false;
boolean foundCategoryFilter = false;
Predicate<EventType> filter = null;
int optionCount = options.size();
while (optionCount > 0) {
// internal option, doest not export to users
if (acceptSingleOption(options, "--ids")) {
showIds = true;
}
if (acceptFilterOption(options, "--events")) {
if (foundEventFilter) {
throw new UserSyntaxException("use --events event1,event2,event3 to include multiple events");
}
foundEventFilter = true;
String filterStr = options.remove();
warnForWildcardExpansion("--events", filterStr);
filter = addEventFilter(filterStr, filter);
}
if (acceptFilterOption(options, "--categories")) {
if (foundCategoryFilter) {
throw new UserSyntaxException("use --categories category1,category2 to include multiple categories");
}
foundCategoryFilter = true;
String filterStr = options.remove();
warnForWildcardExpansion("--categories", filterStr);
filter = addCategoryFilter(filterStr, filter);
}
if (optionCount == options.size()) {
// No progress made
checkCommonError(options, "--event", "--events");
checkCommonError(options, "--category", "--categories");
throw new UserSyntaxException("unknown option " + options.peek());
}
optionCount = options.size();
}
try (PrintWriter pw = new PrintWriter(System.out, false, Charset.forName("UTF-8"))) {
PrettyWriter prettyWriter = new PrettyWriter(pw);
prettyWriter.setShowIds(showIds);
if (filter != null) {
filter = addCache(filter, type -> type.getId());
}
List<Type> types = findTypes(file);
Collections.sort(types, new TypeComparator());
for (Type type : types) {
if (filter != null) {
// If --events or --categories, only operate on events
if (Type.SUPER_TYPE_EVENT.equals(type.getSuperType())) {
EventType et = PrivateAccess.getInstance().newEventType((PlatformEventType) type);
if (filter.test(et)) {
prettyWriter.printType(type);
}
}
} else {
prettyWriter.printType(type);
}
}
prettyWriter.flush(true);
pw.flush();
}
}
private List<Type> findTypes(Path file) throws UserDataException {
// Determine whether reading from recording file or reading from the JDK where
// the jfr tool is located will be used
if (file == null) {
// Force initialization
FlightRecorder.getFlightRecorder().getEventTypes();
return TypeLibrary.getInstance().getTypes();
}
try (RecordingFile rf = new RecordingFile(file)) {
return PRIVATE_ACCESS.readTypes(rf);
} catch (IOException ioe) {
couldNotReadError(file, ioe);
}
return null; // Can't reach
}
private Path getOptionalJFRInputFile(Deque<String> options) throws UserDataException {
if (!options.isEmpty()) {
String file = options.getLast();
if (!file.startsWith("--")) {
Path tmp = Paths.get(file).toAbsolutePath();
if (tmp.toString().endsWith(".jfr")) {
ensureAccess(tmp);
options.removeLast();
return tmp;
}
}
}
return null;
}
private static boolean acceptSingleOption(Deque<String> options, String expected) {
if (expected.equals(options.peek())) {
options.remove();
return true;
}
return false;
}
}
⏎ jdk/jfr/internal/tool/Metadata.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, ≈40🔥, 0💬
Popular Posts:
What JAR files are required to run dom\Writer.java provided in the Apache Xerces package? 3 JAR file...
JDK 11 java.sql.jmod is the JMOD file for JDK 11 SQL (Structured Query Language) module. JDK 11 SQL ...
kernel.jar is a component in iText Java library to provide low-level functionalities. iText Java lib...
JAX-WS is an API for building web services and clients. It is the next generation Web Services API r...
Apache Avalon began in 1999 as the Java Apache Server Framework and in late 2002 separated from the ...